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
This commit is contained in:
Mitsuru IWASAKI 2002-11-24 02:27:07 +00:00
parent e35f2b32ee
commit 87b45ed576
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107199
3 changed files with 19 additions and 7 deletions

View file

@ -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,

View file

@ -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 @@ acpi_pm_func(u_long cmd, void *arg, ...)
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);

View file

@ -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,