From cfecb2e3803e8535b11d7f73d4537242c8d4d22c Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Fri, 30 May 2014 13:46:18 +0000 Subject: Set cold to 1 before executing the DVACT_POWERDOWN handlers when halting or rebooting a machine, like it is done in the hibernate case. At least some USB host controller drivers rely on this to busy way instead of sleeping. Avoid a panic on macppc with an uhci(4) cardbus plugged in. ok deraadt@, uebayashi@ --- sys/arch/alpha/alpha/machdep.c | 3 ++- sys/arch/amd64/amd64/machdep.c | 3 ++- sys/arch/armish/armish/armish_machdep.c | 7 +++---- sys/arch/armv7/armv7/armv7_machdep.c | 7 +++---- sys/arch/aviion/aviion/machdep.c | 3 ++- sys/arch/hppa/hppa/machdep.c | 5 ++--- sys/arch/hppa64/hppa64/machdep.c | 5 ++--- sys/arch/i386/i386/machdep.c | 3 ++- sys/arch/landisk/landisk/machdep.c | 3 ++- sys/arch/loongson/loongson/machdep.c | 5 +++-- sys/arch/luna88k/luna88k/machdep.c | 3 ++- sys/arch/macppc/macppc/machdep.c | 3 ++- sys/arch/octeon/octeon/machdep.c | 5 +++-- sys/arch/sgi/sgi/machdep.c | 5 +++-- sys/arch/socppc/socppc/machdep.c | 3 ++- sys/arch/solbourne/solbourne/machdep.c | 5 +++-- sys/arch/sparc/sparc/machdep.c | 5 +++-- sys/arch/sparc64/sparc64/machdep.c | 5 +++-- sys/arch/vax/vax/machdep.c | 5 +++-- sys/arch/zaurus/zaurus/zaurus_machdep.c | 7 ++++--- 20 files changed, 51 insertions(+), 39 deletions(-) diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index f107df4ed0b..bc26eca52b0 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.154 2014/05/25 13:57:48 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.155 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -1015,6 +1015,7 @@ boot(howto) uvm_shutdown(); splhigh(); /* Disable interrupts. */ + cold = 1; #if defined(MULTIPROCESSOR) /* diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index fd475cd34c9..947287c1d69 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.177 2014/03/29 18:09:28 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.178 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -783,6 +783,7 @@ boot(int howto) uvm_shutdown(); splhigh(); /* Disable interrupts. */ + cold = 1; /* Do a dump if requested. */ if (howto & RB_DUMP) diff --git a/sys/arch/armish/armish/armish_machdep.c b/sys/arch/armish/armish/armish_machdep.c index 43d94ab9154..e408d0d5789 100644 --- a/sys/arch/armish/armish/armish_machdep.c +++ b/sys/arch/armish/armish/armish_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armish_machdep.c,v 1.23 2014/03/23 18:20:59 miod Exp $ */ +/* $OpenBSD: armish_machdep.c,v 1.24 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -274,9 +274,8 @@ boot(int howto) if_downall(); uvm_shutdown(); - - /* Say NO to interrupts */ - splhigh(); + splhigh(); /* Disable interrupts. */ + cold = 1; /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) diff --git a/sys/arch/armv7/armv7/armv7_machdep.c b/sys/arch/armv7/armv7/armv7_machdep.c index 3ac90c7f9b6..ff6d6574d99 100644 --- a/sys/arch/armv7/armv7/armv7_machdep.c +++ b/sys/arch/armv7/armv7/armv7_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: armv7_machdep.c,v 1.6 2014/03/29 18:09:28 guenther Exp $ */ +/* $OpenBSD: armv7_machdep.c,v 1.7 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -290,9 +290,8 @@ boot(int howto) if_downall(); uvm_shutdown(); - - /* Say NO to interrupts */ - splhigh(); + splhigh(); /* Disable interrupts. */ + cold = 1; /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c index 2364e667584..dd5672b5cec 100644 --- a/sys/arch/aviion/aviion/machdep.c +++ b/sys/arch/aviion/aviion/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.62 2014/05/08 22:17:33 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.63 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 2007 Miodrag Vallat. * @@ -326,6 +326,7 @@ boot(howto) uvm_shutdown(); splhigh(); /* Disable interrupts. */ + cold = 1; /* If rebooting and a dump is requested, do it. */ if (howto & RB_DUMP) diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index b4049af0e78..d1888dfe36c 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.220 2014/05/08 21:32:45 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.221 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -925,10 +925,9 @@ boot(int howto) } if_downall(); - /* XXX probably save howto into stable storage */ - uvm_shutdown(); splhigh(); + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c index 174df297e43..10941b713d5 100644 --- a/sys/arch/hppa64/hppa64/machdep.c +++ b/sys/arch/hppa64/hppa64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.58 2014/04/08 09:34:23 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.59 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -562,10 +562,9 @@ boot(int howto) } if_downall(); - /* XXX probably save howto into stable storage */ - uvm_shutdown(); splhigh(); + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index defb7f34074..59c5adeb2cc 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.536 2014/03/29 18:09:29 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.537 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2597,6 +2597,7 @@ boot(int howto) uvm_shutdown(); splhigh(); /* Disable interrupts. */ + cold = 1; /* Do a dump if requested. */ if (howto & RB_DUMP) diff --git a/sys/arch/landisk/landisk/machdep.c b/sys/arch/landisk/landisk/machdep.c index 4639ddb0124..77e4a530315 100644 --- a/sys/arch/landisk/landisk/machdep.c +++ b/sys/arch/landisk/landisk/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.31 2014/04/14 07:36:12 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.32 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ /*- @@ -217,6 +217,7 @@ boot(int howto) uvm_shutdown(); splhigh(); /* Disable interrupts. */ + cold = 1; /* Do a dump if requested. */ if (howto & RB_DUMP) diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c index 79ba9231c36..f461089880d 100644 --- a/sys/arch/loongson/loongson/machdep.c +++ b/sys/arch/loongson/loongson/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.47 2014/04/03 08:07:16 mpi Exp $ */ +/* $OpenBSD: machdep.c,v 1.48 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 2009, 2010, 2014 Miodrag Vallat. @@ -943,7 +943,8 @@ boot(int howto) if_downall(); uvm_shutdown(); - (void) splhigh(); /* Extreme priority. */ + splhigh(); /* Disable interrupts. */ + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index a3c8f44f7b4..4ecd182ea14 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.98 2014/05/08 22:17:33 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.99 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -500,6 +500,7 @@ boot(howto) uvm_shutdown(); splhigh(); /* Disable interrupts. */ + cold = 1; /* If rebooting and a dump is requested, do it. */ if (howto & RB_DUMP) diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 85bf429549d..92747262b82 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.150 2014/05/09 18:16:15 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.151 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -835,6 +835,7 @@ boot(int howto) uvm_shutdown(); splhigh(); + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 99a4f4a3065..94d784570ea 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.46 2014/05/10 22:37:12 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.47 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -687,7 +687,8 @@ boot(int howto) if_downall(); uvm_shutdown(); - (void) splhigh(); /* Extreme priority. */ + splhigh(); /* Disable interrupts. */ + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 96ee70645c1..574784891be 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.138 2014/05/19 21:18:42 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.139 2014/05/30 13:46:16 mpi Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -870,7 +870,8 @@ boot(int howto) if_downall(); uvm_shutdown(); - (void) splhigh(); /* Extreme priority. */ + splhigh(); /* Disable interrupts. */ + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c index a1e013162d7..803a5c99ae5 100644 --- a/sys/arch/socppc/socppc/machdep.c +++ b/sys/arch/socppc/socppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.46 2014/05/09 18:16:15 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.47 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -1064,6 +1064,7 @@ boot(int howto) uvm_shutdown(); splhigh(); + cold = 1; if ((howto & RB_DUMP)) dumpsys(); diff --git a/sys/arch/solbourne/solbourne/machdep.c b/sys/arch/solbourne/solbourne/machdep.c index daa947811fb..ac799656eae 100644 --- a/sys/arch/solbourne/solbourne/machdep.c +++ b/sys/arch/solbourne/solbourne/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.31 2014/05/25 13:57:48 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.32 2014/05/30 13:46:16 mpi Exp $ */ /* OpenBSD: machdep.c,v 1.105 2005/04/11 15:13:01 deraadt Exp */ /* @@ -554,7 +554,8 @@ boot(howto) if_downall(); uvm_shutdown(); - (void) splhigh(); /* ??? */ + splhigh(); /* Disable interrupts. */ + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index bafa320c682..babc7192609 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.152 2014/05/25 13:57:48 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.153 2014/05/30 13:46:16 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -563,7 +563,8 @@ boot(howto) if_downall(); uvm_shutdown(); - (void) splhigh(); /* ??? */ + splhigh(); /* Disable interrupts. */ + cold = 1; if (howto & RB_DUMP) dumpsys(); diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index d55e36a8600..1ef0bf1cc73 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.155 2014/05/25 13:57:48 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.156 2014/05/30 13:46:17 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -648,7 +648,8 @@ boot(howto) if_downall(); uvm_shutdown(); - (void) splhigh(); /* ??? */ + splhigh(); /* Disable interrupts. */ + cold = 1; /* If rebooting and a dump is requested, do it. */ if (howto & RB_DUMP) diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 7bc014bdba7..98a8e3dbdf8 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.134 2014/05/25 13:57:48 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.135 2014/05/30 13:46:17 mpi Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -538,7 +538,8 @@ boot(howto) if_downall(); uvm_shutdown(); - splhigh(); /* extreme priority */ + splhigh(); /* Disable interrupts. */ + cold = 1; /* If rebooting and a dump is requested, do it. */ if (howto & RB_DUMP) diff --git a/sys/arch/zaurus/zaurus/zaurus_machdep.c b/sys/arch/zaurus/zaurus/zaurus_machdep.c index e96de3ef691..8f66e15f4ee 100644 --- a/sys/arch/zaurus/zaurus/zaurus_machdep.c +++ b/sys/arch/zaurus/zaurus/zaurus_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_machdep.c,v 1.42 2014/03/29 18:09:30 guenther Exp $ */ +/* $OpenBSD: zaurus_machdep.c,v 1.43 2014/05/30 13:46:17 mpi Exp $ */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -315,8 +315,9 @@ boot(int howto) if (!(howto & RB_NOSYNC)) bootsync(howto); - /* Say NO to interrupts */ - splhigh(); + uvm_shutdown(); + splhigh(); /* Disable interrupts. */ + cold = 1; /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) -- cgit v1.2.3