Once we get the table header pointer to the MADT in the callback from acpi_parse_table(), we can use it to probe the GIC and its distributors.
Signed-off-by: Ashwin Chaugule ashwin.chaugule@linaro.org --- drivers/acpi/plat/arm-core.c | 54 ++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 37 deletions(-)
diff --git a/drivers/acpi/plat/arm-core.c b/drivers/acpi/plat/arm-core.c index 87e93b2..7a93fef 100644 --- a/drivers/acpi/plat/arm-core.c +++ b/drivers/acpi/plat/arm-core.c @@ -92,19 +92,6 @@ void __init __acpi_unmap_table(char *map, unsigned long size) return; }
-static int __init acpi_parse_madt(struct acpi_table_header *table) -{ - struct acpi_table_madt *madt; - - madt = (struct acpi_table_madt *)table; - if (!madt) { - pr_warn(PREFIX "Unable to get MADT\n"); - return -ENODEV; - } - - return 0; -} - /* * GIC structures on ARM are somthing like Local APIC structures on x86, * which means GIC cpu interfaces for GICv2/v3. Every GIC structure in @@ -146,20 +133,21 @@ acpi_parse_gic_distributor(struct acpi_subtable_header *header, return 0; }
-/* - * Parse GIC cpu interface related entries in MADT - * returns 0 on success, < 0 on error - */ -static int __init acpi_parse_madt_gic_entries(void) +static int __init acpi_parse_madt(struct acpi_table_header *header) { + struct acpi_table_madt *madt; int count;
- /* - * do a partial walk of MADT to determine how many CPUs - * we have including disabled CPUs - */ - count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT, - acpi_parse_gic, MAX_GIC_CPU_INTERFACE); + madt = (struct acpi_table_madt *)header; + if (!madt) { + pr_warn(PREFIX "Unable to get MADT\n"); + return -ENODEV; + } + + /* Parse MADT for GIC entries. */ + count = acpi_parse_entries(sizeof(struct acpi_table_madt), + acpi_parse_gic, header, ACPI_MADT_TYPE_GENERIC_INTERRUPT, + MAX_GIC_CPU_INTERFACE);
if (!count) { pr_err(PREFIX "No GIC entries present\n"); @@ -169,19 +157,11 @@ static int __init acpi_parse_madt_gic_entries(void) return count; }
- return 0; -} - -/* - * Parse GIC distributor related entries in MADT - * returns 0 on success, < 0 on error - */ -static int __init acpi_parse_madt_gic_distributor_entries(void) -{ - int count; - - count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, - acpi_parse_gic_distributor, MAX_GIC_DISTRIBUTOR); + /* Parse MADT for GIC Distributors. */ + count = acpi_parse_entries(sizeof(struct acpi_table_madt), + acpi_parse_gic_distributor, header, + ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR, + MAX_GIC_DISTRIBUTOR);
if (!count) { pr_err(PREFIX "No GIC distributor entries present\n");