baddev.hh revision 909
12292SN/A/*
22329SN/A * Copyright (c) 2004 The Regents of The University of Michigan
32292SN/A * All rights reserved.
42292SN/A *
52292SN/A * Redistribution and use in source and binary forms, with or without
62292SN/A * modification, are permitted provided that the following conditions are
72292SN/A * met: redistributions of source code must retain the above copyright
82292SN/A * notice, this list of conditions and the following disclaimer;
92292SN/A * redistributions in binary form must reproduce the above copyright
102292SN/A * notice, this list of conditions and the following disclaimer in the
112292SN/A * documentation and/or other materials provided with the distribution;
122292SN/A * neither the name of the copyright holders nor the names of its
132292SN/A * contributors may be used to endorse or promote products derived from
142292SN/A * this software without specific prior written permission.
152292SN/A *
162292SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172292SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182292SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192292SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202292SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212292SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222292SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232292SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242292SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252292SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262292SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272689Sktlim@umich.edu */
282689Sktlim@umich.edu
292689Sktlim@umich.edu/* @file
302292SN/A * This devices just panics when touched. For example if you have a
312292SN/A * kernel that touches the frame buffer which isn't allowed.
322292SN/A */
332292SN/A
342292SN/A#ifndef __BADDEV_HH__
352329SN/A#define __BADDEV_HH__
364395Ssaidi@eecs.umich.edu
372292SN/A#include "base/range.hh"
382292SN/A#include "dev/io_device.hh"
392292SN/A
402329SN/A/**
413326Sktlim@umich.edu * BadDevice
422292SN/A * This device just panics when accessed. It is supposed to warn
436658Snate@binkert.org * the user that the kernel they are running has unsupported
445386Sstever@gmail.com * options (i.e. frame buffer)
452292SN/A */
462292SN/Aclass BadDevice : public PioDevice
473348Sbinkertn@umich.edu{
482669Sktlim@umich.edu  private:
492292SN/A    Addr addr;
505529Snate@binkert.org    static const Addr size = 0xf;
515529Snate@binkert.org
522292SN/A    std::string devname;
532329SN/A
542329SN/A  public:
552329SN/A     /**
562329SN/A      * Constructor for the Baddev Class.
572329SN/A      * @param name name of the object
582329SN/A      * @param a base address of the write
592329SN/A      * @param mmu the memory controller
602329SN/A      * @param hier object to store parameters universal the device hierarchy
612329SN/A      * @param bus The bus that this device is attached to
622329SN/A      * @param devicename device that is not implemented
632292SN/A      */
642292SN/A    BadDevice(const std::string &name, Addr a, MemoryController *mmu,
652292SN/A              HierParams *hier, Bus *bus, const std::string &devicename);
662292SN/A
672292SN/A    /**
682292SN/A      * On a read event we just panic aand hopefully print a
692733Sktlim@umich.edu      * meaningful error message.
702292SN/A      * @param req Contains the address to read from.
712292SN/A      * @param data A pointer to write the read data to.
722907Sktlim@umich.edu      * @return The fault condition of the access.
732292SN/A      */
742292SN/A    virtual Fault read(MemReqPtr &req, uint8_t *data);
752292SN/A
762292SN/A    /**
772292SN/A      * On a write event we just panic aand hopefully print a
782292SN/A      * meaningful error message.
792292SN/A      * @param req Contains the address to write to.
805529Snate@binkert.org      * @param data The data to write.
815529Snate@binkert.org      * @return The fault condition of the access.
825529Snate@binkert.org      */
832292SN/A    virtual Fault write(MemReqPtr &req, const uint8_t *data);
842292SN/A
852292SN/A    /**
862292SN/A     * Return how long this access will take.
872727Sktlim@umich.edu     * @param req the memory request to calcuate
882727Sktlim@umich.edu     * @return Tick when the request is done
892727Sktlim@umich.edu     */
902907Sktlim@umich.edu    Tick cacheAccess(MemReqPtr &req);
914329Sktlim@umich.edu};
922907Sktlim@umich.edu
932348SN/A#endif // __BADDEV_HH__
942307SN/A