3 \ -------------------------------------------------------------------------
5 \ -------------------------------------------------------------------------
7 : make-openable ( path )
10 \ install trivial open and close methods
11 dup active-package! is-open
17 : preopen ( chosen-str node-path )
20 " /chosen" find-device
22 encode-int 2swap property
28 \ preopen device nodes (and store the ihandles under /chosen)
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
40 \ -------------------------------------------------------------------------
42 \ -------------------------------------------------------------------------
44 \ add decode-address methods
45 : (make-decodable) ( phandle -- )
47 dup " #address-cells" rot get-package-property 0= if
49 over " decode-unit" rot find-method if 2drop else
50 ( save phandle ncells )
54 1 of ['] parse-hex " decode-unit" is-xt-func endof
56 " bus-range" active-package get-package-property 0= if
58 ['] encode-unit-pci " encode-unit" is-xt-func
59 " decode-unit" is-func-begin
61 ['] decode-unit-pci-bus ,
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
95 ; CONSOLE-IN-initializer
98 \ -------------------------------------------------------------------------
100 \ -------------------------------------------------------------------------
103 " /chosen" find-device
104 stdin @ encode-int " stdin" property
105 stdout @ encode-int " stdout" property