1 \ pearpc specific initialization code
3 \ Copyright (C) 2005 Stefan Reinauer
5 \ This program is free software; you can redistribute it and/or
6 \ modify it under the terms of the GNU General Public License
7 \ as published by the Free Software Foundation
11 \ -------------------------------------------------------------------------
13 \ -------------------------------------------------------------------------
15 : make-openable ( path )
18 \ install trivial open and close methods
19 dup active-package! is-open
25 : preopen ( chosen-str node-path )
28 " /chosen" find-device
30 encode-int 2swap property
36 \ preopen device nodes (and store the ihandles under /chosen)
38 " rtc" " /pci/isa/rtc" preopen
39 " memory" " /memory" preopen
40 " mmu" " /cpu@0" preopen
41 \ " stdout" " /packages/terminal-emulator" preopen
42 " stdout" " /pci/pci6666,6666" preopen
43 " stdin" " /pci/via-cuda/adb" preopen
48 \ -------------------------------------------------------------------------
50 \ -------------------------------------------------------------------------
52 \ add decode-address methods
53 : (make-decodable) ( phandle -- )
55 dup " #address-cells" rot get-package-property 0= if
57 over " decode-unit" rot find-method if 2drop else
58 ( save phandle ncells )
62 1 of ['] parse-hex " decode-unit" is-xt-func endof
64 " bus-range" active-package get-package-property 0= if
66 ['] encode-unit-pci " encode-unit" is-xt-func
67 " decode-unit" is-func-begin
69 ['] decode-unit-pci-bus ,
79 : init-pearpc-tree ( -- )
93 \ use the tty interface if available
94 : activate-tty-interface
95 " /packages/terminal-emulator" find-dev if drop
96 " /pci/via-cuda/adb" " input-device" $setenv
97 " /pci/pci6666,6666" " output-device" $setenv
103 ; CONSOLE-IN-initializer
106 \ -------------------------------------------------------------------------
108 \ -------------------------------------------------------------------------
111 " /chosen" find-device
112 stdin @ encode-int " stdin" property
113 stdout @ encode-int " stdout" property
114 " /pci/isa/interrupt-controller" find-dev if encode-int " interrupt-controller" property then