- 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

svn path=/trunk/; revision=48573
This commit is contained in:
Cameron Gutman 2010-08-20 03:08:50 +00:00
parent 62f520433c
commit 1883a6f208

View file

@ -463,9 +463,20 @@ acpi_bus_generate_event_dpc(PKDPC Dpc,
PVOID SystemArgument1, PVOID SystemArgument1,
PVOID SystemArgument2) 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; 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); KeAcquireSpinLock(&acpi_bus_event_lock, &OldIrql);
list_add_tail(&event->node, &acpi_bus_event_list); list_add_tail(&event->node, &acpi_bus_event_list);
KeReleaseSpinLock(&acpi_bus_event_lock, OldIrql); KeReleaseSpinLock(&acpi_bus_event_lock, OldIrql);
@ -479,7 +490,7 @@ acpi_bus_generate_event (
UINT8 type, UINT8 type,
int data) int data)
{ {
struct acpi_bus_event *event = NULL; ULONG_PTR TypeData = 0;
DPRINT("acpi_bus_generate_event"); DPRINT("acpi_bus_generate_event");
@ -490,17 +501,13 @@ acpi_bus_generate_event (
if (!event_is_open) if (!event_is_open)
return_VALUE(0); return_VALUE(0);
event = ExAllocatePool(NonPagedPool,sizeof(struct acpi_bus_event)); /* Data shouldn't even get near 24 bits */
if (!event) ASSERT(!(data & 0xFF000000));
return_VALUE(-4);
sprintf(event->device_class, "%s", device->pnp.device_class); TypeData = data;
sprintf(event->bus_id, "%s", device->pnp.bus_id); TypeData |= type << 24;
event->type = type;
event->data = data;
if (!KeInsertQueueDpc(&event_dpc, event, NULL)) KeInsertQueueDpc(&event_dpc, device, (PVOID)TypeData);
ExFreePool(event);
return_VALUE(0); return_VALUE(0);
} }