Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / ppc / qemu / qemu.fs
1 \   qemu specific initialization code
2 \
3 \   Copyright (C) 2005 Stefan Reinauer
4 \
5 \   This program is free software; you can redistribute it and/or
6 \   modify it under the terms of the GNU General Public License
7 \   as published by the Free Software Foundation
8 \
9
10
11 \ -------------------------------------------------------------------------
12 \ initialization
13 \ -------------------------------------------------------------------------
14
15 : make-openable ( path )
16   find-dev if
17     begin ?dup while
18       \ install trivial open and close methods
19       dup active-package! is-open
20       parent
21     repeat
22   then
23 ;
24
25 : preopen ( chosen-str node-path )
26   2dup make-openable
27
28   " /chosen" find-device
29   open-dev ?dup if
30     encode-int 2swap property
31   else
32     2drop
33   then
34 ;
35
36 \ preopen device nodes (and store the ihandles under /chosen)
37 :noname
38   " rtc" " rtc" preopen
39   " memory" " /memory" preopen
40 ; SYSTEM-initializer
41
42
43 \ use the tty interface if available
44 : activate-tty-interface
45   " /packages/terminal-emulator" find-dev if drop
46   then
47 ;
48
49 variable keyboard-phandle 0 keyboard-phandle !
50
51 : (find-keyboard-device) ( phandle -- )
52   recursive
53   keyboard-phandle @ 0= if  \ Return first match
54     >dn.child @
55     begin ?dup while
56       dup dup " device_type" rot get-package-property 0= if
57         drop dup cstrlen
58         " keyboard" strcmp 0= if
59           dup to keyboard-phandle
60         then
61       then
62       (find-keyboard-device)
63       >dn.peer @
64     repeat
65   else
66     drop
67   then
68 ;
69
70 \ create the keyboard devalias 
71 :noname
72   device-tree @ (find-keyboard-device)
73   keyboard-phandle @ if
74     active-package
75     " /aliases" find-device
76     keyboard-phandle @ get-package-path
77     encode-string " keyboard" property
78     active-package!  
79   then
80 ; SYSTEM-initializer
81
82 \ -------------------------------------------------------------------------
83 \ pre-booting
84 \ -------------------------------------------------------------------------
85
86 : update-chosen
87   " /chosen" find-device
88   stdin @ encode-int " stdin" property
89   stdout @ encode-int " stdout" property
90   device-end
91 ;
92
93 :noname
94   set-defaults
95 ; PREPOST-initializer