From f2f265930dcaa89f758b100aac370b81a50b6e27 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 24 Sep 2009 17:36:49 +0000 Subject: [PATCH] * Made DPC an ACPI module dependency * Moved DPC queue creation / deletion before/after ACPI subsystem init/shutdown repectively, as AcpiInitializeObjects() would eventually trigger some AcpiOsExecute() call, which need DPC to be ready. * Still missing: a DPC queue that run each call in its own thread, not sequentially... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33264 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/acpi/acpi_busman.c | 14 ++++++++++++++ .../kernel/bus_managers/acpi/acpi_module.c | 18 ++---------------- 2 files changed, 16 insertions(+), 16 deletions(-) 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; }