diff options
author | jkim <jkim@FreeBSD.org> | 2011-02-14 20:05:37 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2011-02-14 20:05:37 +0000 |
commit | a9d6cae20bf16335b24c919c44acd5849ea5ae10 (patch) | |
tree | d8b88534d878b666fc639f90b76d5f169cf9cb28 /sys/dev/acpica | |
parent | efb892cc100e8a809fe7f79921a6df87ee96f75b (diff) | |
download | FreeBSD-src-a9d6cae20bf16335b24c919c44acd5849ea5ae10.zip FreeBSD-src-a9d6cae20bf16335b24c919c44acd5849ea5ae10.tar.gz |
Rework r218685. Copy just enough data for the resource type.
Reviewed by: jhb, mdf
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/acpi_resource.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index 645d746..c83b679 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -65,31 +65,30 @@ acpi_lookup_irq_handler(ACPI_RESOURCE *res, void *context) switch (res->Type) { case ACPI_RESOURCE_TYPE_IRQ: + irqnum = res->Data.Irq.InterruptCount; + irq = res->Data.Irq.Interrupts[0]; + len = ACPI_RS_SIZE(ACPI_RESOURCE_IRQ); + break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - if (res->Type == ACPI_RESOURCE_TYPE_IRQ) { - irqnum = res->Data.Irq.InterruptCount; - irq = res->Data.Irq.Interrupts[0]; - } else { - irqnum = res->Data.ExtendedIrq.InterruptCount; - irq = res->Data.ExtendedIrq.Interrupts[0]; - } - if (irqnum != 1) - break; - req = (struct lookup_irq_request *)context; - if (req->counter != req->rid) { - req->counter++; - break; - } - req->found = 1; - KASSERT(irq == rman_get_start(req->res), - ("IRQ resources do not match")); - len = res->Length; - if (len > sizeof(ACPI_RESOURCE)) - len = sizeof(ACPI_RESOURCE); - bcopy(res, req->acpi_res, len); - return (AE_CTRL_TERMINATE); + irqnum = res->Data.ExtendedIrq.InterruptCount; + irq = res->Data.ExtendedIrq.Interrupts[0]; + len = ACPI_RS_SIZE(ACPI_RESOURCE_EXTENDED_IRQ); + break; + default: + return (AE_OK); + } + if (irqnum != 1) + return (AE_OK); + req = (struct lookup_irq_request *)context; + if (req->counter != req->rid) { + req->counter++; + return (AE_OK); } - return (AE_OK); + req->found = 1; + KASSERT(irq == rman_get_start(req->res), + ("IRQ resources do not match")); + bcopy(res, req->acpi_res, len); + return (AE_CTRL_TERMINATE); } ACPI_STATUS |