mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 12:04:51 +00:00
[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 svn path=/trunk/; revision=48573
This commit is contained in:
parent
62f520433c
commit
1883a6f208
1 changed files with 20 additions and 13 deletions
|
@ -463,9 +463,20 @@ acpi_bus_generate_event_dpc(PKDPC Dpc,
|
|||
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);
|
||||
KeReleaseSpinLock(&acpi_bus_event_lock, OldIrql);
|
||||
|
@ -479,7 +490,7 @@ acpi_bus_generate_event (
|
|||
UINT8 type,
|
||||
int data)
|
||||
{
|
||||
struct acpi_bus_event *event = NULL;
|
||||
ULONG_PTR TypeData = 0;
|
||||
|
||||
DPRINT("acpi_bus_generate_event");
|
||||
|
||||
|
@ -490,17 +501,13 @@ acpi_bus_generate_event (
|
|||
if (!event_is_open)
|
||||
return_VALUE(0);
|
||||
|
||||
event = ExAllocatePool(NonPagedPool,sizeof(struct acpi_bus_event));
|
||||
if (!event)
|
||||
return_VALUE(-4);
|
||||
/* Data shouldn't even get near 24 bits */
|
||||
ASSERT(!(data & 0xFF000000));
|
||||
|
||||
sprintf(event->device_class, "%s", device->pnp.device_class);
|
||||
sprintf(event->bus_id, "%s", device->pnp.bus_id);
|
||||
event->type = type;
|
||||
event->data = data;
|
||||
TypeData = data;
|
||||
TypeData |= type << 24;
|
||||
|
||||
if (!KeInsertQueueDpc(&event_dpc, event, NULL))
|
||||
ExFreePool(event);
|
||||
KeInsertQueueDpc(&event_dpc, device, (PVOID)TypeData);
|
||||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue