1 \ tag: PCI helper functions
3 \ Copyright (C) 2003-2004 Stefan Reinauer
4 \ Copyright (C) 2003 Samuel Rydh
6 \ See the file "COPYING" for further information about
7 \ the copyright and warranty status of this work.
10 \ simple set of words for pci access, these are not
11 \ compliant to the PCI bus binding of OpenFirmware.
15 \ also pci definitions
19 : busdevfn ( bus dev fn -- busdevfn )
21 1f and 3 << or ( dev fn -- devfn )
22 swap 8 << or ( bus devfn -- busdevfn )
25 : config-command ( busdevfn reg -- reg addr )
32 : pci-c@ ( busdevfn reg -- x )
39 : pci-w@ ( busdevfn reg -- x )
45 : pci-l@ ( busdevfn reg -- x )
52 : pci-c! ( busdevfn reg val -- )
58 : pci-w! ( busdevfn reg val -- )
64 : pci-l! ( busdevfn reg val -- )
71 : dump-pci-device ( bus dev fn -- )
72 2 pick (.) type 3a emit over
73 (.) type 2e emit dup (.) type 20 emit 5b emit \ 0:18.0 [
75 r@ 0 pci-w@ u. 2f emit r@ 2 pci-w@ u. 5d emit \ 1022/1100]
79 cr i todigit emit 30 emit 3a emit 20 emit
81 dup i j 4 << or pci-c@
82 dup 4 >> todigit emit f and todigit emit
91 \ 0 2 0 dump-pci-device