|
|
1.1 ! root 1: ! 2: ! 3: \ ------------------------------------------------------------------------- ! 4: \ initialization ! 5: \ ------------------------------------------------------------------------- ! 6: ! 7: : make-openable ( path ) ! 8: find-dev if ! 9: begin ?dup while ! 10: \ install trivial open and close methods ! 11: dup active-package! is-open ! 12: parent ! 13: repeat ! 14: then ! 15: ; ! 16: ! 17: : preopen ( chosen-str node-path ) ! 18: 2dup make-openable ! 19: ! 20: " /chosen" find-device ! 21: open-dev ?dup if ! 22: encode-int 2swap property ! 23: else ! 24: 2drop ! 25: then ! 26: ; ! 27: ! 28: \ preopen device nodes (and store the ihandles under /chosen) ! 29: :noname ! 30: " memory" " /memory" preopen ! 31: " mmu" " /cpus/@0" preopen ! 32: " stdout" " /packages/mol-stdout" preopen ! 33: " stdin" " keyboard" preopen ! 34: " nvram" " /pci/pci-bridge/mac-io/nvram" preopen ! 35: " nvram" " /mol/nvram" preopen ! 36: ! 37: ; SYSTEM-initializer ! 38: ! 39: ! 40: \ ------------------------------------------------------------------------- ! 41: \ device tree fixing ! 42: \ ------------------------------------------------------------------------- ! 43: ! 44: \ add decode-address methods ! 45: : (make-decodable) ( phandle -- ) ! 46: ! 47: dup " #address-cells" rot get-package-property 0= if ! 48: decode-int nip nip ! 49: over " decode-unit" rot find-method if 2drop else ! 50: ( save phandle ncells ) ! 51: ! 52: over active-package! ! 53: case ! 54: 1 of ['] parse-hex " decode-unit" is-xt-func endof ! 55: 3 of ! 56: " bus-range" active-package get-package-property 0= if ! 57: decode-int nip nip ! 58: ['] encode-unit-pci " encode-unit" is-xt-func ! 59: " decode-unit" is-func-begin ! 60: ['] (lit) , , ! 61: ['] decode-unit-pci-bus , ! 62: is-func-end ! 63: then ! 64: endof ! 65: endcase ! 66: then ! 67: then ! 68: drop ! 69: ; ! 70: ! 71: : tree-fixes ( -- ) ! 72: active-package ! 73: ! 74: iterate-tree-begin ! 75: begin ?dup while ! 76: ! 77: dup (make-decodable) ! 78: ! 79: iterate-tree ! 80: repeat ! 81: ! 82: active-package! ! 83: ; ! 84: ! 85: \ use the tty interface if available ! 86: : activate-tty-interface ! 87: " /mol/mol-tty" find-dev if drop ! 88: " /mol/mol-tty" " input-device" $setenv ! 89: " /mol/mol-tty" " output-device" $setenv ! 90: then ! 91: ; ! 92: ! 93: :noname ! 94: " keyboard" input ! 95: ; CONSOLE-IN-initializer ! 96: ! 97: ! 98: \ ------------------------------------------------------------------------- ! 99: \ pre-booting ! 100: \ ------------------------------------------------------------------------- ! 101: ! 102: : update-chosen ! 103: " /chosen" find-device ! 104: stdin @ encode-int " stdin" property ! 105: stdout @ encode-int " stdout" property ! 106: device-end ! 107: ;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.