2005-08-15 22:59:58 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Regents of The University of Michigan
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
2006-11-06 22:24:25 +01:00
|
|
|
* Authors: Ali Saidi
|
2005-08-15 22:59:58 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file
|
|
|
|
* Declaration of a fake device.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ISA_FAKE_HH__
|
|
|
|
#define __ISA_FAKE_HH__
|
|
|
|
|
|
|
|
#include "base/range.hh"
|
|
|
|
#include "dev/io_device.hh"
|
2006-11-07 01:45:00 +01:00
|
|
|
#include "dev/alpha/tsunami.hh"
|
2006-10-20 08:38:45 +02:00
|
|
|
#include "mem/packet.hh"
|
2005-08-15 22:59:58 +02:00
|
|
|
|
2006-12-04 06:54:40 +01:00
|
|
|
#include <string>
|
|
|
|
|
2005-08-15 22:59:58 +02:00
|
|
|
/**
|
2006-11-06 22:24:25 +01:00
|
|
|
* IsaFake is a device that returns, BadAddr, 1 or 0 on all reads and
|
|
|
|
* rites. It is meant to be placed at an address range
|
2005-08-15 22:59:58 +02:00
|
|
|
* so that an mcheck doesn't occur when an os probes a piece of hw
|
2006-11-06 22:24:25 +01:00
|
|
|
* that doesn't exist (e.g. UARTs1-3), or catch requests in the memory system
|
|
|
|
* that have no responders..
|
2005-08-15 22:59:58 +02:00
|
|
|
*/
|
2006-04-10 20:14:06 +02:00
|
|
|
class IsaFake : public BasicPioDevice
|
2005-08-15 22:59:58 +02:00
|
|
|
{
|
2006-04-10 20:14:06 +02:00
|
|
|
public:
|
|
|
|
struct Params : public BasicPioDevice::Params
|
|
|
|
{
|
|
|
|
Addr pio_size;
|
2006-11-06 22:24:25 +01:00
|
|
|
bool retBadAddr;
|
2006-12-04 06:54:40 +01:00
|
|
|
bool updateData;
|
|
|
|
uint8_t retData8;
|
|
|
|
uint16_t retData16;
|
|
|
|
uint32_t retData32;
|
|
|
|
uint64_t retData64;
|
|
|
|
std::string warnAccess;
|
2006-04-10 20:14:06 +02:00
|
|
|
};
|
|
|
|
protected:
|
|
|
|
const Params *params() const { return (const Params*)_params; }
|
2006-12-04 06:54:40 +01:00
|
|
|
uint8_t retData8;
|
|
|
|
uint16_t retData16;
|
|
|
|
uint32_t retData32;
|
|
|
|
uint64_t retData64;
|
|
|
|
|
2005-08-15 22:59:58 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* The constructor for Tsunmami Fake just registers itself with the MMU.
|
2006-04-10 20:14:06 +02:00
|
|
|
* @param p params structure
|
2005-08-15 22:59:58 +02:00
|
|
|
*/
|
2006-04-10 20:14:06 +02:00
|
|
|
IsaFake(Params *p);
|
2005-08-15 22:59:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This read always returns -1.
|
2006-08-15 01:25:07 +02:00
|
|
|
* @param pkt The memory request.
|
2005-08-15 22:59:58 +02:00
|
|
|
* @param data Where to put the data.
|
|
|
|
*/
|
2006-10-20 09:10:12 +02:00
|
|
|
virtual Tick read(PacketPtr pkt);
|
2005-08-15 22:59:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* All writes are simply ignored.
|
2006-08-15 01:25:07 +02:00
|
|
|
* @param pkt The memory request.
|
2005-08-15 22:59:58 +02:00
|
|
|
* @param data the data to not write.
|
|
|
|
*/
|
2006-10-20 09:10:12 +02:00
|
|
|
virtual Tick write(PacketPtr pkt);
|
2006-11-02 21:18:35 +01:00
|
|
|
};
|
|
|
|
|
2006-11-06 22:24:25 +01:00
|
|
|
#endif // __ISA_FAKE_HH__
|