patch-2.2.15 linux/arch/i386/kernel/io_apic.c

Next file: linux/arch/i386/kernel/irq.c
Previous file: linux/arch/i386/kernel/entry.S
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/arch/i386/kernel/io_apic.c linux/arch/i386/kernel/io_apic.c
@@ -1277,6 +1277,37 @@
 	}
 }
 
+/* Patch to set the IO-APIC physical IDs based on the values stored in the MPC table */
+/* by Matt Domsch <Matt_Domsch@dell.com>  Tue Dec 21 12:25:05 CST 1999 */
+
+static void __init setup_ioapic_ids_from_mpc(void)
+{
+	struct IO_APIC_reg_00 reg_00;
+	/*
+	 * Set the IOAPIC ID to the value stored in the MPC table.
+	 */
+	int apic;
+	for (apic = 0; apic < mp_apic_entries; apic++) {
+		/* Read the register 0 value */
+		*(int *)&reg_00 = io_apic_read(apic, 0);
+		
+		if(reg_00.ID != mp_apics[apic].mpc_apicid) {
+			/* Change the value */
+			printk("...changing IO-APIC physical APIC ID to %d\n", mp_apics[apic].mpc_apicid);
+			reg_00.ID = mp_apics[apic].mpc_apicid;
+			io_apic_write(apic, 0, *(int *)&reg_00);
+
+			/*
+			 * Sanity check
+			 */
+			*(int *)&reg_00 = io_apic_read(apic, 0);
+			if (reg_00.ID != mp_apics[apic].mpc_apicid)
+				panic("could not set ID");
+		}
+	}
+}
+
+
 /*
  *
  * IRQ's that are handled by the old PIC in all cases:
@@ -1336,9 +1367,11 @@
 	 * Set up the IO-APIC IRQ routing table by parsing the MP-BIOS
 	 * mptable:
 	 */
+	setup_ioapic_ids_from_mpc();
 	setup_IO_APIC_irqs();
 	init_IO_APIC_traps();
 	check_timer();
 
 	print_IO_APIC();
 }
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)