diff -Naur -X /root/bin/dontdiff a/arch/i386/Kconfig b/arch/i386/Kconfig --- a/arch/i386/Kconfig 2003-02-24 19:14:33.000000000 -0800 +++ b/arch/i386/Kconfig 2003-02-24 19:21:44.000000000 -0800 @@ -1515,7 +1515,7 @@ config X86_FIND_SMP_CONFIG bool - depends on X86_LOCAL_APIC || X86_VOYAGER + depends on X86_LOCAL_APIC || X86_VOYAGER && !X86_VISWS default y config X86_MPPARSE diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c --- a/arch/i386/kernel/acpi/boot.c 2003-02-24 19:16:32.000000000 -0800 +++ b/arch/i386/kernel/acpi/boot.c 2003-02-24 19:23:19.000000000 -0800 @@ -25,9 +25,12 @@ #include #include +#include #include #include +#include #include +#include #if defined (CONFIG_X86_LOCAL_APIC) #include @@ -240,7 +243,7 @@ acpi_table_print_madt_entry(header); - /* TBD: Support nimsrc entries? */ + /* TBD: Support nmisrc entries? */ return 0; } @@ -287,6 +290,30 @@ return rsdp_phys; } +#ifdef CONFIG_X86_LOCAL_APIC +#ifdef CONFIG_X86_IO_APIC +static void +acpi_apicid_changed(u8 apic, u8 oldid, u8 newid) +{ + u8 other_apic; + + for (other_apic = 0; other_apic < nr_ioapics; other_apic++) + if (acpi_ioapic_info[other_apic].apic_id == newid) { + acpi_ioapic_info[other_apic].apic_id = oldid; + break; + } + + acpi_ioapic_info[apic].apic_id = newid; +} +#endif + +static struct smp_enumerator acpi_enum = +{ +#ifdef CONFIG_X86_IO_APIC + .apicid_changed = acpi_apicid_changed +#endif +}; +#endif int __init acpi_boot_init (void) @@ -354,21 +381,18 @@ result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic); if (!result) { printk(KERN_ERR PREFIX "No LAPIC entries present\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return -ENODEV; + goto error; } else if (result < 0) { printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return result; + goto error; } #ifndef CONFIG_ACPI_HT_ONLY result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi); if (result < 0) { printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return result; + goto error; } #endif /*!CONFIG_ACPI_HT_ONLY*/ @@ -387,11 +411,11 @@ result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic); if (!result) { printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); - return -ENODEV; + goto error; } else if (result < 0) { printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n"); - return result; + goto error; } /* Build a default routing table for legacy (ISA) interrupts. */ @@ -400,15 +424,13 @@ result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr); if (result < 0) { printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return result; + goto error; } result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src); if (result < 0) { printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); - /* TBD: Cleanup to allow fallback to MPS */ - return result; + goto error; } acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; @@ -421,9 +443,19 @@ #ifdef CONFIG_X86_LOCAL_APIC if (acpi_lapic && acpi_ioapic) { smp_found_config = 1; + smp_enumerator_register(&acpi_enum); clustered_apic_check(); } #endif return 0; + +#ifdef CONFIG_X86_LOCAL_APIC +error: + /* let someone else try SMP enumeration */ + smp_enum_reset(); + + return result; +#endif } + diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c --- a/arch/i386/kernel/apic.c 2003-02-24 19:17:14.000000000 -0800 +++ b/arch/i386/kernel/apic.c 2003-02-24 19:24:14.000000000 -0800 @@ -699,13 +699,12 @@ Dprintk("mapped APIC to %08lx (%08lx)\n", APIC_BASE, apic_phys); /* - * Fetch the APIC ID of the BSP in case we have a - * default configuration (or the MP table is broken). + * Fetch the APIC ID of the BSP */ if (boot_cpu_physical_apicid == -1U) boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); -#ifdef CONFIG_X86_IO_APIC +#ifdef CONFIG_X86_IO_APIC_DONTNEED { unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; int i; diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c --- a/arch/i386/kernel/io_apic.c 2003-02-24 19:15:09.000000000 -0800 +++ b/arch/i386/kernel/io_apic.c 2003-02-24 19:21:49.000000000 -0800 @@ -1452,109 +1452,135 @@ disconnect_bsp_APIC(); } +#ifndef CONFIG_X86_NUMAQ /* - * function to set the IO-APIC physical IDs based on the - * values stored in the MPC table. + * We must ensure apic <--> irq_entries stay in sync. + */ +static void __init +io_apic_swap_ids(int apic, int oldid, int newid) +{ + int other_apic; + + if (oldid == newid) + return; + + /* The MP enumerator code needs to know an apicid is changed */ + smp_enum.apicid_changed(apic, oldid, newid); + + for (other_apic = 0; other_apic < nr_ioapics; other_apic++) + if (mp_ioapics[other_apic].mpc_apicid == newid) { + mp_ioapics[other_apic].mpc_apicid = oldid; + break; + } + + mp_ioapics[apic].mpc_apicid = newid; +} +#endif + +/* + * Every APIC in a system must have a unique ID or we get lots of nice + * 'stuck on smp_invalidate_needed IPI wait' messages. + * According to the MPS spec section 3.6.6, we should assign apicids + * by the following method: + * + * 1) Use the hw value (if no conflict) + * 2) Use the value from the BIOS (if no conflict) + * 3) Pick a free apicid and use that + * + * The P4 platform supports up to 256 APIC IDs on two separate APIC + * buses (one for LAPICs, one for IOAPICs), where predecessors only + * supports up to 16 on one shared APIC bus. + * + * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full + * advantage of new APIC bus architecture. * * by Matt Domsch Tue Dec 21 12:25:05 CST 1999 + * re-arched for MPS/ACPI coexistance by Andy Grover */ - #ifndef CONFIG_X86_NUMAQ -static void __init setup_ioapic_ids_from_mpc(void) +static void __init setup_ioapic_ids (void) { struct IO_APIC_reg_00 reg_00; unsigned long phys_id_present_map; + unsigned long flags; + int unique_id; + int bios_id; int apic; int i; - unsigned char old_id; - unsigned long flags; - - if (acpi_ioapic) - /* This gets done during IOAPIC enumeration for ACPI. */ - return; phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map); - /* - * Set the IOAPIC ID to the value stored in the MPC table. - */ for (apic = 0; apic < nr_ioapics; apic++) { - /* Read the register 0 value */ + bios_id = mp_ioapics[apic].mpc_apicid; + spin_lock_irqsave(&ioapic_lock, flags); *(int *)®_00 = io_apic_read(apic, 0); spin_unlock_irqrestore(&ioapic_lock, flags); - - old_id = mp_ioapics[apic].mpc_apicid; - if (mp_ioapics[apic].mpc_apicid >= APIC_BROADCAST_ID) { - printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", - apic, mp_ioapics[apic].mpc_apicid); - printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", - reg_00.ID); - mp_ioapics[apic].mpc_apicid = reg_00.ID; + /* 1) Try what was in the HW's ID register */ + unique_id = reg_00.ID; + + if (!check_apicid_used(phys_id_present_map, unique_id)) { + Dprintk("Using HW apicid value %d for IOAPIC %d\n", + unique_id, apic); + goto success; } - /* - * Sanity check, is the ID really free? Every APIC in a - * system must have a unique ID or we get lots of nice - * 'stuck on smp_invalidate_needed IPI wait' messages. - */ - if (check_apicid_used(phys_id_present_map, - mp_ioapics[apic].mpc_apicid)) { - printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", - apic, mp_ioapics[apic].mpc_apicid); - for (i = 0; i < 0xf; i++) - if (!(phys_id_present_map & (1 << i))) - break; - if (i >= 0xf) - panic("Max APIC ID exceeded!\n"); - printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", - i); - phys_id_present_map |= 1 << i; - mp_ioapics[apic].mpc_apicid = i; - } else { - printk("Setting %d in the phys_id_present_map\n", mp_ioapics[apic].mpc_apicid); - phys_id_present_map |= 1 << mp_ioapics[apic].mpc_apicid; + /* 2) Try the BIOS apicid value */ + unique_id = bios_id; + + if (unique_id >= APIC_MAX_ID) { + printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, n", + apic, unique_id); + } + else if (!check_apicid_used(phys_id_present_map, unique_id)) { + Dprintk("Using BIOS apicid value %d for IOAPIC %d\n", + unique_id, apic); + goto success; } + /* 3) Get an unassigned apicid and use that */ + for (i = 0; i < APIC_MAX_ID; i++) { + if (!check_apicid_used(phys_id_present_map, i)) + break; + } - /* - * We need to adjust the IRQ routing table - * if the ID changed. - */ - if (old_id != mp_ioapics[apic].mpc_apicid) - for (i = 0; i < mp_irq_entries; i++) - if (mp_irqs[i].mpc_dstapic == old_id) - mp_irqs[i].mpc_dstapic - = mp_ioapics[apic].mpc_apicid; + if (i == APIC_MAX_ID) + panic("Max apic_id exceeded!\n"); - /* - * Read the right value from the MPC table and - * write it into the ID register. - */ - printk(KERN_INFO "...changing IO-APIC physical APIC ID to %d ...", - mp_ioapics[apic].mpc_apicid); + unique_id = i; + + printk(KERN_WARNING "IOAPIC[%d]: apic_ids in HW (%d) and BIOS (%d)" + " already used, using free id %d\n", apic, reg_00.ID, + bios_id, unique_id); +success: + phys_id_present_map |= (1 << unique_id); + + /* sync new apicid with interrupt entries */ + if (unique_id != bios_id) + io_apic_swap_ids(apic, bios_id, unique_id); + } + /* apicids are now properly allocated. Program the HW */ + for (apic = 0; apic < nr_ioapics; apic++) { reg_00.ID = mp_ioapics[apic].mpc_apicid; - spin_lock_irqsave(&ioapic_lock, flags); - io_apic_write(apic, 0, *(int *)®_00); - spin_unlock_irqrestore(&ioapic_lock, flags); - /* - * Sanity check - */ spin_lock_irqsave(&ioapic_lock, flags); + io_apic_write(apic, 0, *(int *)®_00); *(int *)®_00 = io_apic_read(apic, 0); spin_unlock_irqrestore(&ioapic_lock, flags); + + /* Sanity check */ if (reg_00.ID != mp_ioapics[apic].mpc_apicid) - panic("could not set ID!\n"); - else - printk(" ok.\n"); + panic("IOAPIC[%d]: Unable to change apic_id!\n", apic); + + printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", apic, + mp_ioapics[apic].mpc_apicid); } } #else -static void __init setup_ioapic_ids_from_mpc(void) { } +static void __init setup_ioapic_ids(void) { } #endif /* @@ -2054,7 +2080,7 @@ /* * Set up IO-APIC IRQ routing. */ - setup_ioapic_ids_from_mpc(); + setup_ioapic_ids(); sync_Arb_IDs(); setup_IO_APIC_irqs(); init_IO_APIC_traps(); @@ -2082,77 +2108,6 @@ #ifdef CONFIG_ACPI_BOOT -#define IO_APIC_MAX_ID APIC_BROADCAST_ID - -int __init io_apic_get_unique_id (int ioapic, int apic_id) -{ - struct IO_APIC_reg_00 reg_00; - static unsigned long apic_id_map = 0; - unsigned long flags; - int i = 0; - - /* - * The P4 platform supports up to 256 APIC IDs on two separate APIC - * buses (one for LAPICs, one for IOAPICs), where predecessors only - * supports up to 16 on one shared APIC bus. - * - * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full - * advantage of new APIC bus architecture. - */ - - if (!apic_id_map) - apic_id_map = phys_cpu_present_map; - - spin_lock_irqsave(&ioapic_lock, flags); - *(int *)®_00 = io_apic_read(ioapic, 0); - spin_unlock_irqrestore(&ioapic_lock, flags); - - if (apic_id >= IO_APIC_MAX_ID) { - printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " - "%d\n", ioapic, apic_id, reg_00.ID); - apic_id = reg_00.ID; - } - - /* - * Every APIC in a system must have a unique ID or we get lots of nice - * 'stuck on smp_invalidate_needed IPI wait' messages. - */ - if (apic_id_map & (1 << apic_id)) { - - for (i = 0; i < IO_APIC_MAX_ID; i++) { - if (!(apic_id_map & (1 << i))) - break; - } - - if (i == IO_APIC_MAX_ID) - panic("Max apic_id exceeded!\n"); - - printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " - "trying %d\n", ioapic, apic_id, i); - - apic_id = i; - } - - apic_id_map |= (1 << apic_id); - - if (reg_00.ID != apic_id) { - reg_00.ID = apic_id; - - spin_lock_irqsave(&ioapic_lock, flags); - io_apic_write(ioapic, 0, *(int *)®_00); - *(int *)®_00 = io_apic_read(ioapic, 0); - spin_unlock_irqrestore(&ioapic_lock, flags); - - /* Sanity check */ - if (reg_00.ID != apic_id) - panic("IOAPIC[%d]: Unable change apic_id!\n", ioapic); - } - - printk(KERN_INFO "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); - - return apic_id; -} - int __init io_apic_get_version (int ioapic) { diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile --- a/arch/i386/kernel/Makefile 2003-02-24 19:14:35.000000000 -0800 +++ b/arch/i386/kernel/Makefile 2003-02-24 19:21:45.000000000 -0800 @@ -18,9 +18,9 @@ obj-$(CONFIG_X86_CPUID) += cpuid.o obj-$(CONFIG_MICROCODE) += microcode.o obj-$(CONFIG_APM) += apm.o -obj-$(CONFIG_X86_SMP) += smp.o smpboot.o +obj-$(CONFIG_X86_SMP) += smp.o smpboot.o smpenum.o obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o -obj-$(CONFIG_X86_MPPARSE) += mpparse.o +obj-$(CONFIG_X86_MPPARSE) += mpparse.o obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o suspend_asm.o diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c --- a/arch/i386/kernel/mpparse.c 2003-02-24 19:14:53.000000000 -0800 +++ b/arch/i386/kernel/mpparse.c 2003-02-24 19:21:48.000000000 -0800 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -35,50 +36,12 @@ #include /* Have we found an MP table */ -int smp_found_config; - -/* - * Various Linux-internal data structures created from the - * MP-table. - */ -int apic_version [MAX_APICS]; -int mp_bus_id_to_type [MAX_MP_BUSSES]; -int mp_bus_id_to_node [MAX_MP_BUSSES]; -int mp_bus_id_to_local [MAX_MP_BUSSES]; -int quad_local_to_mp_bus_id [NR_CPUS/4][4]; -int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; -int mp_current_pci_id; - -/* I/O APIC entries */ -struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; - -/* # of MP IRQ source entries */ -struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; +int mps_found_config; /* MP IRQ source entries */ int mp_irq_entries; -int nr_ioapics; - int pic_mode; -unsigned long mp_lapic_addr; - -/* Processor that is doing the boot up */ -unsigned int boot_cpu_physical_apicid = -1U; -unsigned int boot_cpu_logical_apicid = -1U; -/* Internal processor count */ -static unsigned int __initdata num_processors; - -/* Bitmask of physically existing CPUs */ -unsigned long phys_cpu_present_map; - -int x86_summit = 0; -u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; - -/* - * Intel MP BIOS table parsing routines: - */ - /* * Checksum an MP configuration block. @@ -94,129 +57,46 @@ return sum & 0xFF; } -/* - * Have to match translation table entries to main table entries by counter - * hence the mpc_record variable .... can't see a less disgusting way of - * doing this .... - */ - -static int mpc_record; -static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata; +extern int mps_record; +extern struct mps_config_translation *translation_table[MAX_MPC_ENTRY]; -void __init MP_processor_info (struct mpc_config_processor *m) +static void __init mps_processor_info (struct mps_config_processor *m) { - int ver, apicid; - - if (!(m->mpc_cpuflag & CPU_ENABLED)) - return; - - apicid = mpc_apic_id(m, translation_table[mpc_record]->trans_quad); - - if (m->mpc_featureflag&(1<<0)) - Dprintk(" Floating point unit present.\n"); - if (m->mpc_featureflag&(1<<7)) - Dprintk(" Machine Exception supported.\n"); - if (m->mpc_featureflag&(1<<8)) - Dprintk(" 64 bit compare & exchange supported.\n"); - if (m->mpc_featureflag&(1<<9)) - Dprintk(" Internal APIC present.\n"); - if (m->mpc_featureflag&(1<<11)) - Dprintk(" SEP present.\n"); - if (m->mpc_featureflag&(1<<12)) - Dprintk(" MTRR present.\n"); - if (m->mpc_featureflag&(1<<13)) - Dprintk(" PGE present.\n"); - if (m->mpc_featureflag&(1<<14)) - Dprintk(" MCA present.\n"); - if (m->mpc_featureflag&(1<<15)) - Dprintk(" CMOV present.\n"); - if (m->mpc_featureflag&(1<<16)) - Dprintk(" PAT present.\n"); - if (m->mpc_featureflag&(1<<17)) - Dprintk(" PSE present.\n"); - if (m->mpc_featureflag&(1<<18)) - Dprintk(" PSN present.\n"); - if (m->mpc_featureflag&(1<<19)) - Dprintk(" Cache Line Flush Instruction present.\n"); - /* 20 Reserved */ - if (m->mpc_featureflag&(1<<21)) - Dprintk(" Debug Trace and EMON Store present.\n"); - if (m->mpc_featureflag&(1<<22)) - Dprintk(" ACPI Thermal Throttle Registers present.\n"); - if (m->mpc_featureflag&(1<<23)) - Dprintk(" MMX present.\n"); - if (m->mpc_featureflag&(1<<24)) - Dprintk(" FXSR present.\n"); - if (m->mpc_featureflag&(1<<25)) - Dprintk(" XMM present.\n"); - if (m->mpc_featureflag&(1<<26)) - Dprintk(" Willamette New Instructions present.\n"); - if (m->mpc_featureflag&(1<<27)) - Dprintk(" Self Snoop present.\n"); - if (m->mpc_featureflag&(1<<28)) - Dprintk(" HT present.\n"); - if (m->mpc_featureflag&(1<<29)) - Dprintk(" Thermal Monitor present.\n"); - /* 30, 31 Reserved */ - - - if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { - Dprintk(" Bootup CPU\n"); - boot_cpu_physical_apicid = m->mpc_apicid; - boot_cpu_logical_apicid = apicid; - } - - num_processors++; - - if (m->mpc_apicid > MAX_APICS) { - printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n", - m->mpc_apicid, MAX_APICS); - --num_processors; - return; - } - ver = m->mpc_apicver; - - phys_cpu_present_map |= apicid_to_cpu_present(apicid); - - /* - * Validate version - */ - if (ver == 0x0) { - printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", m->mpc_apicid); - ver = 0x10; - } - apic_version[m->mpc_apicid] = ver; - bios_cpu_apicid[num_processors - 1] = m->mpc_apicid; + if (m->mpc_cpuflag & CPU_ENABLED) + smp_processor_register(m->mpc_apicid, m->mpc_apicver); } -static void __init MP_bus_info (struct mpc_config_bus *m) + +static void __init mps_bus_info (struct mps_config_bus *m) { char str[7]; + unsigned char bustype = MP_BUS_UNKNOWN; memcpy(str, m->mpc_bustype, 6); str[6] = 0; - mpc_oem_bus_info(m, str, translation_table[mpc_record]); + mpc_oem_bus_info(m, str, translation_table[mps_record]); if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) { - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; + bustype = MP_BUS_ISA; } else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) { - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA; + bustype = MP_BUS_EISA; } else if (strncmp(str, BUSTYPE_PCI, sizeof(BUSTYPE_PCI)-1) == 0) { - mpc_oem_pci_bus(m, translation_table[mpc_record]); - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; - mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; - mp_current_pci_id++; + mpc_oem_pci_bus(m, translation_table[mps_record]); + bustype = MP_BUS_PCI; } else if (strncmp(str, BUSTYPE_MCA, sizeof(BUSTYPE_MCA)-1) == 0) { - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA; + bustype = MP_BUS_MCA; } else if (strncmp(str, BUSTYPE_NEC98, sizeof(BUSTYPE_NEC98)-1) == 0) { - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_NEC98; + bustype = MP_BUS_NEC98; } else { printk(KERN_WARNING "Unknown bustype %s - ignoring\n", str); } + + if (bustype != MP_BUS_UNKNOWN) + smp_bus_register(bustype, m->mpc_busid); } -static void __init MP_ioapic_info (struct mpc_config_ioapic *m) +static void __init mps_ioapic_info (struct mps_config_ioapic *m) { if (!(m->mpc_flags & MPC_APIC_USABLE)) return; @@ -233,11 +113,11 @@ " found in MP table, skipping!\n"); return; } - mp_ioapics[nr_ioapics] = *m; - nr_ioapics++; + + smp_ioapic_register(m->mpc_apicid, m->mpc_apicaddr); } -static void __init MP_intsrc_info (struct mpc_config_intsrc *m) +static void __init MP_intsrc_info (struct mps_config_intsrc *m) { mp_irqs [mp_irq_entries] = *m; Dprintk("Int: type %d, pol %d, trig %d, bus %d," @@ -249,7 +129,7 @@ panic("Max # of irq sources exceeded!!\n"); } -static void __init MP_lintsrc_info (struct mpc_config_lintsrc *m) +static void __init MP_lintsrc_info (struct mps_config_lintsrc *m) { Dprintk("Lint: type %d, pol %d, trig %d, bus %d," " IRQ %02x, APIC ID %x, APIC LINT %02x\n", @@ -272,14 +152,14 @@ } #ifdef CONFIG_X86_NUMAQ -static void __init MP_translation_info (struct mpc_config_translation *m) +static void __init MP_translation_info (struct mps_config_translation *m) { - printk(KERN_INFO "Translation: record %d, type %d, quad %d, global %d, local %d\n", mpc_record, m->trans_type, m->trans_quad, m->trans_global, m->trans_local); + printk(KERN_INFO "Translation: record %d, type %d, quad %d, global %d, local %d\n", mps_record, m->trans_type, m->trans_quad, m->trans_global, m->trans_local); - if (mpc_record >= MAX_MPC_ENTRY) + if (mps_record >= MAX_MPC_ENTRY) printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); else - translation_table[mpc_record] = m; /* stash this for later */ + translation_table[mps_record] = m; /* stash this for later */ if (m->trans_quad+1 > numnodes) numnodes = m->trans_quad+1; } @@ -288,13 +168,13 @@ * Read/parse the MPC oem tables */ -static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, \ +static void __init mps_read_mpc_oem(struct mp_config_oemtable *oemtable, \ unsigned short oemsize) { int count = sizeof (*oemtable); /* the header size */ unsigned char *oemptr = ((unsigned char *)oemtable)+count; - mpc_record = 0; + mps_record = 0; printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n", oemtable); if (memcmp(oemtable->oem_signature,MPC_OEM_SIGNATURE,4)) { @@ -314,12 +194,12 @@ switch (*oemptr) { case MP_TRANSLATION: { - struct mpc_config_translation *m= - (struct mpc_config_translation *)oemptr; + struct mps_config_translation *m= + (struct mps_config_translation *)oemptr; MP_translation_info(m); oemptr += sizeof(*m); count += sizeof(*m); - ++mpc_record; + ++mps_record; break; } default: @@ -336,12 +216,13 @@ * Read/parse the MPC */ -static int __init smp_read_mpc(struct mp_config_table *mpc) +static int __init mps_parse_table(struct mp_config_table *mpc) { char str[16]; char oem[10]; int count=sizeof(*mpc); unsigned char *mpt=((unsigned char *)mpc)+count; + int found_processor = 0; if (memcmp(mpc->mpc_signature,MPC_SIGNATURE,4)) { panic("SMP mptable: bad signature [%c%c%c%c]!\n", @@ -377,51 +258,52 @@ printk("APIC at: 0x%lX\n",mpc->mpc_lapic); /* - * Save the local APIC address (it might be non-default) -- but only - * if we're not using ACPI. + * Save the local APIC address (it might be non-default) */ - if (!acpi_lapic) - mp_lapic_addr = mpc->mpc_lapic; + mp_lapic_addr = mpc->mpc_lapic; /* * Now process the configuration blocks. */ - mpc_record = 0; + mps_record = 0; while (count < mpc->mpc_length) { switch(*mpt) { case MP_PROCESSOR: { - struct mpc_config_processor *m= - (struct mpc_config_processor *)mpt; - /* ACPI may have already provided this data */ - if (!acpi_lapic) - MP_processor_info(m); + struct mps_config_processor *m= + (struct mps_config_processor *)mpt; + + if (!acpi_lapic) { + mps_processor_info(m); + found_processor++; + } + mpt += sizeof(*m); count += sizeof(*m); break; } case MP_BUS: { - struct mpc_config_bus *m= - (struct mpc_config_bus *)mpt; - MP_bus_info(m); + struct mps_config_bus *m= + (struct mps_config_bus *)mpt; + mps_bus_info(m); mpt += sizeof(*m); count += sizeof(*m); break; } case MP_IOAPIC: { - struct mpc_config_ioapic *m= - (struct mpc_config_ioapic *)mpt; - MP_ioapic_info(m); + struct mps_config_ioapic *m= + (struct mps_config_ioapic *)mpt; + mps_ioapic_info(m); mpt+=sizeof(*m); count+=sizeof(*m); break; } case MP_INTSRC: { - struct mpc_config_intsrc *m= - (struct mpc_config_intsrc *)mpt; + struct mps_config_intsrc *m= + (struct mps_config_intsrc *)mpt; MP_intsrc_info(m); mpt+=sizeof(*m); @@ -430,8 +312,8 @@ } case MP_LINTSRC: { - struct mpc_config_lintsrc *m= - (struct mpc_config_lintsrc *)mpt; + struct mps_config_lintsrc *m= + (struct mps_config_lintsrc *)mpt; MP_lintsrc_info(m); mpt+=sizeof(*m); count+=sizeof(*m); @@ -443,12 +325,12 @@ break; } } - ++mpc_record; + ++mps_record; } clustered_apic_check(); - if (!num_processors) + if (!found_processor) printk(KERN_ERR "SMP mptable: no processors registered!\n"); - return num_processors; + return found_processor; } static int __init ELCR_trigger(unsigned int irq) @@ -461,7 +343,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type) { - struct mpc_config_intsrc intsrc; + struct mps_config_intsrc intsrc; int i; int ELCR_fallback = 0; @@ -527,10 +409,8 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) { - struct mpc_config_processor processor; - struct mpc_config_bus bus; - struct mpc_config_ioapic ioapic; - struct mpc_config_lintsrc lintsrc; + struct mps_config_bus bus; + struct mps_config_lintsrc lintsrc; int linttypes[2] = { mp_ExtINT, mp_NMI }; int i; @@ -542,19 +422,9 @@ /* * 2 CPUs, numbered 0 & 1. */ - processor.mpc_type = MP_PROCESSOR; /* Either an integrated APIC or a discrete 82489DX. */ - processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; - processor.mpc_cpuflag = CPU_ENABLED; - processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | - (boot_cpu_data.x86_model << 4) | - boot_cpu_data.x86_mask; - processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; - processor.mpc_reserved[0] = 0; - processor.mpc_reserved[1] = 0; for (i = 0; i < 2; i++) { - processor.mpc_apicid = i; - MP_processor_info(&processor); + smp_processor_register(i, (mpc_default_type > 4 ? 0x10 : 0x01)); } bus.mpc_type = MP_BUS; @@ -578,19 +448,14 @@ case 7: memcpy(bus.mpc_bustype, "MCA ", 6); } - MP_bus_info(&bus); + mps_bus_info(&bus); if (mpc_default_type > 4) { bus.mpc_busid = 1; memcpy(bus.mpc_bustype, "PCI ", 6); - MP_bus_info(&bus); + mps_bus_info(&bus); } - ioapic.mpc_type = MP_IOAPIC; - ioapic.mpc_apicid = 2; - ioapic.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; - ioapic.mpc_flags = MPC_APIC_USABLE; - ioapic.mpc_apicaddr = 0xFEC00000; - MP_ioapic_info(&ioapic); + smp_ioapic_register(2, 0xFEC00000); /* * We set up most of the low 16 IO-APIC pins according to MPS rules. @@ -611,10 +476,28 @@ static struct intel_mp_floating *mpf_found; +void mps_apicid_changed(u8 apic, u8 oldid, u8 newid) +{ + int i; + + for (i = 0; i < mp_irq_entries; i++) { + if (mp_irqs[i].mpc_dstapic == oldid) + mp_irqs[i].mpc_dstapic = newid; + else if (mp_irqs[i].mpc_dstapic == newid) + mp_irqs[i].mpc_dstapic = oldid; + } +} + + +static struct smp_enumerator mps_enum = +{ + .apicid_changed = mps_apicid_changed +}; + /* * Scan the memory blocks for an SMP configuration block. */ -void __init get_smp_config (void) +void __init get_mps_config (void) { struct intel_mp_floating *mpf = mpf_found; @@ -624,11 +507,7 @@ * ACPI supports both logical (e.g. Hyper-Threading) and physical * processors, where MPS only supports physical. */ - if (acpi_lapic && acpi_ioapic) { - printk(KERN_INFO "Using ACPI (MADT) for SMP configuration information\n"); - return; - } - else if (acpi_lapic) + if (acpi_lapic) printk(KERN_INFO "Using ACPI for processor (LAPIC) configuration information\n"); printk("KERN_INFO Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification); @@ -654,8 +533,9 @@ * Read the physical hardware table. Anything here will * override the defaults. */ - if (!smp_read_mpc((void *)mpf->mpf_physptr)) { + if (!mps_parse_table((void *)mpf->mpf_physptr)) { smp_found_config = 0; + mps_found_config = 0; printk(KERN_ERR "BIOS bug, MP table errors detected!...\n"); printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n"); return; @@ -666,14 +546,14 @@ * ISA defaults and hope it will work. */ if (!mp_irq_entries) { - struct mpc_config_bus bus; + struct mps_config_bus bus; printk(KERN_ERR "BIOS bug, no explicit IRQ entries, using default mptable. (tell your hw vendor)\n"); bus.mpc_type = MP_BUS; bus.mpc_busid = 0; memcpy(bus.mpc_bustype, "ISA ", 6); - MP_bus_info(&bus); + mps_bus_info(&bus); construct_default_ioirq_mptable(0); } @@ -681,13 +561,14 @@ } else BUG(); - printk(KERN_INFO "Processors: %d\n", num_processors); /* * Only use the first configuration found. */ + smp_enumerator_register(&mps_enum); + smp_found_config = 1; } -static int __init smp_scan_config (unsigned long base, unsigned long length) +static int __init mps_scan_config (unsigned long base, unsigned long length) { unsigned long *bp = phys_to_virt(base); struct intel_mp_floating *mpf; @@ -704,7 +585,7 @@ ((mpf->mpf_specification == 1) || (mpf->mpf_specification == 4)) ) { - smp_found_config = 1; + mps_found_config = 1; printk(KERN_INFO "found SMP MP-table at %08lx\n", virt_to_phys(mpf)); reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE); @@ -719,7 +600,7 @@ return 0; } -void __init find_smp_config (void) +void __init find_mps_config (void) { unsigned int address; @@ -731,9 +612,9 @@ * 2) Scan the top 1K of base RAM * 3) Scan the 64K of bios */ - if (smp_scan_config(0x0,0x400) || - smp_scan_config(639*0x400,0x400) || - smp_scan_config(0xF0000,0x10000)) + if (mps_scan_config(0x0,0x400) || + mps_scan_config(639*0x400,0x400) || + mps_scan_config(0xF0000,0x10000)) return; /* * If it is an SMP machine we should know now, unless the @@ -754,7 +635,7 @@ address = *(unsigned short *)phys_to_virt(0x40E); address <<= 4; - smp_scan_config(address, 0x400); + mps_scan_config(address, 0x400); } @@ -768,13 +649,6 @@ u64 address) { mp_lapic_addr = (unsigned long) address; - - set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); - - if (boot_cpu_physical_apicid == -1U) - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); - - Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); } @@ -782,8 +656,8 @@ u8 id, u8 enabled) { - struct mpc_config_processor processor; - int boot_cpu = 0; + if (!enabled) + return; if (id >= MAX_APICS) { printk(KERN_WARNING "Processor #%d invalid (max %d)\n", @@ -791,21 +665,7 @@ return; } - if (id == boot_cpu_physical_apicid) - boot_cpu = 1; - - processor.mpc_type = MP_PROCESSOR; - processor.mpc_apicid = id; - processor.mpc_apicver = 0x10; /* TBD: lapic version */ - processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); - processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); - processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | - (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask; - processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; - processor.mpc_reserved[0] = 0; - processor.mpc_reserved[1] = 0; - - MP_processor_info(&processor); + smp_processor_register(id, 0x10); } #ifdef CONFIG_X86_IO_APIC @@ -813,13 +673,7 @@ #define MP_ISA_BUS 0 #define MP_MAX_IOAPIC_PIN 127 -struct mp_ioapic_routing { - int apic_id; - int irq_start; - int irq_end; - u32 pin_programmed[4]; -} mp_ioapic_routing[MAX_IO_APICS]; - +struct acpi_ioapic_info acpi_ioapic_info[MAX_IO_APICS]; static int __init mp_find_ioapic ( int irq) @@ -828,23 +682,23 @@ /* Find the IOAPIC that manages this IRQ. */ for (i = 0; i < nr_ioapics; i++) { - if ((irq >= mp_ioapic_routing[i].irq_start) - && (irq <= mp_ioapic_routing[i].irq_end)) + if ((irq >= acpi_ioapic_info[i].irq_start) + && (irq <= acpi_ioapic_info[i].irq_end)) return i; } - printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d/n", irq); + printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d\n", irq); return -1; } - + void __init mp_register_ioapic ( u8 id, u32 address, u32 irq_base) { - int idx = 0; + static int idx; if (nr_ioapics >= MAX_IO_APICS) { printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " @@ -857,32 +711,22 @@ return; } - idx = nr_ioapics++; + smp_ioapic_register(id, address); - mp_ioapics[idx].mpc_type = MP_IOAPIC; - mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE; - mp_ioapics[idx].mpc_apicaddr = address; - - set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); - mp_ioapics[idx].mpc_apicid = io_apic_get_unique_id(idx, id); - mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); - /* * Build basic IRQ lookup table to facilitate irq->io_apic lookups * and to prevent reprogramming of IOAPIC pins (PCI IRQs). */ - mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mpc_apicid; - mp_ioapic_routing[idx].irq_start = irq_base; - mp_ioapic_routing[idx].irq_end = irq_base + + acpi_ioapic_info[idx].apic_id = id; + acpi_ioapic_info[idx].irq_start = irq_base; + acpi_ioapic_info[idx].irq_end = irq_base + io_apic_get_redir_entries(idx); - printk("IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, " - "IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, - mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, - mp_ioapic_routing[idx].irq_start, - mp_ioapic_routing[idx].irq_end); - - return; + printk("IOAPIC[%d]: address 0x%x, " + "IRQ %d-%d\n", idx, address, + acpi_ioapic_info[idx].irq_start, + acpi_ioapic_info[idx].irq_end); + idx++; } @@ -892,7 +736,7 @@ u8 trigger, u32 global_irq) { - struct mpc_config_intsrc intsrc; + struct mps_config_intsrc intsrc; int i = 0; int found = 0; int ioapic = -1; @@ -904,7 +748,7 @@ ioapic = mp_find_ioapic(global_irq); if (ioapic < 0) return; - pin = global_irq - mp_ioapic_routing[ioapic].irq_start; + pin = global_irq - acpi_ioapic_info[ioapic].irq_start; /* * TBD: This check is for faulty timer entries, where the override @@ -944,14 +788,12 @@ if (++mp_irq_entries == MAX_IRQ_SOURCES) panic("Max # of irq sources exceeded!\n"); } - - return; } void __init mp_config_acpi_legacy_irqs (void) { - struct mpc_config_intsrc intsrc; + struct mps_config_intsrc intsrc; int i = 0; int ioapic = -1; @@ -965,8 +807,10 @@ * Locate the IOAPIC that manages the ISA IRQs (0-15). */ ioapic = mp_find_ioapic(0); - if (ioapic < 0) + if (ioapic < 0) { + Dprintk("ACPI: Could not find IRQ 0 IOAPIC!\n"); return; + } intsrc.mpc_type = MP_INTSRC; intsrc.mpc_irqflag = 0; /* Conforming */ @@ -1048,7 +892,7 @@ ioapic = mp_find_ioapic(irq); - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = irq - acpi_ioapic_info[ioapic].irq_start; io_apic_set_pci_routing(ioapic, ioapic_pin, irq); } @@ -1079,9 +923,11 @@ irq = entry->link.index; ioapic = mp_find_ioapic(irq); - if (ioapic < 0) + if (ioapic < 0) { + Dprintk("ACPI: Could not find IOAPIC for irq %d!\n", irq); continue; - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + } + ioapic_pin = irq - acpi_ioapic_info[ioapic].irq_start; /* * Avoid pin reprogramming. PRTs typically include entries @@ -1092,18 +938,18 @@ idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32); if (idx > 3) { printk(KERN_ERR "Invalid reference to IOAPIC pin " - "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, + "%d-%d\n", acpi_ioapic_info[ioapic].apic_id, ioapic_pin); continue; } - if ((1<irq = irq; continue; } - mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<irq = irq; @@ -1111,7 +957,7 @@ printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", entry->id.segment, entry->id.bus, entry->id.device, ('A' + entry->pin), - mp_ioapic_routing[ioapic].apic_id, ioapic_pin, + acpi_ioapic_info[ioapic].apic_id, ioapic_pin, entry->irq); } diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c 2003-02-24 19:15:23.000000000 -0800 +++ b/arch/i386/kernel/setup.c 2003-02-24 19:21:55.000000000 -0800 @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -761,12 +762,6 @@ */ acpi_reserve_bootmem(); #endif -#ifdef CONFIG_X86_FIND_SMP_CONFIG - /* - * Find and reserve possible boot-time SMP configuration: - */ - find_smp_config(); -#endif #ifdef CONFIG_BLK_DEV_INITRD if (LOADER_TYPE && INITRD_START) { @@ -894,6 +889,7 @@ smp_alloc_memory(); /* AP processor realmode stacks in low memory*/ #endif paging_init(); + #ifdef CONFIG_ACPI_BOOT /* * Parse the ACPI tables for possible boot-time SMP configuration. @@ -901,9 +897,15 @@ if (!acpi_disabled) acpi_boot_init(); #endif -#ifdef CONFIG_X86_LOCAL_APIC - if (smp_found_config) - get_smp_config(); +#ifdef CONFIG_X86_FIND_MPS_CONFIG + /* + * Find and reserve possible boot-time SMP configuration: + */ + if (!smp_found_config) { + find_mps_config(); + if (mps_found_config) + get_mps_config(); + } #endif register_memory(max_low_pfn); diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/smpenum.c b/arch/i386/kernel/smpenum.c --- a/arch/i386/kernel/smpenum.c 1969-12-31 16:00:00.000000000 -0800 +++ b/arch/i386/kernel/smpenum.c 2003-02-24 19:23:25.000000000 -0800 @@ -0,0 +1,157 @@ +/* + * Generic SMP enumeration code + * + * (c) 2003 Andrew Grover + * + */ + +#include +#include +#include +#include +#include + +#include + +/* ---------- EXPORTED VARS ---------- */ +/* + * Various Linux-internal data structures created from the + * MP-table. + */ +int apic_version [MAX_APICS]; + +/* Processor that is doing the boot up */ +unsigned int boot_cpu_physical_apicid = -1U; + +/* Bitmask of physically existing CPUs */ +unsigned long phys_cpu_present_map; + +int x86_summit = 0; +u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; + +/* I/O APIC entries */ +int nr_ioapics; +struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; + +/* # of MP IRQ source entries */ +struct mps_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; + +unsigned long mp_lapic_addr; + +int smp_found_config; + +/* + * Various Linux-internal data structures created from the + * MP-table. + */ +int mp_bus_id_to_type [MAX_MP_BUSSES]; +int mp_bus_id_to_node [MAX_MP_BUSSES]; +int mp_bus_id_to_local [MAX_MP_BUSSES]; +int quad_local_to_mp_bus_id [NR_CPUS/4][4]; +int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; +int mp_current_pci_id; + +struct smp_enumerator smp_enum; + +void __init smp_enumerator_register(struct smp_enumerator *new_enum) +{ + smp_enum = *new_enum; +} + +/* + * Have to match translation table entries to main table entries by counter + * hence the mps_record variable .... can't see a less disgusting way of + * doing this .... + */ +/* N.B. This is here temporarily until we can come up with a good way to put it in + a numa-only .c file - ASG */ + +int mps_record; +struct mps_config_translation *translation_table[MAX_MPC_ENTRY] __initdata; + +/* -- CODE -- */ + +static unsigned int num_processors; + +void __init smp_processor_register (u8 apicid, u8 apicver) +{ + int ver; + int actual_apicid; + + actual_apicid = mpc_apic_id(apicid, apicver, translation_table[mps_record]->trans_quad); + + if (actual_apicid > MAX_APICS) { + printk("Processor #%d INVALID. (Max ID: %d).\n", + actual_apicid, MAX_APICS); + return; + } + ver = apicver; + + phys_cpu_present_map |= apicid_to_cpu_present(actual_apicid); + + /* + * Validate version + */ + if (ver == 0x0) { + printk("BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", actual_apicid); + ver = 0x10; + } + apic_version[actual_apicid] = ver; + Dprintk("Processor %d found, apicid %d\n", num_processors, actual_apicid); + + num_processors++; +} + +void __init smp_bus_register (unsigned char type, unsigned char busid) +{ + mp_bus_id_to_type[busid] = type; + + if (type == MP_BUS_PCI) { + mp_bus_id_to_pci_bus[busid] = mp_current_pci_id; + mp_current_pci_id++; + } +} + +void __init smp_ioapic_register (u8 bios_apicid, unsigned long apicaddr) +{ + /* + * We must set apicaddr first because we may need to read and write + * determine the apicid. + * mpc_apicaddr remains the phys addr because io_apic_{read,write}() does + * the fix_to_virt for us. + */ +#ifdef CONFIG_X86_IO_APIC + set_fixmap_nocache(FIX_IO_APIC_BASE_0 + nr_ioapics, apicaddr); +#endif + mp_ioapics[nr_ioapics].mpc_apicaddr = apicaddr; + + Dprintk("mapped IOAPIC to %08lx (from %08lx)\n", + __fix_to_virt(nr_ioapics), apicaddr); + + /* we will ensure these are set up properly in setup_ioapic_ids() */ + mp_ioapics[nr_ioapics].mpc_apicid = bios_apicid; + + nr_ioapics++; +} + +/* + * Reset smpenum variables to allow fallback to different enum method + */ +void __init smp_enum_reset(void) +{ + smp_found_config = 0; + + /* reset lapic data */ + num_processors = 0; + phys_cpu_present_map = 0; + memset(apic_version, 0, sizeof (apic_version)); + + /* reset ioapic data */ + nr_ioapics = 0; + memset(mp_ioapics, 0, sizeof (mp_ioapics)); + + /* reset bus data */ + memset(mp_bus_id_to_type, 0, sizeof (mp_bus_id_to_type)); + mp_current_pci_id = 0; +} + diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c --- a/arch/i386/kernel/time.c 2003-02-24 19:15:24.000000000 -0800 +++ b/arch/i386/kernel/time.c 2003-02-24 19:21:55.000000000 -0800 @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include diff -Naur -X /root/bin/dontdiff a/arch/i386/kernel/timers/timer_pit.c b/arch/i386/kernel/timers/timer_pit.c --- a/arch/i386/kernel/timers/timer_pit.c 2003-02-24 19:16:30.000000000 -0800 +++ b/arch/i386/kernel/timers/timer_pit.c 2003-02-24 19:23:16.000000000 -0800 @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff -Naur -X /root/bin/dontdiff a/arch/i386/mach-visws/mpparse.c b/arch/i386/mach-visws/mpparse.c --- a/arch/i386/mach-visws/mpparse.c 2003-02-24 19:14:45.000000000 -0800 +++ b/arch/i386/mach-visws/mpparse.c 2003-02-24 19:21:46.000000000 -0800 @@ -6,49 +6,15 @@ #include #include #include +#include #include #include "cobalt.h" #include "mach_apic.h" -/* Have we found an MP table */ -int smp_found_config; - -/* - * Various Linux-internal data structures created from the - * MP-table. - */ -int apic_version [MAX_APICS]; -int mp_bus_id_to_type [MAX_MP_BUSSES]; -int mp_bus_id_to_node [MAX_MP_BUSSES]; -int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; -int mp_current_pci_id; - -/* I/O APIC entries */ -struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; - -/* # of MP IRQ source entries */ -struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; - -/* MP IRQ source entries */ -int mp_irq_entries; - -int nr_ioapics; - int pic_mode; -unsigned long mp_lapic_addr; - -/* Processor that is doing the boot up */ -unsigned int boot_cpu_physical_apicid = -1U; -unsigned int boot_cpu_logical_apicid = -1U; - -/* Internal processor count */ -static unsigned int num_processors; - -/* Bitmask of physically existing CPUs */ -unsigned long phys_cpu_present_map; -u8 raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS - 1] = BAD_APICID }; +int mps_found_config; /* * The Visual Workstation is Intel MP compliant in the hardware @@ -56,53 +22,17 @@ * No problem for Linux. */ -void __init MP_processor_info (struct mpc_config_processor *m) +void __init find_mps_config(void) { - int ver, logical_apicid; - - if (!(m->mpc_cpuflag & CPU_ENABLED)) - return; - - logical_apicid = m->mpc_apicid; - printk(KERN_INFO "%sCPU #%d %ld:%ld APIC version %d\n", - m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "", - m->mpc_apicid, - (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, - (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, - m->mpc_apicver); - - if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { - boot_cpu_physical_apicid = m->mpc_apicid; - boot_cpu_logical_apicid = logical_apicid; - } - - num_processors++; - - if (m->mpc_apicid > MAX_APICS) { - printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", - m->mpc_apicid, MAX_APICS); - --num_processors; - return; - } - ver = m->mpc_apicver; + unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS)); - phys_cpu_present_map |= apicid_to_cpu_present(m->mpc_apicid); - /* - * Validate version - */ - if (ver == 0x0) { - printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! " - "fixing up to 0x10. (tell your hw vendor)\n", - m->mpc_apicid); - ver = 0x10; - } - apic_version[m->mpc_apicid] = ver; - raw_phys_apicid[num_processors - 1] = m->mpc_apicid; + if (ncpus) + mps_found_config = 1; } -void __init find_smp_config(void) +void __init get_mps_config (void) { - struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS); + struct mps_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS); unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS)); if (ncpus > CO_CPU_MAX) { @@ -112,13 +42,10 @@ ncpus = CO_CPU_MAX; } - smp_found_config = 1; - while (ncpus--) - MP_processor_info(mp++); + while (ncpus--) { + smp_processor_register(mp->mpc_apicid, mp->mpc_apicver); + } mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; } -void __init get_smp_config (void) -{ -} diff -Naur -X /root/bin/dontdiff a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c --- a/arch/i386/mm/discontig.c 2003-02-24 19:15:35.000000000 -0800 +++ b/arch/i386/mm/discontig.c 2003-02-24 19:21:58.000000000 -0800 @@ -249,7 +249,7 @@ /* * Find and reserve possible boot-time SMP configuration: */ - find_smp_config(); + find_mps_config(); /*insert other nodes into pgdat_list*/ for (nid = 1; nid < numnodes; nid++){ diff -Naur -X /root/bin/dontdiff a/drivers/acpi/bus.c b/drivers/acpi/bus.c --- a/drivers/acpi/bus.c 2003-02-24 19:15:40.000000000 -0800 +++ b/drivers/acpi/bus.c 2003-02-24 19:22:00.000000000 -0800 @@ -30,6 +30,7 @@ #include #include #ifdef CONFIG_X86 +#include #include #endif #include diff -Naur -X /root/bin/dontdiff a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig --- a/drivers/acpi/Kconfig 2003-02-24 19:17:13.000000000 -0800 +++ b/drivers/acpi/Kconfig 2003-02-24 19:24:12.000000000 -0800 @@ -6,6 +6,7 @@ config ACPI bool "ACPI Support" if X86 + depends on !X86_VISWS default y if IA64 && (!IA64_HP_SIM || IA64_SGI_SN) ---help--- Advanced Configuration and Power Interface (ACPI) support for diff -Naur -X /root/bin/dontdiff a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c --- a/drivers/acpi/pci_irq.c 2003-02-24 19:15:23.000000000 -0800 +++ b/drivers/acpi/pci_irq.c 2003-02-24 19:21:54.000000000 -0800 @@ -33,7 +33,8 @@ #include #include #include -#ifdef CONFIG_X86_IO_APIC +#ifdef CONFIG_X86_MPPARSE +#include #include #endif #include diff -Naur -X /root/bin/dontdiff a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h --- a/include/asm-i386/acpi.h 2003-02-24 19:16:34.000000000 -0800 +++ b/include/asm-i386/acpi.h 2003-02-24 19:23:22.000000000 -0800 @@ -140,6 +140,15 @@ #endif /*CONFIG_ACPI_SLEEP*/ +struct acpi_ioapic_info { + int apic_id; + int irq_start; + int irq_end; + u32 pin_programmed[4]; +}; + +extern struct acpi_ioapic_info acpi_ioapic_info[]; + #endif /*__KERNEL__*/ #endif /*_ASM_ACPI_H*/ diff -Naur -X /root/bin/dontdiff a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h --- a/include/asm-i386/io_apic.h 2003-02-24 19:16:06.000000000 -0800 +++ b/include/asm-i386/io_apic.h 2003-02-24 19:22:01.000000000 -0800 @@ -3,7 +3,7 @@ #include #include -#include +#include /* * Intel IO-APIC support for SMP and UP systems. @@ -101,7 +101,7 @@ extern int mp_irq_entries; /* MP IRQ source entries */ -extern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; +extern struct mps_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; /* non-0 if default (table-less) MP configuration */ extern int mpc_default_type; @@ -151,7 +151,7 @@ #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup) #ifdef CONFIG_ACPI_BOOT -extern int io_apic_get_unique_id (int ioapic, int apic_id); +extern int io_apic_assign_unique_id (int ioapic, int bios_apic_id); extern int io_apic_get_version (int ioapic); extern int io_apic_get_redir_entries (int ioapic); extern int io_apic_set_pci_routing (int ioapic, int pin, int irq); diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h --- a/include/asm-i386/mach-bigsmp/mach_apic.h 2003-02-24 19:16:47.000000000 -0800 +++ b/include/asm-i386/mach-bigsmp/mach_apic.h 2003-02-24 19:23:34.000000000 -0800 @@ -24,7 +24,7 @@ #define INT_DELIVERY_MODE dest_LowestPrio #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ -#define APIC_BROADCAST_ID (0x0f) +#define APIC_MAX_ID (0x0f) #define check_apicid_used(bitmap, apicid) (0) #define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit)) @@ -87,14 +87,11 @@ return (int)cpu_2_logical_apicid[cpu]; } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(u8 apicid, u8 apicver, int quad) { - printk("Processor #%d %ld:%ld APIC version %d\n", - m->mpc_apicid, - (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, - (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, - m->mpc_apicver); - return (m->mpc_apicid); + printk("Processor #%d APIC version %d\n", + apicid, apicver); + return (apicid); } static inline ulong ioapic_phys_id_map(ulong phys_map) diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h --- a/include/asm-i386/mach-default/mach_apic.h 2003-02-24 19:17:14.000000000 -0800 +++ b/include/asm-i386/mach-default/mach_apic.h 2003-02-24 19:24:14.000000000 -0800 @@ -15,7 +15,7 @@ #define INT_DELIVERY_MODE dest_LowestPrio #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ -#define APIC_BROADCAST_ID 0x0F +#define APIC_MAX_ID 0x0F #define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid)) #define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit)) @@ -79,14 +79,11 @@ return (1ul << phys_apicid); } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(u8 apicid, u8 apicver, int quad) { - printk("Processor #%d %ld:%ld APIC version %d\n", - m->mpc_apicid, - (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, - (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, - m->mpc_apicver); - return (m->mpc_apicid); + printk("Processor #%d APIC version %d\n", + apicid, apicver); + return apicid; } static inline void setup_portio_remap(void) diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-default/mach_mpparse.h b/include/asm-i386/mach-default/mach_mpparse.h --- a/include/asm-i386/mach-default/mach_mpparse.h 2003-02-24 19:16:30.000000000 -0800 +++ b/include/asm-i386/mach-default/mach_mpparse.h 2003-02-24 19:23:16.000000000 -0800 @@ -1,14 +1,14 @@ #ifndef __ASM_MACH_MPPARSE_H #define __ASM_MACH_MPPARSE_H -static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, - struct mpc_config_translation *translation) +static inline void mpc_oem_bus_info(struct mps_config_bus *m, char *name, + struct mps_config_translation *translation) { Dprintk("Bus #%d is %s\n", m->mpc_busid, name); } -static inline void mpc_oem_pci_bus(struct mpc_config_bus *m, - struct mpc_config_translation *translation) +static inline void mpc_oem_pci_bus(struct mps_config_bus *m, + struct mps_config_translation *translation) { } diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h --- a/include/asm-i386/mach-numaq/mach_apic.h 2003-02-24 19:15:21.000000000 -0800 +++ b/include/asm-i386/mach-numaq/mach_apic.h 2003-02-24 19:21:53.000000000 -0800 @@ -11,7 +11,7 @@ #define INT_DELIVERY_MODE dest_LowestPrio #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */ -#define APIC_BROADCAST_ID 0x0F +#define APIC_MAX_ID 0x0F #define check_apicid_used(bitmap, apicid) ((bitmap) & (1 << (apicid))) #define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit)) @@ -73,15 +73,12 @@ return ( (logical_apicid&0xf) << (4*apicid_to_node(logical_apicid)) ); } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(u8 apicid, u8 apicver, int quad) { - int logical_apicid = generate_logical_apicid(quad, m->mpc_apicid); + int logical_apicid = generate_logical_apicid(quad, apicid); - printk("Processor #%d %ld:%ld APIC version %d (quad %d, apic %d)\n", - m->mpc_apicid, - (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, - (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, - m->mpc_apicver, quad, logical_apicid); + printk("Processor #%d APIC version %d (quad %d, apic %d)\n", + apicid, apicver, quad, logical_apicid); return logical_apicid; } diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-numaq/mach_mpparse.h b/include/asm-i386/mach-numaq/mach_mpparse.h --- a/include/asm-i386/mach-numaq/mach_mpparse.h 2003-02-24 19:15:11.000000000 -0800 +++ b/include/asm-i386/mach-numaq/mach_mpparse.h 2003-02-24 19:21:50.000000000 -0800 @@ -1,11 +1,11 @@ #ifndef __ASM_MACH_MPPARSE_H #define __ASM_MACH_MPPARSE_H -static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, +static void __init mps_read_mpc_oem(struct mp_config_oemtable *oemtable, unsigned short oemsize); -static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, - struct mpc_config_translation *translation) +static inline void mpc_oem_bus_info(struct mps_config_bus *m, char *name, + struct mps_config_translation *translation) { int quad = translation->trans_quad; int local = translation->trans_local; @@ -15,8 +15,8 @@ printk("Bus #%d is %s (node %d)\n", m->mpc_busid, name, quad); } -static inline void mpc_oem_pci_bus(struct mpc_config_bus *m, - struct mpc_config_translation *translation) +static inline void mpc_oem_pci_bus(struct mps_config_bus *m, + struct mps_config_translation *translation) { int quad = translation->trans_quad; int local = translation->trans_local; @@ -30,7 +30,7 @@ if (strncmp(oem, "IBM NUMA", 8)) printk("Warning! May not be a NUMA-Q system!\n"); if (mpc->mpc_oemptr) - smp_read_mpc_oem((struct mp_config_oemtable *) mpc->mpc_oemptr, + mps_read_mpc_oem((struct mp_config_oemtable *) mpc->mpc_oemptr, mpc->mpc_oemsize); } diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h --- a/include/asm-i386/mach-summit/mach_apic.h 2003-02-24 19:15:49.000000000 -0800 +++ b/include/asm-i386/mach-summit/mach_apic.h 2003-02-24 19:22:00.000000000 -0800 @@ -18,7 +18,7 @@ #define INT_DELIVERY_MODE (x86_summit ? dest_Fixed : dest_LowestPrio) #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */ -#define APIC_BROADCAST_ID (x86_summit ? 0xFF : 0x0F) +#define APIC_MAX_ID (x86_summit ? 0xFF : 0x0F) #define check_apicid_used(bitmap, apicid) (x86_summit ? 0 : (bitmap & (1 << apicid))) /* we don't use the phys_cpu_present_map to indicate apicid presence */ @@ -90,14 +90,12 @@ return (1ul << apicid); } -static inline int mpc_apic_id(struct mpc_config_processor *m, int quad) +static inline int mpc_apic_id(u8 apicid, u8 apicver, int quad) { - printk("Processor #%d %ld:%ld APIC version %d\n", - m->mpc_apicid, - (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, - (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, - m->mpc_apicver); - return (m->mpc_apicid); + printk("Processor #%d APIC version %d\n", + apicid, + apicver); + return apicid; } static inline void setup_portio_remap(void) diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-summit/mach_mpparse.h b/include/asm-i386/mach-summit/mach_mpparse.h --- a/include/asm-i386/mach-summit/mach_mpparse.h 2003-02-24 19:15:22.000000000 -0800 +++ b/include/asm-i386/mach-summit/mach_mpparse.h 2003-02-24 19:21:54.000000000 -0800 @@ -3,14 +3,14 @@ extern int use_cyclone; -static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, - struct mpc_config_translation *translation) +static inline void mpc_oem_bus_info(struct mps_config_bus *m, char *name, + struct mps_config_translation *translation) { Dprintk("Bus #%d is %s\n", m->mpc_busid, name); } -static inline void mpc_oem_pci_bus(struct mpc_config_bus *m, - struct mpc_config_translation *translation) +static inline void mpc_oem_pci_bus(struct mps_config_bus *m, + struct mps_config_translation *translation) { } diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h --- a/include/asm-i386/mach-visws/mach_apic.h 2003-02-24 19:14:20.000000000 -0800 +++ b/include/asm-i386/mach-visws/mach_apic.h 2003-02-24 19:21:39.000000000 -0800 @@ -25,6 +25,14 @@ &phys_cpu_present_map)); } +static inline int mpc_apic_id(u8 apicid, u8 apicver, int quad) +{ + printk("Processor #%d APIC version %d\n", + apicid, apicver); + return apicid; +} + + /* * Set up the logical destination ID. * diff -Naur -X /root/bin/dontdiff a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h --- a/include/asm-i386/mpspec.h 2003-02-24 19:14:10.000000000 -0800 +++ b/include/asm-i386/mpspec.h 2003-02-24 19:21:37.000000000 -0800 @@ -13,15 +13,6 @@ #define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_') -/* - * a maximum of 16 APICs with the current APIC ID architecture. - */ -#if defined(CONFIG_X86_NUMAQ) || defined (CONFIG_X86_SUMMIT) -#define MAX_APICS 256 -#else -#define MAX_APICS 16 -#endif - #define MAX_MPC_ENTRY 1024 struct intel_mp_floating @@ -63,7 +54,7 @@ #define MP_LINTSRC 4 #define MP_TRANSLATION 192 /* Used by IBM NUMA-Q to describe node locality */ -struct mpc_config_processor +struct mps_config_processor { unsigned char mpc_type; unsigned char mpc_apicid; /* Local APIC number */ @@ -79,7 +70,7 @@ unsigned long mpc_reserved[2]; }; -struct mpc_config_bus +struct mps_config_bus { unsigned char mpc_type; unsigned char mpc_busid; @@ -107,7 +98,7 @@ #define BUSTYPE_XPRESS "XPRESS" #define BUSTYPE_NEC98 "NEC98" -struct mpc_config_ioapic +struct mps_config_ioapic { unsigned char mpc_type; unsigned char mpc_apicid; @@ -117,7 +108,7 @@ unsigned long mpc_apicaddr; }; -struct mpc_config_intsrc +struct mps_config_intsrc { unsigned char mpc_type; unsigned char mpc_irqtype; @@ -140,7 +131,7 @@ #define MP_IRQDIR_LOW 3 -struct mpc_config_lintsrc +struct mps_config_lintsrc { unsigned char mpc_type; unsigned char mpc_irqtype; @@ -162,7 +153,7 @@ char mpc_oem[8]; }; -struct mpc_config_translation +struct mps_config_translation { unsigned char mpc_type; unsigned char trans_len; @@ -191,14 +182,6 @@ #define MAX_IRQ_SOURCES 256 #endif /* CONFIG_X86_NUMAQ */ -#define MAX_MP_BUSSES 32 -enum mp_bustype { - MP_BUS_ISA = 1, - MP_BUS_EISA, - MP_BUS_PCI, - MP_BUS_MCA, - MP_BUS_NEC98 -}; extern int mp_bus_id_to_type [MAX_MP_BUSSES]; extern int mp_bus_id_to_node [MAX_MP_BUSSES]; extern int mp_bus_id_to_local [MAX_MP_BUSSES]; @@ -207,16 +190,14 @@ extern unsigned int boot_cpu_physical_apicid; extern unsigned long phys_cpu_present_map; -extern int smp_found_config; -extern void find_smp_config (void); -extern void get_smp_config (void); +extern int mps_found_config; +extern void find_mps_config (void); +extern void get_mps_config (void); extern int nr_ioapics; extern int apic_version [MAX_APICS]; -extern int mp_bus_id_to_type [MAX_MP_BUSSES]; extern int mp_irq_entries; -extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; +extern struct mps_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; extern int mpc_default_type; -extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; extern int mp_current_pci_id; extern unsigned long mp_lapic_addr; extern int pic_mode; diff -Naur -X /root/bin/dontdiff a/include/asm-i386/smpenum.h b/include/asm-i386/smpenum.h --- a/include/asm-i386/smpenum.h 1969-12-31 16:00:00.000000000 -0800 +++ b/include/asm-i386/smpenum.h 2003-02-24 19:21:44.000000000 -0800 @@ -0,0 +1,105 @@ +#ifndef __ASM_SMPENUM_H +#define __ASM_SMPENUM_H + +#include + +struct smp_enumerator +{ + void (*apicid_changed)(u8 apic, u8 oldid, u8 newid); +}; + +void smp_enumerator_register(struct smp_enumerator *new_enum); + +/* + * Generic structures for modular SMP init + */ + +/* Followed by entries */ + +#define MP_PROCESSOR 0 +#define MP_BUS 1 +#define MP_IOAPIC 2 +#define MP_INTSRC 3 +#define MP_LINTSRC 4 +#define MP_TRANSLATION 192 /* Used by IBM NUMA-Q to describe node locality */ + +struct mpc_config_processor +{ + unsigned char mpc_apicid; /* Local APIC number */ + unsigned char mpc_apicver; /* Local APIC version */ +}; + +void smp_processor_register(u8 apicid, u8 apicver); + +struct mpc_config_bus +{ + unsigned char mpc_type; + unsigned char mpc_busid; + unsigned char mpc_bustype[6] __attribute((packed)); +}; + +void smp_bus_register(unsigned char type, unsigned char busid); + +struct mpc_config_ioapic +{ + u8 mpc_apicid; + unsigned long mpc_apicaddr; +}; + +void smp_ioapic_register (u8 bios_apicid, unsigned long apicaddr); + +void smp_enum_reset(void); + +#ifdef CONFIG_X86_NUMAQ +#define MAX_IRQ_SOURCES 512 +#else /* !CONFIG_X86_NUMAQ */ +#define MAX_IRQ_SOURCES 256 +#endif /* CONFIG_X86_NUMAQ */ + +#define MAX_MP_BUSSES 32 +enum mp_bustype { + MP_BUS_UNKNOWN, + MP_BUS_ISA, + MP_BUS_EISA, + MP_BUS_PCI, + MP_BUS_MCA, + MP_BUS_NEC98 +}; + +extern int mp_bus_id_to_type [MAX_MP_BUSSES]; +extern int mp_bus_id_to_node [MAX_MP_BUSSES]; +extern int mp_bus_id_to_local [MAX_MP_BUSSES]; +extern int quad_local_to_mp_bus_id [NR_CPUS/4][4]; +extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; + +/* + * a maximum of 16 APICs with the current APIC ID architecture. + */ +#if defined(CONFIG_X86_NUMAQ) || defined (CONFIG_X86_SUMMIT) +#define MAX_APICS 256 +#else +#define MAX_APICS 16 +#endif + +extern unsigned int boot_cpu_physical_apicid; +extern unsigned long phys_cpu_present_map; +extern int smp_found_config; +extern int mps_found_config; +extern void find_mps_config (void); +extern void get_mps_config (void); +extern int apic_version [MAX_APICS]; +extern int mp_bus_id_to_type [MAX_MP_BUSSES]; +extern int mp_irq_entries; +extern int nr_ioapics; +extern struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; +extern int mpc_default_type; +extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; +extern int mp_current_pci_id; +extern unsigned long mp_lapic_addr; +extern int pic_mode; +extern int using_apic_timer; + +extern struct smp_enumerator smp_enum; + +#endif + diff -Naur -X /root/bin/dontdiff a/include/asm-i386/smp.h b/include/asm-i386/smp.h --- a/include/asm-i386/smp.h 2003-02-24 19:15:39.000000000 -0800 +++ b/include/asm-i386/smp.h 2003-02-24 19:21:59.000000000 -0800 @@ -14,6 +14,7 @@ #ifndef __ASSEMBLY__ #include #include +#include #include #ifdef CONFIG_X86_IO_APIC #include