Skip to contentSkip to conversation

New/Updated drivers: MMCONFIG PCI config space access driver backported from Linux Kernel Ver. 2.6.31.5

PATCH New Daniel Kiper 1 participant 1 message Nov 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New/Updated drivers: MMCONFIG PCI config space access driver backported from Linux Kernel Ver. 2.6.31.5

# HG changeset patch
# User [email protected] # Date 1259016511 -3600
# Node ID 02e13e85fa55c25c232bd9dc41118d4069957195 # Parent 1db1bb63824b25f97d127449faeb3a56f1272c97 MMCONFIG PCI config space access driver backported from Linux Kernel Ver. 2.6.31.5

arch/i386/pci/Makefile +1 -1
diff -r 1db1bb63824b -r 02e13e85fa55 arch/i386/pci/Makefile
@@ -1,7 +1,7 @@ obj-y				:= i386.o init.o
 obj-y				:= i386.o init.o
 
 obj-$(CONFIG_PCI_BIOS)		+= pcbios.o
-obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig.o direct.o
+obj-$(CONFIG_PCI_MMCONFIG)	+= mmconfig.o direct.o mmconfig-shared.o
 obj-$(CONFIG_PCI_DIRECT)	+= direct.o
 
 # pcifront should be after pcbios.o, mmconfig.o, and direct.o as it should only
arch/i386/pci/direct.c +18 -7
diff -r 1db1bb63824b -r 02e13e85fa55 arch/i386/pci/direct.c
@@ -254,7 +254,18 @@ static int __init pci_check_type2(void)
 	return works;
 }
 
-void __init pci_direct_init(void)
+void __init pci_direct_init(int type)
+{
+	if (type == 0)
+		return;
+	printk(KERN_INFO "PCI: Using configuration type %d\n", type);
+	if (type == 1)
+		raw_pci_ops = &pci_direct_conf1;
+	else
+		raw_pci_ops = &pci_direct_conf2;
+}
+
+int __init pci_direct_probe(void)
 {
 	struct resource *region, *region2;
 
@@ -265,18 +276,17 @@ void __init pci_direct_init(void)
 		goto type2;
 
 	if (pci_check_type1()) {
-		printk(KERN_INFO "PCI: Using configuration type 1\n");
 		raw_pci_ops = &pci_direct_conf1;
-		return;
+		return 1;
 	}
 	release_resource(region);
 
  type2:
 	if ((pci_probe & PCI_PROBE_CONF2) == 0)
-		return;
+		return 0;
 	region = request_region(0xCF8, 4, "PCI conf2");
 	if (!region)
-		return;
+		return 0;
 	region2 = request_region(0xC000, 0x1000, "PCI conf2");
 	if (!region2)
 		goto fail2;
@@ -284,10 +294,11 @@ void __init pci_direct_init(void)
 	if (pci_check_type2()) {
 		printk(KERN_INFO "PCI: Using configuration type 2\n");
 		raw_pci_ops = &pci_direct_conf2;
-		return;
+		return 2;
 	}
 
 	release_resource(region2);
  fail2:
 	release_resource(region);
-}
+	return 0;
+}
arch/i386/pci/init.c +11 -2
diff -r 1db1bb63824b -r 02e13e85fa55 arch/i386/pci/init.c
@@ -6,8 +6,13 @@
    in the right sequence from here. */
 static __init int pci_access_init(void)
 {
+	int type = 0;
+
+#ifdef CONFIG_PCI_DIRECT
+	type = pci_direct_probe();
+#endif
 #ifdef CONFIG_PCI_MMCONFIG
-	pci_mmcfg_init();
+	pci_mmcfg_init(type);
 #endif
 	if (raw_pci_ops)
 		return 0;
@@ -21,8 +26,12 @@ static __init int pci_access_init(void)
 	 * fails.
 	 */
 #ifdef CONFIG_PCI_DIRECT
-	pci_direct_init();
+	pci_direct_init(type);
 #endif
+	if (!raw_pci_ops)
+		printk(KERN_ERR
+		"PCI: Fatal: No config space access function found\n");
+
 	return 0;
 }
 arch_initcall(pci_access_init);
arch/i386/pci/mmconfig.c +22 -53

139 lines not on this page · raw message

arch/i386/pci/pci.h +8 -2
diff -r 1db1bb63824b -r 02e13e85fa55 arch/i386/pci/pci.h
@@ -81,7 +81,13 @@ extern int pci_conf1_read(unsigned int s
 extern int pci_conf1_read(unsigned int seg, unsigned int bus,
 			  unsigned int devfn, int reg, int len, u32 *value);
 
-extern void pci_direct_init(void);
+extern int pci_direct_probe(void);
+extern void pci_direct_init(int type);
 extern void pci_pcbios_init(void);
-extern void pci_mmcfg_init(void);
+extern void pci_mmcfg_init(int type);
 extern void pcibios_sort(void);
+
+/* pci-mmconfig.c */
+
+extern int __init pci_mmcfg_arch_init(void);
+extern void __init pci_mmcfg_arch_free(void);
arch/x86_64/pci/Makefile +2 -1
diff -r 1db1bb63824b -r 02e13e85fa55 arch/x86_64/pci/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_ACPI)	+= acpi.o
 obj-$(CONFIG_ACPI)	+= acpi.o
 obj-y			+= legacy.o irq.o common.o
 # mmconfig has a 64bit special
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o
+obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o mmconfig-shared.o
 
 obj-$(CONFIG_NUMA)	+= k8-bus.o
 
@@ -28,3 +28,4 @@ fixup-y  += ../../i386/pci/fixup.o
 fixup-y  += ../../i386/pci/fixup.o
 i386-y  += ../../i386/pci/i386.o
 init-y += ../../i386/pci/init.o
+mmconfig-shared-y += ../../i386/pci/mmconfig-shared.o
arch/x86_64/pci/mmconfig.c +56 -81

195 lines not on this page · raw message

arch/i386/pci/mmconfig-shared.c new file +439 -0

439 lines not on this page · raw message