baddev.hh revision 909
12315SN/A/*
28733Sgeoffrey.blake@arm.com * Copyright (c) 2004 The Regents of The University of Michigan
39920Syasuko.eckert@amd.com * All rights reserved.
48733Sgeoffrey.blake@arm.com *
58733Sgeoffrey.blake@arm.com * Redistribution and use in source and binary forms, with or without
68733Sgeoffrey.blake@arm.com * modification, are permitted provided that the following conditions are
78733Sgeoffrey.blake@arm.com * met: redistributions of source code must retain the above copyright
88733Sgeoffrey.blake@arm.com * notice, this list of conditions and the following disclaimer;
98733Sgeoffrey.blake@arm.com * redistributions in binary form must reproduce the above copyright
108733Sgeoffrey.blake@arm.com * notice, this list of conditions and the following disclaimer in the
118733Sgeoffrey.blake@arm.com * documentation and/or other materials provided with the distribution;
128733Sgeoffrey.blake@arm.com * neither the name of the copyright holders nor the names of its
138733Sgeoffrey.blake@arm.com * contributors may be used to endorse or promote products derived from
148733Sgeoffrey.blake@arm.com * this software without specific prior written permission.
152332SN/A *
162315SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172315SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182315SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192315SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202315SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212315SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222315SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232315SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242315SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252315SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262315SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272315SN/A */
282315SN/A
292315SN/A/* @file
302315SN/A * This devices just panics when touched. For example if you have a
312315SN/A * kernel that touches the frame buffer which isn't allowed.
322315SN/A */
332315SN/A
342315SN/A#ifndef __BADDEV_HH__
352315SN/A#define __BADDEV_HH__
362315SN/A
372315SN/A#include "base/range.hh"
382315SN/A#include "dev/io_device.hh"
392315SN/A
402689Sktlim@umich.edu/**
412689Sktlim@umich.edu * BadDevice
422315SN/A * This device just panics when accessed. It is supposed to warn
432315SN/A * the user that the kernel they are running has unsupported
442315SN/A * options (i.e. frame buffer)
452315SN/A */
462315SN/Aclass BadDevice : public PioDevice
472315SN/A{
488229Snate@binkert.org  private:
492315SN/A    Addr addr;
502315SN/A    static const Addr size = 0xf;
512669Sktlim@umich.edu
522315SN/A    std::string devname;
532315SN/A
542315SN/A  public:
5510319SAndreas.Sandberg@ARM.com     /**
568229Snate@binkert.org      * Constructor for the Baddev Class.
572683Sktlim@umich.edu      * @param name name of the object
582315SN/A      * @param a base address of the write
598733Sgeoffrey.blake@arm.com      * @param mmu the memory controller
608733Sgeoffrey.blake@arm.com      * @param hier object to store parameters universal the device hierarchy
612315SN/A      * @param bus The bus that this device is attached to
622315SN/A      * @param devicename device that is not implemented
632315SN/A      */
643468Sgblack@eecs.umich.edu    BadDevice(const std::string &name, Addr a, MemoryController *mmu,
653468Sgblack@eecs.umich.edu              HierParams *hier, Bus *bus, const std::string &devicename);
666022Sgblack@eecs.umich.edu
673468Sgblack@eecs.umich.edu    /**
682315SN/A      * On a read event we just panic aand hopefully print a
692315SN/A      * meaningful error message.
702315SN/A      * @param req Contains the address to read from.
712680Sktlim@umich.edu      * @param data A pointer to write the read data to.
722669Sktlim@umich.edu      * @return The fault condition of the access.
732315SN/A      */
742350SN/A    virtual Fault read(MemReqPtr &req, uint8_t *data);
752350SN/A
762350SN/A    /**
772350SN/A      * On a write event we just panic aand hopefully print a
782350SN/A      * meaningful error message.
792350SN/A      * @param req Contains the address to write to.
802350SN/A      * @param data The data to write.
812350SN/A      * @return The fault condition of the access.
822350SN/A      */
832350SN/A    virtual Fault write(MemReqPtr &req, const uint8_t *data);
842680Sktlim@umich.edu
852683Sktlim@umich.edu    /**
862680Sktlim@umich.edu     * Return how long this access will take.
872350SN/A     * @param req the memory request to calcuate
882680Sktlim@umich.edu     * @return Tick when the request is done
892350SN/A     */
9010319SAndreas.Sandberg@ARM.com    Tick cacheAccess(MemReqPtr &req);
912315SN/A};
922315SN/A
932315SN/A#endif // __BADDEV_HH__
942669Sktlim@umich.edu