diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-10-27 13:39:44 +0200 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-11-17 12:10:36 +0100 |
commit | de5b143a1e1c67575914dab1ac1ad9f8ff525daa (patch) | |
tree | c91d23ff10f6583190ec7b2370657b7083cd38ae | |
parent | ae0aaffc1587e9f0eac9bb3b863a20bbb7518378 (diff) | |
download | SLOF-de5b143a1e1c67575914dab1ac1ad9f8ff525daa.zip SLOF-de5b143a1e1c67575914dab1ac1ad9f8ff525daa.tar.gz SLOF-de5b143a1e1c67575914dab1ac1ad9f8ff525daa.tar.bz2 |
Fixed the PCI map-in function.
The map-in function must retriev the BAR address from the config space address
that is provided in the phys.hi parameter. We can not rely on the value in
phys.lo as we did before. This patch is needed to get the FCODE from QLOGIC
working, and it also revealed some bugs in the current version of our ATI rn50
driver (which uses map-in, too, to get the register base address).
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
-rw-r--r-- | board-js2x/slof/pci-device_1002_515e.fs | 19 | ||||
-rw-r--r-- | slof/fs/pci-config-bridge.fs | 19 |
2 files changed, 25 insertions, 13 deletions
diff --git a/board-js2x/slof/pci-device_1002_515e.fs b/board-js2x/slof/pci-device_1002_515e.fs index 5cd692b..84561c4 100644 --- a/board-js2x/slof/pci-device_1002_515e.fs +++ b/board-js2x/slof/pci-device_1002_515e.fs @@ -32,15 +32,12 @@ my-space pci-set-irq-line -1 value regs-addr false value is_installed -: >rn [ 18 config-l@ -10 and ] LITERAL + ; -: rn! >rn rl!-le ; -: rn@ >rn rl@-le ; -: reg-rl@ rn@ ; -: reg-rl! rn! ; -: map-in " map-in" $call-parent ; -: map-out " map-out" $call-parent ; -: pc@ ( offset -- byte ) >rn rb@ ; -: pc! ( byte offset -- ) >rn rb! ; +: reg-rl@ regs-addr + rl@-le ; +: reg-rl! regs-addr + rl!-le ; +: map-in " map-in" $call-parent ; +: map-out " map-out" $call-parent ; +: pc@ ( offset -- byte ) regs-addr + rb@ ; +: pc! ( byte offset -- ) regs-addr + rb! ; 0 value phys_low 0 value phys_mid @@ -206,8 +203,8 @@ dup l@ swap la1+ ; : andorset ( reg and or -- ) - 2 pick regs-addr + dup rn@ - 3 pick AND 2 pick OR swap rn! 3drop + 2 pick dup reg-rl@ + 3 pick AND 2 pick OR swap reg-rl! 3drop ; : INIT1 diff --git a/slof/fs/pci-config-bridge.fs b/slof/fs/pci-config-bridge.fs index e1fe92b..82e263d 100644 --- a/slof/fs/pci-config-bridge.fs +++ b/slof/fs/pci-config-bridge.fs @@ -56,9 +56,24 @@ THEN \ FI ; -: map-in ( phys.lo ... phys.hi size -- virt ) +: map-in ( phys.lo phys.mid phys.hi size -- virt ) \ ." map-in called: " .s cr - 2drop drop + \ Ignore the size, phys.lo and phys.mid, get BAR from config space + drop nip nip ( phys.hi ) + \ Sanity check whether config address is in expected range: + dup FF AND 10 28 WITHIN NOT IF + cr ." phys.hi = " . cr + ABORT" map-in with illegal config space address" + THEN + 00FFFFFF AND \ Need only bus-dev-fn+register bits + dup config-l@ ( phys.hi' bar.lo ) + dup 7 AND 4 = IF \ Is it a 64-bit BAR? + swap 4 + config-l@ lxjoin \ Add upper part of 64-bit BAR + ELSE + nip + THEN + F NOT AND \ Clear indicator bits + \ TODO: Use translate-address here! ; : map-out ( virt size -- ) |