X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=dev%2Fbaddev.cc;h=b6ca919e4aeecefea917ef30a0c538e6da42ed89;hb=a48c24b61eedf580645ff0294b225d1e69a9444b;hp=7c563e80a169871507c9e393fedc16872b8db9da;hpb=13f8dc981fc898e6e200689d305b39f0718f8c83;p=gem5.git diff --git a/dev/baddev.cc b/dev/baddev.cc index 7c563e80a..b6ca919e4 100644 --- a/dev/baddev.cc +++ b/dev/baddev.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004 The Regents of The University of Michigan + * 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 @@ -26,7 +26,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* @file +/** @file * BadDevice implemenation */ @@ -37,42 +37,43 @@ #include "base/trace.hh" #include "cpu/exec_context.hh" #include "dev/baddev.hh" +#include "dev/platform.hh" #include "mem/bus/bus.hh" #include "mem/bus/pio_interface.hh" #include "mem/bus/pio_interface_impl.hh" -#include "mem/functional_mem/memory_control.hh" +#include "mem/functional/memory_control.hh" #include "sim/builder.hh" #include "sim/system.hh" using namespace std; BadDevice::BadDevice(const string &name, Addr a, MemoryController *mmu, - HierParams *hier, Bus *bus, const string &devicename) - : PioDevice(name), addr(a), devname(devicename) + HierParams *hier, Bus *pio_bus, const string &devicename) + : PioDevice(name, NULL), addr(a), devname(devicename) { - mmu->add_child(this, Range(addr, addr + size)); + mmu->add_child(this, RangeSize(addr, size)); - if (bus) { - pioInterface = newPioInterface(name, hier, bus, this, + if (pio_bus) { + pioInterface = newPioInterface(name, hier, pio_bus, this, &BadDevice::cacheAccess); - pioInterface->addAddrRange(addr, addr + size - 1); + pioInterface->addAddrRange(RangeSize(addr, size)); } } -Fault +Fault * BadDevice::read(MemReqPtr &req, uint8_t *data) { panic("Device %s not imlpmented\n", devname); - return No_Fault; + return NoFault; } -Fault +Fault * BadDevice::write(MemReqPtr &req, const uint8_t *data) { panic("Device %s not imlpmented\n", devname); - return No_Fault; + return NoFault; } Tick @@ -83,27 +84,31 @@ BadDevice::cacheAccess(MemReqPtr &req) BEGIN_DECLARE_SIM_OBJECT_PARAMS(BadDevice) + SimObjectParam platform; SimObjectParam mmu; Param addr; SimObjectParam hier; - SimObjectParam io_bus; + SimObjectParam pio_bus; + Param pio_latency; Param devicename; END_DECLARE_SIM_OBJECT_PARAMS(BadDevice) BEGIN_INIT_SIM_OBJECT_PARAMS(BadDevice) + INIT_PARAM(platform, "Platform"), INIT_PARAM(mmu, "Memory Controller"), INIT_PARAM(addr, "Device Address"), INIT_PARAM_DFLT(hier, "Hierarchy global variables", &defaultHierParams), - INIT_PARAM_DFLT(io_bus, "The IO Bus to attach to", NULL), + INIT_PARAM_DFLT(pio_bus, "The IO Bus to attach to", NULL), + INIT_PARAM_DFLT(pio_latency, "Programmed IO latency", 1000), INIT_PARAM(devicename, "Name of device to error on") END_INIT_SIM_OBJECT_PARAMS(BadDevice) CREATE_SIM_OBJECT(BadDevice) { - return new BadDevice(getInstanceName(), addr, mmu, hier, io_bus, + return new BadDevice(getInstanceName(), addr, mmu, hier, pio_bus, devicename); }