Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: sysintf.fth | |
4 | \ | |
5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | \ | |
7 | \ - Do no alter or remove copyright notices | |
8 | \ | |
9 | \ - Redistribution and use of this software in source and binary forms, with | |
10 | \ or without modification, are permitted provided that the following | |
11 | \ conditions are met: | |
12 | \ | |
13 | \ - Redistribution of source code must retain the above copyright notice, | |
14 | \ this list of conditions and the following disclaimer. | |
15 | \ | |
16 | \ - Redistribution in binary form must reproduce the above copyright notice, | |
17 | \ this list of conditions and the following disclaimer in the | |
18 | \ documentation and/or other materials provided with the distribution. | |
19 | \ | |
20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors | |
21 | \ may be used to endorse or promote products derived from this software | |
22 | \ without specific prior written permission. | |
23 | \ | |
24 | \ This software is provided "AS IS," without a warranty of any kind. | |
25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
36 | \ | |
37 | \ You acknowledge that this software is not designed, licensed or | |
38 | \ intended for use in the design, construction, operation or maintenance of | |
39 | \ any nuclear facility. | |
40 | \ | |
41 | \ ========== Copyright Header End ============================================ | |
42 | id: @(#)sysintf.fth 1.24 07/06/22 | |
43 | purpose: Interfaces to low-level system functions | |
44 | copyright: Copyright 1994 FirmWorks All Rights Reserved | |
45 | copyright: Copyright 2007 Sun Microsystems, Inc. All rights reserved. | |
46 | copyright: Use is subject to license terms. | |
47 | ||
48 | \ Interfaces to system-dependent routines | |
49 | ||
50 | defer diag-key ( -- char ) \ Used by dl | |
51 | ||
52 | \ (Approximately) millisecond-granularity timing | |
53 | \ Typically implemented by a driver for a counter/timer device | |
54 | ||
55 | d# 10 value ms/tick | |
56 | headers | |
57 | defer get-msecs ( -- n ) ' 0 is get-msecs | |
58 | defer ms ( n -- ) ' drop is ms | |
59 | defer us ( n -- ) ' drop is us | |
60 | ||
61 | ||
62 | \ Enabling/disabling interrupts | |
63 | \ Typically implemented by a driver for an interrupt controller | |
64 | ||
65 | defer enable-interrupts ( -- ) ' noop is enable-interrupts | |
66 | defer disable-interrupts ( -- ) ' noop is disable-interrupts | |
67 | ||
68 | \ System-wide DMA memory allocation (used only by the deblocker) | |
69 | \ Typically implemented by a MMU driver | |
70 | ||
71 | headerless | |
72 | : null-allocate-dma ( #bytes -- 0 ) drop 0 ; | |
73 | defer allocate-dma ' null-allocate-dma is allocate-dma | |
74 | : null-free-dma ( virt #bytes -- ) 2drop ; | |
75 | defer free-dma ' null-free-dma is free-dma | |
76 | ||
77 | : null-vtop ( virtual -- phys-lo phys-hi ) drop -1 -1 ; | |
78 | ||
79 | headers | |
80 | defer >physical ' null-vtop is >physical | |
81 | ||
82 | \ Dropin-driver execution | |
83 | \ Typically implemented by a driver for the system's ROM | |
84 | defer do-drop-in ( adr len -- ) ' 2drop is do-drop-in | |
85 | defer find-drop-in ( name$ -- buf,len,true | 0 ) | |
86 | defer free-drop-in ( buf,len -- ) ' 2drop is free-drop-in | |
87 | ||
88 | headerless | |
89 | : null-find-drop-in ( name$ -- 0 ) 2drop false ; | |
90 | ' null-find-drop-in is find-drop-in | |
91 | ||
92 | headers | |
93 | \ Support for peeking and poking (memory access immune to bus errors) | |
94 | \ Typically implemented by a driver for the system's trap-handing mechanism | |
95 | ||
96 | : (guarded-execute) ( ??? xt -- ??? flag ) execute true ; | |
97 | defer guarded-execute ( ??? xt -- ??? flag ) | |
98 | ' (guarded-execute) is guarded-execute | |
99 | ||
100 | ||
101 | \ Storage of reboot information across system resets | |
102 | \ The reboot information is typically stored in some type of memory | |
103 | \ that is not cleared by a system reset. The information does not | |
104 | \ necessary have to survive across power cycles. | |
105 | ||
106 | false value reboot? \ Usually set in machine-dependent startup code | |
107 | \ after testing a magic flag in physical memory | |
108 | ||
109 | : null$ ( -- adr len ) " " ; | |
110 | ||
111 | : null-save-reboot-info ( arg$ cmd$ forth? line# column# -- ) | |
112 | 3drop 2drop 2drop | |
113 | ; | |
114 | defer save-reboot-info ( arg$ cmd$ forth? line# column# -- ) | |
115 | ' null-save-reboot-info is save-reboot-info | |
116 | ||
117 | defer get-reboot-info ( -- cmd+arg$ line# column# ) | |
118 | : null-get-reboot-info ( -- cmd+arg$ line# column# ) | |
119 | null$ 0 0 | |
120 | ; | |
121 | ' null-get-reboot-info is get-reboot-info | |
122 | ||
123 | ||
124 | \ Force a system reset | |
125 | \ Typically implemented by a driver for system-level special registers. | |
126 | ||
127 | headers | |
128 | defer reset-all ( -- ) ' noop is reset-all | |
129 | ||
130 | ||
131 | defer cleanup ' noop is cleanup \ pkg/boot/go.fth | |
132 | ||
133 | false value already-go? \ sun4/reenter.fth | |
134 | ||
135 | \ From reenter.fth | |
136 | nuser aborted? aborted? off | |
137 | : (user-abort) ( -- ) 1 aborted? ! ; | |
138 | headers | |
139 | defer user-abort ' (user-abort) is user-abort | |
140 | headerless | |
141 | ||
142 | \ System and version identification | |
143 | ||
144 | defer idprom-valid? ( -- flag ) | |
145 | ' true is idprom-valid? | |
146 | ||
147 | \ You do not need to edit these strings, instead define them | |
148 | \ in version.fth properly. | |
149 | create (4.0-prom) ," 4.0.0" | |
150 | create (sub-release) ," " | |
151 | headers | |
152 | defer obp-release ' (4.0-prom) is obp-release | |
153 | defer sub-release ( -- adr len ) ' (sub-release) is sub-release | |
154 | headerless | |
155 | ||
156 | defer serial# ( -- n ) ' 0 is serial# | |
157 | ||
158 | \ System-wide network address | |
159 | ||
160 | \ system-mac-address is typically defined in some sort of ID PROM | |
161 | defer system-mac-address ( -- adr len ) ' null$ is system-mac-address | |
162 | ||
163 | ||
164 | \ Device to use for console output if the preferred device is unavailable | |
165 | ||
166 | defer fallback-device ( -- adr len ) ' null$ is fallback-device | |
167 | ||
168 | ||
169 | \ Compatibility FCode support | |
170 | ||
171 | headers | |
172 | defer sbus-intr>cpu ( sbus-level -- cpu-level ) ' noop is sbus-intr>cpu | |
173 | headerless | |
174 | ||
175 | : no-memory ( -- adr len ) 0 0 ; | |
176 | ||
177 | ||
178 | \ OS callbacks | |
179 | defer callback-call ( arg-array -- error? ) ' true is callback-call | |
180 | ||
181 | \ Default font | |
182 | headers | |
183 | defer romfont ( -- fontadr ) ' false is romfont | |
184 | headerless | |
185 | ||
186 | \ Security state | |
187 | defer ?secure ' noop is ?secure | |
188 | ||
189 | \ Startup Hook. A chance to get in before the auto-boot starts | |
190 | defer startup-hook ( -- ) ' noop is startup-hook | |
191 | ||
192 | \ check-machine-state, check-machine-chain | |
193 | \ these two are for a machine to verify itself prior to the auto-boot | |
194 | \ starting. | |
195 | \ You should not be changing check-machine-chain defer!! | |
196 | \ use the chain to report various conditions you are unhappy with instead, | |
197 | \ the check-machine-state chain runs before the interrupt-auto-boot? chain | |
198 | \ so you can set complain, and use the state to prevent (perhaps) a subsequent | |
199 | \ auto-boot? | |
200 | \ the chain to attach yourself to is: | |
201 | \ | |
202 | \ check-machine-state | |
203 | \ | |
204 | alias check-machine-state noop | |
205 | defer check-machine-chain ' noop to check-machine-chain | |
206 | ||
207 | \ don't-boot?, interrupt-auto-boot? | |
208 | \ The starting place for the reasons not to boot. | |
209 | \ chain: yourself onto don't-boot? and OR in true to prevent an auto-boot, | |
210 | \ however a routine closer to the head of the chain may over-rule your choice. | |
211 | \ The chain name used to set interrupt-auto-boot? is | |
212 | \ | |
213 | \ don't-boot? | |
214 | \ | |
215 | \ this is the head of the don't-boot? chain. | |
216 | \ You should not be changing this defer!! | |
217 | \ | |
218 | alias don't-boot? false | |
219 | defer interrupt-auto-boot? ' false to interrupt-auto-boot? | |
220 | ||
221 | \ client-starting | |
222 | \ This is a notification chain to let drivers know that activities | |
223 | \ such as alloc-mem, using DMA etc... | |
224 | \ will no longer permitted after the chain executes | |
225 | \ | |
226 | alias client-starting noop | |
227 | defer client-starting-chain ' noop to client-starting-chain | |
228 | ||
229 | \ Client-exited | |
230 | \ This is a notification chain to let drivers know that a client program | |
231 | \ has terminated. | |
232 | \ | |
233 | defer client-exited ( -- ) ' noop is client-exited | |
234 | defer client-exited-chain ' noop to client-exited-chain | |
235 | defer client-fail-exited-chain ' noop to client-fail-exited-chain | |
236 | ||
237 | \ run-diags? | |
238 | \ A simple defer; it returns true if the machine will run diags | |
239 | defer run-diags? ' false is run-diags? | |
240 | ||
241 | h# 4000 constant default-load-base | |
242 | ||
243 | defer help-msg ( -- ) ' noop is help-msg | |
244 | ||
245 | \ Flag to tell us whether we're "inside" the OS or not. | |
246 | \ This lets Forth words (and possibly the environmental monitor) know whether | |
247 | \ they're being run from within Stop-A, perhaps to restrict their behavior. | |
248 | \ This is set when the client takes over the trap table and cleared when the | |
249 | \ client returns (prom-exit). | |
250 | false value obp-control-relinquished? | |
251 | ||
252 | \ Active firmware verbosity level. | |
253 | \ This controls the level of OpenBoot verbosity (console output text) | |
254 | \ generated by probe/config/init code (basically, everything driven | |
255 | \ by the stand-init chain). This active value is not necessarily the | |
256 | \ same as the "verbosity" NVRAM configuration variable...this is driven | |
257 | \ by (e.g.,) the reset/config code, and passing the active verbosity | |
258 | \ into (e.g.,) boot.fth stand-init-io early setup. | |
259 | ||
260 | h# 2 constant VRBS-NONE \ Error messages only | |
261 | h# 4 constant VRBS-MIN \ Minimum F/W verbosity | |
262 | h# 8 constant VRBS-MED \ Medium F/W verbosity | |
263 | h# 10 constant VRBS-MAX \ Maximum F/W verbosity | |
264 | h# 20 constant VRBS-DEBUG \ Debug F/W verbosity | |
265 | ||
266 | VRBS-MAX value fw-verbosity \ Default maximum 'till toned down | |
267 | ||
268 | \ hook from selftest | |
269 | also forth definitions | |
270 | defer diag-hook ( status phandle -- ) ' 2drop to diag-hook | |
271 | previous definitions |