浏览代码

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
  x86/pci: insert ioapic resource before assigning unassigned resources
Linus Torvalds 16 年之前
父节点
当前提交
499ee0710f
共有 3 个文件被更改,包括 12 次插入11 次删除
  1. 2 0
      arch/x86/include/asm/io_apic.h
  2. 3 11
      arch/x86/kernel/apic/io_apic.c
  3. 7 0
      arch/x86/pci/i386.c

+ 2 - 0
arch/x86/include/asm/io_apic.h

@@ -161,6 +161,7 @@ extern int io_apic_set_pci_routing(struct device *dev, int irq,
 		 struct io_apic_irq_attr *irq_attr);
 		 struct io_apic_irq_attr *irq_attr);
 extern int (*ioapic_renumber_irq)(int ioapic, int irq);
 extern int (*ioapic_renumber_irq)(int ioapic, int irq);
 extern void ioapic_init_mappings(void);
 extern void ioapic_init_mappings(void);
+extern void ioapic_insert_resources(void);
 
 
 extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);
 extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);
 extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries);
 extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries);
@@ -180,6 +181,7 @@ extern void ioapic_write_entry(int apic, int pin,
 #define io_apic_assign_pci_irqs 0
 #define io_apic_assign_pci_irqs 0
 static const int timer_through_8259 = 0;
 static const int timer_through_8259 = 0;
 static inline void ioapic_init_mappings(void)	{ }
 static inline void ioapic_init_mappings(void)	{ }
+static inline void ioapic_insert_resources(void) { }
 
 
 static inline void probe_nr_irqs_gsi(void)	{ }
 static inline void probe_nr_irqs_gsi(void)	{ }
 #endif
 #endif

+ 3 - 11
arch/x86/kernel/apic/io_apic.c

@@ -4181,28 +4181,20 @@ fake_ioapic_page:
 	}
 	}
 }
 }
 
 
-static int __init ioapic_insert_resources(void)
+void __init ioapic_insert_resources(void)
 {
 {
 	int i;
 	int i;
 	struct resource *r = ioapic_resources;
 	struct resource *r = ioapic_resources;
 
 
 	if (!r) {
 	if (!r) {
-		if (nr_ioapics > 0) {
+		if (nr_ioapics > 0)
 			printk(KERN_ERR
 			printk(KERN_ERR
 				"IO APIC resources couldn't be allocated.\n");
 				"IO APIC resources couldn't be allocated.\n");
-			return -1;
-		}
-		return 0;
+		return;
 	}
 	}
 
 
 	for (i = 0; i < nr_ioapics; i++) {
 	for (i = 0; i < nr_ioapics; i++) {
 		insert_resource(&iomem_resource, r);
 		insert_resource(&iomem_resource, r);
 		r++;
 		r++;
 	}
 	}
-
-	return 0;
 }
 }
-
-/* Insert the IO APIC resources after PCI initialization has occured to handle
- * IO APICS that are mapped in on a BAR in PCI space. */
-late_initcall(ioapic_insert_resources);

+ 7 - 0
arch/x86/pci/i386.c

@@ -35,6 +35,7 @@
 #include <asm/pat.h>
 #include <asm/pat.h>
 #include <asm/e820.h>
 #include <asm/e820.h>
 #include <asm/pci_x86.h>
 #include <asm/pci_x86.h>
+#include <asm/io_apic.h>
 
 
 
 
 static int
 static int
@@ -227,6 +228,12 @@ void __init pcibios_resource_survey(void)
 	pcibios_allocate_resources(1);
 	pcibios_allocate_resources(1);
 
 
 	e820_reserve_resources_late();
 	e820_reserve_resources_late();
+	/*
+	 * Insert the IO APIC resources after PCI initialization has
+	 * occured to handle IO APICS that are mapped in on a BAR in
+	 * PCI space, but before trying to assign unassigned pci res.
+	 */
+	ioapic_insert_resources();
 }
 }
 
 
 /**
 /**