35 #include <linux/module.h>
37 #include <linux/kernel.h>
38 #include <linux/sched.h>
40 #include <linux/string.h>
41 #include <linux/types.h>
47 #include <linux/slab.h>
51 #include <asm/machvec.h>
56 #include <asm/xen/hypervisor.h>
58 #define BAD_MADT_ENTRY(entry, end) ( \
59 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
60 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
62 #define PREFIX "ACPI: "
70 #ifdef CONFIG_IA64_GENERIC
71 static unsigned long __init acpi_find_rsdp(
void)
73 unsigned long rsdp_phys = 0;
79 "v1.0/r0.71 tables no longer supported\n");
84 acpi_get_sysname(
void)
86 unsigned long rsdp_phys;
90 #ifdef CONFIG_INTEL_IOMMU
94 rsdp_phys = acpi_find_rsdp();
97 "ACPI 2.0 RSDP not found, default to \"dig\"\n");
104 "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
112 "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
127 #ifdef CONFIG_INTEL_IOMMU
129 nentries = (hdr->
length -
sizeof(*hdr)) /
131 for (i = 0; i < nentries; i++) {
143 #define ACPI_MAX_PLATFORM_INTERRUPTS 256
162 vector = platform_intr_list[
int_type];
165 "acpi_request_vector(): invalid interrupt type\n");
171 return __va(phys_addr);
188 const unsigned long end)
215 smp_boot_data.cpu_phys_id[available_cpus] =
216 (lsapic->
id << 8) | lsapic->
eid;
252 static unsigned int __initdata acpi_madt_rev;
256 const unsigned long end)
283 if (acpi_madt_rev > 1) {
295 #ifdef CONFIG_HOTPLUG_CPU
296 unsigned int can_cpei_retarget(
void)
306 if (cpe_vector > 0) {
315 unsigned int is_cpu_cpei_target(
unsigned int cpu)
317 unsigned int logical_id;
321 if (logical_id == cpu)
327 void set_cpei_target_cpu(
unsigned int cpu)
340 const unsigned long end)
373 static void __init acpi_madt_oem_check(
char *
oem_id,
char *oem_table_id)
375 if (!
strncmp(oem_id,
"IBM", 3) && (!
strncmp(oem_table_id,
"SERMOW", 6))) {
395 acpi_madt_rev = acpi_madt->header.
revision;
398 #ifdef CONFIG_ITANIUM
407 if (acpi_madt->address)
412 acpi_madt_oem_check(acpi_madt->header.oem_id,
413 acpi_madt->header.oem_table_id);
418 #ifdef CONFIG_ACPI_NUMA
422 #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
424 static int __initdata srat_num_cpus;
426 #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
427 #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
464 if (slit->
header.length != len) {
466 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
467 len, slit->
header.length);
483 "node_cpuid[%ld] is too small, may not be able to use all cpus\n",
487 pxm = get_processor_proximity_domain(pa);
496 cpu_set(srat_num_cpus, early_cpu_possible_map);
505 struct node_memblk_s *
p, *
q, *
pend;
507 pxm = get_memory_proximity_domain(ma);
523 if (paddr < p->start_paddr)
527 for (q = pend - 1; q >=
p; q--)
530 p->start_paddr =
paddr;
539 int i,
j, node_from, node_to;
542 if (srat_num_cpus == 0) {
553 for (i = 0; i < MAX_PXM_DOMAINS; i++) {
554 if (pxm_bit_test(i)) {
575 for_each_possible_early_cpu(i)
592 for (i = 0; i < slit_table->locality_count; i++) {
593 if (!pxm_bit_test(i))
596 for (j = 0; j < slit_table->locality_count; j++) {
597 if (!pxm_bit_test(j))
601 slit_table->entry[i * slit_table->locality_count +
j];
606 printk(
"ACPI 2.0 SLIT locality table:\n");
622 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
625 if (has_8259 && gsi < 16)
639 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
642 if (has_8259 && gsi < 16)
684 "Error parsing MADT - no LAPIC entries\n");
687 if (available_cpus == 0) {
690 smp_boot_data.cpu_phys_id[available_cpus] =
694 smp_boot_data.cpu_count = available_cpus;
724 "Error parsing LAPIC address override entry\n");
736 "Error parsing MADT - no IOSAPIC entries\n");
745 "Error parsing platform interrupt source entry\n");
750 "Error parsing interrupt source overrides entry\n");
765 #ifdef CONFIG_ACPI_NUMA
767 if (srat_num_cpus == 0) {
769 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
770 if (smp_boot_data.cpu_phys_id[cpu] !=
773 smp_boot_data.cpu_phys_id[
cpu];
785 if (has_8259 && gsi < 16)
807 #ifdef CONFIG_ACPI_HOTPLUG_CPU
811 #ifdef CONFIG_ACPI_NUMA
830 int additional_cpus __initdata = -1;
832 static __init int setup_additional_cpus(
char *
s)
840 early_param(
"additional_cpus", setup_additional_cpus);
860 int possible, disabled_cpus;
864 if (additional_cpus == -1) {
865 if (disabled_cpus > 0)
866 additional_cpus = disabled_cpus;
871 possible = available_cpus + additional_cpus;
873 if (possible > nr_cpu_ids)
877 possible,
max((possible - available_cpus), 0));
879 for (i = 0; i < possible; i++)
912 physid = ((lsapic->
id << 8) | (lsapic->
eid));
918 cpumask_complement(&tmp_map, cpu_present_mask);
919 cpu = cpumask_first(&tmp_map);
920 if (cpu >= nr_cpu_ids)
923 acpi_map_cpu2node(handle, cpu, physid);
937 return _acpi_map_lsapic(handle, pcpu);
941 int acpi_unmap_lsapic(
int cpu)
946 #ifdef CONFIG_ACPI_NUMA
956 #ifdef CONFIG_ACPI_NUMA
963 unsigned int gsi_base;
975 obj->
buffer.length <
sizeof(*iosapic)) {
1006 map_iosapic_to_node(gsi_base, node);
1011 acpi_map_iosapics (
void)
1027 #ifdef CONFIG_ACPI_NUMA
1028 acpi_map_iosapic(handle, 0,
NULL,
NULL);