diff options
author | Hanjun Guo <hanjun.guo@linaro.org> | 2014-01-17 10:03:27 +0800 |
---|---|---|
committer | Graeme Gregory <graeme.gregory@linaro.org> | 2014-01-23 16:06:41 +0000 |
commit | e235d5c1000b73c2ba9b62a1746cc67844fa31ea (patch) | |
tree | 1e1650734edc94e3120d7d62fd5488d45db78db4 /drivers | |
parent | 8a1f99ff6dd3469a86562c0912cfbb1762a779bb (diff) |
ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method
Get apic id from MADT or _MAT method is not implemented on arm/arm64,
and ACPI 5.0 introduces GIC Structure for it, so this patch introduces
map_gic_id() to get apic id followed the ACPI 5.0 spec.
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/processor_core.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index cd7b5fe6c03e..165eac7ca357 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -90,6 +90,27 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, return 1; } +static int map_gic_id(struct acpi_subtable_header *entry, + int device_declaration, u32 acpi_id, int *apic_id) +{ + struct acpi_madt_generic_interrupt *gic = + (struct acpi_madt_generic_interrupt *)entry; + + if (!(gic->flags & ACPI_MADT_ENABLED)) + return 0; + + /* In the GIC interrupt model, logical processors are + * required to have a Processor Device object in the DSDT, + * so we should check device_declaration here + */ + if (device_declaration && (gic->uid == acpi_id)) { + *apic_id = gic->gic_id; + return 1; + } + + return 0; +} + static int map_madt_entry(int type, u32 acpi_id) { unsigned long madt_end, entry; @@ -125,6 +146,9 @@ static int map_madt_entry(int type, u32 acpi_id) } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { if (map_lsapic_id(header, type, acpi_id, &apic_id)) break; + } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { + if (map_gic_id(header, type, acpi_id, &apic_id)) + break; } entry += header->length; } @@ -155,6 +179,8 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) map_lapic_id(header, acpi_id, &apic_id); } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { map_lsapic_id(header, type, acpi_id, &apic_id); + } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { + map_gic_id(header, type, acpi_id, &apic_id); } exit: |