Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / slof / fs / root.fs
1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
8 \ *
9 \ * Contributors:
10 \ *     IBM Corporation - initial implementation
11 \ ****************************************************************************/
12
13 \ this creates the root and common branches of the device tree
14
15 defer (client-exec)
16 defer client-exec
17
18 \ defined in slof/fs/client.fs
19 defer callback
20 defer continue-client
21
22 0 VALUE chosen-node
23
24 : chosen
25   chosen-node dup 0= IF
26     drop s" /chosen" find-node dup to chosen-node
27   THEN
28 ;
29
30 : set-chosen ( prop len name len -- )
31   chosen set-property ;
32
33 : get-chosen ( name len -- [ prop len ] success )
34   chosen get-property 0= ;
35
36 \ Look for an exising root, create one if needed
37 " /" find-node dup 0= IF
38     drop
39     new-device
40     s" /" device-name
41 ELSE
42     extend-device
43 THEN
44
45 \ Create /chosen if it doesn't exist
46 " /chosen" find-node dup 0= IF
47     drop
48     new-device
49     s" chosen" device-name
50     s" " encode-string s" bootargs" property
51     s" " encode-string s" bootpath" property
52     finish-device
53 ELSE
54     drop
55 THEN
56
57 \ Create /aliases
58 new-device
59     s" aliases" device-name
60 finish-device
61
62 \ Create /options
63 new-device
64     s" options" device-name
65 finish-device
66
67 \ Create /openprom
68 new-device
69     s" openprom" device-name
70     0 0 s" relative-addressing" property
71 finish-device
72
73 \ Create /packages
74 new-device 
75 #include <packages.fs>
76 finish-device
77
78 : open true ;
79 : close ;
80 #include <archsupport.fs>
81
82 \ Finish root
83 finish-device
84