~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/openbios/drivers/pci.fs

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
[IFDEF] CONFIG_DRIVER_PCI
 
2
 
 
3
: pci-addr-encode ( addr.lo addr.mi addr.hi )
 
4
  rot >r swap >r 
 
5
  encode-int 
 
6
  r> encode-int encode+ 
 
7
  r> encode-int encode+
 
8
  ;
 
9
 
 
10
: pci-len-encode ( len.lo len.hi )
 
11
  encode-int 
 
12
  rot encode-int encode+ 
 
13
  ;
 
14
 
 
15
\ Get PCI physical address and size for configured BAR reg
 
16
: pci-bar>pci-addr ( bar-reg -- addr.lo addr.mid addr.hi size -1 | 0 )
 
17
  " assigned-addresses" active-package get-package-property 0= if
 
18
    begin
 
19
      decode-phys    \ ( reg prop prop-len phys.lo phys.mid phys.hi )
 
20
      dup ff and 6 pick = if
 
21
        >r >r >r rot drop
 
22
        decode-int drop decode-int
 
23
        -rot 2drop
 
24
        r> swap r> r> rot
 
25
        -1 exit
 
26
      else
 
27
        3drop
 
28
      then
 
29
      \ Drop the size as we don't need it
 
30
      decode-int drop decode-int drop
 
31
      dup 0=
 
32
    until
 
33
    3drop
 
34
    0 exit
 
35
  else
 
36
    0
 
37
  then
 
38
  ;
 
39
 
 
40
[THEN]