SE/FS: Put platform pointers in fewer objects.
authorGabe Black <gblack@eecs.umich.edu>
Tue, 4 Oct 2011 09:26:03 +0000 (02:26 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 4 Oct 2011 09:26:03 +0000 (02:26 -0700)
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.

17 files changed:
src/arch/x86/X86LocalApic.py
src/arch/x86/interrupts.cc
src/arch/x86/interrupts.hh
src/dev/Device.py
src/dev/Pci.py
src/dev/Uart.py
src/dev/alpha/AlphaBackdoor.py
src/dev/arm/RealView.py
src/dev/arm/gic.cc
src/dev/arm/gic.hh
src/dev/baddev.cc
src/dev/io_device.cc
src/dev/io_device.hh
src/dev/pcidev.cc
src/dev/pcidev.hh
src/dev/sparc/T1000.py
src/dev/sparc/iob.cc

index b9be19b64f221136680244fbc2b900c7bced6330..cfb225240b46235a21b00b9f8fcbf0e892760d92 100644 (file)
@@ -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.")
index 7d6f6e35e3b00affc5b4362a956d6c7040e42382..81cb306dc7bb3fbfb0fb997b08332579f042459d 100644 (file)
@@ -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));
index f5d86219b7360041578ab6f453176c509b3434d3..46e5e5cad14978a046f39e9d5b2995dabc5b11b9 100644 (file)
@@ -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.
index bf43449b550b868eae56b56506e5881c4f276c90..9cd41fe09447566d3ff20de138abe5c2569fa349 100644 (file)
@@ -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):
index bd67d82fb0edf3933748ac29decd92d9345cb6d0..2f9f93a59735ec5e5c0406f626baef9d5ab51105 100644 (file)
@@ -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")
index 9254dc695e3d40303a22275b48e29f0060b33470..3dfc885eb55c5a15ce07b6609b3d88c1e3237f53 100644 (file)
@@ -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):
index f7402f5937421e4fdd6985269bbda342ea155c39..c6d4583c2039c603e2167c1a035ce31e25b5cc6d 100644 (file)
@@ -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")
index 96f3c8a6172e34867ce99c0aa188451d1830e70f..11905ae79c6173065b1e853727c8b507e706a8be 100644 (file)
@@ -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")
index ddea4873f8fe050e01a830d654657a507d1c88f1..67520f86586c8a25d1835d14ffbba512bca8f634 100644 (file)
 #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);
 
index 4c43db66008d393b668f5f51f7d6e3245585f43c..6988d6ed176491af7530e4376d6db89780b5a3ff 100644 (file)
@@ -124,6 +124,8 @@ class Gic : public PioDevice
         Bitfield<12,10> cpu_id;
     EndBitUnion(IAR)
 
+    Platform *platform;
+
     /** Distributor address GIC listens at */
     Addr distAddr;
 
index 1b4d04afc7e261a26efd45197fe959f44ca9c9e7..9fb88d876f8dc668902fb0ca042a8a65c64afc25 100644 (file)
@@ -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"
index bfdf3d486f930d458579ce7fb81e3b3e50fed80e..c073ab50146445ff0645e3cd68016ec2eac2c15b 100644 (file)
@@ -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()
index bc6f1d4f78ef837c7802126cd5f3872aad636158..bdafc34a08ec12df910b850a315a3e6e59eeed3d 100644 (file)
@@ -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
index 2c7d50e83519acd67df828463b2fa3720f094f3c..ac315341a4cd9a7b7f988a05ae076ab2d60507a0 100644 (file)
@@ -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));
 }
 
index 5da8b2dfcdbfa4c51a4692401ef87cbf76476e32..dae005a970dc5399ff383b956899c1f6bef31acb 100644 (file)
@@ -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()
index cbf390737e1b1aa9c4d3e1109e2ed9b41a03e639..901304251d3f292c0646f7bac301810c00dfc1b1 100644 (file)
@@ -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")
 
 
index cbb0bbde0dac7786bd6e64f99dde8b64d90007f0..008e063e0aec821dcc3416a6588fbb776987eed9 100644 (file)
@@ -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;