isa_fake.hh revision 4762
16019Shines@cs.fsu.edu/*
211496Sandreas.sandberg@arm.com * Copyright (c) 2004-2005 The Regents of The University of Michigan
37093Sgblack@eecs.umich.edu * All rights reserved.
47093Sgblack@eecs.umich.edu *
57093Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
67093Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
77093Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
87093Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
97093Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
107093Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
117093Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
127093Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
137093Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
146019Shines@cs.fsu.edu * this software without specific prior written permission.
156019Shines@cs.fsu.edu *
166019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216019Shines@cs.fsu.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246019Shines@cs.fsu.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276019Shines@cs.fsu.edu *
286019Shines@cs.fsu.edu * Authors: Ali Saidi
296019Shines@cs.fsu.edu */
306019Shines@cs.fsu.edu
316019Shines@cs.fsu.edu/** @file
326019Shines@cs.fsu.edu * Declaration of a fake device.
336019Shines@cs.fsu.edu */
346019Shines@cs.fsu.edu
356019Shines@cs.fsu.edu#ifndef __ISA_FAKE_HH__
366019Shines@cs.fsu.edu#define __ISA_FAKE_HH__
376019Shines@cs.fsu.edu
386019Shines@cs.fsu.edu#include <string>
396019Shines@cs.fsu.edu
406019Shines@cs.fsu.edu#include "base/range.hh"
416735Sgblack@eecs.umich.edu#include "dev/io_device.hh"
426735Sgblack@eecs.umich.edu#include "dev/alpha/tsunami.hh"
4310037SARM gem5 Developers#include "params/IsaFake.hh"
4410037SARM gem5 Developers#include "mem/packet.hh"
456019Shines@cs.fsu.edu
466019Shines@cs.fsu.edu/**
476019Shines@cs.fsu.edu * IsaFake is a device that returns, BadAddr, 1 or 0 on all reads and
4810037SARM gem5 Developers *  rites. It is meant to be placed at an address range
4910037SARM gem5 Developers * so that an mcheck doesn't occur when an os probes a piece of hw
5010037SARM gem5 Developers * that doesn't exist (e.g. UARTs1-3), or catch requests in the memory system
5110037SARM gem5 Developers * that have no responders..
528229Snate@binkert.org */
538229Snate@binkert.orgclass IsaFake : public BasicPioDevice
546019Shines@cs.fsu.edu{
558232Snate@binkert.org  protected:
568782Sgblack@eecs.umich.edu    uint8_t retData8;
576019Shines@cs.fsu.edu    uint16_t retData16;
586019Shines@cs.fsu.edu    uint32_t retData32;
596019Shines@cs.fsu.edu    uint64_t retData64;
606019Shines@cs.fsu.edu
6110037SARM gem5 Developers  public:
6210037SARM gem5 Developers    typedef IsaFakeParams Params;
6310037SARM gem5 Developers    const Params *
6410037SARM gem5 Developers    params() const
6510037SARM gem5 Developers    {
6610037SARM gem5 Developers        return dynamic_cast<const Params *>(_params);
6710037SARM gem5 Developers    }
6810037SARM gem5 Developers    /**
6910037SARM gem5 Developers      * The constructor for Tsunmami Fake just registers itself with the MMU.
7010037SARM gem5 Developers      * @param p params structure
7110037SARM gem5 Developers      */
7210037SARM gem5 Developers    IsaFake(Params *p);
7310037SARM gem5 Developers
7410037SARM gem5 Developers    /**
7510037SARM gem5 Developers     * This read always returns -1.
7610037SARM gem5 Developers     * @param pkt The memory request.
7710037SARM gem5 Developers     * @param data Where to put the data.
7810037SARM gem5 Developers     */
7910037SARM gem5 Developers    virtual Tick read(PacketPtr pkt);
8010037SARM gem5 Developers
8110037SARM gem5 Developers    /**
8210037SARM gem5 Developers     * All writes are simply ignored.
8310037SARM gem5 Developers     * @param pkt The memory request.
8410037SARM gem5 Developers     * @param data the data to not write.
8510037SARM gem5 Developers     */
8610037SARM gem5 Developers    virtual Tick write(PacketPtr pkt);
8710037SARM gem5 Developers};
8810037SARM gem5 Developers
8910037SARM gem5 Developers#endif // __ISA_FAKE_HH__
9010037SARM gem5 Developers