aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2017-07-14 11:45:54 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2017-07-21 15:03:29 +1000
commitc4dd5b62f0d027dc653888f6e049bbb77f832cc4 (patch)
treee62734f4d30d25503c3e79824d1c3d524d356ea8
parent206cff5fc88231d06ec2465873814da1f85e2b00 (diff)
downloadSLOF-c4dd5b62f0d027dc653888f6e049bbb77f832cc4.zip
SLOF-c4dd5b62f0d027dc653888f6e049bbb77f832cc4.tar.gz
SLOF-c4dd5b62f0d027dc653888f6e049bbb77f832cc4.tar.bz2
pci: Avoid 32-bit prefetchable memory area if possible
PCI bridges can only have one prefetchable memory area. If we are already using 64-bit prefetchable memory regions, we can not use a dedicated 32-bit prefetchable memory region anymore. In that case the 32-bit BARs should all be located in the 32-bit non- prefetchable memory space instead. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r--board-qemu/slof/pci-phb.fs16
-rw-r--r--slof/fs/pci-properties.fs7
2 files changed, 17 insertions, 6 deletions
diff --git a/board-qemu/slof/pci-phb.fs b/board-qemu/slof/pci-phb.fs
index 195c833..06729bc 100644
--- a/board-qemu/slof/pci-phb.fs
+++ b/board-qemu/slof/pci-phb.fs
@@ -253,12 +253,9 @@ setup-puid
THEN
ENDOF
2000000 OF \ 32-bit memory space?
- decode-64 pci-next-mem ! \ Decode mem base address
+ decode-64 dup >r pci-next-mmio ! \ Decode base address
decode-64 drop \ Forget the parent address
- decode-64 2 / dup >r \ Decode and calc size/2
- pci-next-mem @ + dup pci-max-mem ! \ and calc max mem address
- dup pci-next-mmio ! \ which is the same as MMIO base
- r> + pci-max-mmio ! \ calc max MMIO address
+ decode-64 r> + pci-max-mmio ! \ calc max MMIO address
ENDOF
3000000 OF \ 64-bit memory space?
decode-64 dup >r pci-next-mem64 !
@@ -270,6 +267,15 @@ setup-puid
( prop-addr prop-len )
2drop
+ \ If we do not have 64-bit prefetchable memory, split the 32-bit space:
+ pci-next-mem64 @ 0= IF
+ pci-next-mmio @ pci-next-mem ! \ Start of 32-bit prefetchable
+ pci-max-mmio @ pci-next-mmio @ - 2 / \ Calculate new size
+ pci-next-mmio @ + \ The middle of the area
+ dup pci-max-mem !
+ pci-next-mmio !
+ THEN
+
phb-debug? IF
pci-var-out
THEN
diff --git a/slof/fs/pci-properties.fs b/slof/fs/pci-properties.fs
index b7bb534..6f8f013 100644
--- a/slof/fs/pci-properties.fs
+++ b/slof/fs/pci-properties.fs
@@ -159,7 +159,12 @@
\ Setup a prefetchable 32bit BAR and return its size
: assign-mem32-bar ( bar-addr -- 4 )
dup pci-bar-size-mem32 \ fetch size
- pci-next-mem \ var to change
+ \ Do we have a dedicated 32-bit prefetchable area? If not, use MMIO
+ pci-next-mem @ IF
+ pci-next-mem
+ ELSE
+ pci-next-mmio
+ THEN
assign-bar-value32 \ and set it all
;