diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2002-11-24 02:27:07 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2002-11-24 02:27:07 +0000 |
commit | 723c83e3b4c94002b86e1efce61f943049884f7f (patch) | |
tree | 709ea465f83853e58e833dc3c48410efd3b454b2 /sys | |
parent | 934f550c4f05597b7cc859497ca4482e96368ea2 (diff) | |
download | FreeBSD-src-723c83e3b4c94002b86e1efce61f943049884f7f.zip FreeBSD-src-723c83e3b4c94002b86e1efce61f943049884f7f.tar.gz |
Add `if (!cold)' checkings for functions which is called via SYSINIT.
Loading acpi.ko with kldload is disallowed, however some
functions were executed unexpectedly.
Approved by: re
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/acpica/acpi_wakeup.c | 3 | ||||
-rw-r--r-- | sys/dev/acpica/acpi.c | 20 | ||||
-rw-r--r-- | sys/i386/acpica/acpi_wakeup.c | 3 |
3 files changed, 19 insertions, 7 deletions
diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c index 6dc942e..53c16a4 100644 --- a/sys/amd64/acpica/acpi_wakeup.c +++ b/sys/amd64/acpica/acpi_wakeup.c @@ -301,6 +301,9 @@ static void acpi_alloc_wakeup_handler(void) { + if (!cold) + return; + if (bus_dma_tag_create(/* parent */ NULL, /* alignment */ 2, 0, /* lowaddr below 1MB */ 0x9ffff, /* highaddr */ BUS_SPACE_MAXADDR, NULL, NULL, diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index c8f7e62..2a6ca65 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -185,8 +185,10 @@ acpi_modevent(struct module *mod, int event, void *junk) { switch(event) { case MOD_LOAD: - if (!cold) + if (!cold) { + printf("The ACPI driver cannot be loaded after boot.\n"); return(EPERM); + } break; case MOD_UNLOAD: if (!cold && power_pm_get_type() == POWER_PM_TYPE_ACPI) @@ -212,10 +214,8 @@ acpi_identify(driver_t *driver, device_t parent) ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - if(!cold){ - printf("Don't load this driver from userland!!\n"); - return ; - } + if (!cold) + return_VOID; /* * Check that we haven't been disabled with a hint. @@ -2043,6 +2043,9 @@ acpi_set_debugging(void *junk) { char *cp; + if (!cold) + return; + AcpiDbgLayer = 0; AcpiDbgLevel = 0; if ((cp = getenv("debug.acpi.layer")) != NULL) { @@ -2110,13 +2113,16 @@ out: static void acpi_pm_register(void *arg) { - int error; + int error; + + if (!cold) + return; if (!resource_int_value("acpi", 0, "disabled", &error) && (error != 0)) return; - power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, NULL); + power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, NULL); } SYSINIT(power, SI_SUB_KLD, SI_ORDER_ANY, acpi_pm_register, 0); diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c index 6dc942e..53c16a4 100644 --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -301,6 +301,9 @@ static void acpi_alloc_wakeup_handler(void) { + if (!cold) + return; + if (bus_dma_tag_create(/* parent */ NULL, /* alignment */ 2, 0, /* lowaddr below 1MB */ 0x9ffff, /* highaddr */ BUS_SPACE_MAXADDR, NULL, NULL, |