Skip to content

Commit fb7c2ba

Browse files
daviddaneyrafaeljw
authored andcommitted
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 <david.daney@cavium.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent e0af261 commit fb7c2ba

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

drivers/acpi/processor_core.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ static int map_gicc_mpidr(struct acpi_subtable_header *entry,
108108
return -EINVAL;
109109
}
110110

111-
static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
111+
static phys_cpuid_t map_madt_entry(struct acpi_table_madt *madt,
112+
int type, u32 acpi_id)
112113
{
113114
unsigned long madt_end, entry;
114115
phys_cpuid_t phys_id = PHYS_CPUID_INVALID; /* CPU hardware ID */
115-
struct acpi_table_madt *madt;
116116

117-
madt = get_madt_table();
118117
if (!madt)
119118
return phys_id;
120119

@@ -145,6 +144,25 @@ static phys_cpuid_t map_madt_entry(int type, u32 acpi_id)
145144
return phys_id;
146145
}
147146

147+
phys_cpuid_t __init acpi_map_madt_entry(u32 acpi_id)
148+
{
149+
struct acpi_table_madt *madt = NULL;
150+
acpi_size tbl_size;
151+
phys_cpuid_t rv;
152+
153+
acpi_get_table_with_size(ACPI_SIG_MADT, 0,
154+
(struct acpi_table_header **)&madt,
155+
&tbl_size);
156+
if (!madt)
157+
return PHYS_CPUID_INVALID;
158+
159+
rv = map_madt_entry(madt, 1, acpi_id);
160+
161+
early_acpi_os_unmap_memory(madt, tbl_size);
162+
163+
return rv;
164+
}
165+
148166
static phys_cpuid_t map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
149167
{
150168
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)
185203

186204
phys_id = map_mat_entry(handle, type, acpi_id);
187205
if (invalid_phys_cpuid(phys_id))
188-
phys_id = map_madt_entry(type, acpi_id);
206+
phys_id = map_madt_entry(get_madt_table(), type, acpi_id);
189207

190208
return phys_id;
191209
}

include/acpi/processor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
309309

310310
/* in processor_core.c */
311311
phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
312+
phys_cpuid_t acpi_map_madt_entry(u32 acpi_id);
312313
int acpi_map_cpuid(phys_cpuid_t phys_id, u32 acpi_id);
313314
int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
314315

0 commit comments

Comments
 (0)