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

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 )
1.1.1.2 ! root       18:    puid f2000000 >= IF
        !            19:       ffffff AND                        \ Mask away highest byte for normal PCI
        !            20:       dup ffff > IF
        !            21:          1000000 +
        !            22:       THEN
        !            23:    THEN
        !            24:    puid +
        !            25: ;
1.1       root       26: 
                     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 ;
                     33: 
                     34: 440 cp
                     35: 
                     36: #include "pci-scan.fs"
                     37: 
                     38: 480 cp
                     39: 
                     40: \ The root of the device tree and some of its kids.
                     41: 
                     42: s" /" find-device
                     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,"
                     46: bimini? IF
                     47:    2dup drop 4 ( straddr strlen str 4 ) \ for string comparison: only first 4 bytes ("IBM,")
                     48:    \ string comparison
                     49:    s" IBM," str= IF
                     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...
                     54:    THEN
                     55: THEN
                     56: \ store the model string
                     57: encode-string s" model" property
                     58: 
                     59: 2 encode-int s" #address-cells" property
                     60: 2 encode-int s" #size-cells" property
                     61: 
                     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
                     65: 
                     66: \ Yaboot is stupid.  Without this, it can't/won't find /etc/yaboot.conf.
                     67: s" chrp SLOF based 970 blade" device-type
                     68: 
                     69: \ add more information to the compatible property
                     70: js21?  IF
                     71:    bimini?  IF
                     72:       s" IBM,Bimini"
                     73:    ELSE
                     74:       s" IBM,JS21"
                     75:    THEN
                     76: ELSE
                     77:    s" IBM,JS20"
                     78: THEN  encode-string
                     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
                     81: 
                     82: 
                     83: \ See 3.6.5, and the PowerPC OF binding document.
                     84: new-device
                     85: s" mmu" 2dup device-name device-type
                     86: 0 0 s" translations" property
                     87: 
                     88: : open  true ;
                     89: : close ;
                     90: 
                     91: finish-device
                     92: 
                     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
                     99:    : open  true  ;
                    100:    : close  ;
                    101: finish-device
                    102: 
                    103: 4a0 cp
                    104: 
                    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
                    111:    : open  true  ;
                    112:    : close  ;
                    113: finish-device
                    114: 
                    115: 4c0 cp
                    116: 
                    117: #include "memory.fs"
                    118: 
                    119: 500 cp
                    120: 
                    121: #include "mpic.fs"
                    122: 
                    123: 580 cp
                    124: 
                    125: #include "dart.fs"
                    126: 
                    127: 5a0 cp
                    128: 
                    129: #include "i2c.fs"
                    130: 
                    131: 600 cp
                    132: get-node device-end
                    133: 620 cp
                    134: \ if it is js21/bimini the fbuffer code is included
                    135: u4? ?include fbuffer.fs
                    136: 640 cp
                    137: set-node
                    138: 
                    139: 690 cp
                    140: 
                    141: #include "ht.fs"
                    142: 
                    143: 6b0 cp
                    144: 
                    145: u4? ?include attu.fs
                    146: 6c0 cp
                    147: 
                    148: \ See the PowerPC OF binding document.
                    149: new-device
                    150: s" cpus" device-name
                    151: 
                    152: 1 encode-int s" #address-cells" property
                    153: 0 encode-int s" #size-cells" property
                    154: 
                    155: : decode-unit  1 hex-decode-unit ;
                    156: : encode-unit  1 hex-encode-unit ;
                    157: 
                    158: cpu-mask @ 40 0 DO dup 1 and IF
                    159: i s" cpu.fs" INCLUDED THEN u2/ LOOP drop
                    160: 
                    161: : open  true ;
                    162: : close ;
                    163: 
                    164: finish-device
                    165: 
                    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
                    168: 
                    169: 6e0 cp
                    170: 
                    171: new-device
                    172:    s" rtas" device-name
                    173: 
                    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
                    179: 
                    180: : open  true ;
                    181: : close ;
                    182: 
                    183: : instantiate-rtas instantiate-rtas ;
                    184: 
                    185: finish-device
                    186: 
                    187: 700 cp
                    188: 
                    189: device-end
                    190: 
                    191: \ Hack for AIX.
                    192: s" /options" find-device
                    193:    \ s" 33554432" encode-string s" load-base" property
                    194:    s" 16384" encode-string s" load-base" property
                    195: device-end
                    196: 
                    197: \ See 3.5.
                    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
                    203:    takeover? not  IF
                    204:       0 set-flashside drop
                    205:       read-version-and-date  s" ibm,fw-perm-bank" property
                    206:       1 set-flashside drop
                    207:       read-version-and-date  s" ibm,fw-temp-bank" property
                    208:       flashside? set-flashside drop
                    209:    THEN
                    210: device-end
                    211: 
                    212: s" /aliases" find-device
                    213:    : open  true ;
                    214:    : close ;
                    215: device-end
                    216: 
                    217: s" /mmu" open-dev encode-int s" mmu" set-chosen
                    218: 
                    219: #include "available.fs"
                    220: 
                    221: #include <term-io.fs>
                    222: 
                    223: u3? IF s" /ht/isa/serial@3f8" io
                    224:   ELSE s" /ht/isa/serial@2f8" io THEN
                    225: 

unix.superglobalmegacorp.com

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