Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: reset.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: @(#)reset.fth 1.3 07/06/22 | |
43 | purpose: | |
44 | copyright: Copyright 2007 Sun Microsystems, Inc. All rights reserved. | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | \ [define] verify-dropin-copy? | |
48 | \ [define] dropin-checksum? | |
49 | ||
50 | resident headerless | |
51 | ||
52 | h# 4f.42.4d.44 constant dropin-magic | |
53 | h# 70 constant soft-state-set | |
54 | ||
55 | 1 constant core-api-group | |
56 | 1 constant core-major-version | |
57 | 0 constant core-minor-version | |
58 | 3 constant guest-state-api-group | |
59 | 1 constant guest-state-major-version | |
60 | 0 constant guest-state-minor-version | |
61 | 2 constant sis-transitional | |
62 | 1 constant sis-normal | |
63 | ||
64 | fload ${BP}/arch/sun4s/reset/common.fth | |
65 | fload ${BP}/arch/sun/auto-field.fth | |
66 | ||
67 | : save-binary | |
68 | new-file | |
69 | obj-base obj-size ofd @ fputs | |
70 | ofd @ fclose | |
71 | ; | |
72 | ||
73 | begin-obj | |
74 | ||
75 | label reset-vector | |
76 | resident-assembler | |
77 | ||
78 | nop nop nop nop | |
79 | nop nop nop nop | |
80 | ||
81 | 0 F: always brif annul nop | |
82 | nop nop nop nop nop nop | |
83 | ||
84 | 1 F: always brif annul nop | |
85 | nop nop nop nop nop nop | |
86 | ||
87 | 2 F: always brif annul nop | |
88 | nop nop nop nop nop nop | |
89 | ||
90 | 3 F: always brif annul nop | |
91 | nop nop nop nop nop nop | |
92 | ||
93 | 4 F: always brif annul nop | |
94 | nop nop nop nop nop nop | |
95 | ||
96 | 5 F: always brif annul nop | |
97 | nop nop nop nop nop nop | |
98 | ||
99 | end-code | |
100 | ||
101 | label sccs-string sccs-id cscount ", align end-code | |
102 | ||
103 | label boot-name$ " bootprom" bounds do i c@ c, loop 0 c, end-code | |
104 | label obp-name$ " OBP" bounds do i c@ c, loop 0 c, end-code | |
105 | ||
106 | \ these two labels need to be kept one after the other for proper | |
107 | \ opperation | |
108 | ||
109 | label guest-state-align-buffer& h# 20 .align end-code | |
110 | label guest-state-init-string$ | |
111 | " Openboot initializing" tuck bounds do i c@ c, loop 0 c, | |
112 | h# 1f swap - | |
113 | 0 do 0 c, loop | |
114 | end-code | |
115 | ||
116 | fload ${BP}/cpu/sparc/ultra4v/tlbasm.fth | |
117 | fload ${BP}/arch/sun4v/niagara/tlbsetup.fth | |
118 | fload ${BP}/arch/sun4v/savestate.fth | |
119 | fload ${BP}/arch/sun4v/error-reset.fth | |
120 | fload ${BP}/arch/sun4v/diagprint.fth | |
121 | fload ${BP}/pkg/dropins/sparc/find-dropin.fth | |
122 | fload ${BP}/arch/sun/reset-dropin.fth | |
123 | ||
124 | label power-on-reset | |
125 | %i0 %g1 move \ membase | |
126 | %i1 %g2 move \ memsize | |
127 | %i2 %g3 move \ pd base | |
128 | %g0 h# f wrpil | |
129 | %g0 4 wrpstate | |
130 | %g0 0 wrtba | |
131 | %g0 7 wrcleanwin | |
132 | %g0 0 wrotherwin | |
133 | %g0 0 wrwstate | |
134 | %g0 0 wrcanrestore | |
135 | %g0 6 wrcansave | |
136 | %g0 0 wrcwp | |
137 | %g1 %i0 move \ restore %i's | |
138 | %g2 %i1 move | |
139 | %g3 %i2 move | |
140 | %g0 0 wrtl \ TL = 0 | |
141 | %g0 0 wrgl | |
142 | ||
143 | \ At start up, all hypervisor API calls are disabled. Any calls | |
144 | \ we need must be enabled with appropriate calls to | |
145 | \ API_SET_VERSION. | |
146 | core-api-group %o0 set \ core API group | |
147 | core-major-version %o1 set \ current major version | |
148 | core-minor-version %o2 set \ current minor version | |
149 | %g0 0 %o5 add \ api_set_version function | |
150 | %g0 h# 7f always htrapif | |
151 | nop | |
152 | ||
153 | \ Negotiate the guest-state API, and set the initial state. | |
154 | \ If the guest-staet API is not supported, hypervisor will | |
155 | \ return an error, but we are not checking the return code | |
156 | ||
157 | guest-state-api-group %o0 set \ guest state API group | |
158 | guest-state-major-version %o1 set \ current major version | |
159 | guest-state-minor-version %o2 set \ current minor version | |
160 | %g0 0 %o5 add \ api_set_version function | |
161 | %g0 h# 7f always htrapif | |
162 | nop | |
163 | ||
164 | sis-transitional %o0 set \ transitional state | |
165 | guest-state-init-string$ obj-base - \ | |
166 | %o2 %o1 setx \ location of string | |
167 | %i0 %o1 %o1 add \ physical address | |
168 | soft-state-set %o5 set \ soft-state-set function | |
169 | %g0 0 always htrapif | |
170 | nop | |
171 | ||
172 | %i0 %o0 move | |
173 | setup-i/d-tlbs call | |
174 | %i1 %o1 move | |
175 | ||
176 | \ DTLB: 0 -> membase + 8M | |
177 | %g0 %o0 move | |
178 | 8meg %o1 set | |
179 | %i0 %o1 %o1 add | |
180 | %g0 3 %o2 add | |
181 | setup-dtlb-entry call | |
182 | %g0 0 %o3 add | |
183 | ||
184 | \ ITLB: 0 -> membase + 8M | |
185 | %g0 %o0 move | |
186 | 8meg %o1 set | |
187 | %i0 %o1 %o1 add | |
188 | %g0 3 %o2 add | |
189 | setup-itlb-entry call | |
190 | %g0 0 %o3 add | |
191 | ||
192 | %g0 1 %o0 add | |
193 | %g0 h# 27 %o5 add \ MMU_ENABLE | |
194 | %g4 rdpc | |
195 | %g4 h# 10 %o1 add | |
196 | %g0 0 always htrapif | |
197 | nop | |
198 | ||
199 | \ bclear the first 512KB of memory (@0) | |
200 | 1meg 2/ %l4 set \ 512Kb | |
201 | 8meg %l3 set | |
202 | %i0 %l3 %l3 add \ offset | |
203 | %g0 h# 31 %o5 add \ mem_scrub | |
204 | begin | |
205 | %l4 %o1 move \ Len | |
206 | %l3 %o0 move \ RA | |
207 | %g0 0 always htrapif | |
208 | %o0 7 %g0 subcc \ error? | |
209 | 0<> if | |
210 | %g0 %g0 %g0 subcc \ BAIL! | |
211 | %l3 %o1 %l3 add \ dump RA | |
212 | %l4 %o1 %l4 subcc | |
213 | then | |
214 | 0<= until | |
215 | %g0 h# 31 %o5 add \ (mem scrub) delay | |
216 | ||
217 | obp-name$ obj-base - | |
218 | %o1 %o0 setx | |
219 | %i0 %o0 %o0 add | |
220 | %i0 %o1 move | |
221 | %g0 h# 20 %o2 add | |
222 | %g0 %g0 %o3 add | |
223 | find©-dropin call | |
224 | %g0 1 %o4 add | |
225 | ||
226 | %o0 h# 20 %i7 add | |
227 | ||
228 | h# 10 .align | |
229 | ||
230 | here obj-base - h# 20 + scr set | |
231 | scr %g0 %g0 jmpl | |
232 | nop nop nop nop | |
233 | nop nop nop nop | |
234 | nop nop | |
235 | ||
236 | boot-name$ obj-base - | |
237 | %o1 %o0 setx | |
238 | %i0 %o0 %o0 add | |
239 | %i0 %o1 move | |
240 | ROMbase %o2 set | |
241 | %i7 %g0 %o3 add | |
242 | find©-dropin call | |
243 | %g0 1 %o4 add | |
244 | ||
245 | ROMbase %o0 set | |
246 | %o0 h# 30 %g0 jmpl nop | |
247 | ||
248 | begin again nop | |
249 | ||
250 | h# 20 .align | |
251 | ||
252 | 0 L: \ Power On Reset 0x20 | |
253 | power-on-reset always brif annul nop | |
254 | 1 L: \ Watchdog Reset 0x40 | |
255 | ||
256 | save-reset-state call nop | |
257 | ||
258 | %g0 2 %o1 add \ error code | |
259 | %o1 %o0 offset-of last-trap# %asi stxa \ last-trap = error-reset-trap | |
260 | %o1 %o0 offset-of error-reset-trap %asi stxa | |
261 | ||
262 | error-reset-recovery call nop | |
263 | ||
264 | ROMbase %o0 set | |
265 | %o0 h# 40 %g0 jmpl nop | |
266 | ||
267 | begin again nop | |
268 | 2 L: \ XIR 0x60 | |
269 | ||
270 | save-reset-state call nop | |
271 | ||
272 | %g0 3 %o1 add \ error code | |
273 | %o1 %o0 offset-of last-trap# %asi stxa \ last-trap = error-reset-trap | |
274 | %o1 %o0 offset-of error-reset-trap %asi stxa | |
275 | ||
276 | error-reset-recovery call nop | |
277 | ||
278 | ROMbase %o0 set | |
279 | %o0 h# 60 %g0 jmpl nop | |
280 | ||
281 | begin again nop | |
282 | 3 L: \ SIR 0x80 | |
283 | ||
284 | save-reset-state call nop | |
285 | %g0 4 %o1 add \ error code | |
286 | %o1 %o0 offset-of last-trap# %asi stxa \ last-trap = error-reset-trap | |
287 | %o1 %o0 offset-of error-reset-trap %asi stxa | |
288 | ||
289 | error-reset-recovery call nop | |
290 | ||
291 | ROMbase %o0 set | |
292 | %o0 h# 80 %g0 jmpl nop | |
293 | ||
294 | begin again nop | |
295 | 4 L: \ RED 0xa0 | |
296 | ||
297 | save-reset-state call nop | |
298 | %g0 5 %o1 add \ error code | |
299 | %o1 %o0 offset-of last-trap# %asi stxa \ last-trap = error-reset-trap | |
300 | %o1 %o0 offset-of error-reset-trap %asi stxa | |
301 | ||
302 | error-reset-recovery call nop | |
303 | ||
304 | ROMbase %o0 set | |
305 | %o0 h# 80 %g0 jmpl nop | |
306 | ||
307 | begin again nop | |
308 | 5 L: | |
309 | begin again nop | |
310 | -1 , | |
311 | ||
312 | end-code | |
313 | end-obj | |
314 | ||
315 | " reset-vector" " reset" $export-procedure | |
316 | ||
317 | fload ${BP}/arch/sun/reset-cleanup.fth |