Annotation of qemu/roms/SLOF/board-qemu/slof/OF.fs, revision 1.1.1.3

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: \ The master file.  Everything else is included into here.
                     14: 
                     15: hex
                     16: 
                     17: ' ll-cr to cr
                     18: 
                     19: #include "header.fs"
                     20: 
                     21: #include "hvterm.fs"
                     22: 
                     23: #include "base.fs"
                     24: 
1.1.1.2   root       25: \ Adjust load-base to point to paflof-start / 2:
                     26: paflof-start 1 rshift fff not and to load-base
                     27: 
1.1       root       28: \ Little-endian accesses.  Also known as `wrong-endian'.
                     29: #include <little-endian.fs>
                     30: 
                     31: : #join  ( lo hi #bits -- x )  lshift or ;
                     32: : #split ( x #bits -- lo hi )  2dup rshift dup >r swap lshift xor r> ;
                     33: 
                     34: : blink ;
                     35: : reset-dual-emit ;
                     36: : console-clean-fifo ;
                     37: : bootmsg-nvupdate ;
                     38: : asm-cout 2drop drop ;
                     39: 
                     40: #include "logging.fs"
                     41: 
                     42: : log-string 2drop ;
                     43: 
                     44: #include "bootmsg.fs"
                     45: 
                     46: 000 cp
                     47: 
                     48: #include "exception.fs"
                     49: 
                     50: : mm-log-warning 2drop ;
                     51: 
                     52: : write-mm-log ( data length type -- status )
                     53:        3drop 0
                     54: ;
                     55: 
                     56: 100 cp
                     57: 
                     58: \ Input line editing.
                     59: #include "accept.fs"
                     60: 
                     61: 120 cp
                     62: 
                     63: #include "dump.fs"
                     64: 
                     65: cistack ciregs >r1 ! \ kernel wants a stack :-)
                     66: 
                     67: 140 cp
                     68: 
1.1.1.3 ! root       69: #include "romfs.fs"
        !            70: 
1.1       root       71: 200 cp
                     72: 
                     73: #include <slof-logo.fs>
1.1.1.3 ! root       74: 
        !            75: 201 cp
        !            76: 
1.1       root       77: #include <banner.fs>
                     78: 
                     79: : .banner .slof-logo .banner ;
                     80: 
                     81: 220 cp
                     82: 
                     83: DEFER find-boot-sector ( -- )
                     84: 
                     85: 240 cp
                     86: \ Timebase frequency, in Hz. Start with a good default
                     87: \ Use device-tree later to fix it up
                     88: d# 512000000 VALUE tb-frequency   \ default value - needed for "ms" to work
                     89: -1 VALUE cpu-frequency
                     90: 
                     91: #include "helper.fs"
                     92: 260 cp
                     93: 
                     94: #include <timebase.fs>
                     95: 
1.1.1.3 ! root       96: 270 cp
1.1       root       97: 
1.1.1.3 ! root       98: #include <fcode/evaluator.fs>
1.1       root       99: 
                    100: 2e0 cp
                    101: 
                    102: #include <quiesce.fs>
                    103: 
                    104: 300 cp
                    105: 
                    106: #include <usb/usb-static.fs>
                    107: 
                    108: 320 cp
                    109: 
                    110: #include <scsi-loader.fs>
                    111: 
                    112: 360 cp
                    113: 
                    114: #include "fdt.fs"
                    115: 
                    116: 370 cp
                    117: 
1.1.1.3 ! root      118: \ Grab rtas from qemu
        !           119: #include "rtas.fs"
        !           120: 
        !           121: 390 cp
        !           122: 
        !           123: #include "virtio.fs"
        !           124: 
        !           125: 3f0 cp
        !           126: 
1.1       root      127: #include "tree.fs"
                    128: 
                    129: 800 cp
                    130: 
                    131: #include "nvram.fs"
                    132: 
                    133: 880 cp
                    134: 
                    135: #include "envvar.fs"
                    136: check-for-nvramrc
                    137: 
                    138: 890 cp
                    139: 
                    140: #include "qemu-bootlist.fs"
                    141: 
                    142: 8a0 cp
                    143: 
                    144: \ The client interface.
                    145: #include "client.fs"
                    146: \ ELF binary file format.
                    147: #include "elf.fs"
                    148: #include <loaders.fs>
                    149: 
1.1.1.3 ! root      150: 8a8 cp
        !           151: 
        !           152: : enable-framebuffer-output  ( -- )
        !           153: \ enable output on framebuffer
        !           154:    s" screen" find-alias ?dup  IF
        !           155:       \ we need to open/close the screen device once
        !           156:       \ before "ticking" display-emit to emit
        !           157:       open-dev close-node
        !           158:       s" display-emit" $find  IF 
        !           159:          to emit 
        !           160:       ELSE
        !           161:          2drop
        !           162:       THEN
        !           163:    THEN
        !           164: ;
        !           165: 
        !           166: enable-framebuffer-output
        !           167: 
1.1       root      168: 8b0 cp
                    169: 
1.1.1.3 ! root      170: \ Scan USB devices
        !           171: usb-scan
        !           172: 
        !           173: 8c0 cp
        !           174: 
1.1.1.2   root      175: \ Claim remaining memory that is used by firmware:
                    176: romfs-base 400000 0 ' claim CATCH IF ." claim failed!" cr 2drop THEN drop
1.1       root      177: 
1.1.1.3 ! root      178: 8d0 cp
        !           179: 
        !           180: : set-default-console
        !           181:     s" linux,stdout-path" get-chosen IF
        !           182:         decode-string
        !           183:         ." Using default console: " 2dup type cr
        !           184:         io
        !           185:         2drop
        !           186:     ELSE
        !           187:         ." No console specified "
        !           188:         " screen" find-alias dup IF nip THEN
        !           189:         " keyboard" find-alias dup IF nip THEN
        !           190:        AND IF
        !           191:          ." using screen & keyboard" cr
        !           192:          " screen" output
        !           193:          " keyboard" input
        !           194:         ELSE
        !           195:           " hvterm" find-alias IF
        !           196:            drop
        !           197:            ." using hvterm" cr
        !           198:             " hvterm" io
        !           199:          ELSE
        !           200:            ." and no default found" cr
        !           201:          THEN
        !           202:         THEN
        !           203:     THEN
        !           204: ;
        !           205: set-default-console
        !           206: 
        !           207: 8e0 cp
        !           208: 
        !           209: \ Check if we are booting a kernel passed by qemu, in which case
        !           210: \ we skip initializing some devices
        !           211: 
        !           212: 0 VALUE direct-ram-boot-base
        !           213: 0 VALUE direct-ram-boot-size
        !           214: CREATE boot-opd 10 ALLOT
        !           215: 
        !           216: : (boot-ram)
        !           217:     direct-ram-boot-size 0<> IF
        !           218:         ." Booting from memory..." cr
        !           219:        direct-ram-boot-base boot-opd !
        !           220:        0 boot-opd 8 + !
        !           221:        s" boot-opd to go-entry" evaluate
        !           222:        s" true state-valid ! " evaluate
        !           223:        s" disable-watchdog go-64" evaluate
        !           224:     THEN
        !           225: ;
        !           226: 
        !           227: 8e8 cp
        !           228: 
        !           229: : check-boot-from-ram
        !           230:     s" qemu,boot-kernel" get-chosen IF
        !           231:         decode-int -rot decode-int -rot ( n1 n2 p s )
        !           232:        decode-int -rot decode-int -rot ( n1 n2 n3 n4 p s )
        !           233:        2drop
        !           234:        swap 20 << or to direct-ram-boot-size
        !           235:        swap 20 << or to direct-ram-boot-base
        !           236:        ." Detected RAM kernel at " direct-ram-boot-base .
        !           237:        ." (" direct-ram-boot-size . ." bytes) "
        !           238:        \ Override the boot-command word without touching the
        !           239:        \ nvram environment
        !           240:        s" boot-command" $create " (boot-ram)" env-string
        !           241:     THEN
        !           242: ;
        !           243: check-boot-from-ram
        !           244: 
1.1       root      245: 8ff cp
                    246: 
                    247: #include <start-up.fs>
                    248: 
                    249: ."      "   \ Clear last checkpoint
                    250: 
                    251: #include <boot.fs>
                    252: 
                    253: cr .(   Welcome to Open Firmware)
                    254: cr
                    255: #include "copyright-oss.fs"
                    256: cr cr
                    257: 
                    258: \ this CATCH is to ensure the code bellow always executes:  boot may ABORT!
                    259: ' start-it CATCH drop
                    260: 
                    261: cr ." Ready!"

unix.superglobalmegacorp.com

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