Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: startup.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: @(#)startup.fth 1.25 06/02/16 | |
43 | purpose: | |
44 | copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | \ The latter part of the initialization sequence. | |
48 | ||
49 | headers | |
50 | alias cd dev | |
51 | overload: probe-all ( -- ) | |
52 | " probe-" do-drop-in | |
53 | probe-all | |
54 | " probe+" do-drop-in | |
55 | ; | |
56 | ||
57 | headerless | |
58 | : delete-fb-prop ( -- ) | |
59 | root-device | |
60 | " fb" 2dup get-property 0= if | |
61 | 2swap delete-property | |
62 | then 2drop | |
63 | device-end | |
64 | ; | |
65 | ||
66 | : setup-memory ( -- ) | |
67 | ecc-off ce-off | |
68 | " scrub-memory" memory-node @ ['] $call-method catch drop | |
69 | ecc-on ce-on | |
70 | map-for-unix | |
71 | ; | |
72 | ||
73 | : ?cleanup ( -- ) | |
74 | \ If the selftest code was interrupted, | |
75 | \ the interrupt registers could | |
76 | \ be in the wrong state | |
77 | \ (i.e. pil=9, interrupt-enable=21). | |
78 | ||
79 | monitor-interrupt-state | |
80 | ||
81 | %o6@ c-stack <> if init-c-stack then | |
82 | setup-memory | |
83 | ; | |
84 | ' ?cleanup is cleanup | |
85 | ||
86 | variable banner-done? banner-done? off | |
87 | ||
88 | \ Service brk char only if diag-switch?=true or OBP banner is up | |
89 | : (startup-abort) ( -- ) | |
90 | diagnostic-mode? banner-done? @ or if | |
91 | (user-abort) | |
92 | then | |
93 | ; | |
94 | ' (startup-abort) is user-abort | |
95 | ||
96 | stand-init: Executing NVRAMRC | |
97 | execute-nvramrc | |
98 | auto-banner? if | |
99 | probe-all install-console | |
100 | output-device fallback-device $= 0= if | |
101 | \ show tty msgs only if console <> ttya | |
102 | show-tty-msgs | |
103 | then | |
104 | ?banner | |
105 | then | |
106 | banner-done? on | |
107 | delete-fb-prop | |
108 | ; | |
109 | ||
110 | headerless | |
111 | \ Be carefull, this chain is supposed to return a flag! | |
112 | \ by the time your first token runs someone else has already left the | |
113 | \ current state on the stack for you to consider. | |
114 | chain: don't-boot? ( flag -- flag' ) | |
115 | idprom-valid? system-test-ok? and | |
116 | post-ok? and 0= or | |
117 | ; | |
118 | ||
119 | defer pre-boot-hook ' noop is pre-boot-hook | |
120 | ||
121 | : startup ( -- ) | |
122 | hex | |
123 | warning on | |
124 | only forth also definitions | |
125 | ||
126 | startup-hook | |
127 | ||
128 | #line off | |
129 | ||
130 | \ Perform OBDiag tests if this is a power-on | |
131 | \ and not a reboot | |
132 | reboot? 0= if | |
133 | system-tests | |
134 | then | |
135 | ||
136 | check-machine-chain ?cr | |
137 | setup-memory | |
138 | ||
139 | [ifdef] DakASR? \ Daktari-style ASR/Diag-status handling | |
140 | restore-obd-fail-status \ Populate device tree with diag status | |
141 | restore-asr-disable-status \ Populate device tree with ASR status | |
142 | [then] | |
143 | ||
144 | false to init-incomplete? \ OK to [try to] boot | |
145 | ||
146 | pre-boot-hook | |
147 | auto-boot | |
148 | ; | |
149 | ||
150 | headerless | |
151 | : ok> ( -- ) ." ok> " ; | |
152 | ||
153 | chain: unix-init ( -- ) | |
154 | hex ['] ok> is (ok) | |
155 | \ Running stand.exe | |
156 | ." # " obp-release ". space sub-release ". space .compile-date cr | |
157 | ['] false to idprom-valid? ['] 2drop to do-drop-in | |
158 | ; | |
159 | headers |