summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2001-11-24 17:53:42 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2001-11-24 17:53:42 +0000
commit7a90d5732b29d7724f332d8639860539b423c9cd (patch)
tree6a97252c3014aa8bd0b577885f4717cb997feac9 /sys
parentb50e76635844355014ba05285dc1afbbc97c1e9d (diff)
Harmonize boot() logic across arches:
- ensure RB_DUMP | RB_HALT will cause a dump - or RB_HALT if (cold) While there, honor RB_TIMEBAD on sparc64.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/machdep.c6
-rw-r--r--sys/arch/amiga/amiga/machdep.c9
-rw-r--r--sys/arch/hppa/hppa/machdep.c40
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c9
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c14
-rw-r--r--sys/arch/sparc/sparc/machdep.c19
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c7
-rw-r--r--sys/arch/vax/vax/machdep.c30
9 files changed, 86 insertions, 52 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 9cbbd5c72e0..16b3514c6b5 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.57 2001/11/07 01:18:00 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.58 2001/11/24 17:53:39 miod Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1120,11 +1120,7 @@ boot(howto)
splhigh();
/* If rebooting and a dump is requested do it. */
-#if 0
- if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
-#else
if (howto & RB_DUMP)
-#endif
dumpsys();
haltsys:
diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c
index abfba61cc77..151fa9f18e6 100644
--- a/sys/arch/amiga/amiga/machdep.c
+++ b/sys/arch/amiga/amiga/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.57 2001/11/09 15:25:55 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.58 2001/11/24 17:53:41 miod Exp $ */
/* $NetBSD: machdep.c,v 1.95 1997/08/27 18:31:17 is Exp $ */
/*
@@ -739,6 +739,12 @@ boot(howto)
if (curproc)
savectx(&curproc->p_addr->u_pcb);
+ /* If system is cold, just halt. */
+ if (cold) {
+ howto |= RB_HALT;
+ goto haltsys;
+ }
+
boothowto = howto;
if ((howto & RB_NOSYNC) == 0) {
bootsync();
@@ -762,6 +768,7 @@ boot(howto)
if (howto & RB_DUMP)
dumpsys();
+haltsys:
/* Run any shutdown hooks. */
doshutdownhooks();
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 8d0ead6124d..196d2ac85d1 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.43 2001/11/09 15:25:55 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.44 2001/11/24 17:53:41 miod Exp $ */
/*
* Copyright (c) 1999-2000 Michael Shalayeff
@@ -885,34 +885,36 @@ void
boot(howto)
int howto;
{
- if (cold)
- /* XXX howto |= RB_HALT */;
- else {
- boothowto = howto | (boothowto & RB_HALT);
-
- if (!(howto & RB_NOSYNC) && waittime < 0) {
- extern struct proc proc0;
+ /* If system is cold, just halt. */
+ if (cold) {
+ howto |= RB_HALT;
+ goto haltsys;
+ }
- /* protect against curproc->p_stats refs in sync XXX */
- if (curproc == NULL)
- curproc = &proc0;
+ boothowto = howto | (boothowto & RB_HALT);
- waittime = 0;
- vfs_shutdown();
- if ((howto & RB_TIMEBAD) == 0)
- resettodr();
- else
- printf("WARNING: not updating battery clock\n");
- }
+ if (!(howto & RB_NOSYNC)) {
+ waittime = 0;
+ vfs_shutdown();
+ /*
+ * If we've been adjusting the clock, the todr
+ * will be out of synch; adjust it now unless
+ * the system was sitting in ddb.
+ */
+ if ((howto & RB_TIMEBAD) == 0)
+ resettodr();
+ else
+ printf("WARNING: not updating battery clock\n");
}
/* XXX probably save howto into stable storage */
splhigh();
- if ((howto & (RB_DUMP /* | RB_HALT */)) == RB_DUMP)
+ if (howto & RB_DUMP)
dumpsys();
+haltsys:
doshutdownhooks();
if (howto & RB_HALT) {
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index aba28ca0742..e4e9633ea1d 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.182 2001/11/09 15:25:55 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.183 2001/11/24 17:53:41 miod Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1603,7 +1603,7 @@ boot(howto)
splhigh();
/* Do a dump if requested. */
- if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) {
+ if (howto & RB_DUMP) {
/* Save registers. */
savectx(&dumppcb);
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index f652386bd36..51db2e477b0 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.87 2001/11/23 00:47:45 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.88 2001/11/24 17:53:41 miod Exp $ */
/* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */
/*
@@ -631,6 +631,12 @@ boot(howto)
if (curproc)
savectx((struct pcb *)curproc->p_addr);
+ /* If system is cold, just halt. */
+ if (cold) {
+ howto |= RB_HALT;
+ goto haltsys;
+ }
+
boothowto = howto;
if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
extern struct proc proc0;
@@ -672,6 +678,7 @@ boot(howto)
dumpsys();
}
+haltsys:
/* Run any shutdown hooks. */
doshutdownhooks();
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
index 2eb6a6b45aa..c8002d34884 100644
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ b/sys/arch/mvme68k/mvme68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.55 2001/11/07 01:18:00 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.56 2001/11/24 17:53:41 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -665,17 +665,22 @@ halt_establish(fn, pri)
}
}
-void
+__dead void
boot(howto)
register int howto;
{
+ /* If system is cold, just halt. */
+ if (cold) {
+ howto |= RB_HALT;
+ goto haltsys;
+ }
/* take a snap shot before clobbering any registers */
if (curproc && curproc->p_addr)
savectx(curproc->p_addr);
boothowto = howto;
- if ((howto&RB_NOSYNC) == 0 && waittime < 0) {
+ if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
extern struct proc proc0;
/* do that another panic fly away */
if (curproc == NULL)
@@ -701,10 +706,11 @@ boot(howto)
if (howto & RB_DUMP)
dumpsys();
+haltsys:
/* Run any shutdown hooks. */
doshutdownhooks();
- if (howto&RB_HALT) {
+ if (howto & RB_HALT) {
printf("halted\n\n");
} else {
struct haltvec *hv;
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index a1a272fbc87..26afa435d6d 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.70 2001/11/22 09:49:43 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.71 2001/11/24 17:53:41 miod Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -675,9 +675,10 @@ boot(howto)
int i;
static char str[4]; /* room for "-sd\0" */
+ /* If system is cold, just halt. */
if (cold) {
- printf("halted\n\n");
- romhalt();
+ howto |= RB_HALT;
+ goto haltsys;
}
fb_unblank();
@@ -703,8 +704,15 @@ boot(howto)
}
}
(void) splhigh(); /* ??? */
+
+ if (howto & RB_DUMP)
+ dumpsys();
+
+haltsys:
+ /* Run any shutdown hooks */
+ doshutdownhooks();
+
if ((howto & RB_HALT) || (howto & RB_POWERDOWN)) {
- doshutdownhooks();
#if defined(SUN4M)
if (howto & RB_POWERDOWN) {
#if NPOWER > 0 || NTCTRL >0
@@ -722,10 +730,7 @@ boot(howto)
printf("halted\n\n");
romhalt();
}
- if (howto & RB_DUMP)
- dumpsys();
- doshutdownhooks();
printf("rebooting\n\n");
i = 1;
if (howto & RB_SINGLE)
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 4a563b0be1c..032da939c6f 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.25 2001/11/16 21:28:08 jason Exp $ */
+/* $OpenBSD: machdep.c,v 1.26 2001/11/24 17:53:41 miod Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -793,8 +793,11 @@ boot(howto)
* successfully by inittodr() or set by an explicit call
* to resettodr() (e.g. from settimeofday()).
*/
- if (sparc_clock_time_is_ok)
+ if ((howto & RB_TIMEBAD) == 0 && sparc_clock_time_is_ok) {
resettodr();
+ } else {
+ printf("WARNING: not updating battery clock\n");
+ }
}
(void) splhigh(); /* ??? */
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index fd8efc31667..e6d251700d9 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.44 2001/11/09 15:25:56 art Exp $ */
+/* $OpenBSD: machdep.c,v 1.45 2001/11/24 17:53:41 miod Exp $ */
/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
/*
@@ -488,6 +488,12 @@ void
boot(howto)
register int howto;
{
+ /* If system is cold, just halt. */
+ if (cold) {
+ howto |= RB_HALT;
+ goto haltsys;
+ }
+
if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
waittime = 0;
vfs_shutdown();
@@ -498,12 +504,20 @@ boot(howto)
resettodr();
}
splhigh(); /* extreme priority */
+
+ /* If rebooting and a dump is requested, do it. */
+ if (howto & RB_DUMP)
+ dumpsys();
+
+ /* Run any shutdown hooks. */
+ doshutdownhooks();
+
+haltsys:
if (howto & RB_HALT) {
if (dep_call->cpu_halt)
(*dep_call->cpu_halt) ();
printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n");
- for (;;)
- ;
+ for (;;) ;
} else {
showto = howto;
#ifdef notyet
@@ -540,13 +554,6 @@ boot(howto)
");
#endif
- /* If rebooting and a dump is requested, do it. */
- if (showto & RB_DUMP)
- dumpsys();
-
- /* Run any shutdown hooks. */
- doshutdownhooks();
-
if (dep_call->cpu_reboot)
(*dep_call->cpu_reboot)(showto);
@@ -559,7 +566,8 @@ boot(howto)
asm("movl %0, r5":: "g" (showto)); /* How to boot */
asm("movl %0, r11":: "r"(showto)); /* ??? */
asm("halt");
- panic("Halt sket sej");
+ for (;;) ;
+ /* NOTREACHED */
}
void