summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2011-10-04 02:26:03 -0700
committerGabe Black <gblack@eecs.umich.edu>2011-10-04 02:26:03 -0700
commitd3683440923051607ae96974fb2bdc5783993bf4 (patch)
tree45b500db2e2dd4cca5fc00f2fbb7371e488d1a51
parente2dbe59f5dd63ad7a84df701dfbd033320cb8bf9 (diff)
downloadgem5-d3683440923051607ae96974fb2bdc5783993bf4.tar.xz
SE/FS: Put platform pointers in fewer objects.
Not all objects need a platform pointer, and having one creates a dependence on their being a platform object. This change removes the platform pointer to from the base device object and moves it into subclasses that actually need it.
-rw-r--r--src/arch/x86/X86LocalApic.py5
-rw-r--r--src/arch/x86/interrupts.cc6
-rw-r--r--src/arch/x86/interrupts.hh5
-rw-r--r--src/dev/Device.py1
-rw-r--r--src/dev/Pci.py2
-rw-r--r--src/dev/Uart.py1
-rw-r--r--src/dev/alpha/AlphaBackdoor.py1
-rw-r--r--src/dev/arm/RealView.py1
-rw-r--r--src/dev/arm/gic.cc7
-rw-r--r--src/dev/arm/gic.hh2
-rw-r--r--src/dev/baddev.cc1
-rw-r--r--src/dev/io_device.cc2
-rw-r--r--src/dev/io_device.hh6
-rw-r--r--src/dev/pcidev.cc4
-rw-r--r--src/dev/pcidev.hh8
-rw-r--r--src/dev/sparc/T1000.py1
-rw-r--r--src/dev/sparc/iob.cc3
17 files changed, 34 insertions, 22 deletions
diff --git a/src/arch/x86/X86LocalApic.py b/src/arch/x86/X86LocalApic.py
index b9be19b64..cfb225240 100644
--- a/src/arch/x86/X86LocalApic.py
+++ b/src/arch/x86/X86LocalApic.py
@@ -26,7 +26,9 @@
#
# Authors: Gabe Black
+from m5.defines import buildEnv
from m5.params import *
+from m5.proxy import *
from Device import BasicPioDevice
class X86LocalApic(BasicPioDevice):
@@ -36,3 +38,6 @@ class X86LocalApic(BasicPioDevice):
int_port = Port("Port for sending and receiving interrupt messages")
int_latency = Param.Latency('1ns', \
"Latency for an interrupt to propagate through this device.")
+ if buildEnv['FULL_SYSTEM']: # No platform in SE mode.
+ platform = Param.Platform(Parent.any,
+ "Platform this device is part of.")
diff --git a/src/arch/x86/interrupts.cc b/src/arch/x86/interrupts.cc
index 7d6f6e35e..81cb306dc 100644
--- a/src/arch/x86/interrupts.cc
+++ b/src/arch/x86/interrupts.cc
@@ -302,10 +302,11 @@ X86ISA::Interrupts::init()
//
BasicPioDevice::init();
IntDev::init();
-
+#if FULL_SYSTEM
Pc * pc = dynamic_cast<Pc *>(platform);
assert(pc);
pc->southBridge->ioApic->registerLocalApic(initialApicId, this);
+#endif
}
@@ -613,6 +614,9 @@ X86ISA::Interrupts::Interrupts(Params * p) :
pendingStartup(false), startupVector(0),
startedUp(false), pendingUnmaskableInt(false),
pendingIPIs(0), cpu(NULL)
+#if FULL_SYSTEM
+ , platform(p->platform)
+#endif
{
pioSize = PageBytes;
memset(regs, 0, sizeof(regs));
diff --git a/src/arch/x86/interrupts.hh b/src/arch/x86/interrupts.hh
index f5d86219b..46e5e5cad 100644
--- a/src/arch/x86/interrupts.hh
+++ b/src/arch/x86/interrupts.hh
@@ -44,6 +44,7 @@
#include "arch/x86/faults.hh"
#include "arch/x86/intmessage.hh"
#include "base/bitfield.hh"
+#include "config/full_system.hh"
#include "cpu/thread_context.hh"
#include "dev/x86/intdev.hh"
#include "dev/io_device.hh"
@@ -175,6 +176,10 @@ class Interrupts : public BasicPioDevice, IntDev
int initialApicId;
+#if FULL_SYSTEM
+ Platform *platform;
+#endif
+
public:
/*
* Params stuff.
diff --git a/src/dev/Device.py b/src/dev/Device.py
index bf43449b5..9cd41fe09 100644
--- a/src/dev/Device.py
+++ b/src/dev/Device.py
@@ -34,7 +34,6 @@ class PioDevice(MemObject):
type = 'PioDevice'
abstract = True
pio = Port("Programmed I/O port")
- platform = Param.Platform(Parent.any, "Platform this device is part of")
system = Param.System(Parent.any, "System this device is part of")
class BasicPioDevice(PioDevice):
diff --git a/src/dev/Pci.py b/src/dev/Pci.py
index bd67d82fb..2f9f93a59 100644
--- a/src/dev/Pci.py
+++ b/src/dev/Pci.py
@@ -33,6 +33,7 @@ from Device import BasicPioDevice, DmaDevice, PioDevice
class PciConfigAll(PioDevice):
type = 'PciConfigAll'
+ platform = Param.Platform(Parent.any, "Platform this device is part of.")
pio_latency = Param.Tick(1, "Programmed IO latency in simticks")
bus = Param.UInt8(0x00, "PCI bus to act as config space for")
size = Param.MemorySize32('16MB', "Size of config space")
@@ -41,6 +42,7 @@ class PciConfigAll(PioDevice):
class PciDevice(DmaDevice):
type = 'PciDevice'
abstract = True
+ platform = Param.Platform(Parent.any, "Platform this device is part of.")
config = Port(Self.pio.peerObj.port, "PCI configuration space port")
pci_bus = Param.Int("PCI bus")
pci_dev = Param.Int("PCI device number")
diff --git a/src/dev/Uart.py b/src/dev/Uart.py
index 9254dc695..3dfc885eb 100644
--- a/src/dev/Uart.py
+++ b/src/dev/Uart.py
@@ -33,6 +33,7 @@ from Device import BasicPioDevice
class Uart(BasicPioDevice):
type = 'Uart'
abstract = True
+ platform = Param.Platform(Parent.any, "Platform this device is part of.")
terminal = Param.Terminal(Parent.any, "The terminal")
class Uart8250(Uart):
diff --git a/src/dev/alpha/AlphaBackdoor.py b/src/dev/alpha/AlphaBackdoor.py
index f7402f593..c6d4583c2 100644
--- a/src/dev/alpha/AlphaBackdoor.py
+++ b/src/dev/alpha/AlphaBackdoor.py
@@ -36,5 +36,6 @@ class AlphaBackdoor(BasicPioDevice):
cpu = Param.BaseCPU(Parent.cpu[0], "Processor")
disk = Param.SimpleDisk("Simple Disk")
terminal = Param.Terminal(Parent.any, "The console terminal")
+ platform = Param.Platform(Parent.any, "Platform this device is part of.")
if buildEnv['FULL_SYSTEM']: # No AlphaSystem in SE mode.
system = Param.AlphaSystem(Parent.any, "system object")
diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py
index 96f3c8a61..11905ae79 100644
--- a/src/dev/arm/RealView.py
+++ b/src/dev/arm/RealView.py
@@ -83,6 +83,7 @@ class RealViewCtrl(BasicPioDevice):
class Gic(PioDevice):
type = 'Gic'
+ platform = Param.Platform(Parent.any, "Platform this device is part of.")
dist_addr = Param.Addr(0x1f001000, "Address for distributor")
cpu_addr = Param.Addr(0x1f000100, "Address for cpu")
dist_pio_delay = Param.Latency('10ns', "Delay for PIO r/w to distributor")
diff --git a/src/dev/arm/gic.cc b/src/dev/arm/gic.cc
index ddea4873f..67520f865 100644
--- a/src/dev/arm/gic.cc
+++ b/src/dev/arm/gic.cc
@@ -53,9 +53,10 @@
#include "mem/packet_access.hh"
Gic::Gic(const Params *p)
- : PioDevice(p),distAddr(p->dist_addr), cpuAddr(p->cpu_addr),
- distPioDelay(p->dist_pio_delay), cpuPioDelay(p->cpu_pio_delay),
- intLatency(p->int_latency), enabled(false), itLines(p->it_lines)
+ : PioDevice(p), platform(p->platform), distAddr(p->dist_addr),
+ cpuAddr(p->cpu_addr), distPioDelay(p->dist_pio_delay),
+ cpuPioDelay(p->cpu_pio_delay), intLatency(p->int_latency),
+ enabled(false), itLines(p->it_lines)
{
itLinesLog2 = ceilLog2(itLines);
diff --git a/src/dev/arm/gic.hh b/src/dev/arm/gic.hh
index 4c43db660..6988d6ed1 100644
--- a/src/dev/arm/gic.hh
+++ b/src/dev/arm/gic.hh
@@ -124,6 +124,8 @@ class Gic : public PioDevice
Bitfield<12,10> cpu_id;
EndBitUnion(IAR)
+ Platform *platform;
+
/** Distributor address GIC listens at */
Addr distAddr;
diff --git a/src/dev/baddev.cc b/src/dev/baddev.cc
index 1b4d04afc..9fb88d876 100644
--- a/src/dev/baddev.cc
+++ b/src/dev/baddev.cc
@@ -39,7 +39,6 @@
#include "base/trace.hh"
#include "config/the_isa.hh"
#include "dev/baddev.hh"
-#include "dev/platform.hh"
#include "mem/port.hh"
#include "params/BadDevice.hh"
#include "sim/system.hh"
diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc
index bfdf3d486..c073ab501 100644
--- a/src/dev/io_device.cc
+++ b/src/dev/io_device.cc
@@ -58,7 +58,7 @@ PioPort::getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
PioDevice::PioDevice(const Params *p)
- : MemObject(p), platform(p->platform), sys(p->system), pioPort(NULL)
+ : MemObject(p), sys(p->system), pioPort(NULL)
{}
PioDevice::~PioDevice()
diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh
index bc6f1d4f7..bdafc34a0 100644
--- a/src/dev/io_device.hh
+++ b/src/dev/io_device.hh
@@ -42,7 +42,6 @@
#include "sim/sim_object.hh"
class Event;
-class Platform;
class PioDevice;
class DmaDevice;
class System;
@@ -173,11 +172,6 @@ class DmaPort : public Port
class PioDevice : public MemObject
{
protected:
-
- /** The platform we are in. This is used to decide what type of memory
- * transaction we should perform. */
- Platform *platform;
-
System *sys;
/** The pioPort that handles the requests for us and provides us requests
diff --git a/src/dev/pcidev.cc b/src/dev/pcidev.cc
index 2c7d50e83..ac315341a 100644
--- a/src/dev/pcidev.cc
+++ b/src/dev/pcidev.cc
@@ -83,7 +83,7 @@ PciDev::PciConfigPort::getDeviceAddressRanges(AddrRangeList &resp,
PciDev::PciDev(const Params *p)
- : DmaDevice(p), plat(p->platform), pioDelay(p->pio_latency),
+ : DmaDevice(p), platform(p->platform), pioDelay(p->pio_latency),
configDelay(p->config_latency), configPort(NULL)
{
config.vendor = htole(p->VendorID);
@@ -143,7 +143,7 @@ PciDev::PciDev(const Params *p)
}
}
- plat->registerPciDevice(p->pci_bus, p->pci_dev, p->pci_func,
+ platform->registerPciDevice(p->pci_bus, p->pci_dev, p->pci_func,
letoh(config.interruptLine));
}
diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh
index 5da8b2dfc..dae005a97 100644
--- a/src/dev/pcidev.hh
+++ b/src/dev/pcidev.hh
@@ -149,7 +149,7 @@ class PciDev : public DmaDevice
}
protected:
- Platform *plat;
+ Platform *platform;
Tick pioDelay;
Tick configDelay;
PciConfigPort *configPort;
@@ -173,15 +173,15 @@ class PciDev : public DmaDevice
public:
Addr pciToDma(Addr pciAddr) const
- { return plat->pciToDma(pciAddr); }
+ { return platform->pciToDma(pciAddr); }
void
intrPost()
- { plat->postPciInt(letoh(config.interruptLine)); }
+ { platform->postPciInt(letoh(config.interruptLine)); }
void
intrClear()
- { plat->clearPciInt(letoh(config.interruptLine)); }
+ { platform->clearPciInt(letoh(config.interruptLine)); }
uint8_t
interruptLine()
diff --git a/src/dev/sparc/T1000.py b/src/dev/sparc/T1000.py
index cbf390737..901304251 100644
--- a/src/dev/sparc/T1000.py
+++ b/src/dev/sparc/T1000.py
@@ -46,6 +46,7 @@ class DumbTOD(BasicPioDevice):
class Iob(PioDevice):
type = 'Iob'
+ platform = Param.Platform(Parent.any, "Platform this device is part of.")
pio_latency = Param.Latency('1ns', "Programed IO latency in simticks")
diff --git a/src/dev/sparc/iob.cc b/src/dev/sparc/iob.cc
index cbb0bbde0..008e063e0 100644
--- a/src/dev/sparc/iob.cc
+++ b/src/dev/sparc/iob.cc
@@ -62,9 +62,6 @@ Iob::Iob(const Params *p)
pioDelay = p->pio_latency;
- // Get the interrupt controller from the platform
- ic = platform->intrctrl;
-
for (int x = 0; x < NumDeviceIds; ++x) {
intMan[x].cpu = 0;
intMan[x].vector = 0;