Files
openbios/drivers/pci.fs
Mark Cave-Ayland cba50366da pci: switch ob_pci_map_in() to use physical addresses rather than region and size
This matches the parameters for the map-in word as defined in the IEEE-1275
PCI bindings and provides extra information about the address space in use to
be used later. Even better this allows us to considerably simplify the Forth.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@1372 f158a5a8-5612-0410-a976-696ce0be7e32
2016-01-08 12:09:35 +00:00

41 lines
859 B
Forth

[IFDEF] CONFIG_DRIVER_PCI
: pci-addr-encode ( addr.lo addr.mi addr.hi )
rot >r swap >r
encode-int
r> encode-int encode+
r> encode-int encode+
;
: pci-len-encode ( len.lo len.hi )
encode-int
rot encode-int encode+
;
\ Get PCI physical address and size for configured BAR reg
: pci-bar>pci-addr ( bar-reg -- addr.lo addr.mid addr.hi size -1 | 0 )
" assigned-addresses" active-package get-package-property 0= if
begin
decode-phys \ ( reg prop prop-len phys.lo phys.mid phys.hi )
dup ff and 6 pick = if
>r >r >r rot drop
decode-int drop decode-int
-rot 2drop
r> swap r> r> rot
-1 exit
else
3drop
then
\ Drop the size as we don't need it
decode-int drop decode-int drop
dup 0=
until
3drop
0 exit
else
0
then
;
[THEN]