diff options
author | Huacai Chen <chenhuacai@loongson.cn> | 2022-07-19 04:53:13 +0200 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2022-08-12 07:10:11 +0200 |
commit | e9e7ff16d7f098f6fa9394e9d2b191c01ba0d5f6 (patch) | |
tree | f60dadb261598d0a4fbfd832528d4889d01bf9b3 /arch/loongarch/kernel/acpi.c | |
parent | LoongArch: Jump to the link address before enable PG (diff) | |
download | linux-e9e7ff16d7f098f6fa9394e9d2b191c01ba0d5f6.tar.xz linux-e9e7ff16d7f098f6fa9394e9d2b191c01ba0d5f6.zip |
LoongArch: Parse MADT to get multi-processor information
Parse MADT to get multi-processor information, in order to fix the boot
problem and cpu-hotplug problem for SMP platform.
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/acpi.c')
-rw-r--r-- | arch/loongarch/kernel/acpi.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c index 03aa14581d0a..f1c928648a4a 100644 --- a/arch/loongarch/kernel/acpi.c +++ b/arch/loongarch/kernel/acpi.c @@ -104,6 +104,39 @@ static int set_processor_mask(u32 id, u32 flags) } #endif +static int __init +acpi_parse_processor(union acpi_subtable_headers *header, const unsigned long end) +{ + struct acpi_madt_core_pic *processor = NULL; + + processor = (struct acpi_madt_core_pic *)header; + if (BAD_MADT_ENTRY(processor, end)) + return -EINVAL; + + acpi_table_print_madt_entry(&header->common); +#ifdef CONFIG_SMP + set_processor_mask(processor->core_id, processor->flags); +#endif + + return 0; +} + +static int __init +acpi_parse_eio_master(union acpi_subtable_headers *header, const unsigned long end) +{ + static int core = 0; + struct acpi_madt_eio_pic *eiointc = NULL; + + eiointc = (struct acpi_madt_eio_pic *)header; + if (BAD_MADT_ENTRY(eiointc, end)) + return -EINVAL; + + core = eiointc->node * CORES_PER_EIO_NODE; + set_bit(core, &(loongson_sysconf.cores_io_master)); + + return 0; +} + static void __init acpi_process_madt(void) { #ifdef CONFIG_SMP @@ -114,6 +147,11 @@ static void __init acpi_process_madt(void) __cpu_logical_map[i] = -1; } #endif + acpi_table_parse_madt(ACPI_MADT_TYPE_CORE_PIC, + acpi_parse_processor, MAX_CORE_PIC); + + acpi_table_parse_madt(ACPI_MADT_TYPE_EIO_PIC, + acpi_parse_eio_master, MAX_IO_PICS); loongson_sysconf.nr_cpus = num_processors; } |