summaryrefslogtreecommitdiff
path: root/src/dev/pci/PciHost.py
diff options
context:
space:
mode:
authorGlenn Bergmans <glenn.bergmans@arm.com>2016-01-22 15:40:14 +0000
committerCurtis Dunham <curtis.dunham@arm.com>2018-01-29 22:22:41 +0000
commit7c9122b6f2365bae51903f125ccaa9c4b779ea26 (patch)
tree8bbb3c02645e4587702e866978f3b6eec1e97613 /src/dev/pci/PciHost.py
parentaa80cc9edbfb46b1a83342a32858c1cf48ac61a2 (diff)
downloadgem5-7c9122b6f2365bae51903f125ccaa9c4b779ea26.tar.xz
arm: DT autogeneration - generate PCI node
Enables automatic generation of Device Trees for RealView PCI host controllers. Note that some parts are more hard coded than you'd want, but this is due to the limited understanding the PCI host has of its configuration (i.e. it doesn't know all memory ranges). Fixing this, for now at least, went beyond the scope and intentions of the Device Tree generating code: use with care! Change-Id: I2041871e0eb4d04fb5191257c47dd38649d1c0cc Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5967 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/dev/pci/PciHost.py')
-rw-r--r--src/dev/pci/PciHost.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/dev/pci/PciHost.py b/src/dev/pci/PciHost.py
index f4f9e45e8..28405c198 100644
--- a/src/dev/pci/PciHost.py
+++ b/src/dev/pci/PciHost.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 ARM Limited
+# Copyright (c) 2015-2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
@@ -34,6 +34,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Andreas Sandberg
+# Glenn Bergmans
from m5.SimObject import SimObject
from m5.params import *
@@ -62,3 +63,34 @@ class GenericPciHost(PciHost):
pci_pio_base = Param.Addr(0, "Base address for PCI IO accesses")
pci_mem_base = Param.Addr(0, "Base address for PCI memory accesses")
pci_dma_base = Param.Addr(0, "Base address for DMA memory accesses")
+
+ def pciFdtAddr(self, bus=0, device=0, function=0, register=0, space=0,
+ aliased=0, prefetchable=0, relocatable=0, addr=0):
+
+ busf = bus & 0xff
+ devicef = device & 0x1f
+ functionf = function & 0x7
+ registerf = register & 0xff
+ spacef = space & 0x3
+ aliasedf = aliased & 0x1
+ prefetchablef = prefetchable & 0x1
+ relocatablef = relocatable & 0x1
+
+ if busf != bus or \
+ devicef != device or \
+ functionf != function or \
+ registerf != register or \
+ spacef != space or \
+ aliasedf != aliased or \
+ prefetchablef != prefetchable or \
+ relocatablef != relocatable:
+ fatal("One of the fields for the PCI address is out of bounds")
+
+ address = registerf | (functionf << 8) | (devicef << 11) | \
+ (busf << 16) | (spacef << 24) | (aliasedf << 29) | \
+ (prefetchablef << 30) | (relocatablef << 31)
+
+ low_addr = addr & 0xffffffff
+ high_addr = (addr >> 32) & 0xffffffff
+
+ return [address, high_addr, low_addr]