diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2012-02-24 11:43:53 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2012-02-24 11:43:53 -0500 |
commit | 1031b824b975cec999c37cabc8c05c485a4ae5ca (patch) | |
tree | 18af5987accd59781642001849908ddb486d069a /src/dev/pcidev.hh | |
parent | 9f07d2ce7ecf435b9a1946f15fb3491bb4636637 (diff) | |
download | gem5-1031b824b975cec999c37cabc8c05c485a4ae5ca.tar.xz |
MEM: Move port creation to the memory object(s) construction
This patch moves all port creation from the getPort method to be
consistently done in the MemObject's constructor. This is possible
thanks to the Swig interface passing the length of the vector ports.
Previously there was a mix of: 1) creating the ports as members (at
object construction time) and using getPort for the name resolution,
or 2) dynamically creating the ports in the getPort call. This is now
uniform. Furthermore, objects that would not be complete without a
port have these ports as members rather than having pointers to
dynamically allocated ports.
This patch also enables an elaboration-time enumeration of all the
ports in the system which can be used to determine the masterId.
Diffstat (limited to 'src/dev/pcidev.hh')
-rw-r--r-- | src/dev/pcidev.hh | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh index c0c3df0a6..07089fd0e 100644 --- a/src/dev/pcidev.hh +++ b/src/dev/pcidev.hh @@ -151,7 +151,7 @@ class PciDev : public DmaDevice Platform *platform; Tick pioDelay; Tick configDelay; - PciConfigPort *configPort; + PciConfigPort configPort; /** * Write to the PCI config space data that is stored locally. This may be @@ -221,12 +221,7 @@ class PciDev : public DmaDevice virtual Port *getPort(const std::string &if_name, int idx = -1) { if (if_name == "config") { - if (configPort != NULL) - panic("pciconfig port already connected to."); - configPort = new PciConfigPort(this, params()->pci_bus, - params()->pci_dev, params()->pci_func, - params()->platform); - return configPort; + return &configPort; } return DmaDevice::getPort(if_name, idx); } |