Already get the DCP module when init the ACPI modul.

Doing it on demand in AcpiOsExecute leads to kernel panic on my machine.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31481 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2009-07-09 16:06:40 +00:00
parent c85e773511
commit 2f0441f7e3
3 changed files with 18 additions and 31 deletions

View File

@ -13,7 +13,6 @@
#include <string.h> #include <string.h>
#include <ACPI.h> #include <ACPI.h>
#include <dpc.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <PCI.h> #include <PCI.h>
@ -33,9 +32,6 @@
#define ERROR(x...) dprintf("acpi: " x) #define ERROR(x...) dprintf("acpi: " x)
extern dpc_module_info* gDPC;
void* gDPCHandle = NULL;
extern pci_module_info* gPCIManager; extern pci_module_info* gPCIManager;
@ -138,7 +134,7 @@ acpi_std_ops(int32 op,...)
AcpiFormatException(status)); AcpiFormatException(status));
goto err; goto err;
} }
/* Phew. Now in ACPI mode */ /* Phew. Now in ACPI mode */
TRACE("ACPI initialized\n"); TRACE("ACPI initialized\n");
return B_OK; return B_OK;
@ -151,17 +147,6 @@ acpi_std_ops(int32 op,...)
{ {
if (AcpiTerminate() != AE_OK) if (AcpiTerminate() != AE_OK)
ERROR("Could not bring system out of ACPI mode. Oh well.\n"); ERROR("Could not bring system out of ACPI mode. Oh well.\n");
/* This isn't so terrible. We'll just fail silently */
if (gDPC != NULL) {
if (gDPCHandle != NULL) {
gDPC->delete_dpc_queue(gDPCHandle);
gDPCHandle = NULL;
}
put_module(B_DPC_MODULE_NAME);
}
break; break;
} }

View File

@ -13,6 +13,8 @@
#include <dpc.h> #include <dpc.h>
#include <PCI.h> #include <PCI.h>
dpc_module_info* gDPC = NULL;
void* gDPCHandle = NULL;
//#define TRACE_ACPI_MODULE //#define TRACE_ACPI_MODULE
#ifdef TRACE_ACPI_MODULE #ifdef TRACE_ACPI_MODULE
@ -170,6 +172,16 @@ acpi_module_register_child_devices(void *cookie)
static status_t static status_t
acpi_module_init(device_node *node, void **_cookie) 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; *_cookie = node;
return B_OK; return B_OK;
} }
@ -178,6 +190,10 @@ acpi_module_init(device_node *node, void **_cookie)
static void static void
acpi_module_uninit(void *cookie) acpi_module_uninit(void *cookie)
{ {
gDPC->delete_dpc_queue(gDPCHandle);
gDPCHandle = NULL;
put_module(B_DPC_MODULE_NAME);
gDPC = NULL;
} }

View File

@ -132,7 +132,7 @@
#include <PCI.h> #include <PCI.h>
extern pci_module_info *gPCIManager; extern pci_module_info *gPCIManager;
#include <dpc.h> #include <dpc.h>
dpc_module_info *gDPC = NULL; extern dpc_module_info *gDPC;
extern void *gDPCHandle; extern void *gDPCHandle;
#endif #endif
@ -822,20 +822,6 @@ AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function,
break; break;
} }
if (gDPC == NULL && get_module(B_DPC_MODULE_NAME,
(module_info **)&gDPC) != B_OK) {
dprintf("failed to get dpc module for os execution\n");
return AE_ERROR;
}
if (gDPCHandle == NULL) {
if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task",
B_NORMAL_PRIORITY) != B_OK) {
dprintf("failed to create os execution queue\n");
return AE_ERROR;
}
}
if (gDPC->queue_dpc(gDPCHandle, Function, Context) != B_OK) if (gDPC->queue_dpc(gDPCHandle, Function, Context) != B_OK)
return AE_ERROR; return AE_ERROR;