Add a pmf(9) shutdown hook to acpiec(4) to use polling on shutdown.

This fixes DIAGNOSTIC's assertion failure:

cpu_switchto(): switching above IPL_SCHED

during ACPI shutdown.

OK'd by joerg@
This commit is contained in:
alc 2009-07-06 00:54:00 +00:00
parent 6ce0e276a4
commit 3fb1b3bc21
1 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_ec.c,v 1.55 2009/05/12 09:29:46 cegger Exp $ */
/* $NetBSD: acpi_ec.c,v 1.56 2009/07/06 00:54:00 alc Exp $ */
/*-
* Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.55 2009/05/12 09:29:46 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.56 2009/07/06 00:54:00 alc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -148,8 +148,9 @@ static void acpiec_attach(device_t, device_t, void *);
static void acpiec_common_attach(device_t, device_t, ACPI_HANDLE,
bus_addr_t, bus_addr_t, ACPI_HANDLE, uint8_t);
static bool acpiec_resume(device_t PMF_FN_PROTO);
static bool acpiec_suspend(device_t PMF_FN_PROTO);
static bool acpiec_resume(device_t PMF_FN_PROTO);
static bool acpiec_shutdown(device_t, int);
static bool acpiec_parse_gpe_package(device_t, ACPI_HANDLE,
ACPI_HANDLE *, uint8_t *);
@ -377,7 +378,8 @@ acpiec_common_attach(device_t parent, device_t self,
ec_singleton = self;
if (!pmf_device_register(self, acpiec_suspend, acpiec_resume))
if (!pmf_device_register1(self, acpiec_suspend, acpiec_resume,
acpiec_shutdown))
aprint_error_dev(self, "couldn't establish power handler\n");
return;
@ -408,6 +410,14 @@ acpiec_resume(device_t dv PMF_FN_ARGS)
return true;
}
static bool
acpiec_shutdown(device_t dv, int how)
{
acpiec_cold = true;
return true;
}
static bool
acpiec_parse_gpe_package(device_t self, ACPI_HANDLE ec_handle,
ACPI_HANDLE *gpe_handle, uint8_t *gpebit)