| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: booke_machdep.c,v 1.32 2020/07/06 10:08:16 rin Exp $ */ | | 1 | /* $NetBSD: booke_machdep.c,v 1.33 2021/03/30 14:29:54 rin Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. | | 3 | * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * This code is derived from software contributed to The NetBSD Foundation | | 6 | * This code is derived from software contributed to The NetBSD Foundation |
7 | * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects | | 7 | * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects |
8 | * Agency and which was developed by Matt Thomas of 3am Software Foundry. | | 8 | * Agency and which was developed by Matt Thomas of 3am Software Foundry. |
9 | * | | 9 | * |
10 | * This material is based upon work supported by the Defense Advanced Research | | 10 | * This material is based upon work supported by the Defense Advanced Research |
11 | * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under | | 11 | * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under |
12 | * Contract No. N66001-09-C-2073. | | 12 | * Contract No. N66001-09-C-2073. |
13 | * Approved for Public Release, Distribution Unlimited | | 13 | * Approved for Public Release, Distribution Unlimited |
14 | * | | 14 | * |
| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 28 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
34 | * POSSIBILITY OF SUCH DAMAGE. | | 34 | * POSSIBILITY OF SUCH DAMAGE. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #define __INTR_PRIVATE | | 37 | #define __INTR_PRIVATE |
38 | #define _POWERPC_BUS_DMA_PRIVATE | | 38 | #define _POWERPC_BUS_DMA_PRIVATE |
39 | | | 39 | |
40 | #include <sys/cdefs.h> | | 40 | #include <sys/cdefs.h> |
41 | __KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.32 2020/07/06 10:08:16 rin Exp $"); | | 41 | __KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.33 2021/03/30 14:29:54 rin Exp $"); |
42 | | | 42 | |
43 | #include "ksyms.h" | | 43 | #include "ksyms.h" |
44 | | | 44 | |
45 | #ifdef _KERNEL_OPT | | 45 | #ifdef _KERNEL_OPT |
46 | #include "opt_ddb.h" | | 46 | #include "opt_ddb.h" |
47 | #include "opt_modular.h" | | 47 | #include "opt_modular.h" |
48 | #include "opt_multiprocessor.h" | | 48 | #include "opt_multiprocessor.h" |
49 | #endif | | 49 | #endif |
50 | | | 50 | |
51 | #include <sys/param.h> | | 51 | #include <sys/param.h> |
52 | #include <sys/cpu.h> | | 52 | #include <sys/cpu.h> |
53 | #include <sys/device.h> | | 53 | #include <sys/device.h> |
54 | #include <sys/intr.h> | | 54 | #include <sys/intr.h> |
| @@ -278,60 +278,50 @@ cpu_reboot(int howto, char *what) | | | @@ -278,60 +278,50 @@ cpu_reboot(int howto, char *what) |
278 | | | 278 | |
279 | pmf_system_shutdown(boothowto); | | 279 | pmf_system_shutdown(boothowto); |
280 | | | 280 | |
281 | if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { | | 281 | if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { |
282 | /* Power off here if we know how...*/ | | 282 | /* Power off here if we know how...*/ |
283 | } | | 283 | } |
284 | | | 284 | |
285 | if (howto & RB_HALT) { | | 285 | if (howto & RB_HALT) { |
286 | printf("The operating system has halted.\n" | | 286 | printf("The operating system has halted.\n" |
287 | "Press any key to reboot.\n\n"); | | 287 | "Press any key to reboot.\n\n"); |
288 | cnpollc(1); /* For proper keyboard command handling */ | | 288 | cnpollc(1); /* For proper keyboard command handling */ |
289 | cngetc(); | | 289 | cngetc(); |
290 | cnpollc(0); | | 290 | cnpollc(0); |
291 | | | | |
292 | printf("rebooting...\n\n"); | | | |
293 | goto reboot; /* XXX for now... */ | | | |
294 | | | | |
295 | #ifdef DDB | | | |
296 | printf("dropping to debugger\n"); | | | |
297 | while(1) | | | |
298 | Debugger(); | | | |
299 | #endif | | | |
300 | } | | 291 | } |
301 | | | 292 | |
302 | printf("rebooting\n\n"); | | 293 | printf("rebooting\n\n"); |
303 | if (what && *what) { | | 294 | if (what && *what) { |
304 | if (strlen(what) > sizeof str - 5) | | 295 | if (strlen(what) > sizeof str - 5) |
305 | printf("boot string too large, ignored\n"); | | 296 | printf("boot string too large, ignored\n"); |
306 | else { | | 297 | else { |
307 | strcpy(str, what); | | 298 | strcpy(str, what); |
308 | ap1 = ap = str + strlen(str); | | 299 | ap1 = ap = str + strlen(str); |
309 | *ap++ = ' '; | | 300 | *ap++ = ' '; |
310 | } | | 301 | } |
311 | } | | 302 | } |
312 | *ap++ = '-'; | | 303 | *ap++ = '-'; |
313 | if (howto & RB_SINGLE) | | 304 | if (howto & RB_SINGLE) |
314 | *ap++ = 's'; | | 305 | *ap++ = 's'; |
315 | if (howto & RB_KDB) | | 306 | if (howto & RB_KDB) |
316 | *ap++ = 'd'; | | 307 | *ap++ = 'd'; |
317 | *ap++ = 0; | | 308 | *ap++ = 0; |
318 | if (ap[-2] == '-') | | 309 | if (ap[-2] == '-') |
319 | *ap1 = 0; | | 310 | *ap1 = 0; |
320 | | | 311 | |
321 | /* flush cache for msgbuf */ | | 312 | /* flush cache for msgbuf */ |
322 | dcache_wb(msgbuf_paddr, round_page(MSGBUFSIZE)); | | 313 | dcache_wb(msgbuf_paddr, round_page(MSGBUFSIZE)); |
323 | | | 314 | |
324 | reboot: | | | |
325 | __asm volatile("msync; isync"); | | 315 | __asm volatile("msync; isync"); |
326 | (*cpu_md_ops.md_cpu_reset)(); | | 316 | (*cpu_md_ops.md_cpu_reset)(); |
327 | | | 317 | |
328 | printf("%s: md_cpu_reset() failed!\n", __func__); | | 318 | printf("%s: md_cpu_reset() failed!\n", __func__); |
329 | #ifdef DDB | | 319 | #ifdef DDB |
330 | for (;;) | | 320 | for (;;) |
331 | Debugger(); | | 321 | Debugger(); |
332 | #else | | 322 | #else |
333 | for (;;) | | 323 | for (;;) |
334 | /* nothing */; | | 324 | /* nothing */; |
335 | #endif | | 325 | #endif |
336 | } | | 326 | } |
337 | | | 327 | |