patch-2.1.110 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 --recursive --new-file v2.1.109/linux/arch/i386/kernel/io_apic.c linux/arch/i386/kernel/io_apic.c
@@ -32,7 +32,7 @@
  * volatile is justified in this case, it might change
  * spontaneously, GCC should not cache it
  */
-#define IO_APIC_BASE ((volatile int *)0xfec00000)
+#define IO_APIC_BASE ((volatile int *)fix_to_virt(FIX_IO_APIC_BASE))
 
 enum mp_irq_source_types {
     mp_INT = 0,
@@ -525,6 +525,22 @@
 	return 0;
 }
 
+__initfunc(static int assign_irq_vector(int irq))
+{
+	static int current_vector = IRQ0_TRAP_VECTOR, offset = 0;
+	if (IO_APIC_VECTOR(irq) > 0)
+		return IO_APIC_VECTOR(irq);
+	current_vector += 8;
+	if (current_vector > 0xFE) {
+		offset++;
+		current_vector = IRQ0_TRAP_VECTOR + offset;
+		printk("WARNING: ASSIGN_IRQ_VECTOR wrapped back to %02X\n",
+		       current_vector);
+	}
+	IO_APIC_VECTOR(irq) = current_vector;
+	return current_vector;
+}
+
 __initfunc(void setup_IO_APIC_irqs (void))
 {
 	struct IO_APIC_route_entry entry;
@@ -563,7 +579,7 @@
 		if (!IO_APIC_IRQ(irq))
 			continue;
 
-		entry.vector = IO_APIC_VECTOR(irq);
+		entry.vector = assign_irq_vector(irq);
 
 		bus = mp_irqs[idx].mpc_srcbus;
 
@@ -592,7 +608,7 @@
 	entry.mask = 0;					/* unmask IRQ now */
 	entry.dest.logical.logical_dest = 0xff;		/* all CPUs */
 
-	entry.vector = IO_APIC_VECTOR(irq);
+	entry.vector = assign_irq_vector(irq);
 
 	entry.polarity=0;
 	entry.trigger=0;
@@ -618,7 +634,7 @@
 	entry.mask = 0;					/* unmask IRQ now */
 	entry.dest.logical.logical_dest = 0x01;		/* all CPUs */
 
-	entry.vector = IO_APIC_VECTOR(pin);		/* it's ignored */
+	entry.vector = 0;				/* it's ignored */
 
 	entry.polarity=0;
 	entry.trigger=0;
@@ -1109,8 +1125,7 @@
 	 * 0x80, because int 0x80 is hm, kind of importantish. ;)
 	 */
 	for (i = 0; i < NR_IRQS ; i++) {
-		if ((IO_APIC_VECTOR(i) <= 0xfe)  /* HACK */ &&
-		    (IO_APIC_IRQ(i))) {
+		if (IO_APIC_IRQ(i)) {
 			if (IO_APIC_irq_trigger(i))
 				irq_desc[i].handler = &ioapic_level_irq_type;
 			else
@@ -1217,6 +1232,7 @@
 	 * mptable:
 	 */
 	setup_IO_APIC_irqs ();
+	init_IRQ_SMP();
 	check_timer();
  
 	print_IO_APIC();

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov