Annotation of qemu/roms/SLOF/board-js2x/slof/tree.fs, revision 1.1.1.1

1.1       root        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: 400 cp
                     14: 
                     15: 0 value puid
                     16: 
                     17: : >conf-rtas ( config-addr  -- config-addr )
                     18:    puid f2000000 >= IF dup ffff > IF 1000000 + THEN THEN puid +  ;
                     19: 
                     20: : rtas-config-b@ ( config-addr -- value ) >conf-rtas rb@ ;
                     21: : rtas-config-b! ( value config-addr -- ) >conf-rtas rb! ;
                     22: : rtas-config-w@ ( config-addr -- value ) >conf-rtas rw@-le ;
                     23: : rtas-config-w! ( value config-addr -- ) >conf-rtas rw!-le ;
                     24: : rtas-config-l@ ( config-addr -- value ) >conf-rtas rl@-le ;
                     25: : rtas-config-l! ( value config-addr -- ) >conf-rtas rl!-le ;
                     26: 
                     27: 440 cp
                     28: 
                     29: #include "pci-scan.fs"
                     30: 
                     31: 480 cp
                     32: 
                     33: \ The root of the device tree and some of its kids.
                     34: 
                     35: s" /" find-device
                     36: \ read model string from VPD
                     37: vpd-read-model ( straddr strlen )
                     38: \ if it is a bimini, we replace the "IBM," in the model string with "TSS,"
                     39: bimini? IF
                     40:    2dup drop 4 ( straddr strlen str 4 ) \ for string comparison: only first 4 bytes ("IBM,")
                     41:    \ string comparison
                     42:    s" IBM," str= IF
                     43:       \ model starts with "IBM,", we replace it with "TSS,"
                     44:       2dup drop s" TSS," ( straddr strlen straddr replacestr len )
                     45:       rot swap ( straddr strlen replacestr straddr len ) \ correct order for move: src dest len
                     46:       move ( straddr strlen ) \ now we have TSS, at beginning of str...
                     47:    THEN
                     48: THEN
                     49: \ store the model string
                     50: encode-string s" model" property
                     51: 
                     52: 2 encode-int s" #address-cells" property
                     53: 2 encode-int s" #size-cells" property
                     54: 
                     55: \ XXX: what requires this?  Linux?
                     56: 0 encode-int  f8040000 encode-int+
                     57: 0 encode-int+ f8050000 encode-int+ s" platform-open-pic" property
                     58: 
                     59: \ Yaboot is stupid.  Without this, it can't/won't find /etc/yaboot.conf.
                     60: s" chrp SLOF based 970 blade" device-type
                     61: 
                     62: \ add more information to the compatible property
                     63: js21?  IF
                     64:    bimini?  IF
                     65:       s" IBM,Bimini"
                     66:    ELSE
                     67:       s" IBM,JS21"
                     68:    THEN
                     69: ELSE
                     70:    s" IBM,JS20"
                     71: THEN  encode-string
                     72: \ To get linux-2.6.10 and later to work out-of-the-box.
                     73: s" Momentum,Maple" encode-string encode+ s" compatible" property
                     74: 
                     75: 
                     76: \ See 3.6.5, and the PowerPC OF binding document.
                     77: new-device
                     78: s" mmu" 2dup device-name device-type
                     79: 0 0 s" translations" property
                     80: 
                     81: : open  true ;
                     82: : close ;
                     83: 
                     84: finish-device
                     85: 
                     86: new-device flash-addr set-unit-64
                     87:    s" flash" 2dup device-name device-type
                     88:    0 encode-int flash-addr encode-int+
                     89:    0 encode-int+ get-flash-size encode-int+ s" reg" property
                     90:    get-flash-size encode-int s" #bytes" property
                     91:    0 0 s" used-by-rtas" property
                     92:    : open  true  ;
                     93:    : close  ;
                     94: finish-device
                     95: 
                     96: 4a0 cp
                     97: 
                     98: new-device nvram-base set-unit-64
                     99:    s" nvram" 2dup device-name device-type
                    100:    nvram-size encode-int s" #bytes" property
                    101:    0 encode-int nvram-base encode-int+
                    102:    0 encode-int+ nvram-size encode-int+ s" reg" property
                    103:    get-node node>path s" nvram" 2swap set-alias
                    104:    : open  true  ;
                    105:    : close  ;
                    106: finish-device
                    107: 
                    108: 4c0 cp
                    109: 
                    110: #include "memory.fs"
                    111: 
                    112: 500 cp
                    113: 
                    114: #include "mpic.fs"
                    115: 
                    116: 580 cp
                    117: 
                    118: #include "dart.fs"
                    119: 
                    120: 5a0 cp
                    121: 
                    122: #include "i2c.fs"
                    123: 
                    124: 600 cp
                    125: get-node device-end
                    126: 620 cp
                    127: \ if it is js21/bimini the fbuffer code is included
                    128: u4? ?include fbuffer.fs
                    129: 640 cp
                    130: set-node
                    131: 
                    132: 690 cp
                    133: 
                    134: #include "ht.fs"
                    135: 
                    136: 6a0 cp
                    137: get-node device-end
                    138: 6a8 cp
                    139: \ at this point the SAS controller has been detected and we know
                    140: \ if it is bimini or js21
                    141: \ if it is bimini the fcode evaluator is included
                    142: bimini? ?include evaluator.fs
                    143: 6b0 cp
                    144: set-node
                    145: 6b8 cp
                    146: 
                    147: u4? ?include attu.fs
                    148: 6c0 cp
                    149: 
                    150: \ See the PowerPC OF binding document.
                    151: new-device
                    152: s" cpus" device-name
                    153: 
                    154: 1 encode-int s" #address-cells" property
                    155: 0 encode-int s" #size-cells" property
                    156: 
                    157: : decode-unit  1 hex-decode-unit ;
                    158: : encode-unit  1 hex-encode-unit ;
                    159: 
                    160: cpu-mask @ 40 0 DO dup 1 and IF
                    161: i s" cpu.fs" INCLUDED THEN u2/ LOOP drop
                    162: 
                    163: : open  true ;
                    164: : close ;
                    165: 
                    166: finish-device
                    167: 
                    168: master-cpu s" /cpus/@" rot (u.) $cat open-dev encode-int s" cpu" set-chosen
                    169: s" /memory" open-dev encode-int s" memory" set-chosen
                    170: 
                    171: 6e0 cp
                    172: 
                    173: new-device
                    174:    s" rtas" device-name
                    175: 
                    176:    rtas-size encode-int s" rtas-size" property
                    177:    00000001 encode-int s" ibm,flash-block-version" property
                    178:    00000001 encode-int s" rtas-event-scan-rate" property
                    179:    rtas-create-token-properties
                    180:    00000001 encode-int s" rtas-version" property
                    181: 
                    182: : open  true ;
                    183: : close ;
                    184: 
                    185: : instantiate-rtas instantiate-rtas ;
                    186: 
                    187: finish-device
                    188: 
                    189: 700 cp
                    190: 
                    191: device-end
                    192: 
                    193: \ Hack for AIX.
                    194: s" /options" find-device
                    195:    \ s" 33554432" encode-string s" load-base" property
                    196:    s" 16384" encode-string s" load-base" property
                    197: device-end
                    198: 
                    199: \ See 3.5.
                    200: s" /openprom" find-device
                    201:    s" SLOF," slof-build-id here swap rmove here slof-build-id nip $cat encode-string s" model" property
                    202:    0 0 s" relative-addressing" property
                    203:    flashside? 1 = IF s" T" ELSE s" P" THEN
                    204:    encode-string s" ibm,fw-bank" property
                    205:    takeover? not  IF
                    206:       0 set-flashside drop
                    207:       read-version-and-date  s" ibm,fw-perm-bank" property
                    208:       1 set-flashside drop
                    209:       read-version-and-date  s" ibm,fw-temp-bank" property
                    210:       flashside? set-flashside drop
                    211:    THEN
                    212: device-end
                    213: 
                    214: s" /aliases" find-device
                    215:    : open  true ;
                    216:    : close ;
                    217: device-end
                    218: 
                    219: s" /mmu" open-dev encode-int s" mmu" set-chosen
                    220: 
                    221: #include "available.fs"
                    222: 
                    223: #include <term-io.fs>
                    224: 
                    225: u3? IF s" /ht/isa/serial@3f8" io
                    226:   ELSE s" /ht/isa/serial@2f8" io THEN
                    227: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.