baddev.hh revision 885
113821Sgabeblack@google.com/* 213821Sgabeblack@google.com * Copyright (c) 2003 The Regents of The University of Michigan 313821Sgabeblack@google.com * All rights reserved. 413821Sgabeblack@google.com * 513821Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 613821Sgabeblack@google.com * modification, are permitted provided that the following conditions are 713821Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 813821Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 913821Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1013821Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1113821Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1213821Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1313821Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1413821Sgabeblack@google.com * this software without specific prior written permission. 1513821Sgabeblack@google.com * 1613821Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1713821Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1813821Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1913821Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2013821Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2113821Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2213821Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2313821Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2413821Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2513821Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2613821Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2713821Sgabeblack@google.com */ 2813821Sgabeblack@google.com 2913821Sgabeblack@google.com/* @file 3013821Sgabeblack@google.com * This devices just panics when touched. For example if you have a 3113821Sgabeblack@google.com * kernel that touches the frame buffer which isn't allowed. 3213874Sgabeblack@google.com */ 3313874Sgabeblack@google.com 3413823Sgabeblack@google.com#ifndef __BADDEV_HH__ 3513823Sgabeblack@google.com#define __BADDEV_HH__ 3613823Sgabeblack@google.com 3713823Sgabeblack@google.com#include "mem/functional_mem/functional_memory.hh" 3813821Sgabeblack@google.com 3913821Sgabeblack@google.com/** 4013821Sgabeblack@google.com * BadDevice 4113821Sgabeblack@google.com * This device just panics when accessed. It is supposed to warn 4213821Sgabeblack@google.com * the user that the kernel they are running has unsupported 4313821Sgabeblack@google.com * options (i.e. frame buffer) 4413821Sgabeblack@google.com */ 4513821Sgabeblack@google.comclass BadDevice : public FunctionalMemory 4613823Sgabeblack@google.com{ 4713823Sgabeblack@google.com private: 4813823Sgabeblack@google.com Addr addr; 4913823Sgabeblack@google.com static const Addr size = 0xf; 5013821Sgabeblack@google.com 5113821Sgabeblack@google.com std::string devname; 5213821Sgabeblack@google.com 5313821Sgabeblack@google.com public: 5413821Sgabeblack@google.com /** 5513823Sgabeblack@google.com * Constructor for the Baddev Class. 5613823Sgabeblack@google.com * @param name name of the object 5713823Sgabeblack@google.com * @param a base address of the write 5813823Sgabeblack@google.com * @param mmu the memory controller 5913823Sgabeblack@google.com * @param devicename device that is not implemented 6013823Sgabeblack@google.com */ 6113823Sgabeblack@google.com BadDevice(const std::string &name, Addr a, MemoryController *mmu, 6213823Sgabeblack@google.com const std::string &devicename); 6313874Sgabeblack@google.com 6413874Sgabeblack@google.com /** 6513823Sgabeblack@google.com * On a read event we just panic aand hopefully print a 6613823Sgabeblack@google.com * meaningful error message. 6713823Sgabeblack@google.com * @param req Contains the address to read from. 6813823Sgabeblack@google.com * @param data A pointer to write the read data to. 6913823Sgabeblack@google.com * @return The fault condition of the access. 7013823Sgabeblack@google.com */ 7113874Sgabeblack@google.com virtual Fault read(MemReqPtr &req, uint8_t *data); 7213874Sgabeblack@google.com 7313823Sgabeblack@google.com /** 7413823Sgabeblack@google.com * On a write event we just panic aand hopefully print a 7513823Sgabeblack@google.com * meaningful error message. 7613823Sgabeblack@google.com * @param req Contains the address to write to. 7713823Sgabeblack@google.com * @param data The data to write. 7813823Sgabeblack@google.com * @return The fault condition of the access. 7913823Sgabeblack@google.com */ 8013874Sgabeblack@google.com virtual Fault write(MemReqPtr &req, const uint8_t *data); 8113874Sgabeblack@google.com 8213823Sgabeblack@google.com /** @todo add serialize/unserialize */ 8313823Sgabeblack@google.com}; 8413823Sgabeblack@google.com 8513823Sgabeblack@google.com#endif // __BADDEV_HH__ 8613823Sgabeblack@google.com