baddev.hh revision 885
1955SN/A/*
2955SN/A * Copyright (c) 2003 The Regents of The University of Michigan
31762SN/A * All rights reserved.
4955SN/A *
5955SN/A * Redistribution and use in source and binary forms, with or without
6955SN/A * modification, are permitted provided that the following conditions are
7955SN/A * met: redistributions of source code must retain the above copyright
8955SN/A * notice, this list of conditions and the following disclaimer;
9955SN/A * redistributions in binary form must reproduce the above copyright
10955SN/A * notice, this list of conditions and the following disclaimer in the
11955SN/A * documentation and/or other materials provided with the distribution;
12955SN/A * neither the name of the copyright holders nor the names of its
13955SN/A * contributors may be used to endorse or promote products derived from
14955SN/A * this software without specific prior written permission.
15955SN/A *
16955SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17955SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18955SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19955SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20955SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21955SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22955SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23955SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24955SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25955SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26955SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27955SN/A */
282665Ssaidi@eecs.umich.edu
294762Snate@binkert.org/* @file
30955SN/A * This devices just panics when touched. For example if you have a
315522Snate@binkert.org * kernel that touches the frame buffer which isn't allowed.
326143Snate@binkert.org */
334762Snate@binkert.org
345522Snate@binkert.org#ifndef __BADDEV_HH__
35955SN/A#define __BADDEV_HH__
365522Snate@binkert.org
37955SN/A#include "mem/functional_mem/functional_memory.hh"
385522Snate@binkert.org
394202Sbinkertn@umich.edu/**
405742Snate@binkert.org * BadDevice
41955SN/A * This device just panics when accessed. It is supposed to warn
424381Sbinkertn@umich.edu * the user that the kernel they are running has unsupported
434381Sbinkertn@umich.edu * options (i.e. frame buffer)
448334Snate@binkert.org */
45955SN/Aclass BadDevice : public FunctionalMemory
46955SN/A{
474202Sbinkertn@umich.edu  private:
48955SN/A    Addr addr;
494382Sbinkertn@umich.edu    static const Addr size = 0xf;
504382Sbinkertn@umich.edu
514382Sbinkertn@umich.edu    std::string devname;
526654Snate@binkert.org
535517Snate@binkert.org  public:
548614Sgblack@eecs.umich.edu     /**
557674Snate@binkert.org      * Constructor for the Baddev Class.
566143Snate@binkert.org      * @param name name of the object
576143Snate@binkert.org      * @param a base address of the write
586143Snate@binkert.org      * @param mmu the memory controller
598233Snate@binkert.org      * @param devicename device that is not implemented
608233Snate@binkert.org      */
618233Snate@binkert.org    BadDevice(const std::string &name, Addr a, MemoryController *mmu,
628233Snate@binkert.org              const std::string &devicename);
638233Snate@binkert.org
648334Snate@binkert.org    /**
658334Snate@binkert.org      * On a read event we just panic aand hopefully print a
6610453SAndrew.Bardsley@arm.com      * meaningful error message.
6710453SAndrew.Bardsley@arm.com      * @param req Contains the address to read from.
688233Snate@binkert.org      * @param data A pointer to write the read data to.
698233Snate@binkert.org      * @return The fault condition of the access.
708233Snate@binkert.org      */
718233Snate@binkert.org    virtual Fault read(MemReqPtr &req, uint8_t *data);
728233Snate@binkert.org
738233Snate@binkert.org    /**
746143Snate@binkert.org      * On a write event we just panic aand hopefully print a
758233Snate@binkert.org      * meaningful error message.
768233Snate@binkert.org      * @param req Contains the address to write to.
778233Snate@binkert.org      * @param data The data to write.
786143Snate@binkert.org      * @return The fault condition of the access.
796143Snate@binkert.org      */
806143Snate@binkert.org    virtual Fault write(MemReqPtr &req, const uint8_t *data);
816143Snate@binkert.org
828233Snate@binkert.org    /** @todo add serialize/unserialize */
838233Snate@binkert.org};
848233Snate@binkert.org
856143Snate@binkert.org#endif // __BADDEV_HH__
868233Snate@binkert.org