now uses the dpc module for AcpiExecute(). Untested with hardware events.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19830 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2007-01-16 20:37:22 +00:00
parent 8cddf19132
commit 84137e45f1
3 changed files with 23 additions and 26 deletions

View File

@ -6,6 +6,7 @@
*/ */
#include <ACPI.h> #include <ACPI.h>
#include <dpc.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <malloc.h> #include <malloc.h>
@ -23,7 +24,8 @@ status_t acpi_rescan_stub(void);
#define TRACE(x...) dprintf("acpi: " x) #define TRACE(x...) dprintf("acpi: " x)
#define ERROR(x...) dprintf("acpi: " x) #define ERROR(x...) dprintf("acpi: " x)
extern dpc_module_info *gDPC;
void *gDPChandle = NULL;
struct acpi_module_info acpi_module = { struct acpi_module_info acpi_module = {
{ {
@ -83,23 +85,12 @@ acpi_std_ops(int32 op,...)
return ENOSYS; return ENOSYS;
} }
gDPChandle = gDPC->new_dpc_queue("acpi_task", B_NORMAL_PRIORITY, 10);
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
AcpiDbgLevel = ACPI_DEBUG_ALL | ACPI_LV_VERBOSE; AcpiDbgLevel = ACPI_DEBUG_ALL | ACPI_LV_VERBOSE;
AcpiDbgLayer = ACPI_ALL_COMPONENTS; AcpiDbgLayer = ACPI_ALL_COMPONENTS;
#endif #endif
// check if safemode settings disable ACPI
settings = load_driver_settings(B_SAFEMODE_DRIVER_SETTINGS);
if (settings != NULL) {
acpiDisabled = get_driver_boolean_parameter(settings, B_SAFEMODE_DISABLE_ACPI,
false, false);
unload_driver_settings(settings);
}
if (acpiDisabled) {
ERROR("ACPI disabled");
return ENOSYS;
}
Status = AcpiInitializeSubsystem(); Status = AcpiInitializeSubsystem();
if (Status != AE_OK) { if (Status != AE_OK) {
@ -135,6 +126,11 @@ acpi_std_ops(int32 op,...)
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 */ /* This isn't so terrible. We'll just fail silently */
if (gDPChandle != NULL) {
gDPC->delete_dpc_queue(gDPChandle);
gDPChandle = NULL;
}
break; break;
default: default:
return B_ERROR; return B_ERROR;

View File

@ -6,9 +6,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "acpi_priv.h" #include "acpi_priv.h"
#include <dpc.h>
#include <PCI.h> #include <PCI.h>
//#define TRACE_ACPI_MODULE //#define TRACE_ACPI_MODULE
#ifdef TRACE_ACPI_MODULE #ifdef TRACE_ACPI_MODULE
# define TRACE(x) dprintf x # define TRACE(x) dprintf x
@ -18,10 +22,12 @@
device_manager_info *gDeviceManager; device_manager_info *gDeviceManager;
pci_module_info *gPCIManager; pci_module_info *gPCIManager;
dpc_module_info *gDPC;
module_dependency module_dependencies[] = { module_dependency module_dependencies[] = {
{B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager}, {B_DEVICE_MANAGER_MODULE_NAME, (module_info **)&gDeviceManager},
{B_PCI_MODULE_NAME, (module_info **)&gPCIManager}, {B_PCI_MODULE_NAME, (module_info **)&gPCIManager},
{B_DPC_MODULE_NAME, (module_info **)&gDPC},
{} {}
}; };

View File

@ -131,6 +131,9 @@
# include <KernelExport.h> # include <KernelExport.h>
#include <PCI.h> #include <PCI.h>
extern pci_module_info *gPCIManager; extern pci_module_info *gPCIManager;
#include <dpc.h>
extern dpc_module_info *gDPC;
extern void *gDPChandle;
#endif #endif
#include "acpi.h" #include "acpi.h"
@ -844,8 +847,7 @@ AcpiOsExecute (
ACPI_OSD_EXEC_CALLBACK Function, ACPI_OSD_EXEC_CALLBACK Function,
void *Context) void *Context)
{ {
int priority = 10; status_t err;
thread_id thread;
switch (Type) { switch (Type) {
case OSL_GLOBAL_LOCK_HANDLER: case OSL_GLOBAL_LOCK_HANDLER:
@ -856,17 +858,10 @@ AcpiOsExecute (
case OSL_EC_BURST_HANDLER: case OSL_EC_BURST_HANDLER:
break; break;
} }
err = gDPC->queue_dpc(gDPChandle, Function, Context);
#ifndef _KERNEL_MODE if (err != B_OK)
#define spawn_kernel_thread spawn_thread
#endif
thread = spawn_kernel_thread((thread_func)(Function),"ACPI Worker Thread",priority,Context);
/* We're going to cheerfully ignore the fact that ACPI_OSD_EXEC_CALLBACK
routines don't give canonical return values, as we aren't going to
check up on them, and the kernel doesn't care */
if (thread < B_OK)
return AE_ERROR; return AE_ERROR;
return AE_OK; return AE_OK;
} }