@@ -104,14 +104,23 @@ here 100 allot CONSTANT pci-device-vec
or swap 20 + rtas-config-l! \ and write it into the Reg
;
+: pci-bridge-support-mem64 ( addr -- 1|0 )
+ 24 + rtas-config-w@ 1 and \ does bridge support 64-bit?
+;
+
+: pci-bridge-has-mem64 ( addr -- 1|0 )
+ pci-bridge-support-mem64
+ pci-next-mem64 @ 0<> and
+;
+
\ Update pci-next-mem to be 1MB aligned and set the mem-base and mem-base-upper register
\ and set the Limit register to the maximum available address space
\ needed for scanning possible devices behind the bridge
: pci-bridge-set-mem-base ( addr -- )
pci-next-mem @ 100000 #aligned \ read the current Value and align to 1MB boundary
dup pci-next-mem ! \ and write it back
- over 24 + rtas-config-w@ \ check if 64bit support
- 1 and IF \ IF 64 bit support
+ over pci-bridge-has-mem64 \ check if 64bit support
+ IF \ IF 64 bit support
pci-next-mem64 @ 100000000 #aligned \ | read the current Value of 64-bit and align to 4GB boundary
dup 100000000 + pci-next-mem64 x! \ | and write back with 1GB for bridge
2 pick swap \ |
@@ -137,8 +146,8 @@ here 100 allot CONSTANT pci-device-vec
100000 #aligned \ align to 1MB boundary
dup pci-next-mem ! \ and write it back
1- \ make limit one less than boundary
- over 24 + rtas-config-w@ \ check if 64bit support
- 1 and IF \ IF 64 bit support
+ over pci-bridge-has-mem64 \ check if 64bit support
+ IF \ IF 64 bit support
pci-next-mem64 @ 100000000 #aligned \ | Reat current value of 64-bar and align at 4GB
dup pci-next-mem64 x! \ | and write it back
1- \ | make limite one less than boundary
While we here, add an additional check for pci-next-mem64 there. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- slof/fs/pci-scan.fs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)