Author: cgutman
Date: Fri Aug 20 03:08:50 2010
New Revision: 48573
URL:
http://svn.reactos.org/svn/reactos?rev=48573&view=rev
Log:
[ACPI]
- Do all of the work inside the DPC so we don't have IRQL issues when entering the
memory manager
- This is a slight hack but we can be assured that data won't be over 24 bits unless
somebody wants to push the power/sleep button over 16 million times
Modified:
trunk/reactos/drivers/bus/acpi/busmgr/bus.c
Modified: trunk/reactos/drivers/bus/acpi/busmgr/bus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/busmgr/bu…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/busmgr/bus.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/bus/acpi/busmgr/bus.c [iso-8859-1] Fri Aug 20 03:08:50 2010
@@ -463,8 +463,19 @@
PVOID SystemArgument1,
PVOID SystemArgument2)
{
- struct acpi_bus_event *event = SystemArgument1;
+ struct acpi_bus_event *event;
+ struct acpi_device *device = SystemArgument1;
+ ULONG_PTR TypeData = (ULONG_PTR)SystemArgument2;
KIRQL OldIrql;
+
+ event = ExAllocatePool(NonPagedPool,sizeof(struct acpi_bus_event));
+ if (!event)
+ return;
+
+ sprintf(event->device_class, "%s", device->pnp.device_class);
+ sprintf(event->bus_id, "%s", device->pnp.bus_id);
+ event->type = (TypeData & 0xFF000000) >> 24;
+ event->data = (TypeData & 0x00FFFFFF);
KeAcquireSpinLock(&acpi_bus_event_lock, &OldIrql);
list_add_tail(&event->node, &acpi_bus_event_list);
@@ -479,7 +490,7 @@
UINT8 type,
int data)
{
- struct acpi_bus_event *event = NULL;
+ ULONG_PTR TypeData = 0;
DPRINT("acpi_bus_generate_event");
@@ -489,18 +500,14 @@
/* drop event on the floor if no one's listening */
if (!event_is_open)
return_VALUE(0);
-
- event = ExAllocatePool(NonPagedPool,sizeof(struct acpi_bus_event));
- if (!event)
- return_VALUE(-4);
-
- sprintf(event->device_class, "%s", device->pnp.device_class);
- sprintf(event->bus_id, "%s", device->pnp.bus_id);
- event->type = type;
- event->data = data;
-
- if (!KeInsertQueueDpc(&event_dpc, event, NULL))
- ExFreePool(event);
+
+ /* Data shouldn't even get near 24 bits */
+ ASSERT(!(data & 0xFF000000));
+
+ TypeData = data;
+ TypeData |= type << 24;
+
+ KeInsertQueueDpc(&event_dpc, device, (PVOID)TypeData);
return_VALUE(0);
}