diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index e47ee14355..1791f81c79 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -35,6 +36,8 @@ #define ACPI_DEVICE_ID_LENGTH 0x08 extern pci_module_info* gPCIManager; +extern dpc_module_info* gDPC; +void* gDPCHandle = NULL; static ACPI_STATUS @@ -107,6 +110,14 @@ acpi_std_ops(int32 op,...) ERROR("ACPI disabled\n"); return ENOSYS; } + + if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task", + B_NORMAL_PRIORITY) != B_OK) { + ERROR("failed to create os execution queue\n"); + return B_ERROR; + } + + AcpiGbl_EnableInterpreterSlack = true; // AcpiGbl_CreateOSIMethod = true; @@ -169,6 +180,9 @@ acpi_std_ops(int32 op,...) { if (AcpiTerminate() != AE_OK) ERROR("Could not bring system out of ACPI mode. Oh well.\n"); + + gDPC->delete_dpc_queue(gDPCHandle); + gDPCHandle = NULL; break; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c index 317876ca4f..6e9ba51702 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c @@ -13,8 +13,6 @@ #include #include -dpc_module_info* gDPC = NULL; -void* gDPCHandle = NULL; //#define TRACE_ACPI_MODULE #ifdef TRACE_ACPI_MODULE @@ -25,10 +23,12 @@ void* gDPCHandle = NULL; device_manager_info *gDeviceManager = NULL; pci_module_info *gPCIManager = NULL; +dpc_module_info* gDPC = NULL; module_dependency module_dependencies[] = { {B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager}, {B_PCI_MODULE_NAME, (module_info **)&gPCIManager}, + {B_DPC_MODULE_NAME, (module_info **)&gDPC}, {} }; @@ -172,16 +172,6 @@ acpi_module_register_child_devices(void *cookie) static status_t acpi_module_init(device_node *node, void **_cookie) { - if (get_module(B_DPC_MODULE_NAME, (module_info **)&gDPC) != B_OK) { - dprintf("failed to get dpc module\n"); - return B_ERROR; - } - if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task", - B_NORMAL_PRIORITY) != B_OK) { - dprintf("failed to create os execution queue\n"); - return B_ERROR; - } - *_cookie = node; return B_OK; } @@ -190,10 +180,6 @@ acpi_module_init(device_node *node, void **_cookie) static void acpi_module_uninit(void *cookie) { - gDPC->delete_dpc_queue(gDPCHandle); - gDPCHandle = NULL; - put_module(B_DPC_MODULE_NAME); - gDPC = NULL; }