summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-04-26 05:25:06 +0000
committernjl <njl@FreeBSD.org>2004-04-26 05:25:06 +0000
commit8d6b2a87ee2379aa6b5f70eade44f5c20244bfb8 (patch)
tree0360bbdb2a9616a82e90dbf0debdc67dae986689 /sys/dev/acpica
parentbd609915e07121dc82cca7d677c8057f0468b425 (diff)
downloadFreeBSD-src-8d6b2a87ee2379aa6b5f70eade44f5c20244bfb8.zip
FreeBSD-src-8d6b2a87ee2379aa6b5f70eade44f5c20244bfb8.tar.gz
Move the call to AcpiEnterSleepStatePrep() to before we select the BSP
(cpuid 0) as the processor. It mallocs some data and smp_rendezvous calls functions with locks held.
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index e432b9f..c4dd1db 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1168,6 +1168,12 @@ acpi_shutdown_final(void *arg, int howto)
* not power off the system correctly if called from an AP.
*/
if ((howto & RB_POWEROFF) != 0) {
+ status = AcpiEnterSleepStatePrep(ACPI_STATE_S5);
+ if (ACPI_FAILURE(status)) {
+ printf("AcpiEnterSleepStatePrep failed - %s\n",
+ AcpiFormatException(status));
+ return;
+ }
printf("Powering system off using ACPI\n");
smp_rendezvous(NULL, acpi_shutdown_poweroff, NULL, NULL);
} else {
@@ -1176,6 +1182,10 @@ acpi_shutdown_final(void *arg, int howto)
}
}
+/*
+ * Since this function may be called with locks held or in an unknown
+ * context, it cannot allocate memory, acquire locks, sleep, etc.
+ */
static void
acpi_shutdown_poweroff(void *arg)
{
@@ -1187,12 +1197,6 @@ acpi_shutdown_poweroff(void *arg)
if (PCPU_GET(cpuid) != 0)
return;
- status = AcpiEnterSleepStatePrep(ACPI_STATE_S5);
- if (ACPI_FAILURE(status)) {
- printf("AcpiEnterSleepStatePrep failed - %s\n",
- AcpiFormatException(status));
- return;
- }
ACPI_DISABLE_IRQS();
status = AcpiEnterSleepState(ACPI_STATE_S5);
if (ACPI_FAILURE(status)) {
OpenPOWER on IntegriCloud