summaryrefslogtreecommitdiffstats
path: root/sys/amd64/acpica/acpi_machdep.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2009-10-08 17:41:53 +0000
committerjkim <jkim@FreeBSD.org>2009-10-08 17:41:53 +0000
commit8a5074a99c2a4d389b2ef2d7b902a607ee9b9a79 (patch)
treea89be9ece2e55e12a45b805879c8d0efd5d61ff5 /sys/amd64/acpica/acpi_machdep.c
parent91e8f12740ed6a3e1d23db4edaa7e819e5618251 (diff)
downloadFreeBSD-src-8a5074a99c2a4d389b2ef2d7b902a607ee9b9a79.zip
FreeBSD-src-8a5074a99c2a4d389b2ef2d7b902a607ee9b9a79.tar.gz
Clean up amd64 suspend/resume code.
- Allocate memory for wakeup code after ACPI bus is attached. The early memory allocation hack was inherited from i386 but amd64 does not need it. - Exclude real mode IVT and BDA explicitly. Improve comments about memory allocation and reason for the exclusions. It is a no-op in reality, though. - Remove an unnecessary CLD from wakeup code and re-align.
Diffstat (limited to 'sys/amd64/acpica/acpi_machdep.c')
-rw-r--r--sys/amd64/acpica/acpi_machdep.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/amd64/acpica/acpi_machdep.c b/sys/amd64/acpica/acpi_machdep.c
index 9d62ab5..7e7a01a 100644
--- a/sys/amd64/acpica/acpi_machdep.c
+++ b/sys/amd64/acpica/acpi_machdep.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/sysctl.h>
+
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -511,7 +512,6 @@ acpi_machdep_init(device_t dev)
sc->acpi_clone = apm_create_clone(sc->acpi_dev_t, sc);
clone_setup(&apm_clones);
EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000);
- acpi_install_wakeup_handler(sc);
if (intr_model != ACPI_INTR_PIC)
acpi_SetIntrModel(intr_model);
@@ -801,13 +801,20 @@ nexus_acpi_probe(device_t dev)
static int
nexus_acpi_attach(device_t dev)
{
+ device_t acpi_dev;
+ int error;
nexus_init_resources();
bus_generic_probe(dev);
- if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL)
+ acpi_dev = BUS_ADD_CHILD(dev, 10, "acpi", 0);
+ if (acpi_dev == NULL)
panic("failed to add acpi0 device");
- return (bus_generic_attach(dev));
+ error = bus_generic_attach(dev);
+ if (error == 0)
+ acpi_install_wakeup_handler(device_get_softc(acpi_dev));
+
+ return (error);
}
static device_method_t nexus_acpi_methods[] = {
OpenPOWER on IntegriCloud