1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun #include <linux/pci.h> 3*4882a593Smuzhiyun #include <linux/init.h> 4*4882a593Smuzhiyun #include <asm/pci_x86.h> 5*4882a593Smuzhiyun #include <asm/x86_init.h> 6*4882a593Smuzhiyun #include <asm/irqdomain.h> 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun /* arch_initcall has too random ordering, so call the initializers 9*4882a593Smuzhiyun in the right sequence from here. */ pci_arch_init(void)10*4882a593Smuzhiyunstatic __init int pci_arch_init(void) 11*4882a593Smuzhiyun { 12*4882a593Smuzhiyun int type, pcbios = 1; 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun type = pci_direct_probe(); 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun if (!(pci_probe & PCI_PROBE_NOEARLY)) 17*4882a593Smuzhiyun pci_mmcfg_early_init(); 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun if (x86_init.pci.arch_init) 20*4882a593Smuzhiyun pcbios = x86_init.pci.arch_init(); 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun /* 23*4882a593Smuzhiyun * Must happen after x86_init.pci.arch_init(). Xen sets up the 24*4882a593Smuzhiyun * x86_init.irqs.create_pci_msi_domain there. 25*4882a593Smuzhiyun */ 26*4882a593Smuzhiyun x86_create_pci_msi_domain(); 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun if (!pcbios) 29*4882a593Smuzhiyun return 0; 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun pci_pcbios_init(); 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun /* 34*4882a593Smuzhiyun * don't check for raw_pci_ops here because we want pcbios as last 35*4882a593Smuzhiyun * fallback, yet it's needed to run first to set pcibios_last_bus 36*4882a593Smuzhiyun * in case legacy PCI probing is used. otherwise detecting peer busses 37*4882a593Smuzhiyun * fails. 38*4882a593Smuzhiyun */ 39*4882a593Smuzhiyun pci_direct_init(type); 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun if (!raw_pci_ops && !raw_pci_ext_ops) 42*4882a593Smuzhiyun printk(KERN_ERR 43*4882a593Smuzhiyun "PCI: Fatal: No config space access function found\n"); 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun dmi_check_pciprobe(); 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun dmi_check_skip_isa_align(); 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun return 0; 50*4882a593Smuzhiyun } 51*4882a593Smuzhiyun arch_initcall(pci_arch_init); 52