cpu_reboot():

- fix data write-back to hard disk is failed when reboot/halt.
This commit is contained in:
nonaka 2007-06-28 16:07:12 +00:00
parent bc90321cbe
commit e02b41111a
1 changed files with 27 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.4 2007/01/29 01:52:45 hubertf Exp $ */ /* $NetBSD: machdep.c,v 1.5 2007/06/28 16:07:12 nonaka Exp $ */
/* $OpenBSD: zaurus_machdep.c,v 1.25 2006/06/20 18:24:04 todd Exp $ */ /* $OpenBSD: zaurus_machdep.c,v 1.25 2006/06/20 18:24:04 todd Exp $ */
/* /*
@ -107,7 +107,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.4 2007/01/29 01:52:45 hubertf Exp $"); __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.5 2007/06/28 16:07:12 nonaka Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -245,12 +245,15 @@ struct user *proc0paddr;
const char *console = "glass"; const char *console = "glass";
int glass_console = 0; int glass_console = 0;
char bootargs[MAX_BOOT_STRING]; char bootargs[MAX_BOOT_STRING];
void process_kernel_args(char *);
/* Prototypes */
void consinit(void); void consinit(void);
void kgdb_port_init(void);
void dumpsys(void); void dumpsys(void);
void process_kernel_args(char *);
#ifdef KGDB
void kgdb_port_init(void);
#endif
/* /*
* void cpu_reboot(int howto, char *bootstr) * void cpu_reboot(int howto, char *bootstr)
@ -268,20 +271,12 @@ cpu_reboot(int howto, char *bootstr)
* and crash to earth fast * and crash to earth fast
*/ */
if (cold) { if (cold) {
doshutdownhooks(); howto |= RB_HALT;
printf("The operating system has halted.\n"); goto haltsys;
printf("Please press any key to reboot.\n\n");
cngetc();
printf("rebooting...\n");
delay(6 * 1000 * 1000); /* wait 6s */
zaurus_restart();
printf("REBOOT FAILED: spinning\n");
for (;;)
continue;
/*NOTREACHED*/
} }
boothowto = howto;
/* /*
* If RB_NOSYNC was not specified sync the discs. * If RB_NOSYNC was not specified sync the discs.
* Note: Unless cold is set to 1 here, syslogd will die during the * Note: Unless cold is set to 1 here, syslogd will die during the
@ -289,8 +284,17 @@ cpu_reboot(int howto, char *bootstr)
* that it cannot page part of the binary in as the filesystem has * that it cannot page part of the binary in as the filesystem has
* been unmounted. * been unmounted.
*/ */
if (!(howto & RB_NOSYNC)) if (!(howto & RB_NOSYNC)) {
bootsync(); bootsync();
/*
* If we've been adjusting the clock, the todr
* will be out of synch; adjust it now.
*/
resettodr();
}
/* Wait 3s */
delay(3 * 1000 * 1000);
/* Say NO to interrupts */ /* Say NO to interrupts */
splhigh(); splhigh();
@ -298,7 +302,8 @@ cpu_reboot(int howto, char *bootstr)
/* Do a dump if requested. */ /* Do a dump if requested. */
if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
dumpsys(); dumpsys();
haltsys:
/* Run any shutdown hooks */ /* Run any shutdown hooks */
doshutdownhooks(); doshutdownhooks();
@ -309,7 +314,6 @@ cpu_reboot(int howto, char *bootstr)
#if NAPM > 0 #if NAPM > 0
if (howto & RB_POWERDOWN) { if (howto & RB_POWERDOWN) {
printf("\nAttempting to power down...\n"); printf("\nAttempting to power down...\n");
delay(1 * 1000 * 1000);
zapm_poweroff(); zapm_poweroff();
} }
#endif #endif
@ -321,6 +325,7 @@ cpu_reboot(int howto, char *bootstr)
printf("rebooting...\n"); printf("rebooting...\n");
delay(1 * 1000 * 1000); delay(1 * 1000 * 1000);
zaurus_restart(); zaurus_restart();
printf("REBOOT FAILED!!!\n"); printf("REBOOT FAILED!!!\n");
for (;;) for (;;)
continue; continue;
@ -347,7 +352,7 @@ zaurus_restart(void)
delay(1 * 1000* 1000); /* wait 1s */ delay(1 * 1000* 1000); /* wait 1s */
} }
static __inline pd_entry_t * static inline pd_entry_t *
read_ttb(void) read_ttb(void)
{ {
u_long ttb; u_long ttb;
@ -1140,7 +1145,7 @@ kgdb_port_init(void)
} else } else
return; return;
if (com_kgdb_attach_pxa2x0(&pxa2x0_a4x_bs_tag, paddr, if (com_kgdb_attach(&pxa2x0_a4x_bs_tag, paddr,
kgdb_rate, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comkgdbmode) == 0) { kgdb_rate, PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comkgdbmode) == 0) {
pxa2x0_clkman_config(cken, 1); pxa2x0_clkman_config(cken, 1);
} }