Skip to content

Commit

Permalink
ACPI / processor: Add acpi_map_madt_entry()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Daney authored and Rafael J. Wysocki committed May 30, 2016
1 parent e0af261 commit fb7c2ba
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
26 changes: 22 additions & 4 deletions drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions include/acpi/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fb7c2ba

Please sign in to comment.