diff mbox

[v2,1/5] pci-scan: Realign code

Message ID 20170721144433.27719-2-aik@ozlabs.ru
State Rejected
Headers show

Commit Message

Alexey Kardashevskiy July 21, 2017, 2:44 p.m. UTC
This changes indentation and copies last common bits of code to
32bit and 64bit branches; these will be changed later separately.

This causes no behavioral change.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 slof/fs/pci-scan.fs | 72 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 31 deletions(-)
diff mbox

Patch

diff --git a/slof/fs/pci-scan.fs b/slof/fs/pci-scan.fs
index c39707a..80ad2ec 100644
--- a/slof/fs/pci-scan.fs
+++ b/slof/fs/pci-scan.fs
@@ -108,43 +108,53 @@  here 100 allot CONSTANT pci-device-vec
 \ 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
-                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                         \ |
-                20 rshift                           \ | keep upper 32 bits
-                swap 28 + rtas-config-l!            \ | and write it into the Base-Upper32-bits
-                pci-max-mem64 @ 20 rshift           \ | fetch max Limit address and keep upper 32 bits
-                2 pick 2C + rtas-config-l!          \ | and set the Limit
-        THEN                                    \ FI
-        10 rshift                               \ keep upper 16 bits
-        pci-max-mem @ 1- FFFF0000 and or        \ and Insert mmem Limit (set it to max)
-        swap 24 + rtas-config-l!                \ and write it into the bridge
+    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
+        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                         \ |
+        20 rshift                           \ | keep upper 32 bits
+        swap 28 + rtas-config-l!            \ | and write it into the Base-Upper32-bits
+        pci-max-mem64 @ 20 rshift           \ | fetch max Limit address and keep upper 32 bits
+        2 pick 2C + rtas-config-l!          \ | and set the Limit
+        10 rshift                           \ | keep upper 16 bits
+        pci-max-mem @ 1- FFFF0000 and or    \ | and Insert mmem Limit (set it to max)
+        swap 24 + rtas-config-l!            \ | and write it into the bridge
+    ELSE
+        10 rshift                           \ | keep upper 16 bits
+        pci-max-mem @ 1- FFFF0000 and or    \ | and Insert mmem Limit (set it to max)
+        swap 24 + rtas-config-l!            \ | and write it into the bridge
+    THEN
 ;
 
 \ Update pci-next-mem to be 1MB aligned and set the mem-limit register
 \ The Limit Value is one less then the upper boundary
 \ If the limit is less than the base the mem is disabled
 : pci-bridge-set-mem-limit ( addr -- )
-        pci-next-mem @ 100000 +                 \ add space for hot-plugging
-        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
-                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
-                2 pick swap                         \ |
-                20 rshift                           \ | keep upper 32 bits
-                swap 2C + rtas-config-l!            \ | and write it into the Limit-Upper32-bits
-        THEN                                    \ FI
-        FFFF0000 and                            \ keep upper 16 bits
-        over 24 + rtas-config-l@ 0000FFFF and   \ fetch original Value
-        or swap 24 + rtas-config-l!             \ and write it into the bridge
+    pci-next-mem @ 100000 +                 \ add space for hot-plugging
+    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
+        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
+        2 pick swap                         \ |
+        20 rshift                           \ | keep upper 32 bits
+        swap 2C + rtas-config-l!            \ | and write it into the Limit-Upper32-bits
+        FFFF0000 and                        \ | keep upper 16 bits
+        over 24 + rtas-config-l@
+        0000FFFF and                        \ | fetch original Value
+        or swap 24 + rtas-config-l!         \ | and write it into the bridge
+    ELSE
+        FFFF0000 and                        \ | keep upper 16 bits
+        over 24 + rtas-config-l@
+        0000FFFF and                        \ | fetch original Value
+        or swap 24 + rtas-config-l!         \ | and write it into the bridge
+    THEN
 ;
 
 \ Update pci-next-io to be 4KB aligned and set the io-base and io-base-upper register