From e84025e274e66986277e11f0dda03373e246ffad Mon Sep 17 00:00:00 2001 From: David Daney Date: Tue, 24 May 2016 15:35:39 -0700 Subject: ACPI / NUMA: move bad_srat() and srat_disabled() to drivers/acpi/numa.c bad_srat() and srat_disabled() are shared by x86 and follow-on arm64 patches. Move them to drivers/acpi/numa.c in preparation for arm64 support. Signed-off-by: Hanjun Guo Signed-off-by: Robert Richter [david.daney@cavium.com moved definitions to drivers/acpi/numa.c] Signed-off-by: David Daney Signed-off-by: Rafael J. Wysocki --- include/acpi/acpi_numa.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/acpi') diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h index 94a37cd7fbda..d4b72944ccda 100644 --- a/include/acpi/acpi_numa.h +++ b/include/acpi/acpi_numa.h @@ -15,6 +15,10 @@ extern int pxm_to_node(int); extern int node_to_pxm(int); extern int acpi_map_pxm_to_node(int); extern unsigned char acpi_srat_revision; +extern int acpi_numa __initdata; + +extern void bad_srat(void); +extern int srat_disabled(void); #endif /* CONFIG_ACPI_NUMA */ #endif /* __ACP_NUMA_H */ -- cgit v1.2.3 From fb7c2bae8a479e388a1f664e32d6ddca55c7a249 Mon Sep 17 00:00:00 2001 From: David Daney Date: Tue, 24 May 2016 15:35:43 -0700 Subject: ACPI / processor: Add acpi_map_madt_entry() Follow-on arm64 ACPI/NUMA patches need to map MADT entries very early (before kmalloc is usable). Add acpi_map_madt_entry() which, indirectly, uses early_memremap()/early_memunmap() to access the table and parse out the mpidr. The existing implementation of map_madt_entry() is modified to take a pointer to the MADT as a parameter and the callers adjusted. Signed-off-by: David Daney Acked-by: Catalin Marinas Signed-off-by: Rafael J. Wysocki --- drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++---- include/acpi/processor.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'include/acpi') diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 33a38d604630..9125d7d96372 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry, return -EINVAL; } -static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) +static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt, + int type, u32 acpi_id) { unsigned long madt_end, entry; phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */ - struct acpi_table_madt *madt; - madt = get_madt_table(); if (!madt) return phys_id; @@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id) return phys_id; } +phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id) +{ + struct acpi_table_madt *madt = NULL; + acpi_size tbl_size; + phys_cpuid_t rv; + + acpi_get_table_with_size(ACPI_SIG_MADT, 0, + (struct acpi_table_header **)&madt, + &tbl_size); + if (!madt) + return PHYS_CPUID_INVALID; + + rv = map_madt_entry(madt, 1, acpi_id); + + early_acpi_os_unmap_memory(madt, tbl_size); + + return rv; +} + static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -185,7 +203,7 @@ phys_cpuid_t acpi_get_phys_id(acpi_handle handle, int type, u32 acpi_id) phys_id = map_mat_entry(handle, type, acpi_id); if (invalid_phys_cpuid(phys_id)) - phys_id = map_madt_entry(type, acpi_id); + phys_id = map_madt_entry(get_madt_table(), type, acpi_id); return phys_id; } diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 6f1805dd5d3c..f473e6618339 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -309,6 +309,7 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) /* in processor_core.c */ phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id); +phys_cpuid_t acpi_map_madt_entry(u32 acpi_id); int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id); int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id); -- cgit v1.2.3