x86, olpc: Use pci subarch init for OLPC

Replace the #ifdef'ed OLPC-specific init functions by a conditional
x86_init function. If the function returns 0 we leave pci_arch_init,
otherwise we continue.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Andres Salomon <dilinger@collabora.co.uk>
LKML-Reference: <43F901BD926A4E43B106BF17856F0755A318CE89@orsmsx508.amr.corp.intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>

authored by Thomas Gleixner and committed by H. Peter Anvin d5d0e88c 4fb6088a

+13 -29
+2 -18
arch/x86/include/asm/olpc.h
··· 13 14 #define OLPC_F_PRESENT 0x01 15 #define OLPC_F_DCON 0x02 16 - #define OLPC_F_VSA 0x04 17 18 #ifdef CONFIG_OLPC 19 ··· 50 } 51 52 /* 53 - * The VSA is software from AMD that typical Geode bioses will include. 54 - * It is used to emulate the PCI bus, VGA, etc. OLPC's Open Firmware does 55 - * not include the VSA; instead, PCI is emulated by the kernel. 56 - * 57 - * The VSA is described further in arch/x86/pci/olpc.c. 58 - */ 59 - static inline int olpc_has_vsa(void) 60 - { 61 - return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0; 62 - } 63 - 64 - /* 65 * The "Mass Production" version of OLPC's XO is identified as being model 66 * C2. During the prototype phase, the following models (in chronological 67 * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models ··· 74 return 0; 75 } 76 77 - static inline int olpc_has_vsa(void) 78 - { 79 - return 0; 80 - } 81 - 82 #endif 83 84 /* EC related functions */ 85
··· 13 14 #define OLPC_F_PRESENT 0x01 15 #define OLPC_F_DCON 0x02 16 17 #ifdef CONFIG_OLPC 18 ··· 51 } 52 53 /* 54 * The "Mass Production" version of OLPC's XO is identified as being model 55 * C2. During the prototype phase, the following models (in chronological 56 * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models ··· 87 return 0; 88 } 89 90 #endif 91 + 92 + extern int pci_olpc_init(void); 93 94 /* EC related functions */ 95
-1
arch/x86/include/asm/pci_x86.h
··· 104 extern int pci_direct_probe(void); 105 extern void pci_direct_init(int type); 106 extern void pci_pcbios_init(void); 107 - extern int pci_olpc_init(void); 108 extern void __init dmi_check_pciprobe(void); 109 extern void __init dmi_check_skip_isa_align(void); 110
··· 104 extern int pci_direct_probe(void); 105 extern void pci_direct_init(int type); 106 extern void pci_pcbios_init(void); 107 extern void __init dmi_check_pciprobe(void); 108 extern void __init dmi_check_skip_isa_align(void); 109
+7 -3
arch/x86/kernel/olpc.c
··· 17 #include <linux/spinlock.h> 18 #include <linux/io.h> 19 #include <linux/string.h> 20 #include <asm/geode.h> 21 #include <asm/olpc.h> 22 23 #ifdef CONFIG_OPEN_FIRMWARE ··· 245 olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, 246 (unsigned char *) &olpc_platform_info.ecver, 1); 247 248 - /* check to see if the VSA exists */ 249 - if (cs5535_has_vsa2()) 250 - olpc_platform_info.flags |= OLPC_F_VSA; 251 252 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n", 253 ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
··· 17 #include <linux/spinlock.h> 18 #include <linux/io.h> 19 #include <linux/string.h> 20 + 21 #include <asm/geode.h> 22 + #include <asm/setup.h> 23 #include <asm/olpc.h> 24 25 #ifdef CONFIG_OPEN_FIRMWARE ··· 243 olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, 244 (unsigned char *) &olpc_platform_info.ecver, 1); 245 246 + #ifdef CONFIG_PCI_OLPC 247 + /* If the VSA exists let it emulate PCI, if not emulate in kernel */ 248 + if (!cs5535_has_vsa2()) 249 + x86_init.pci.arch_init = pci_olpc_init; 250 + #endif 251 252 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n", 253 ((olpc_platform_info.boardrev & 0xf) < 8) ? "pre" : "",
+4 -4
arch/x86/pci/init.c
··· 1 #include <linux/pci.h> 2 #include <linux/init.h> 3 #include <asm/pci_x86.h> 4 5 /* arch_initcall has too random ordering, so call the initializers 6 in the right sequence from here. */ ··· 16 if (!(pci_probe & PCI_PROBE_NOEARLY)) 17 pci_mmcfg_early_init(); 18 19 - #ifdef CONFIG_PCI_OLPC 20 - if (!pci_olpc_init()) 21 - return 0; /* skip additional checks if it's an XO */ 22 - #endif 23 #ifdef CONFIG_PCI_BIOS 24 pci_pcbios_init(); 25 #endif
··· 1 #include <linux/pci.h> 2 #include <linux/init.h> 3 #include <asm/pci_x86.h> 4 + #include <asm/x86_init.h> 5 6 /* arch_initcall has too random ordering, so call the initializers 7 in the right sequence from here. */ ··· 15 if (!(pci_probe & PCI_PROBE_NOEARLY)) 16 pci_mmcfg_early_init(); 17 18 + if (x86_init.pci.arch_init && !x86_init.pci.arch_init()) 19 + return 0; 20 + 21 #ifdef CONFIG_PCI_BIOS 22 pci_pcbios_init(); 23 #endif
-3
arch/x86/pci/olpc.c
··· 304 305 int __init pci_olpc_init(void) 306 { 307 - if (!machine_is_olpc() || olpc_has_vsa()) 308 - return -ENODEV; 309 - 310 printk(KERN_INFO "PCI: Using configuration type OLPC\n"); 311 raw_pci_ops = &pci_olpc_conf; 312 is_lx = is_geode_lx();
··· 304 305 int __init pci_olpc_init(void) 306 { 307 printk(KERN_INFO "PCI: Using configuration type OLPC\n"); 308 raw_pci_ops = &pci_olpc_conf; 309 is_lx = is_geode_lx();