Skip to content

Commit

Permalink
ACPI / processor: Make it possible to get APIC ID via GIC
Browse files Browse the repository at this point in the history
Introduce a new function map_gic_id() to allow APIC IDs to be obtained
from the GIC Structure introduced by ACPI 5.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
hanjun-guo authored and rafaeljw committed Feb 18, 2014
1 parent 2c4fa00 commit df86f5d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
return 0;
}

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 -ENODEV;

/*
* 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 0;
}

return -EINVAL;
}

static int map_madt_entry(int type, u32 acpi_id)
{
unsigned long madt_end, entry;
Expand Down Expand Up @@ -106,6 +128,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;
}
Expand Down Expand Up @@ -136,6 +161,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:
Expand Down

0 comments on commit df86f5d

Please sign in to comment.