Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *	Low-Level PCI Support for PC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/pci-acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/ioport.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/dmi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <asm/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <asm/segment.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <asm/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <asm/pci_x86.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <asm/irqdomain.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 				PCI_PROBE_MMCONF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) static int pci_bf_sort;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) int pci_routeirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) int noioapicquirk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) int noioapicreroute = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) int noioapicreroute = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) int pcibios_last_bus = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) unsigned long pirq_table_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) const struct pci_raw_ops *__read_mostly raw_pci_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) const struct pci_raw_ops *__read_mostly raw_pci_ext_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 						int reg, int len, u32 *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	if (domain == 0 && reg < 256 && raw_pci_ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		return raw_pci_ops->read(domain, bus, devfn, reg, len, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	if (raw_pci_ext_ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		return raw_pci_ext_ops->read(domain, bus, devfn, reg, len, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 						int reg, int len, u32 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	if (domain == 0 && reg < 256 && raw_pci_ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		return raw_pci_ops->write(domain, bus, devfn, reg, len, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	if (raw_pci_ext_ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		return raw_pci_ext_ops->write(domain, bus, devfn, reg, len, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	return raw_pci_read(pci_domain_nr(bus), bus->number,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 				 devfn, where, size, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	return raw_pci_write(pci_domain_nr(bus), bus->number,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 				  devfn, where, size, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) struct pci_ops pci_root_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	.read = pci_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	.write = pci_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * This interrupt-safe spinlock protects all accesses to PCI configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * space, except for the mmconfig (ECAM) based operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) DEFINE_RAW_SPINLOCK(pci_config_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) static int __init can_skip_ioresource_align(const struct dmi_system_id *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) static const struct dmi_system_id can_skip_pciprobe_dmi_table[] __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * Systems where PCI IO resource ISA alignment can be skipped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * when the ISA enable bit in the bridge control is not set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		.callback = can_skip_ioresource_align,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		.ident = "IBM System x3800",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 			DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		.callback = can_skip_ioresource_align,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		.ident = "IBM System x3850",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			DMI_MATCH(DMI_PRODUCT_NAME, "x3850"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		.callback = can_skip_ioresource_align,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		.ident = "IBM System x3950",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			DMI_MATCH(DMI_PRODUCT_NAME, "x3950"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) void __init dmi_check_skip_isa_align(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	dmi_check_system(can_skip_pciprobe_dmi_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static void pcibios_fixup_device_resources(struct pci_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	struct resource *bar_r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	int bar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	if (pci_probe & PCI_NOASSIGN_BARS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		* If the BIOS did not assign the BAR, zero out the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		* resource so the kernel doesn't attempt to assign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		* it later on in pci_assign_unassigned_resources
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			bar_r = &dev->resource[bar];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			if (bar_r->start == 0 && bar_r->end != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 				bar_r->flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 				bar_r->end = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	if (pci_probe & PCI_NOASSIGN_ROMS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		if (rom_r->parent)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		if (rom_r->start) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			/* we deal with BIOS assigned ROM later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		rom_r->start = rom_r->end = rom_r->flags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *  Called after each bus is probed, but before its children
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  *  are examined.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) void pcibios_fixup_bus(struct pci_bus *b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct pci_dev *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	pci_read_bridge_bases(b);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	list_for_each_entry(dev, &b->devices, bus_list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		pcibios_fixup_device_resources(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) void pcibios_add_bus(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	acpi_pci_add_bus(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) void pcibios_remove_bus(struct pci_bus *bus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	acpi_pci_remove_bus(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  * Only use DMI information to set this if nothing was passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * on the kernel command line (which was parsed earlier).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static int __init set_bf_sort(const struct dmi_system_id *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	if (pci_bf_sort == pci_bf_sort_default) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		pci_bf_sort = pci_dmi_bf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		printk(KERN_INFO "PCI: %s detected, enabling pci=bfsort.\n", d->ident);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static void __init read_dmi_type_b1(const struct dmi_header *dm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 				    void *private_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	u8 *data = (u8 *)dm + 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	if (dm->type != 0xB1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	if ((((*(u32 *)data) >> 9) & 0x03) == 0x01)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		set_bf_sort((const struct dmi_system_id *)private_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static int __init find_sort_method(const struct dmi_system_id *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	dmi_walk(read_dmi_type_b1, (void *)d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)  * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) #ifdef __i386__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) static int __init assign_all_busses(const struct dmi_system_id *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	pci_probe |= PCI_ASSIGN_ALL_BUSSES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	printk(KERN_INFO "%s detected: enabling PCI bus# renumbering"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			" (pci=assign-busses)\n", d->ident);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static int __init set_scan_all(const struct dmi_system_id *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	       d->ident);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) static const struct dmi_system_id pciprobe_dmi_table[] __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) #ifdef __i386__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * Laptops which need pci=assign-busses to see Cardbus cards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		.callback = assign_all_busses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		.ident = "Samsung X20 Laptop",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 			DMI_MATCH(DMI_SYS_VENDOR, "Samsung Electronics"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			DMI_MATCH(DMI_PRODUCT_NAME, "SX20S"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #endif		/* __i386__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		.ident = "Dell PowerEdge 1950",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 			DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 			DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1950"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 		.ident = "Dell PowerEdge 1955",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 			DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1955"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		.ident = "Dell PowerEdge 2900",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 			DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 			DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2900"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		.ident = "Dell PowerEdge 2950",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 			DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 			DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2950"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		.ident = "Dell PowerEdge R900",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 			DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 			DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		.callback = find_sort_method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 		.ident = "Dell System",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 		.ident = "HP ProLiant BL20p G3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL20p G3"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 		.ident = "HP ProLiant BL20p G4",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL20p G4"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		.ident = "HP ProLiant BL30p G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL30p G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 		.ident = "HP ProLiant BL25p G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL25p G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		.ident = "HP ProLiant BL35p G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL35p G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 		.ident = "HP ProLiant BL45p G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL45p G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		.ident = "HP ProLiant BL45p G2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL45p G2"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		.ident = "HP ProLiant BL460c G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL460c G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		.ident = "HP ProLiant BL465c G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL465c G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		.ident = "HP ProLiant BL480c G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL480c G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		.ident = "HP ProLiant BL685c G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c G1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 		.ident = "HP ProLiant DL360",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL360"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 		.ident = "HP ProLiant DL380",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL380"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) #ifdef __i386__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 		.callback = assign_all_busses,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 		.ident = "Compaq EVO N800c",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 			DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 			DMI_MATCH(DMI_PRODUCT_NAME, "EVO N800c"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 		.ident = "HP ProLiant DL385 G2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 		.callback = set_bf_sort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 		.ident = "HP ProLiant DL585 G2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 			DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 		.callback = set_scan_all,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 		.ident = "Stratus/NEC ftServer",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 		.matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 			DMI_MATCH(DMI_SYS_VENDOR, "Stratus"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 			DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 		},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)         {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)                 .callback = set_scan_all,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)                 .ident = "Stratus/NEC ftServer",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)                 .matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)                         DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)                         DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R32"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)                 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)         },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)         {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)                 .callback = set_scan_all,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)                 .ident = "Stratus/NEC ftServer",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)                 .matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)                         DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)                         DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R31"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)                 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)         },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) void __init dmi_check_pciprobe(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 	dmi_check_system(pciprobe_dmi_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) void pcibios_scan_root(int busnum)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	struct pci_bus *bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	struct pci_sysdata *sd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	LIST_HEAD(resources);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 	sd = kzalloc(sizeof(*sd), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 	if (!sd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 		printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	sd->node = x86_pci_root_bus_node(busnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 	x86_pci_root_bus_resources(busnum, &resources);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 	printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) 	bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 	if (!bus) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) 		pci_free_resource_list(&resources);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 		kfree(sd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 	pci_bus_add_devices(bus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) void __init pcibios_set_cache_line_size(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 	struct cpuinfo_x86 *c = &boot_cpu_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 	 * Set PCI cacheline size to that of the CPU if the CPU has reported it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 	 * (For older CPUs that don't support cpuid, we se it to 32 bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 	 * It's also good for 386/486s (which actually have 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 	 * as quite a few PCI devices do not support smaller values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	if (c->x86_clflush_size > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 		pci_dfl_cache_line_size = c->x86_clflush_size >> 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 		printk(KERN_DEBUG "PCI: pci_cache_line_size set to %d bytes\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 			pci_dfl_cache_line_size << 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)  		pci_dfl_cache_line_size = 32 >> 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 		printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) int __init pcibios_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	if (!raw_pci_ops && !raw_pci_ext_ops) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 		printk(KERN_WARNING "PCI: System does not support PCI\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	pcibios_set_cache_line_size();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	pcibios_resource_survey();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	if (pci_bf_sort >= pci_force_bf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 		pci_sort_breadthfirst();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) char *__init pcibios_setup(char *str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	if (!strcmp(str, "off")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 		pci_probe = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	} else if (!strcmp(str, "bfsort")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 		pci_bf_sort = pci_force_bf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 	} else if (!strcmp(str, "nobfsort")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 		pci_bf_sort = pci_force_nobf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) #ifdef CONFIG_PCI_BIOS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 	else if (!strcmp(str, "bios")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 		pci_probe = PCI_PROBE_BIOS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	} else if (!strcmp(str, "nobios")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 		pci_probe &= ~PCI_PROBE_BIOS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 	} else if (!strcmp(str, "biosirq")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 		pci_probe |= PCI_BIOS_IRQ_SCAN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) 	} else if (!strncmp(str, "pirqaddr=", 9)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 		pirq_table_addr = simple_strtoul(str+9, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) #ifdef CONFIG_PCI_DIRECT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	else if (!strcmp(str, "conf1")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 		pci_probe = PCI_PROBE_CONF1 | PCI_NO_CHECKS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	else if (!strcmp(str, "conf2")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) 		pci_probe = PCI_PROBE_CONF2 | PCI_NO_CHECKS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) #ifdef CONFIG_PCI_MMCONFIG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	else if (!strcmp(str, "nommconf")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 		pci_probe &= ~PCI_PROBE_MMCONF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	else if (!strcmp(str, "check_enable_amd_mmconf")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 		pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	else if (!strcmp(str, "noacpi")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 		acpi_noirq_set();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	else if (!strcmp(str, "noearly")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 		pci_probe |= PCI_PROBE_NOEARLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 	else if (!strcmp(str, "usepirqmask")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 		pci_probe |= PCI_USE_PIRQ_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 	} else if (!strncmp(str, "irqmask=", 8)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 		pcibios_irq_mask = simple_strtol(str+8, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	} else if (!strncmp(str, "lastbus=", 8)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 		pcibios_last_bus = simple_strtol(str+8, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	} else if (!strcmp(str, "rom")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 		pci_probe |= PCI_ASSIGN_ROMS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 	} else if (!strcmp(str, "norom")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 		pci_probe |= PCI_NOASSIGN_ROMS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 	} else if (!strcmp(str, "nobar")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 		pci_probe |= PCI_NOASSIGN_BARS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	} else if (!strcmp(str, "assign-busses")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 		pci_probe |= PCI_ASSIGN_ALL_BUSSES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 	} else if (!strcmp(str, "use_crs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 		pci_probe |= PCI_USE__CRS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	} else if (!strcmp(str, "nocrs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 		pci_probe |= PCI_ROOT_NO_CRS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) #ifdef CONFIG_PHYS_ADDR_T_64BIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	} else if (!strcmp(str, "big_root_window")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 		pci_probe |= PCI_BIG_ROOT_WINDOW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	} else if (!strcmp(str, "routeirq")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 		pci_routeirq = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 	} else if (!strcmp(str, "skip_isa_align")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 		pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 	} else if (!strcmp(str, "noioapicquirk")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 		noioapicquirk = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	} else if (!strcmp(str, "ioapicreroute")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 		if (noioapicreroute != -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 			noioapicreroute = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 	} else if (!strcmp(str, "noioapicreroute")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 		if (noioapicreroute != -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 			noioapicreroute = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 	return str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) unsigned int pcibios_assign_all_busses(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 	return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) static void set_dev_domain_options(struct pci_dev *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	if (is_vmd(pdev->bus))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 		pdev->hotplug_user_indicators = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) int pcibios_add_device(struct pci_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	struct pci_setup_rom *rom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 	struct irq_domain *msidom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 	struct setup_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 	u64 pa_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 	pa_data = boot_params.hdr.setup_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 	while (pa_data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 		data = memremap(pa_data, sizeof(*rom), MEMREMAP_WB);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 		if (!data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 			return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 		if (data->type == SETUP_PCI) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 			rom = (struct pci_setup_rom *)data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 			if ((pci_domain_nr(dev->bus) == rom->segment) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 			    (dev->bus->number == rom->bus) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 			    (PCI_SLOT(dev->devfn) == rom->device) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 			    (PCI_FUNC(dev->devfn) == rom->function) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 			    (dev->vendor == rom->vendor) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 			    (dev->device == rom->devid)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) 				dev->rom = pa_data +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 				      offsetof(struct pci_setup_rom, romdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) 				dev->romlen = rom->pcilen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 		pa_data = data->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 		memunmap(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 	set_dev_domain_options(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 	 * Setup the initial MSI domain of the device. If the underlying
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 	 * bus has a PCI/MSI irqdomain associated use the bus domain,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 	 * otherwise set the default domain. This ensures that special irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 	 * domains e.g. VMD are preserved. The default ensures initial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 	 * operation if irq remapping is not active. If irq remapping is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 	 * active it will overwrite the domain pointer when the device is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 	 * associated to a remapping domain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	msidom = dev_get_msi_domain(&dev->bus->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 	if (!msidom)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 		msidom = x86_pci_msi_default_domain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 	dev_set_msi_domain(&dev->dev, msidom);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) int pcibios_enable_device(struct pci_dev *dev, int mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) 	if ((err = pci_enable_resources(dev, mask)) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 	if (!pci_dev_msi_enabled(dev))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) 		return pcibios_enable_irq(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) void pcibios_disable_device (struct pci_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 	if (!pci_dev_msi_enabled(dev) && pcibios_disable_irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 		pcibios_disable_irq(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) void pcibios_release_device(struct pci_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) 	if (atomic_dec_return(&dev->enable_cnt) >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 		pcibios_disable_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) int pci_ext_cfg_avail(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 	if (raw_pci_ext_ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) #if IS_ENABLED(CONFIG_VMD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) struct pci_dev *pci_real_dma_dev(struct pci_dev *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) 	if (is_vmd(dev->bus))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) 		return to_pci_sysdata(dev->bus)->vmd_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) 	return dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) #endif