baddev.cc revision 2539
1955SN/A/* 2955SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan 313576Sciro.santilli@arm.com * All rights reserved. 413576Sciro.santilli@arm.com * 513576Sciro.santilli@arm.com * Redistribution and use in source and binary forms, with or without 613576Sciro.santilli@arm.com * modification, are permitted provided that the following conditions are 713576Sciro.santilli@arm.com * met: redistributions of source code must retain the above copyright 813576Sciro.santilli@arm.com * notice, this list of conditions and the following disclaimer; 913576Sciro.santilli@arm.com * redistributions in binary form must reproduce the above copyright 1013576Sciro.santilli@arm.com * notice, this list of conditions and the following disclaimer in the 1113576Sciro.santilli@arm.com * documentation and/or other materials provided with the distribution; 1213576Sciro.santilli@arm.com * neither the name of the copyright holders nor the names of its 1313576Sciro.santilli@arm.com * contributors may be used to endorse or promote products derived from 141762SN/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 */ 28955SN/A 29955SN/A/** @file 30955SN/A * BadDevice implemenation 31955SN/A */ 32955SN/A 33955SN/A#include <deque> 34955SN/A#include <string> 35955SN/A#include <vector> 36955SN/A 37955SN/A#include "base/trace.hh" 38955SN/A#include "cpu/exec_context.hh" 392665Ssaidi@eecs.umich.edu#include "dev/baddev.hh" 404762Snate@binkert.org#include "dev/platform.hh" 41955SN/A#include "mem/bus/bus.hh" 4212563Sgabeblack@google.com#include "mem/bus/pio_interface.hh" 4312563Sgabeblack@google.com#include "mem/bus/pio_interface_impl.hh" 445522Snate@binkert.org#include "mem/functional/memory_control.hh" 456143Snate@binkert.org#include "sim/builder.hh" 4612371Sgabeblack@google.com#include "sim/system.hh" 474762Snate@binkert.org 485522Snate@binkert.orgusing namespace std; 49955SN/Ausing namespace TheISA; 505522Snate@binkert.org 5111974Sgabeblack@google.comBadDevice::BadDevice(Params *p) 52955SN/A : BasicPioDevice(p), devname(p->devic_ename) 535522Snate@binkert.org{ 544202Sbinkertn@umich.edu pioSize = 0xf; 555742Snate@binkert.org} 56955SN/A 574381Sbinkertn@umich.eduTick 584381Sbinkertn@umich.eduBadDevice::read(Packet &pkt) 5912246Sgabeblack@google.com{ 6012246Sgabeblack@google.com panic("Device %s not imlpmented\n", devname); 618334Snate@binkert.org} 62955SN/A 63955SN/ATick 644202Sbinkertn@umich.eduBadDevice::write(Packet &pkt) 65955SN/A{ 664382Sbinkertn@umich.edu panic("Device %s not imlpmented\n", devname); 674382Sbinkertn@umich.edu} 684382Sbinkertn@umich.edu 696654Snate@binkert.orgBEGIN_DECLARE_SIM_OBJECT_PARAMS(BadDevice) 705517Snate@binkert.org 718614Sgblack@eecs.umich.edu Param<string> devicename; 727674Snate@binkert.org Param<Addr> pio_addr; 736143Snate@binkert.org SimObjectParam<AlphaSystem *> system; 746143Snate@binkert.org SimObjectParam<Platform *> platform; 756143Snate@binkert.org Param<Tick> pio_latency; 7612302Sgabeblack@google.com 7712302Sgabeblack@google.comEND_DECLARE_SIM_OBJECT_PARAMS(BadDevice) 7812302Sgabeblack@google.com 7912371Sgabeblack@google.comBEGIN_INIT_SIM_OBJECT_PARAMS(BadDevice) 8012371Sgabeblack@google.com 8112371Sgabeblack@google.com INIT_PARAM(devicename, "Name of device to error on"), 8212371Sgabeblack@google.com INIT_PARAM(pio_addr, "Device Address"), 8312371Sgabeblack@google.com INIT_PARAM(system, "system object"), 8412371Sgabeblack@google.com INIT_PARAM(platform, "platform"), 8512371Sgabeblack@google.com INIT_PARAM_DFLT(pio_latency, "Programmed IO latency", 1000) 8612371Sgabeblack@google.com 8712371Sgabeblack@google.comEND_INIT_SIM_OBJECT_PARAMS(BadDevice) 8812371Sgabeblack@google.com 8912371Sgabeblack@google.comCREATE_SIM_OBJECT(BadDevice) 9012371Sgabeblack@google.com{ 9112371Sgabeblack@google.com BadDevice::Params *p = new BadDevice::Params; 9212371Sgabeblack@google.com p->name =getInstanceName(); 9312371Sgabeblack@google.com p->platform = platform; 9412371Sgabeblack@google.com p->pio_addr = pio_addr; 9512371Sgabeblack@google.com p->pio_delay = pio_latency; 9612371Sgabeblack@google.com p->system = system; 9712371Sgabeblack@google.com p->devicename = devicename; 9812371Sgabeblack@google.com return new BadDevice(p); 9912371Sgabeblack@google.com} 10012371Sgabeblack@google.com 10112371Sgabeblack@google.comREGISTER_SIM_OBJECT("BadDevice", BadDevice) 10212371Sgabeblack@google.com