baddev.hh revision 1310
112837Sgabeblack@google.com/* 212837Sgabeblack@google.com * Copyright (c) 2004 The Regents of The University of Michigan 312837Sgabeblack@google.com * All rights reserved. 412837Sgabeblack@google.com * 512837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612837Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712837Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912837Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112837Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212837Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412837Sgabeblack@google.com * this software without specific prior written permission. 1512837Sgabeblack@google.com * 1612837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812837Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912837Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012837Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112837Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212837Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312837Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412837Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512837Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612837Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712837Sgabeblack@google.com */ 2812837Sgabeblack@google.com 2912837Sgabeblack@google.com/* @file 3012901Sgabeblack@google.com * This devices just panics when touched. For example if you have a 3113135Sgabeblack@google.com * kernel that touches the frame buffer which isn't allowed. 3212901Sgabeblack@google.com */ 3312901Sgabeblack@google.com 3412837Sgabeblack@google.com#ifndef __DEV_BADDEV_HH__ 3512982Sgabeblack@google.com#define __DEV_BADDEV_HH__ 3612951Sgabeblack@google.com 3712953Sgabeblack@google.com#include "base/range.hh" 3813155Sgabeblack@google.com#include "dev/io_device.hh" 3912837Sgabeblack@google.com 4012951Sgabeblack@google.com/** 4113155Sgabeblack@google.com * BadDevice 4213135Sgabeblack@google.com * This device just panics when accessed. It is supposed to warn 4312837Sgabeblack@google.com * the user that the kernel they are running has unsupported 4412952Sgabeblack@google.com * options (i.e. frame buffer) 4512952Sgabeblack@google.com */ 4612952Sgabeblack@google.comclass BadDevice : public PioDevice 4712952Sgabeblack@google.com{ 4812952Sgabeblack@google.com private: 4912952Sgabeblack@google.com Addr addr; 5013135Sgabeblack@google.com static const Addr size = 0xf; 5113135Sgabeblack@google.com 5213135Sgabeblack@google.com std::string devname; 5313135Sgabeblack@google.com 5413135Sgabeblack@google.com public: 5513135Sgabeblack@google.com /** 5613135Sgabeblack@google.com * Constructor for the Baddev Class. 5713135Sgabeblack@google.com * @param name name of the object 5812993Sgabeblack@google.com * @param a base address of the write 5912993Sgabeblack@google.com * @param mmu the memory controller 6012952Sgabeblack@google.com * @param hier object to store parameters universal the device hierarchy 6112952Sgabeblack@google.com * @param bus The bus that this device is attached to 6212952Sgabeblack@google.com * @param devicename device that is not implemented 6312952Sgabeblack@google.com */ 6412952Sgabeblack@google.com BadDevice(const std::string &name, Addr a, MemoryController *mmu, 6513135Sgabeblack@google.com HierParams *hier, Bus *bus, const std::string &devicename); 6613135Sgabeblack@google.com 6713135Sgabeblack@google.com /** 6813135Sgabeblack@google.com * On a read event we just panic aand hopefully print a 6913135Sgabeblack@google.com * meaningful error message. 7013135Sgabeblack@google.com * @param req Contains the address to read from. 7113135Sgabeblack@google.com * @param data A pointer to write the read data to. 7213135Sgabeblack@google.com * @return The fault condition of the access. 7312993Sgabeblack@google.com */ 7412993Sgabeblack@google.com virtual Fault read(MemReqPtr &req, uint8_t *data); 7512952Sgabeblack@google.com 7612952Sgabeblack@google.com /** 7712952Sgabeblack@google.com * On a write event we just panic aand hopefully print a 7812952Sgabeblack@google.com * meaningful error message. 7912952Sgabeblack@google.com * @param req Contains the address to write to. 8013135Sgabeblack@google.com * @param data The data to write. 8113135Sgabeblack@google.com * @return The fault condition of the access. 8213135Sgabeblack@google.com */ 8313135Sgabeblack@google.com virtual Fault write(MemReqPtr &req, const uint8_t *data); 8413135Sgabeblack@google.com 8513135Sgabeblack@google.com /** 8613135Sgabeblack@google.com * Return how long this access will take. 8713135Sgabeblack@google.com * @param req the memory request to calcuate 8812993Sgabeblack@google.com * @return Tick when the request is done 8913060Sgabeblack@google.com */ 9012993Sgabeblack@google.com Tick cacheAccess(MemReqPtr &req); 9112952Sgabeblack@google.com}; 9212952Sgabeblack@google.com 9313035Sgabeblack@google.com#endif // __DEV_BADDEV_HH__ 9413035Sgabeblack@google.com