From bf8414039700548ef9b21d2e820dd4d3b26d3f89 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Thu, 28 Aug 2003 02:46:09 -0700 Subject: [PATCH] [PATCH] ia64: clean up acpi_boot_init() I was confused about this bit of code in acpi_boot_init(): smp_boot_data.cpu_count = available_cpus; if (available_cpus == 0) { printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); available_cpus = 1; /* We've got at least one of these, no? */ } smp_build_cpu_map(); because it first saves available cpus in smp_boot_data, then potentially modifies available_cpus. This looked at first like a bug, but I think actually works out correctly, because smp_boot_data.cpu_count is only used in smp_build_cpu_map(), and if cpu_count is zero, it prevents us from looking at smp_boot_data.cpu_phys_id[0], which hasn't been initialized. This should only happen with really buggy firmware, so I'm not even sure it's worth doing more than panicking, but if we're going to deal with it, I propose the following patch to avoid even the appearance of a bug. This just does what acpi_parse_lsapic() would have done if the firmware tables were correct. --- arch/ia64/kernel/acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index d5e1917e87157..6ee74e2ef0b92 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c @@ -603,11 +603,13 @@ acpi_boot_init (void) printk(KERN_ERR PREFIX "Can't find FADT\n"); #ifdef CONFIG_SMP - smp_boot_data.cpu_count = available_cpus; if (available_cpus == 0) { printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); + printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id()); + smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id(); available_cpus = 1; /* We've got at least one of these, no? */ } + smp_boot_data.cpu_count = available_cpus; smp_build_cpu_map(); # ifdef CONFIG_NUMA -- 2.53.0