isa_fake.hh revision 3540
11817SN/A/* 21817SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 31817SN/A * All rights reserved. 41817SN/A * 51817SN/A * Redistribution and use in source and binary forms, with or without 61817SN/A * modification, are permitted provided that the following conditions are 71817SN/A * met: redistributions of source code must retain the above copyright 81817SN/A * notice, this list of conditions and the following disclaimer; 91817SN/A * redistributions in binary form must reproduce the above copyright 101817SN/A * notice, this list of conditions and the following disclaimer in the 111817SN/A * documentation and/or other materials provided with the distribution; 121817SN/A * neither the name of the copyright holders nor the names of its 131817SN/A * contributors may be used to endorse or promote products derived from 141817SN/A * this software without specific prior written permission. 151817SN/A * 161817SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 171817SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 181817SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 191817SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 201817SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 211817SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 221817SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 231817SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 241817SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 251817SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 261817SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Miguel Serrano 292665Ssaidi@eecs.umich.edu * Ali Saidi 301817SN/A */ 311817SN/A 321817SN/A/** @file 331817SN/A * Declaration of a fake device. 341817SN/A */ 351817SN/A 361817SN/A#ifndef __ISA_FAKE_HH__ 371817SN/A#define __ISA_FAKE_HH__ 381817SN/A 391817SN/A#include "base/range.hh" 401817SN/A#include "dev/io_device.hh" 413540Sgblack@eecs.umich.edu#include "dev/alpha/tsunami.hh" 423348Sbinkertn@umich.edu#include "mem/packet.hh" 431817SN/A 441817SN/A/** 451817SN/A * IsaFake is a device that returns -1 on all reads and 461817SN/A * accepts all writes. It is meant to be placed at an address range 471817SN/A * so that an mcheck doesn't occur when an os probes a piece of hw 481817SN/A * that doesn't exist (e.g. UARTs1-3). 491817SN/A */ 502539SN/Aclass IsaFake : public BasicPioDevice 511817SN/A{ 522539SN/A public: 532539SN/A struct Params : public BasicPioDevice::Params 542539SN/A { 552539SN/A Addr pio_size; 562539SN/A }; 572539SN/A protected: 582539SN/A const Params *params() const { return (const Params*)_params; } 591817SN/A 601817SN/A public: 611817SN/A /** 621817SN/A * The constructor for Tsunmami Fake just registers itself with the MMU. 632539SN/A * @param p params structure 641817SN/A */ 652539SN/A IsaFake(Params *p); 661817SN/A 671817SN/A /** 681817SN/A * This read always returns -1. 692982Sstever@eecs.umich.edu * @param pkt The memory request. 701817SN/A * @param data Where to put the data. 711817SN/A */ 723349Sbinkertn@umich.edu virtual Tick read(PacketPtr pkt); 731817SN/A 741817SN/A /** 751817SN/A * All writes are simply ignored. 762982Sstever@eecs.umich.edu * @param pkt The memory request. 771817SN/A * @param data the data to not write. 781817SN/A */ 793349Sbinkertn@umich.edu virtual Tick write(PacketPtr pkt); 801817SN/A}; 811817SN/A 823488Sktlim@umich.edu/** 833488Sktlim@umich.edu * BadAddr is a device that fills the packet's result field with "BadAddress". 843488Sktlim@umich.edu * @todo: Consider consolidating with IsaFake and similar classes. 853488Sktlim@umich.edu */ 863488Sktlim@umich.educlass BadAddr : public BasicPioDevice 873488Sktlim@umich.edu{ 883488Sktlim@umich.edu public: 893488Sktlim@umich.edu struct Params : public BasicPioDevice::Params 903488Sktlim@umich.edu { 913488Sktlim@umich.edu }; 923488Sktlim@umich.edu 933488Sktlim@umich.edu BadAddr(Params *p); 943488Sktlim@umich.edu virtual void init(); 953488Sktlim@umich.edu virtual Tick read(PacketPtr pkt); 963488Sktlim@umich.edu virtual Tick write(PacketPtr pkt); 973488Sktlim@umich.edu}; 983488Sktlim@umich.edu 992539SN/A#endif // __TSUNAMI_FAKE_HH__ 100