Introduce map_gic_id() to get the apic id for ARM platform
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- drivers/acpi/processor_core.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 43363ef..2874fd4 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -90,6 +90,22 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, return 1; }
+static int map_gic_id(struct acpi_subtable_header *entry, + 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; + + if (gic->uid != acpi_id) + return 0; + + *apic_id = gic->gic_id; + return 1; +} + static int map_madt_entry(int type, u32 acpi_id) { unsigned long madt_end, entry; @@ -125,7 +141,10 @@ 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, acpi_id, &apic_id)) + break; + } entry += header->length; } return apic_id; @@ -155,6 +174,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, acpi_id, &apic_id); }
exit: @@ -197,7 +218,7 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) }
#ifdef CONFIG_ARM - + return apic_id; /* * BOZO: need to abstract this out to have it make sense -- * it's not that ARM has no equivalent, it's that apic_id is
Hi Graeme,
Could you please try this patch on top of my former patch set to see if it solve the cpu stall problem?
Thanks Hanjun
On 2013-6-6 11:39, Hanjun Guo wrote:
Introduce map_gic_id() to get the apic id for ARM platform
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org
drivers/acpi/processor_core.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 43363ef..2874fd4 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -90,6 +90,22 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, return 1; } +static int map_gic_id(struct acpi_subtable_header *entry,
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;
- if (gic->uid != acpi_id)
return 0;
- *apic_id = gic->gic_id;
- return 1;
+}
static int map_madt_entry(int type, u32 acpi_id) { unsigned long madt_end, entry; @@ -125,7 +141,10 @@ 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, acpi_id, &apic_id))
break;
entry += header->length; } return apic_id;}
@@ -155,6 +174,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, acpi_id, &apic_id);
exit: @@ -197,7 +218,7 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) } #ifdef CONFIG_ARM
- return apic_id; /*
- BOZO: need to abstract this out to have it make sense --
- it's not that ARM has no equivalent, it's that apic_id is