* Make the initialization of the DPC module lazy. It'll not be available in early
boot, but it's not needed there either. * Return 1 for the thread id when ACPI asks and we are thread 0 (early boot), because it treats 0 as an error. * Switch over logic when installing/removing interrupt handle to panic when installing the interrupt handler if the data supplied is non-NULL. In case it is NULL we're fine because we can remove it again without knowing the data. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28188 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -105,12 +105,6 @@ acpi_std_ops(int32 op,...)
|
|||||||
return ENOSYS;
|
return ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (gDPC->new_dpc_queue(&gDPCHandle, "acpi_task", B_NORMAL_PRIORITY) != B_OK) {
|
|
||||||
ERROR("AcpiInitializeSubsystem failed (new_dpc_queue() failed!)\n");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
#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;
|
||||||
@@ -158,9 +152,13 @@ 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) {
|
if (gDPC != NULL) {
|
||||||
gDPC->delete_dpc_queue(gDPCHandle);
|
if (gDPCHandle != NULL) {
|
||||||
gDPCHandle = NULL;
|
gDPC->delete_dpc_queue(gDPCHandle);
|
||||||
|
gDPCHandle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
put_module(B_DPC_MODULE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -20,14 +20,13 @@
|
|||||||
# define TRACE(x) ;
|
# define TRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
device_manager_info *gDeviceManager;
|
device_manager_info *gDeviceManager = NULL;
|
||||||
pci_module_info *gPCIManager;
|
pci_module_info *gPCIManager = NULL;
|
||||||
dpc_module_info *gDPC;
|
dpc_module_info *gDPC = NULL;
|
||||||
|
|
||||||
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},
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -751,8 +751,14 @@ AcpiOsInstallInterruptHandler(UINT32 InterruptNumber,
|
|||||||
DEBUG_FUNCTION_F("vector: %lu; handler: %p; data: %p",
|
DEBUG_FUNCTION_F("vector: %lu; handler: %p; data: %p",
|
||||||
(uint32)InterruptNumber, ServiceRoutine, Context);
|
(uint32)InterruptNumber, ServiceRoutine, Context);
|
||||||
#ifdef _KERNEL_MODE
|
#ifdef _KERNEL_MODE
|
||||||
/* It so happens that the Haiku and ACPI-CA interrupt handler routines
|
if (Context != NULL) {
|
||||||
return the same values with the same meanings */
|
// we don't get the context parameter when
|
||||||
|
panic("ACPI: cannot add interrupt handler with non-null context");
|
||||||
|
return AE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* It so happens that the Haiku and ACPI-CA interrupt handler routines
|
||||||
|
return the same values with the same meanings */
|
||||||
return install_io_interrupt_handler(InterruptNumber,
|
return install_io_interrupt_handler(InterruptNumber,
|
||||||
(interrupt_handler)ServiceRoutine, Context, 0) == B_OK ? AE_OK
|
(interrupt_handler)ServiceRoutine, Context, 0) == B_OK ? AE_OK
|
||||||
: AE_ERROR;
|
: AE_ERROR;
|
||||||
@@ -781,11 +787,8 @@ AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber,
|
|||||||
DEBUG_FUNCTION_F("vector: %lu; handler: %p", (uint32)InterruptNumber,
|
DEBUG_FUNCTION_F("vector: %lu; handler: %p", (uint32)InterruptNumber,
|
||||||
ServiceRoutine);
|
ServiceRoutine);
|
||||||
#ifdef _KERNEL_MODE
|
#ifdef _KERNEL_MODE
|
||||||
panic("AcpiOsRemoveInterruptHandler()\n");
|
remove_io_interrupt_handler(InterruptNumber,
|
||||||
/*remove_io_interrupt_handler(InterruptNumber,
|
(interrupt_handler)ServiceRoutine, NULL);
|
||||||
(interrupt_handler)ServiceRoutine, NULL);*/
|
|
||||||
/* Crap. We don't get the Context argument back. */
|
|
||||||
#warning Sketchy code!
|
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
#else
|
#else
|
||||||
return AE_ERROR;
|
return AE_ERROR;
|
||||||
@@ -822,6 +825,20 @@ 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;
|
||||||
|
|
||||||
@@ -1199,7 +1216,10 @@ AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width)
|
|||||||
UINT32
|
UINT32
|
||||||
AcpiOsGetThreadId(void)
|
AcpiOsGetThreadId(void)
|
||||||
{
|
{
|
||||||
return find_thread(NULL);
|
// ACPI treats a 0 return as an error,
|
||||||
|
// but we are thread 0 in early boot
|
||||||
|
thread_id thread = find_thread(NULL);
|
||||||
|
return thread == 0 ? 1 : thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user