dev-arm: Automatically assign PCI device ids in attachPciDevice

Simulation scripts currently need to assign PCI device addresses when
adding new devices. This change moves this responsibility to the
VExpress_GEM5_BASE::attachPciDevice method.

Change-Id: I6d62af8a8f9176d964cc011dd8fb9744154bbb87
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22830
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
Ciro Santilli
2019-10-24 17:35:13 +01:00
parent 43e9d8745e
commit bcf041f257
3 changed files with 6 additions and 6 deletions

View File

@@ -365,8 +365,7 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,
# Attach off-chip devices
self.realview.attachIO(self.iobus)
for dev_id, dev in enumerate(pci_devices):
dev.pci_bus, dev.pci_dev, dev.pci_func = (0, dev_id + 1, 0)
for dev in pci_devices:
self.realview.attachPciDevice(
dev, self.iobus,
dma_ports=self._dma_ports if ruby else None)

View File

@@ -303,14 +303,10 @@ def simpleSystem(BaseSystem, caches, mem_size, platform=None, **kwargs):
self.dmabridge = Bridge(delay='50ns',
ranges=[self.mem_ranges[0]])
self._pci_devices = 0
self._clusters = []
self._num_cpus = 0
def attach_pci(self, dev):
dev.pci_bus, dev.pci_dev, dev.pci_func = \
(0, self._pci_devices + 1, 0)
self._pci_devices += 1
self.realview.attachPciDevice(dev, self.iobus)
def connect(self):

View File

@@ -542,6 +542,7 @@ class RealView(Platform):
cxx_header = "dev/arm/realview.hh"
system = Param.System(Parent.any, "system")
_mem_regions = [ AddrRange(0, size='256MB') ]
_num_pci_dev = 0
def _on_chip_devices(self):
return []
@@ -952,6 +953,10 @@ Interrupts:
def attachPciDevice(self, device, *args, **kwargs):
device.host = self.pci_host
self._num_pci_dev += 1
device.pci_bus = 0
device.pci_dev = self._num_pci_dev
device.pci_func = 0
self._attach_device(device, *args, **kwargs)
def attachSmmu(self, devices, bus):