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

1.1       root        1: \ *****************************************************************************
                      2: \ * Copyright (c) 2004, 2011 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: : strequal ( str1 len1 str2 len2 -- flag )
                     14:   rot dup rot = IF comp 0= ELSE 2drop drop 0 THEN ; 
                     15: 
                     16: 400 cp
                     17: 
                     18: \ The root of the device tree and some of its kids.
                     19: " /" find-device
                     20: 
1.1.1.2 ! root       21: \ The following properties have been provided by the FDT from QEMU already,
        !            22: \ so we do not have to create them on our own:
1.1       root       23: 
1.1.1.2 ! root       24: \ " QEMU" encode-string s" model" property
        !            25: \ 2 encode-int s" #address-cells" property
        !            26: \ 2 encode-int s" #size-cells" property
        !            27: \ s" chrp" device-type
1.1       root       28: 
1.1.1.2 ! root       29: 480 cp
1.1       root       30: 
                     31: \ See 3.6.5, and the PowerPC OF binding document.
                     32: new-device
                     33: s" mmu" 2dup device-name device-type
                     34: 0 0 s" translations" property
                     35: 
                     36: : open  true ;
                     37: : close ;
                     38: 
                     39: finish-device
                     40: device-end
                     41: 
                     42: 4c0 cp
                     43: 
                     44: \ Fixup timebase frequency from device-tree
                     45: : fixup-tbfreq
                     46:     " /cpus/@0" find-device
                     47:     " timebase-frequency" get-node get-package-property IF
                     48:         2drop
                     49:     ELSE
                     50:         decode-int to tb-frequency 2drop
                     51:     THEN
                     52:     device-end
                     53: ;
                     54: fixup-tbfreq
                     55: 
                     56: 4d0 cp
                     57: 
1.1.1.2 ! root       58: include fbuffer.fs
1.1       root       59: 
                     60: 500 cp
                     61: 
                     62: : populate-vios ( -- )
                     63:     \ Populate the /vdevice children with their methods
                     64:     \ WARNING: Quite a few SLOFisms here like get-node, set-node, ...
                     65: 
                     66:     ." Populating /vdevice methods" cr
                     67:     " /vdevice" find-device get-node child
                     68:     BEGIN
                     69:         dup 0 <>
                     70:     WHILE
                     71:         dup set-node
                     72:         dup " compatible" rot get-package-property 0 = IF
                     73:             drop dup from-cstring
                     74:             2dup " hvterm1" strequal IF
                     75:                 " vio-hvterm.fs" included
                     76:             THEN
                     77:             2dup " IBM,v-scsi" strequal IF
                     78:                 " vio-vscsi.fs" included
                     79:             THEN
                     80:             2dup " IBM,l-lan" strequal IF
                     81:                 " vio-veth.fs" included
                     82:             THEN
                     83:             2drop
                     84:        THEN
                     85:        peer
                     86:     REPEAT drop
                     87: 
                     88:     device-end
                     89: ;
                     90: 
                     91: \ Now do it
                     92: populate-vios
                     93: 
                     94: 580 cp
                     95: 
                     96: 5a0 cp
                     97: 
1.1.1.2 ! root       98: #include "pci-scan.fs"
        !            99: 
        !           100: : populate-pci-busses ( -- )
        !           101:     \ Populate the /pci* children with their methods
        !           102:     " /" find-device get-node child
        !           103:     BEGIN
        !           104:         dup 0 <>
        !           105:     WHILE
        !           106:         dup set-node
        !           107:         dup " name" rot get-package-property 0 = IF
        !           108:             drop dup from-cstring
        !           109:             2dup s" pci" strequal IF
        !           110:                 s" pci-phb.fs" included
        !           111:             THEN
        !           112:             2drop
        !           113:        THEN
        !           114:        peer
        !           115:     REPEAT drop
        !           116: 
        !           117:     device-end
        !           118: ;
        !           119: 
        !           120: populate-pci-busses
        !           121: 
1.1       root      122: 600 cp
                    123: 
                    124: \ Add rtas cleanup last
                    125: ' rtas-quiesce add-quiesce-xt
                    126: 
                    127: 640 cp
                    128: 
                    129: 690 cp
                    130: 
                    131: 6a0 cp
                    132: 
                    133: 6a8 cp
                    134: 
                    135: 6b0 cp
                    136: 
                    137: 6b8 cp
                    138: 
                    139: 6c0 cp
                    140: 
                    141: s" /cpus/@0" open-dev encode-int s" cpu" set-chosen
                    142: s" /memory" open-dev encode-int s" memory" set-chosen
                    143: 
                    144: 6e0 cp
                    145: 
                    146: 700 cp
                    147: 
                    148: \ See 3.5.
                    149: s" /openprom" find-device
                    150:    s" SLOF," slof-build-id here swap rmove here slof-build-id nip $cat encode-string s" model" property
                    151:    0 0 s" relative-addressing" property
                    152: device-end
                    153: 
                    154: s" /aliases" find-device
                    155:    : open  true ;
                    156:    : close ;
                    157: device-end
                    158: 
                    159: s" /mmu" open-dev encode-int s" mmu" set-chosen
                    160: 
                    161: #include "available.fs"
                    162: 
                    163: \ Setup terminal IO
                    164: 
                    165: #include <term-io.fs>
                    166: 

unix.superglobalmegacorp.com

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