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
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
17 : >conf-rtas ( config-addr -- config-addr )
19 ffffff AND \ Mask away highest byte for normal PCI
27 : rtas-config-b@ ( config-addr -- value ) >conf-rtas rb@ ;
28 : rtas-config-b! ( value config-addr -- ) >conf-rtas rb! ;
29 : rtas-config-w@ ( config-addr -- value ) >conf-rtas rw@-le ;
30 : rtas-config-w! ( value config-addr -- ) >conf-rtas rw!-le ;
31 : rtas-config-l@ ( config-addr -- value ) >conf-rtas rl@-le ;
32 : rtas-config-l! ( value config-addr -- ) >conf-rtas rl!-le ;
36 #include "pci-scan.fs"
40 \ The root of the device tree and some of its kids.
43 \ read model string from VPD
44 vpd-read-model ( straddr strlen )
45 \ if it is a bimini, we replace the "IBM," in the model string with "TSS,"
47 2dup drop 4 ( straddr strlen str 4 ) \ for string comparison: only first 4 bytes ("IBM,")
50 \ model starts with "IBM,", we replace it with "TSS,"
51 2dup drop s" TSS," ( straddr strlen straddr replacestr len )
52 rot swap ( straddr strlen replacestr straddr len ) \ correct order for move: src dest len
53 move ( straddr strlen ) \ now we have TSS, at beginning of str...
56 \ store the model string
57 encode-string s" model" property
59 2 encode-int s" #address-cells" property
60 2 encode-int s" #size-cells" property
62 \ XXX: what requires this? Linux?
63 0 encode-int f8040000 encode-int+
64 0 encode-int+ f8050000 encode-int+ s" platform-open-pic" property
66 \ Yaboot is stupid. Without this, it can't/won't find /etc/yaboot.conf.
67 s" chrp SLOF based 970 blade" device-type
69 \ add more information to the compatible property
79 \ To get linux-2.6.10 and later to work out-of-the-box.
80 s" Momentum,Maple" encode-string encode+ s" compatible" property
83 \ See 3.6.5, and the PowerPC OF binding document.
85 s" mmu" 2dup device-name device-type
86 0 0 s" translations" property
93 new-device flash-addr set-unit-64
94 s" flash" 2dup device-name device-type
95 0 encode-int flash-addr encode-int+
96 0 encode-int+ get-flash-size encode-int+ s" reg" property
97 get-flash-size encode-int s" #bytes" property
98 0 0 s" used-by-rtas" property
105 new-device nvram-base set-unit-64
106 s" nvram" 2dup device-name device-type
107 nvram-size encode-int s" #bytes" property
108 0 encode-int nvram-base encode-int+
109 0 encode-int+ nvram-size encode-int+ s" reg" property
110 get-node node>path s" nvram" 2swap set-alias
134 \ if it is js21/bimini the fbuffer code is included
135 u4? ?include fbuffer.fs
148 \ See the PowerPC OF binding document.
152 1 encode-int s" #address-cells" property
153 0 encode-int s" #size-cells" property
155 : decode-unit 1 hex-decode-unit ;
156 : encode-unit 1 hex-encode-unit ;
158 cpu-mask @ 40 0 DO dup 1 and IF
159 i s" cpu.fs" INCLUDED THEN u2/ LOOP drop
166 master-cpu s" /cpus/@" rot (u.) $cat open-dev encode-int s" cpu" set-chosen
167 s" /memory" open-dev encode-int s" memory" set-chosen
174 rtas-size encode-int s" rtas-size" property
175 00000001 encode-int s" ibm,flash-block-version" property
176 00000001 encode-int s" rtas-event-scan-rate" property
177 rtas-create-token-properties
178 00000001 encode-int s" rtas-version" property
183 : instantiate-rtas instantiate-rtas ;
192 s" /options" find-device
193 \ s" 33554432" encode-string s" load-base" property
194 s" 16384" encode-string s" load-base" property
198 s" /openprom" find-device
199 s" SLOF," slof-build-id here swap rmove here slof-build-id nip $cat encode-string s" model" property
200 0 0 s" relative-addressing" property
201 flashside? 1 = IF s" T" ELSE s" P" THEN
202 encode-string s" ibm,fw-bank" property
205 read-version-and-date s" ibm,fw-perm-bank" property
207 read-version-and-date s" ibm,fw-temp-bank" property
208 flashside? set-flashside drop
212 s" /aliases" find-device
217 s" /mmu" open-dev encode-int s" mmu" set-chosen
219 #include "available.fs"
221 #include <term-io.fs>
223 u3? IF s" /ht/isa/serial@3f8" io
224 ELSE s" /ht/isa/serial@2f8" io THEN