Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / unix / tree.fs
1 :noname 
2   ."   Type 'help' for detailed information" cr
3   ; DIAG-initializer
4
5 " /" find-device
6
7 new-device
8   " memory" device-name
9   \ 12230 encode-int " reg" property
10   external
11   : open true ;
12   : close ;
13   \ claim ( phys size align -- base )
14   \ release ( phys size -- )
15 finish-device
16
17 new-device
18   " cpus" device-name
19   1 " #address-cells" int-property
20   0 " #size-cells" int-property
21
22   external
23   : open true ;
24   : close ;
25   : decode-unit parse-hex ;
26
27 finish-device
28
29 : make-openable ( path )
30   find-dev if
31     begin ?dup while
32       \ install trivial open and close methods
33       dup active-package! is-open
34       parent
35     repeat
36   then
37 ;
38
39 : preopen ( chosen-str node-path )
40   2dup make-openable
41     
42   " /chosen" find-device
43   open-dev ?dup if
44     encode-int 2swap property
45   else
46     2drop
47   then
48 ;
49  
50 :noname
51   set-defaults
52 ; SYSTEM-initializer
53   
54
55 \ preopen device nodes (and store the ihandles under /chosen)
56 :noname
57   " memory" " /memory" preopen
58   " mmu" " /cpus/@0" preopen
59   " stdout" " /builtin/console" preopen
60   " stdin" " /builtin/console" preopen
61   device-end
62 ; SYSTEM-initializer
63
64 \ use the tty interface if available
65 :noname
66   " /builtin/console" find-dev if drop
67     " /builtin/console" " input-device" $setenv
68     " /builtin/console" " output-device" $setenv
69   then
70 ; SYSTEM-initializer
71             
72 :noname
73   " keyboard" input
74 ; CONSOLE-IN-initializer
75
76 dev /
77
78 \ node suitable for non-PCI devices 
79 new-device
80   " unix" device-name
81         0 encode-int " #address-cells" property
82         0 encode-int " #size-cells" property
83         
84         external
85   : open true ;
86   : close ;
87
88 \ block device node
89 new-device
90   " block" device-name
91   " unix-block" device-type
92         1 " #address-cells" int-property
93         0 " #size-cells" int-property
94         
95         external
96   : open true ;
97   : close ;
98   : decode-unit parse-hex ;
99
100 \ testnode
101 \ new-device
102 \   " kappa" device-name
103
104 \   1 encode-int " reg" property
105 \   external
106 \   : open true ;
107 \   : close ;
108 \ finish-device
109
110 finish-device
111 finish-device
112
113 dev /aliases
114 " /unix/block/disk" encode-string " hd" property
115
116 device-end