Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v3.20-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI changes from Bjorn Helgaas:
"Enumeration
- Move domain assignment from arm64 to generic code (Lorenzo Pieralisi)
- ARM: Remove artificial dependency on pci_sys_data domain (Lorenzo Pieralisi)
- ARM: Move to generic PCI domains (Lorenzo Pieralisi)
- Generate uppercase hex for modalias var in uevent (Ricardo Ribalda Delgado)
- Add and use generic config accessors on ARM, PowerPC (Rob Herring)

Resource management
- Free resources on failure in of_pci_get_host_bridge_resources() (Lorenzo Pieralisi)
- Fix infinite loop with ROM image of size 0 (Michel Dänzer)

PCI device hotplug
- Handle surprise add even if surprise removal isn't supported (Bjorn Helgaas)

Virtualization
- Mark AMD/ATI VGA devices that don't reset on D3hot->D0 transition (Alex Williamson)
- Add DMA alias quirk for Adaptec 3405 (Alex Williamson)
- Add Wellsburg (X99) to Intel PCH root port ACS quirk (Alex Williamson)
- Add ACS quirk for Emulex NICs (Vasundhara Volam)

MSI
- Fail MSI-X mappings if there's no space assigned to MSI-X BAR (Yijing Wang)

Freescale Layerscape host bridge driver
- Fix platform_no_drv_owner.cocci warnings (Julia Lawall)

NVIDIA Tegra host bridge driver
- Remove unnecessary tegra_pcie_fixup_bridge() (Lucas Stach)

Renesas R-Car host bridge driver
- Fix error handling of irq_of_parse_and_map() (Dmitry Torokhov)

TI Keystone host bridge driver
- Fix error handling of irq_of_parse_and_map() (Dmitry Torokhov)
- Fix misspelling of current function in debug output (Julia Lawall)

Xilinx AXI host bridge driver
- Fix harmless format string warning (Arnd Bergmann)

Miscellaneous
- Use standard parsing functions for ASPM sysfs setters (Chris J Arges)
- Add pci_device_to_OF_node() stub for !CONFIG_OF (Kevin Hao)
- Delete unnecessary NULL pointer checks (Markus Elfring)
- Add and use defines for PCIe Max_Read_Request_Size (Rafał Miłecki)
- Include clk.h instead of clk-private.h (Stephen Boyd)"

* tag 'pci-v3.20-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (48 commits)
PCI: Add pci_device_to_OF_node() stub for !CONFIG_OF
PCI: xilinx: Convert to use generic config accessors
PCI: xgene: Convert to use generic config accessors
PCI: tegra: Convert to use generic config accessors
PCI: rcar: Convert to use generic config accessors
PCI: generic: Convert to use generic config accessors
powerpc/powermac: Convert PCI to use generic config accessors
powerpc/fsl_pci: Convert PCI to use generic config accessors
ARM: ks8695: Convert PCI to use generic config accessors
ARM: sa1100: Convert PCI to use generic config accessors
ARM: integrator: Convert PCI to use generic config accessors
PCI: versatile: Add DT-based ARM Versatile PB PCIe host driver
ARM: dts: versatile: add PCI controller binding
of/pci: Free resources on failure in of_pci_get_host_bridge_resources()
PCI: versatile: Add DT docs for ARM Versatile PB PCIe driver
PCI: Fail MSI-X mappings if there's no space assigned to MSI-X BAR
r8169: use PCI define for Max_Read_Request_Size
[SCSI] esas2r: use PCI define for Max_Read_Request_Size
tile: use PCI define for Max_Read_Request_Size
rapidio/tsi721: use PCI define for Max_Read_Request_Size
...

+744 -978
+59
Documentation/devicetree/bindings/pci/versatile.txt
··· 1 + * ARM Versatile Platform Baseboard PCI interface 2 + 3 + PCI host controller found on the ARM Versatile PB board's FPGA. 4 + 5 + Required properties: 6 + - compatible: should contain "arm,versatile-pci" to identify the Versatile PCI 7 + controller. 8 + - reg: base addresses and lengths of the pci controller. There must be 3 9 + entries: 10 + - Versatile-specific registers 11 + - Self Config space 12 + - Config space 13 + - #address-cells: set to <3> 14 + - #size-cells: set to <2> 15 + - device_type: set to "pci" 16 + - bus-range: set to <0 0xff> 17 + - ranges: ranges for the PCI memory and I/O regions 18 + - #interrupt-cells: set to <1> 19 + - interrupt-map-mask and interrupt-map: standard PCI properties to define 20 + the mapping of the PCI interface to interrupt numbers. 21 + 22 + Example: 23 + 24 + pci-controller@10001000 { 25 + compatible = "arm,versatile-pci"; 26 + device_type = "pci"; 27 + reg = <0x10001000 0x1000 28 + 0x41000000 0x10000 29 + 0x42000000 0x100000>; 30 + bus-range = <0 0xff>; 31 + #address-cells = <3>; 32 + #size-cells = <2>; 33 + #interrupt-cells = <1>; 34 + 35 + ranges = <0x01000000 0 0x00000000 0x43000000 0 0x00010000 /* downstream I/O */ 36 + 0x02000000 0 0x50000000 0x50000000 0 0x10000000 /* non-prefetchable memory */ 37 + 0x42000000 0 0x60000000 0x60000000 0 0x10000000>; /* prefetchable memory */ 38 + 39 + interrupt-map-mask = <0x1800 0 0 7>; 40 + interrupt-map = <0x1800 0 0 1 &sic 28 41 + 0x1800 0 0 2 &sic 29 42 + 0x1800 0 0 3 &sic 30 43 + 0x1800 0 0 4 &sic 27 44 + 45 + 0x1000 0 0 1 &sic 27 46 + 0x1000 0 0 2 &sic 28 47 + 0x1000 0 0 3 &sic 29 48 + 0x1000 0 0 4 &sic 30 49 + 50 + 0x0800 0 0 1 &sic 30 51 + 0x0800 0 0 2 &sic 27 52 + 0x0800 0 0 3 &sic 28 53 + 0x0800 0 0 4 &sic 29 54 + 55 + 0x0000 0 0 1 &sic 29 56 + 0x0000 0 0 2 &sic 30 57 + 0x0000 0 0 3 &sic 27 58 + 0x0000 0 0 4 &sic 28>; 59 + };
+8
MAINTAINERS
··· 7277 7277 F: arch/x86/pci/ 7278 7278 F: arch/x86/kernel/quirks.c 7279 7279 7280 + PCI DRIVER FOR ARM VERSATILE PLATFORM 7281 + M: Rob Herring <robh@kernel.org> 7282 + L: linux-pci@vger.kernel.org 7283 + L: linux-arm-kernel@lists.infradead.org 7284 + S: Maintained 7285 + F: Documentation/devicetree/bindings/pci/versatile.txt 7286 + F: drivers/pci/host/pci-versatile.c 7287 + 7280 7288 PCI DRIVER FOR APPLIEDMICRO XGENE 7281 7289 M: Tanmay Inamdar <tinamdar@apm.com> 7282 7290 L: linux-pci@vger.kernel.org
+3
arch/arm/Kconfig
··· 1279 1279 bool 1280 1280 depends on PCI 1281 1281 1282 + config PCI_DOMAINS_GENERIC 1283 + def_bool PCI_DOMAINS 1284 + 1282 1285 config PCI_NANOENGINE 1283 1286 bool "BSE nanoEngine PCI support" 1284 1287 depends on SA1100_NANOENGINE
+37
arch/arm/boot/dts/versatile-pb.dts
··· 29 29 clock-names = "apb_pclk"; 30 30 }; 31 31 32 + pci-controller@10001000 { 33 + compatible = "arm,versatile-pci"; 34 + device_type = "pci"; 35 + reg = <0x10001000 0x1000 36 + 0x41000000 0x10000 37 + 0x42000000 0x100000>; 38 + bus-range = <0 0xff>; 39 + #address-cells = <3>; 40 + #size-cells = <2>; 41 + #interrupt-cells = <1>; 42 + 43 + ranges = <0x01000000 0 0x00000000 0x43000000 0 0x00010000 /* downstream I/O */ 44 + 0x02000000 0 0x50000000 0x50000000 0 0x10000000 /* non-prefetchable memory */ 45 + 0x42000000 0 0x60000000 0x60000000 0 0x10000000>; /* prefetchable memory */ 46 + 47 + interrupt-map-mask = <0x1800 0 0 7>; 48 + interrupt-map = <0x1800 0 0 1 &sic 28 49 + 0x1800 0 0 2 &sic 29 50 + 0x1800 0 0 3 &sic 30 51 + 0x1800 0 0 4 &sic 27 52 + 53 + 0x1000 0 0 1 &sic 27 54 + 0x1000 0 0 2 &sic 28 55 + 0x1000 0 0 3 &sic 29 56 + 0x1000 0 0 4 &sic 30 57 + 58 + 0x0800 0 0 1 &sic 30 59 + 0x0800 0 0 2 &sic 27 60 + 0x0800 0 0 3 &sic 28 61 + 0x0800 0 0 4 &sic 29 62 + 63 + 0x0000 0 0 1 &sic 29 64 + 0x0000 0 0 2 &sic 30 65 + 0x0000 0 0 3 &sic 27 66 + 0x0000 0 0 4 &sic 28>; 67 + }; 68 + 32 69 fpga { 33 70 uart@9000 { 34 71 compatible = "arm,pl011", "arm,primecell";
-6
arch/arm/include/asm/mach/pci.h
··· 19 19 struct device; 20 20 21 21 struct hw_pci { 22 - #ifdef CONFIG_PCI_DOMAINS 23 - int domain; 24 - #endif 25 22 #ifdef CONFIG_PCI_MSI 26 23 struct msi_controller *msi_ctrl; 27 24 #endif ··· 42 45 * Per-controller structure 43 46 */ 44 47 struct pci_sys_data { 45 - #ifdef CONFIG_PCI_DOMAINS 46 - int domain; 47 - #endif 48 48 #ifdef CONFIG_PCI_MSI 49 49 struct msi_controller *msi_ctrl; 50 50 #endif
-7
arch/arm/include/asm/pci.h
··· 18 18 } 19 19 20 20 #ifdef CONFIG_PCI_DOMAINS 21 - static inline int pci_domain_nr(struct pci_bus *bus) 22 - { 23 - struct pci_sys_data *root = bus->sysdata; 24 - 25 - return root->domain; 26 - } 27 - 28 21 static inline int pci_proc_domain(struct pci_bus *bus) 29 22 { 30 23 return pci_domain_nr(bus);
-3
arch/arm/kernel/bios32.c
··· 463 463 if (!sys) 464 464 panic("PCI: unable to allocate sys data!"); 465 465 466 - #ifdef CONFIG_PCI_DOMAINS 467 - sys->domain = hw->domain; 468 - #endif 469 466 #ifdef CONFIG_PCI_MSI 470 467 sys->msi_ctrl = hw->msi_ctrl; 471 468 #endif
+27 -65
arch/arm/mach-cns3xxx/pcie.c
··· 30 30 unsigned int irqs[2]; 31 31 struct resource res_io; 32 32 struct resource res_mem; 33 - struct hw_pci hw_pci; 34 - 33 + int port; 35 34 bool linked; 36 35 }; 37 - 38 - static struct cns3xxx_pcie cns3xxx_pcie[]; /* forward decl. */ 39 36 40 37 static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata) 41 38 { 42 39 struct pci_sys_data *root = sysdata; 43 40 44 - return &cns3xxx_pcie[root->domain]; 41 + return root->private_data; 45 42 } 46 43 47 44 static struct cns3xxx_pcie *pdev_to_cnspci(const struct pci_dev *dev) ··· 51 54 return sysdata_to_cnspci(bus->sysdata); 52 55 } 53 56 54 - static void __iomem *cns3xxx_pci_cfg_base(struct pci_bus *bus, 55 - unsigned int devfn, int where) 57 + static void __iomem *cns3xxx_pci_map_bus(struct pci_bus *bus, 58 + unsigned int devfn, int where) 56 59 { 57 60 struct cns3xxx_pcie *cnspci = pbus_to_cnspci(bus); 58 61 int busno = bus->number; ··· 88 91 static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, 89 92 int where, int size, u32 *val) 90 93 { 91 - u32 v; 92 - void __iomem *base; 94 + int ret; 93 95 u32 mask = (0x1ull << (size * 8)) - 1; 94 96 int shift = (where % 4) * 8; 95 97 96 - base = cns3xxx_pci_cfg_base(bus, devfn, where); 97 - if (!base) { 98 - *val = 0xffffffff; 99 - return PCIBIOS_SUCCESSFUL; 100 - } 98 + ret = pci_generic_config_read32(bus, devfn, where, size, val); 101 99 102 - v = __raw_readl(base); 103 - 104 - if (bus->number == 0 && devfn == 0 && 105 - (where & 0xffc) == PCI_CLASS_REVISION) { 100 + if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && 101 + (where & 0xffc) == PCI_CLASS_REVISION) 106 102 /* 107 103 * RC's class is 0xb, but Linux PCI driver needs 0x604 108 104 * for a PCIe bridge. So we must fixup the class code 109 105 * to 0x604 here. 110 106 */ 111 - v &= 0xff; 112 - v |= 0x604 << 16; 113 - } 107 + *val = ((((*val << shift) & 0xff) | (0x604 << 16)) >> shift) & mask; 114 108 115 - *val = (v >> shift) & mask; 116 - 117 - return PCIBIOS_SUCCESSFUL; 118 - } 119 - 120 - static int cns3xxx_pci_write_config(struct pci_bus *bus, unsigned int devfn, 121 - int where, int size, u32 val) 122 - { 123 - u32 v; 124 - void __iomem *base; 125 - u32 mask = (0x1ull << (size * 8)) - 1; 126 - int shift = (where % 4) * 8; 127 - 128 - base = cns3xxx_pci_cfg_base(bus, devfn, where); 129 - if (!base) 130 - return PCIBIOS_SUCCESSFUL; 131 - 132 - v = __raw_readl(base); 133 - 134 - v &= ~(mask << shift); 135 - v |= (val & mask) << shift; 136 - 137 - __raw_writel(v, base); 138 - 139 - return PCIBIOS_SUCCESSFUL; 109 + return ret; 140 110 } 141 111 142 112 static int cns3xxx_pci_setup(int nr, struct pci_sys_data *sys) ··· 122 158 } 123 159 124 160 static struct pci_ops cns3xxx_pcie_ops = { 161 + .map_bus = cns3xxx_pci_map_bus, 125 162 .read = cns3xxx_pci_read_config, 126 - .write = cns3xxx_pci_write_config, 163 + .write = pci_generic_config_write, 127 164 }; 128 165 129 166 static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) ··· 157 192 .flags = IORESOURCE_MEM, 158 193 }, 159 194 .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, }, 160 - .hw_pci = { 161 - .domain = 0, 162 - .nr_controllers = 1, 163 - .ops = &cns3xxx_pcie_ops, 164 - .setup = cns3xxx_pci_setup, 165 - .map_irq = cns3xxx_pcie_map_irq, 166 - }, 195 + .port = 0, 167 196 }, 168 197 [1] = { 169 198 .host_regs = (void __iomem *)CNS3XXX_PCIE1_HOST_BASE_VIRT, ··· 176 217 .flags = IORESOURCE_MEM, 177 218 }, 178 219 .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, }, 179 - .hw_pci = { 180 - .domain = 1, 181 - .nr_controllers = 1, 182 - .ops = &cns3xxx_pcie_ops, 183 - .setup = cns3xxx_pci_setup, 184 - .map_irq = cns3xxx_pcie_map_irq, 185 - }, 220 + .port = 1, 186 221 }, 187 222 }; 188 223 189 224 static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) 190 225 { 191 - int port = cnspci->hw_pci.domain; 226 + int port = cnspci->port; 192 227 u32 reg; 193 228 unsigned long time; 194 229 ··· 213 260 214 261 static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) 215 262 { 216 - int port = cnspci->hw_pci.domain; 263 + int port = cnspci->port; 217 264 struct pci_sys_data sd = { 218 - .domain = port, 265 + .private_data = cnspci, 219 266 }; 220 267 struct pci_bus bus = { 221 268 .number = 0, ··· 276 323 void __init cns3xxx_pcie_init_late(void) 277 324 { 278 325 int i; 326 + void *private_data; 327 + struct hw_pci hw_pci = { 328 + .nr_controllers = 1, 329 + .ops = &cns3xxx_pcie_ops, 330 + .setup = cns3xxx_pci_setup, 331 + .map_irq = cns3xxx_pcie_map_irq, 332 + .private_data = &private_data, 333 + }; 279 334 280 335 pcibios_min_io = 0; 281 336 pcibios_min_mem = 0; ··· 296 335 cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i)); 297 336 cns3xxx_pcie_check_link(&cns3xxx_pcie[i]); 298 337 cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]); 299 - pci_common_init(&cns3xxx_pcie[i].hw_pci); 338 + private_data = &cns3xxx_pcie[i]; 339 + pci_common_init(&hw_pci); 300 340 } 301 341 302 342 pci_assign_unassigned_resources();
+5 -57
arch/arm/mach-integrator/pci_v3.c
··· 356 356 * 7:2 register number 357 357 * 358 358 */ 359 - static DEFINE_RAW_SPINLOCK(v3_lock); 360 359 361 360 #undef V3_LB_BASE_PREFETCH 362 361 #define V3_LB_BASE_PREFETCH 0 ··· 456 457 static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where, 457 458 int size, u32 *val) 458 459 { 459 - void __iomem *addr; 460 - unsigned long flags; 461 - u32 v; 462 - 463 - raw_spin_lock_irqsave(&v3_lock, flags); 464 - addr = v3_open_config_window(bus, devfn, where); 465 - 466 - switch (size) { 467 - case 1: 468 - v = __raw_readb(addr); 469 - break; 470 - 471 - case 2: 472 - v = __raw_readw(addr); 473 - break; 474 - 475 - default: 476 - v = __raw_readl(addr); 477 - break; 478 - } 479 - 460 + int ret = pci_generic_config_read(bus, devfn, where, size, val); 480 461 v3_close_config_window(); 481 - raw_spin_unlock_irqrestore(&v3_lock, flags); 482 - 483 - *val = v; 484 - return PCIBIOS_SUCCESSFUL; 462 + return ret; 485 463 } 486 464 487 465 static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where, 488 466 int size, u32 val) 489 467 { 490 - void __iomem *addr; 491 - unsigned long flags; 492 - 493 - raw_spin_lock_irqsave(&v3_lock, flags); 494 - addr = v3_open_config_window(bus, devfn, where); 495 - 496 - switch (size) { 497 - case 1: 498 - __raw_writeb((u8)val, addr); 499 - __raw_readb(addr); 500 - break; 501 - 502 - case 2: 503 - __raw_writew((u16)val, addr); 504 - __raw_readw(addr); 505 - break; 506 - 507 - case 4: 508 - __raw_writel(val, addr); 509 - __raw_readl(addr); 510 - break; 511 - } 512 - 468 + int ret = pci_generic_config_write(bus, devfn, where, size, val); 513 469 v3_close_config_window(); 514 - raw_spin_unlock_irqrestore(&v3_lock, flags); 515 - 516 - return PCIBIOS_SUCCESSFUL; 470 + return ret; 517 471 } 518 472 519 473 static struct pci_ops pci_v3_ops = { 474 + .map_bus = v3_open_config_window, 520 475 .read = v3_read_config, 521 476 .write = v3_write_config, 522 477 }; ··· 611 658 */ 612 659 static void __init pci_v3_preinit(void) 613 660 { 614 - unsigned long flags; 615 661 unsigned int temp; 616 662 phys_addr_t io_address = pci_pio_to_address(io_mem.start); 617 663 ··· 623 671 hook_fault_code(6, v3_pci_fault, SIGBUS, 0, "external abort on linefetch"); 624 672 hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch"); 625 673 hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch"); 626 - 627 - raw_spin_lock_irqsave(&v3_lock, flags); 628 674 629 675 /* 630 676 * Unlock V3 registers, but only if they were previously locked. ··· 686 736 v3_writew(V3_LB_CFG, v3_readw(V3_LB_CFG) | (1 << 10)); 687 737 v3_writeb(V3_LB_IMASK, 0x28); 688 738 __raw_writel(3, ap_syscon_base + INTEGRATOR_SC_PCIENABLE_OFFSET); 689 - 690 - raw_spin_unlock_irqrestore(&v3_lock, flags); 691 739 } 692 740 693 741 static void __init pci_v3_postinit(void)
+6 -71
arch/arm/mach-ks8695/pci.c
··· 38 38 39 39 40 40 static int pci_dbg; 41 - static int pci_cfg_dbg; 42 - 43 41 44 42 static void ks8695_pci_setupconfig(unsigned int bus_nr, unsigned int devfn, unsigned int where) 45 43 { ··· 57 59 } 58 60 } 59 61 60 - 61 - /* 62 - * The KS8695 datasheet prohibits anything other than 32bit accesses 63 - * to the IO registers, so all our configuration must be done with 64 - * 32bit operations, and the correct bit masking and shifting. 65 - */ 66 - 67 - static int ks8695_pci_readconfig(struct pci_bus *bus, 68 - unsigned int devfn, int where, int size, u32 *value) 62 + static void __iomem *ks8695_pci_map_bus(struct pci_bus *bus, unsigned int devfn, 63 + int where) 69 64 { 70 65 ks8695_pci_setupconfig(bus->number, devfn, where); 71 - 72 - *value = __raw_readl(KS8695_PCI_VA + KS8695_PBCD); 73 - 74 - switch (size) { 75 - case 4: 76 - break; 77 - case 2: 78 - *value = *value >> ((where & 2) * 8); 79 - *value &= 0xffff; 80 - break; 81 - case 1: 82 - *value = *value >> ((where & 3) * 8); 83 - *value &= 0xff; 84 - break; 85 - } 86 - 87 - if (pci_cfg_dbg) { 88 - printk("read: %d,%08x,%02x,%d: %08x (%08x)\n", 89 - bus->number, devfn, where, size, *value, 90 - __raw_readl(KS8695_PCI_VA + KS8695_PBCD)); 91 - } 92 - 93 - return PCIBIOS_SUCCESSFUL; 94 - } 95 - 96 - static int ks8695_pci_writeconfig(struct pci_bus *bus, 97 - unsigned int devfn, int where, int size, u32 value) 98 - { 99 - unsigned long tmp; 100 - 101 - if (pci_cfg_dbg) { 102 - printk("write: %d,%08x,%02x,%d: %08x\n", 103 - bus->number, devfn, where, size, value); 104 - } 105 - 106 - ks8695_pci_setupconfig(bus->number, devfn, where); 107 - 108 - switch (size) { 109 - case 4: 110 - __raw_writel(value, KS8695_PCI_VA + KS8695_PBCD); 111 - break; 112 - case 2: 113 - tmp = __raw_readl(KS8695_PCI_VA + KS8695_PBCD); 114 - tmp &= ~(0xffff << ((where & 2) * 8)); 115 - tmp |= value << ((where & 2) * 8); 116 - 117 - __raw_writel(tmp, KS8695_PCI_VA + KS8695_PBCD); 118 - break; 119 - case 1: 120 - tmp = __raw_readl(KS8695_PCI_VA + KS8695_PBCD); 121 - tmp &= ~(0xff << ((where & 3) * 8)); 122 - tmp |= value << ((where & 3) * 8); 123 - 124 - __raw_writel(tmp, KS8695_PCI_VA + KS8695_PBCD); 125 - break; 126 - } 127 - 128 - return PCIBIOS_SUCCESSFUL; 66 + return KS8695_PCI_VA + KS8695_PBCD; 129 67 } 130 68 131 69 static void ks8695_local_writeconfig(int where, u32 value) ··· 71 137 } 72 138 73 139 static struct pci_ops ks8695_pci_ops = { 74 - .read = ks8695_pci_readconfig, 75 - .write = ks8695_pci_writeconfig, 140 + .map_bus = ks8695_pci_map_bus, 141 + .read = pci_generic_config_read32, 142 + .write = pci_generic_config_write32, 76 143 }; 77 144 78 145 static struct resource pci_mem = {
+8 -86
arch/arm/mach-sa1100/pci-nanoengine.c
··· 22 22 #include <linux/kernel.h> 23 23 #include <linux/irq.h> 24 24 #include <linux/pci.h> 25 - #include <linux/spinlock.h> 26 25 27 26 #include <asm/mach/pci.h> 28 27 #include <asm/mach-types.h> ··· 29 30 #include <mach/nanoengine.h> 30 31 #include <mach/hardware.h> 31 32 32 - static DEFINE_SPINLOCK(nano_lock); 33 - 34 - static int nanoengine_get_pci_address(struct pci_bus *bus, 35 - unsigned int devfn, int where, void __iomem **address) 33 + static void __iomem *nanoengine_pci_map_bus(struct pci_bus *bus, 34 + unsigned int devfn, int where) 36 35 { 37 - int ret = PCIBIOS_DEVICE_NOT_FOUND; 38 - unsigned int busnr = bus->number; 36 + if (bus->number != 0 || (devfn >> 3) != 0) 37 + return NULL; 39 38 40 - *address = (void __iomem *)NANO_PCI_CONFIG_SPACE_VIRT + 39 + return (void __iomem *)NANO_PCI_CONFIG_SPACE_VIRT + 41 40 ((bus->number << 16) | (devfn << 8) | (where & ~3)); 42 - 43 - ret = (busnr > 255 || devfn > 255 || where > 255) ? 44 - PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL; 45 - 46 - return ret; 47 - } 48 - 49 - static int nanoengine_read_config(struct pci_bus *bus, unsigned int devfn, int where, 50 - int size, u32 *val) 51 - { 52 - int ret; 53 - void __iomem *address; 54 - unsigned long flags; 55 - u32 v; 56 - 57 - /* nanoEngine PCI bridge does not return -1 for a non-existing 58 - * device. We must fake the answer. We know that the only valid 59 - * device is device zero at bus 0, which is the network chip. */ 60 - if (bus->number != 0 || (devfn >> 3) != 0) { 61 - v = -1; 62 - nanoengine_get_pci_address(bus, devfn, where, &address); 63 - goto exit_function; 64 - } 65 - 66 - spin_lock_irqsave(&nano_lock, flags); 67 - 68 - ret = nanoengine_get_pci_address(bus, devfn, where, &address); 69 - if (ret != PCIBIOS_SUCCESSFUL) 70 - return ret; 71 - v = __raw_readl(address); 72 - 73 - spin_unlock_irqrestore(&nano_lock, flags); 74 - 75 - v >>= ((where & 3) * 8); 76 - v &= (unsigned long)(-1) >> ((4 - size) * 8); 77 - 78 - exit_function: 79 - *val = v; 80 - return PCIBIOS_SUCCESSFUL; 81 - } 82 - 83 - static int nanoengine_write_config(struct pci_bus *bus, unsigned int devfn, int where, 84 - int size, u32 val) 85 - { 86 - int ret; 87 - void __iomem *address; 88 - unsigned long flags; 89 - unsigned shift; 90 - u32 v; 91 - 92 - shift = (where & 3) * 8; 93 - 94 - spin_lock_irqsave(&nano_lock, flags); 95 - 96 - ret = nanoengine_get_pci_address(bus, devfn, where, &address); 97 - if (ret != PCIBIOS_SUCCESSFUL) 98 - return ret; 99 - v = __raw_readl(address); 100 - switch (size) { 101 - case 1: 102 - v &= ~(0xFF << shift); 103 - v |= val << shift; 104 - break; 105 - case 2: 106 - v &= ~(0xFFFF << shift); 107 - v |= val << shift; 108 - break; 109 - case 4: 110 - v = val; 111 - break; 112 - } 113 - __raw_writel(v, address); 114 - 115 - spin_unlock_irqrestore(&nano_lock, flags); 116 - 117 - return PCIBIOS_SUCCESSFUL; 118 41 } 119 42 120 43 static struct pci_ops pci_nano_ops = { 121 - .read = nanoengine_read_config, 122 - .write = nanoengine_write_config, 44 + .map_bus = nanoengine_pci_map_bus, 45 + .read = pci_generic_config_read32, 46 + .write = pci_generic_config_write32, 123 47 }; 124 48 125 49 static int __init pci_nanoengine_map_irq(const struct pci_dev *dev, u8 slot,
-22
arch/arm64/kernel/pci.c
··· 46 46 47 47 return 0; 48 48 } 49 - 50 - 51 - #ifdef CONFIG_PCI_DOMAINS_GENERIC 52 - static bool dt_domain_found = false; 53 - 54 - void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) 55 - { 56 - int domain = of_get_pci_domain_nr(parent->of_node); 57 - 58 - if (domain >= 0) { 59 - dt_domain_found = true; 60 - } else if (dt_domain_found == true) { 61 - dev_err(parent, "Node %s is missing \"linux,pci-domain\" property in DT\n", 62 - parent->of_node->full_name); 63 - return; 64 - } else { 65 - domain = pci_get_new_domain_nr(); 66 - } 67 - 68 - bus->domain_nr = domain; 69 - } 70 - #endif
+2 -2
arch/frv/mb93090-mb00/pci-vdk.c
··· 168 168 } 169 169 170 170 static struct pci_ops pci_direct_frv = { 171 - pci_frv_read_config, 172 - pci_frv_write_config, 171 + .read = pci_frv_read_config, 172 + .write = pci_frv_write_config, 173 173 }; 174 174 175 175 /*
+2 -2
arch/mips/pci/pci-bcm1480.c
··· 173 173 } 174 174 175 175 struct pci_ops bcm1480_pci_ops = { 176 - bcm1480_pcibios_read, 177 - bcm1480_pcibios_write, 176 + .read = bcm1480_pcibios_read, 177 + .write = bcm1480_pcibios_write, 178 178 }; 179 179 180 180 static struct resource bcm1480_mem_resource = {
+2 -2
arch/mips/pci/pci-octeon.c
··· 327 327 328 328 329 329 static struct pci_ops octeon_pci_ops = { 330 - octeon_read_config, 331 - octeon_write_config, 330 + .read = octeon_read_config, 331 + .write = octeon_write_config, 332 332 }; 333 333 334 334 static struct resource octeon_pci_mem_resource = {
+6 -6
arch/mips/pci/pcie-octeon.c
··· 1792 1792 } 1793 1793 1794 1794 static struct pci_ops octeon_pcie0_ops = { 1795 - octeon_pcie0_read_config, 1796 - octeon_pcie0_write_config, 1795 + .read = octeon_pcie0_read_config, 1796 + .write = octeon_pcie0_write_config, 1797 1797 }; 1798 1798 1799 1799 static struct resource octeon_pcie0_mem_resource = { ··· 1813 1813 }; 1814 1814 1815 1815 static struct pci_ops octeon_pcie1_ops = { 1816 - octeon_pcie1_read_config, 1817 - octeon_pcie1_write_config, 1816 + .read = octeon_pcie1_read_config, 1817 + .write = octeon_pcie1_write_config, 1818 1818 }; 1819 1819 1820 1820 static struct resource octeon_pcie1_mem_resource = { ··· 1834 1834 }; 1835 1835 1836 1836 static struct pci_ops octeon_dummy_ops = { 1837 - octeon_dummy_read_config, 1838 - octeon_dummy_write_config, 1837 + .read = octeon_dummy_read_config, 1838 + .write = octeon_dummy_write_config, 1839 1839 }; 1840 1840 1841 1841 static struct resource octeon_dummy_mem_resource = {
+2 -2
arch/mn10300/unit-asb2305/pci.c
··· 228 228 } 229 229 230 230 static struct pci_ops pci_direct_ampci = { 231 - pci_ampci_read_config, 232 - pci_ampci_write_config, 231 + .read = pci_ampci_read_config, 232 + .write = pci_ampci_write_config, 233 233 }; 234 234 235 235 /*
+2 -2
arch/powerpc/platforms/cell/celleb_scc_pciex.c
··· 399 399 } 400 400 401 401 static struct pci_ops scc_pciex_pci_ops = { 402 - scc_pciex_read_config, 403 - scc_pciex_write_config, 402 + .read = scc_pciex_read_config, 403 + .write = scc_pciex_write_config, 404 404 }; 405 405 406 406 static void pciex_clear_intr_all(unsigned int __iomem *base)
+39 -170
arch/powerpc/platforms/powermac/pci.c
··· 133 133 |(((unsigned int)(off)) & 0xFCUL) \ 134 134 |1UL) 135 135 136 - static volatile void __iomem *macrisc_cfg_access(struct pci_controller* hose, 137 - u8 bus, u8 dev_fn, u8 offset) 136 + static void __iomem *macrisc_cfg_map_bus(struct pci_bus *bus, 137 + unsigned int dev_fn, 138 + int offset) 138 139 { 139 140 unsigned int caddr; 141 + struct pci_controller *hose; 140 142 141 - if (bus == hose->first_busno) { 143 + hose = pci_bus_to_host(bus); 144 + if (hose == NULL) 145 + return NULL; 146 + 147 + if (bus->number == hose->first_busno) { 142 148 if (dev_fn < (11 << 3)) 143 149 return NULL; 144 150 caddr = MACRISC_CFA0(dev_fn, offset); 145 151 } else 146 - caddr = MACRISC_CFA1(bus, dev_fn, offset); 152 + caddr = MACRISC_CFA1(bus->number, dev_fn, offset); 147 153 148 154 /* Uninorth will return garbage if we don't read back the value ! */ 149 155 do { ··· 160 154 return hose->cfg_data + offset; 161 155 } 162 156 163 - static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 164 - int offset, int len, u32 *val) 165 - { 166 - struct pci_controller *hose; 167 - volatile void __iomem *addr; 168 - 169 - hose = pci_bus_to_host(bus); 170 - if (hose == NULL) 171 - return PCIBIOS_DEVICE_NOT_FOUND; 172 - if (offset >= 0x100) 173 - return PCIBIOS_BAD_REGISTER_NUMBER; 174 - addr = macrisc_cfg_access(hose, bus->number, devfn, offset); 175 - if (!addr) 176 - return PCIBIOS_DEVICE_NOT_FOUND; 177 - /* 178 - * Note: the caller has already checked that offset is 179 - * suitably aligned and that len is 1, 2 or 4. 180 - */ 181 - switch (len) { 182 - case 1: 183 - *val = in_8(addr); 184 - break; 185 - case 2: 186 - *val = in_le16(addr); 187 - break; 188 - default: 189 - *val = in_le32(addr); 190 - break; 191 - } 192 - return PCIBIOS_SUCCESSFUL; 193 - } 194 - 195 - static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn, 196 - int offset, int len, u32 val) 197 - { 198 - struct pci_controller *hose; 199 - volatile void __iomem *addr; 200 - 201 - hose = pci_bus_to_host(bus); 202 - if (hose == NULL) 203 - return PCIBIOS_DEVICE_NOT_FOUND; 204 - if (offset >= 0x100) 205 - return PCIBIOS_BAD_REGISTER_NUMBER; 206 - addr = macrisc_cfg_access(hose, bus->number, devfn, offset); 207 - if (!addr) 208 - return PCIBIOS_DEVICE_NOT_FOUND; 209 - /* 210 - * Note: the caller has already checked that offset is 211 - * suitably aligned and that len is 1, 2 or 4. 212 - */ 213 - switch (len) { 214 - case 1: 215 - out_8(addr, val); 216 - break; 217 - case 2: 218 - out_le16(addr, val); 219 - break; 220 - default: 221 - out_le32(addr, val); 222 - break; 223 - } 224 - return PCIBIOS_SUCCESSFUL; 225 - } 226 - 227 157 static struct pci_ops macrisc_pci_ops = 228 158 { 229 - .read = macrisc_read_config, 230 - .write = macrisc_write_config, 159 + .map_bus = macrisc_cfg_map_bus, 160 + .read = pci_generic_config_read, 161 + .write = pci_generic_config_write, 231 162 }; 232 163 233 164 #ifdef CONFIG_PPC32 234 165 /* 235 166 * Verify that a specific (bus, dev_fn) exists on chaos 236 167 */ 237 - static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) 168 + static void __iomem *chaos_map_bus(struct pci_bus *bus, unsigned int devfn, 169 + int offset) 238 170 { 239 171 struct device_node *np; 240 172 const u32 *vendor, *device; 241 173 242 174 if (offset >= 0x100) 243 - return PCIBIOS_BAD_REGISTER_NUMBER; 175 + return NULL; 244 176 np = of_pci_find_child_device(bus->dev.of_node, devfn); 245 177 if (np == NULL) 246 - return PCIBIOS_DEVICE_NOT_FOUND; 178 + return NULL; 247 179 248 180 vendor = of_get_property(np, "vendor-id", NULL); 249 181 device = of_get_property(np, "device-id", NULL); 250 182 if (vendor == NULL || device == NULL) 251 - return PCIBIOS_DEVICE_NOT_FOUND; 183 + return NULL; 252 184 253 185 if ((*vendor == 0x106b) && (*device == 3) && (offset >= 0x10) 254 186 && (offset != 0x14) && (offset != 0x18) && (offset <= 0x24)) 255 - return PCIBIOS_BAD_REGISTER_NUMBER; 187 + return NULL; 256 188 257 - return PCIBIOS_SUCCESSFUL; 258 - } 259 - 260 - static int 261 - chaos_read_config(struct pci_bus *bus, unsigned int devfn, int offset, 262 - int len, u32 *val) 263 - { 264 - int result = chaos_validate_dev(bus, devfn, offset); 265 - if (result == PCIBIOS_BAD_REGISTER_NUMBER) 266 - *val = ~0U; 267 - if (result != PCIBIOS_SUCCESSFUL) 268 - return result; 269 - return macrisc_read_config(bus, devfn, offset, len, val); 270 - } 271 - 272 - static int 273 - chaos_write_config(struct pci_bus *bus, unsigned int devfn, int offset, 274 - int len, u32 val) 275 - { 276 - int result = chaos_validate_dev(bus, devfn, offset); 277 - if (result != PCIBIOS_SUCCESSFUL) 278 - return result; 279 - return macrisc_write_config(bus, devfn, offset, len, val); 189 + return macrisc_cfg_map_bus(bus, devfn, offset); 280 190 } 281 191 282 192 static struct pci_ops chaos_pci_ops = 283 193 { 284 - .read = chaos_read_config, 285 - .write = chaos_write_config, 194 + .map_bus = chaos_map_bus, 195 + .read = pci_generic_config_read, 196 + .write = pci_generic_config_write, 286 197 }; 287 198 288 199 static void __init setup_chaos(struct pci_controller *hose, ··· 394 471 |(((unsigned int)(off)) & 0xfcU) \ 395 472 |1UL) 396 473 397 - static volatile void __iomem *u4_pcie_cfg_access(struct pci_controller* hose, 398 - u8 bus, u8 dev_fn, int offset) 474 + static void __iomem *u4_pcie_cfg_map_bus(struct pci_bus *bus, 475 + unsigned int dev_fn, 476 + int offset) 399 477 { 478 + struct pci_controller *hose; 400 479 unsigned int caddr; 401 480 402 - if (bus == hose->first_busno) { 481 + if (offset >= 0x1000) 482 + return NULL; 483 + 484 + hose = pci_bus_to_host(bus); 485 + if (!hose) 486 + return NULL; 487 + 488 + if (bus->number == hose->first_busno) { 403 489 caddr = U4_PCIE_CFA0(dev_fn, offset); 404 490 } else 405 - caddr = U4_PCIE_CFA1(bus, dev_fn, offset); 491 + caddr = U4_PCIE_CFA1(bus->number, dev_fn, offset); 406 492 407 493 /* Uninorth will return garbage if we don't read back the value ! */ 408 494 do { ··· 422 490 return hose->cfg_data + offset; 423 491 } 424 492 425 - static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 426 - int offset, int len, u32 *val) 427 - { 428 - struct pci_controller *hose; 429 - volatile void __iomem *addr; 430 - 431 - hose = pci_bus_to_host(bus); 432 - if (hose == NULL) 433 - return PCIBIOS_DEVICE_NOT_FOUND; 434 - if (offset >= 0x1000) 435 - return PCIBIOS_BAD_REGISTER_NUMBER; 436 - addr = u4_pcie_cfg_access(hose, bus->number, devfn, offset); 437 - if (!addr) 438 - return PCIBIOS_DEVICE_NOT_FOUND; 439 - /* 440 - * Note: the caller has already checked that offset is 441 - * suitably aligned and that len is 1, 2 or 4. 442 - */ 443 - switch (len) { 444 - case 1: 445 - *val = in_8(addr); 446 - break; 447 - case 2: 448 - *val = in_le16(addr); 449 - break; 450 - default: 451 - *val = in_le32(addr); 452 - break; 453 - } 454 - return PCIBIOS_SUCCESSFUL; 455 - } 456 - 457 - static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn, 458 - int offset, int len, u32 val) 459 - { 460 - struct pci_controller *hose; 461 - volatile void __iomem *addr; 462 - 463 - hose = pci_bus_to_host(bus); 464 - if (hose == NULL) 465 - return PCIBIOS_DEVICE_NOT_FOUND; 466 - if (offset >= 0x1000) 467 - return PCIBIOS_BAD_REGISTER_NUMBER; 468 - addr = u4_pcie_cfg_access(hose, bus->number, devfn, offset); 469 - if (!addr) 470 - return PCIBIOS_DEVICE_NOT_FOUND; 471 - /* 472 - * Note: the caller has already checked that offset is 473 - * suitably aligned and that len is 1, 2 or 4. 474 - */ 475 - switch (len) { 476 - case 1: 477 - out_8(addr, val); 478 - break; 479 - case 2: 480 - out_le16(addr, val); 481 - break; 482 - default: 483 - out_le32(addr, val); 484 - break; 485 - } 486 - return PCIBIOS_SUCCESSFUL; 487 - } 488 - 489 493 static struct pci_ops u4_pcie_pci_ops = 490 494 { 491 - .read = u4_pcie_read_config, 492 - .write = u4_pcie_write_config, 495 + .map_bus = u4_pcie_cfg_map_bus, 496 + .read = pci_generic_config_read, 497 + .write = pci_generic_config_write, 493 498 }; 494 499 495 500 static void pmac_pci_fixup_u4_of_node(struct pci_dev *dev)
+3 -43
arch/powerpc/sysdev/fsl_pci.c
··· 645 645 return pcie->cfg_type1 + offset; 646 646 } 647 647 648 - static int mpc83xx_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 649 - int offset, int len, u32 *val) 650 - { 651 - void __iomem *cfg_addr; 652 - 653 - cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); 654 - if (!cfg_addr) 655 - return PCIBIOS_DEVICE_NOT_FOUND; 656 - 657 - switch (len) { 658 - case 1: 659 - *val = in_8(cfg_addr); 660 - break; 661 - case 2: 662 - *val = in_le16(cfg_addr); 663 - break; 664 - default: 665 - *val = in_le32(cfg_addr); 666 - break; 667 - } 668 - 669 - return PCIBIOS_SUCCESSFUL; 670 - } 671 - 672 648 static int mpc83xx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, 673 649 int offset, int len, u32 val) 674 650 { 675 651 struct pci_controller *hose = pci_bus_to_host(bus); 676 - void __iomem *cfg_addr; 677 - 678 - cfg_addr = mpc83xx_pcie_remap_cfg(bus, devfn, offset); 679 - if (!cfg_addr) 680 - return PCIBIOS_DEVICE_NOT_FOUND; 681 652 682 653 /* PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS */ 683 654 if (offset == PCI_PRIMARY_BUS && bus->number == hose->first_busno) 684 655 val &= 0xffffff00; 685 656 686 - switch (len) { 687 - case 1: 688 - out_8(cfg_addr, val); 689 - break; 690 - case 2: 691 - out_le16(cfg_addr, val); 692 - break; 693 - default: 694 - out_le32(cfg_addr, val); 695 - break; 696 - } 697 - 698 - return PCIBIOS_SUCCESSFUL; 657 + return pci_generic_config_write(bus, devfn, offset, len, val); 699 658 } 700 659 701 660 static struct pci_ops mpc83xx_pcie_ops = { 702 - .read = mpc83xx_pcie_read_config, 661 + .map_bus = mpc83xx_pcie_remap_cfg, 662 + .read = pci_generic_config_read, 703 663 .write = mpc83xx_pcie_write_config, 704 664 }; 705 665
+2 -2
arch/tile/kernel/pci.c
··· 245 245 { 246 246 struct pci_dev *dev = NULL; 247 247 int smallest_max_payload = 0x1; /* Tile maxes out at 256 bytes. */ 248 - int max_read_size = 0x2; /* Limit to 512 byte reads. */ 248 + int max_read_size = PCI_EXP_DEVCTL_READRQ_512B; 249 249 u16 new_values; 250 250 251 251 /* Scan for the smallest maximum payload size. */ ··· 258 258 } 259 259 260 260 /* Now, set the max_payload_size for all devices to that value. */ 261 - new_values = (max_read_size << 12) | (smallest_max_payload << 5); 261 + new_values = max_read_size | (smallest_max_payload << 5); 262 262 for_each_pci_dev(dev) 263 263 pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL, 264 264 PCI_EXP_DEVCTL_PAYLOAD | PCI_EXP_DEVCTL_READRQ,
+4
arch/x86/pci/xen.c
··· 298 298 map_irq.entry_nr = nvec; 299 299 } else if (type == PCI_CAP_ID_MSIX) { 300 300 int pos; 301 + unsigned long flags; 301 302 u32 table_offset, bir; 302 303 303 304 pos = dev->msix_cap; 304 305 pci_read_config_dword(dev, pos + PCI_MSIX_TABLE, 305 306 &table_offset); 306 307 bir = (u8)(table_offset & PCI_MSIX_TABLE_BIR); 308 + flags = pci_resource_flags(dev, bir); 309 + if (!flags || (flags & IORESOURCE_UNSET)) 310 + return -EINVAL; 307 311 308 312 map_irq.table_base = pci_resource_start(dev, bir); 309 313 map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
+3 -3
drivers/net/ethernet/realtek/r8169.c
··· 4915 4915 4916 4916 RTL_W8(Config3, RTL_R8(Config3) | Jumbo_En0); 4917 4917 RTL_W8(Config4, RTL_R8(Config4) | Jumbo_En1); 4918 - rtl_tx_performance_tweak(tp->pci_dev, 0x2 << MAX_READ_REQUEST_SHIFT); 4918 + rtl_tx_performance_tweak(tp->pci_dev, PCI_EXP_DEVCTL_READRQ_512B); 4919 4919 } 4920 4920 4921 4921 static void r8168c_hw_jumbo_disable(struct rtl8169_private *tp) ··· 4948 4948 RTL_W8(MaxTxPacketSize, 0x3f); 4949 4949 RTL_W8(Config3, RTL_R8(Config3) | Jumbo_En0); 4950 4950 RTL_W8(Config4, RTL_R8(Config4) | 0x01); 4951 - rtl_tx_performance_tweak(tp->pci_dev, 0x2 << MAX_READ_REQUEST_SHIFT); 4951 + rtl_tx_performance_tweak(tp->pci_dev, PCI_EXP_DEVCTL_READRQ_512B); 4952 4952 } 4953 4953 4954 4954 static void r8168e_hw_jumbo_disable(struct rtl8169_private *tp) ··· 4964 4964 static void r8168b_0_hw_jumbo_enable(struct rtl8169_private *tp) 4965 4965 { 4966 4966 rtl_tx_performance_tweak(tp->pci_dev, 4967 - (0x2 << MAX_READ_REQUEST_SHIFT) | PCI_EXP_DEVCTL_NOSNOOP_EN); 4967 + PCI_EXP_DEVCTL_READRQ_512B | PCI_EXP_DEVCTL_NOSNOOP_EN); 4968 4968 } 4969 4969 4970 4970 static void r8168b_0_hw_jumbo_disable(struct rtl8169_private *tp)
+4
drivers/of/of_pci.c
··· 140 140 unsigned char busno, unsigned char bus_max, 141 141 struct list_head *resources, resource_size_t *io_base) 142 142 { 143 + struct pci_host_bridge_window *window; 143 144 struct resource *res; 144 145 struct resource *bus_range; 145 146 struct of_pci_range range; ··· 226 225 conversion_failed: 227 226 kfree(res); 228 227 parse_failed: 228 + list_for_each_entry(window, resources, list) 229 + kfree(window->res); 229 230 pci_free_resource_list(resources); 231 + kfree(bus_range); 230 232 return err; 231 233 } 232 234 EXPORT_SYMBOL_GPL(of_pci_get_host_bridge_resources);
+87
drivers/pci/access.c
··· 67 67 EXPORT_SYMBOL(pci_bus_write_config_word); 68 68 EXPORT_SYMBOL(pci_bus_write_config_dword); 69 69 70 + int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn, 71 + int where, int size, u32 *val) 72 + { 73 + void __iomem *addr; 74 + 75 + addr = bus->ops->map_bus(bus, devfn, where); 76 + if (!addr) { 77 + *val = ~0; 78 + return PCIBIOS_DEVICE_NOT_FOUND; 79 + } 80 + 81 + if (size == 1) 82 + *val = readb(addr); 83 + else if (size == 2) 84 + *val = readw(addr); 85 + else 86 + *val = readl(addr); 87 + 88 + return PCIBIOS_SUCCESSFUL; 89 + } 90 + EXPORT_SYMBOL_GPL(pci_generic_config_read); 91 + 92 + int pci_generic_config_write(struct pci_bus *bus, unsigned int devfn, 93 + int where, int size, u32 val) 94 + { 95 + void __iomem *addr; 96 + 97 + addr = bus->ops->map_bus(bus, devfn, where); 98 + if (!addr) 99 + return PCIBIOS_DEVICE_NOT_FOUND; 100 + 101 + if (size == 1) 102 + writeb(val, addr); 103 + else if (size == 2) 104 + writew(val, addr); 105 + else 106 + writel(val, addr); 107 + 108 + return PCIBIOS_SUCCESSFUL; 109 + } 110 + EXPORT_SYMBOL_GPL(pci_generic_config_write); 111 + 112 + int pci_generic_config_read32(struct pci_bus *bus, unsigned int devfn, 113 + int where, int size, u32 *val) 114 + { 115 + void __iomem *addr; 116 + 117 + addr = bus->ops->map_bus(bus, devfn, where & ~0x3); 118 + if (!addr) { 119 + *val = ~0; 120 + return PCIBIOS_DEVICE_NOT_FOUND; 121 + } 122 + 123 + *val = readl(addr); 124 + 125 + if (size <= 2) 126 + *val = (*val >> (8 * (where & 3))) & ((1 << (size * 8)) - 1); 127 + 128 + return PCIBIOS_SUCCESSFUL; 129 + } 130 + EXPORT_SYMBOL_GPL(pci_generic_config_read32); 131 + 132 + int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn, 133 + int where, int size, u32 val) 134 + { 135 + void __iomem *addr; 136 + u32 mask, tmp; 137 + 138 + addr = bus->ops->map_bus(bus, devfn, where & ~0x3); 139 + if (!addr) 140 + return PCIBIOS_DEVICE_NOT_FOUND; 141 + 142 + if (size == 4) { 143 + writel(val, addr); 144 + return PCIBIOS_SUCCESSFUL; 145 + } else { 146 + mask = ~(((1 << (size * 8)) - 1) << ((where & 0x3) * 8)); 147 + } 148 + 149 + tmp = readl(addr) & mask; 150 + tmp |= val << ((where & 0x3) * 8); 151 + writel(tmp, addr); 152 + 153 + return PCIBIOS_SUCCESSFUL; 154 + } 155 + EXPORT_SYMBOL_GPL(pci_generic_config_write32); 156 + 70 157 /** 71 158 * pci_bus_set_ops - Set raw operations of pci bus 72 159 * @bus: pci bus struct
+4
drivers/pci/host/Kconfig
··· 102 102 help 103 103 Say Y here if you want PCIe controller support on Layerscape SoCs. 104 104 105 + config PCI_VERSATILE 106 + bool "ARM Versatile PB PCI controller" 107 + depends on ARCH_VERSATILE 108 + 105 109 endmenu
+1
drivers/pci/host/Makefile
··· 12 12 obj-$(CONFIG_PCIE_XILINX) += pcie-xilinx.o 13 13 obj-$(CONFIG_PCI_XGENE) += pci-xgene.o 14 14 obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o 15 + obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
+3 -48
drivers/pci/host/pci-host-generic.c
··· 76 76 .map_bus = gen_pci_map_cfg_bus_ecam, 77 77 }; 78 78 79 - static int gen_pci_config_read(struct pci_bus *bus, unsigned int devfn, 80 - int where, int size, u32 *val) 81 - { 82 - void __iomem *addr; 83 - struct pci_sys_data *sys = bus->sysdata; 84 - struct gen_pci *pci = sys->private_data; 85 - 86 - addr = pci->cfg.ops->map_bus(bus, devfn, where); 87 - 88 - switch (size) { 89 - case 1: 90 - *val = readb(addr); 91 - break; 92 - case 2: 93 - *val = readw(addr); 94 - break; 95 - default: 96 - *val = readl(addr); 97 - } 98 - 99 - return PCIBIOS_SUCCESSFUL; 100 - } 101 - 102 - static int gen_pci_config_write(struct pci_bus *bus, unsigned int devfn, 103 - int where, int size, u32 val) 104 - { 105 - void __iomem *addr; 106 - struct pci_sys_data *sys = bus->sysdata; 107 - struct gen_pci *pci = sys->private_data; 108 - 109 - addr = pci->cfg.ops->map_bus(bus, devfn, where); 110 - 111 - switch (size) { 112 - case 1: 113 - writeb(val, addr); 114 - break; 115 - case 2: 116 - writew(val, addr); 117 - break; 118 - default: 119 - writel(val, addr); 120 - } 121 - 122 - return PCIBIOS_SUCCESSFUL; 123 - } 124 - 125 79 static struct pci_ops gen_pci_ops = { 126 - .read = gen_pci_config_read, 127 - .write = gen_pci_config_write, 80 + .read = pci_generic_config_read, 81 + .write = pci_generic_config_write, 128 82 }; 129 83 130 84 static const struct of_device_id gen_pci_of_match[] = { ··· 241 287 242 288 of_id = of_match_node(gen_pci_of_match, np); 243 289 pci->cfg.ops = of_id->data; 290 + gen_pci_ops.map_bus = pci->cfg.ops->map_bus; 244 291 pci->host.dev.parent = dev; 245 292 INIT_LIST_HEAD(&pci->host.windows); 246 293 INIT_LIST_HEAD(&pci->resources);
+2 -2
drivers/pci/host/pci-keystone.c
··· 119 119 struct pcie_port *pp = &ks_pcie->pp; 120 120 struct irq_chip *chip = irq_desc_get_chip(desc); 121 121 122 - dev_dbg(pp->dev, "ks_pci_msi_irq_handler, irq %d\n", irq); 122 + dev_dbg(pp->dev, "%s, irq %d\n", __func__, irq); 123 123 124 124 /* 125 125 * The chained irq handler installation would have replaced normal ··· 197 197 */ 198 198 for (temp = 0; temp < max_host_irqs; temp++) { 199 199 host_irqs[temp] = irq_of_parse_and_map(*np_temp, temp); 200 - if (host_irqs[temp] < 0) 200 + if (!host_irqs[temp]) 201 201 break; 202 202 } 203 203 if (temp) {
-1
drivers/pci/host/pci-layerscape.c
··· 167 167 static struct platform_driver ls_pcie_driver = { 168 168 .driver = { 169 169 .name = "layerscape-pcie", 170 - .owner = THIS_MODULE, 171 170 .of_match_table = ls_pcie_of_match, 172 171 }, 173 172 };
+2 -13
drivers/pci/host/pci-mvebu.c
··· 101 101 struct mvebu_pcie_port *ports; 102 102 struct msi_controller *msi; 103 103 struct resource io; 104 - char io_name[30]; 105 104 struct resource realio; 106 - char mem_name[30]; 107 105 struct resource mem; 108 106 struct resource busn; 109 107 int nports; ··· 721 723 { 722 724 struct mvebu_pcie *pcie = sys_to_pcie(sys); 723 725 int i; 724 - int domain = 0; 725 726 726 - #ifdef CONFIG_PCI_DOMAINS 727 - domain = sys->domain; 728 - #endif 729 - 730 - snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x", 731 - domain); 732 - pcie->mem.name = pcie->mem_name; 733 - 734 - snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain); 735 - pcie->realio.name = pcie->io_name; 727 + pcie->mem.name = "PCI MEM"; 728 + pcie->realio.name = "PCI I/O"; 736 729 737 730 if (request_resource(&iomem_resource, &pcie->mem)) 738 731 return 0;
+3 -48
drivers/pci/host/pci-rcar-gen2.c
··· 131 131 return priv->reg + (slot >> 1) * 0x100 + where; 132 132 } 133 133 134 - static int rcar_pci_read_config(struct pci_bus *bus, unsigned int devfn, 135 - int where, int size, u32 *val) 136 - { 137 - void __iomem *reg = rcar_pci_cfg_base(bus, devfn, where); 138 - 139 - if (!reg) 140 - return PCIBIOS_DEVICE_NOT_FOUND; 141 - 142 - switch (size) { 143 - case 1: 144 - *val = ioread8(reg); 145 - break; 146 - case 2: 147 - *val = ioread16(reg); 148 - break; 149 - default: 150 - *val = ioread32(reg); 151 - break; 152 - } 153 - 154 - return PCIBIOS_SUCCESSFUL; 155 - } 156 - 157 - static int rcar_pci_write_config(struct pci_bus *bus, unsigned int devfn, 158 - int where, int size, u32 val) 159 - { 160 - void __iomem *reg = rcar_pci_cfg_base(bus, devfn, where); 161 - 162 - if (!reg) 163 - return PCIBIOS_DEVICE_NOT_FOUND; 164 - 165 - switch (size) { 166 - case 1: 167 - iowrite8(val, reg); 168 - break; 169 - case 2: 170 - iowrite16(val, reg); 171 - break; 172 - default: 173 - iowrite32(val, reg); 174 - break; 175 - } 176 - 177 - return PCIBIOS_SUCCESSFUL; 178 - } 179 - 180 134 /* PCI interrupt mapping */ 181 135 static int rcar_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 182 136 { ··· 279 325 } 280 326 281 327 static struct pci_ops rcar_pci_ops = { 282 - .read = rcar_pci_read_config, 283 - .write = rcar_pci_write_config, 328 + .map_bus = rcar_pci_cfg_base, 329 + .read = pci_generic_config_read, 330 + .write = pci_generic_config_write, 284 331 }; 285 332 286 333 static int rcar_pci_probe(struct platform_device *pdev)
+3 -65
drivers/pci/host/pci-tegra.c
··· 480 480 return addr; 481 481 } 482 482 483 - static int tegra_pcie_read_conf(struct pci_bus *bus, unsigned int devfn, 484 - int where, int size, u32 *value) 485 - { 486 - void __iomem *addr; 487 - 488 - addr = tegra_pcie_conf_address(bus, devfn, where); 489 - if (!addr) { 490 - *value = 0xffffffff; 491 - return PCIBIOS_DEVICE_NOT_FOUND; 492 - } 493 - 494 - *value = readl(addr); 495 - 496 - if (size == 1) 497 - *value = (*value >> (8 * (where & 3))) & 0xff; 498 - else if (size == 2) 499 - *value = (*value >> (8 * (where & 3))) & 0xffff; 500 - 501 - return PCIBIOS_SUCCESSFUL; 502 - } 503 - 504 - static int tegra_pcie_write_conf(struct pci_bus *bus, unsigned int devfn, 505 - int where, int size, u32 value) 506 - { 507 - void __iomem *addr; 508 - u32 mask, tmp; 509 - 510 - addr = tegra_pcie_conf_address(bus, devfn, where); 511 - if (!addr) 512 - return PCIBIOS_DEVICE_NOT_FOUND; 513 - 514 - if (size == 4) { 515 - writel(value, addr); 516 - return PCIBIOS_SUCCESSFUL; 517 - } 518 - 519 - if (size == 2) 520 - mask = ~(0xffff << ((where & 0x3) * 8)); 521 - else if (size == 1) 522 - mask = ~(0xff << ((where & 0x3) * 8)); 523 - else 524 - return PCIBIOS_BAD_REGISTER_NUMBER; 525 - 526 - tmp = readl(addr) & mask; 527 - tmp |= value << ((where & 0x3) * 8); 528 - writel(tmp, addr); 529 - 530 - return PCIBIOS_SUCCESSFUL; 531 - } 532 - 533 483 static struct pci_ops tegra_pcie_ops = { 534 - .read = tegra_pcie_read_conf, 535 - .write = tegra_pcie_write_conf, 484 + .map_bus = tegra_pcie_conf_address, 485 + .read = pci_generic_config_read32, 486 + .write = pci_generic_config_write32, 536 487 }; 537 488 538 489 static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port) ··· 575 624 list_del(&port->list); 576 625 devm_kfree(pcie->dev, port); 577 626 } 578 - 579 - static void tegra_pcie_fixup_bridge(struct pci_dev *dev) 580 - { 581 - u16 reg; 582 - 583 - if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) { 584 - pci_read_config_word(dev, PCI_COMMAND, &reg); 585 - reg |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | 586 - PCI_COMMAND_MASTER | PCI_COMMAND_SERR); 587 - pci_write_config_word(dev, PCI_COMMAND, reg); 588 - } 589 - } 590 - DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_fixup_bridge); 591 627 592 628 /* Tegra PCIE root complex wrongly reports device class */ 593 629 static void tegra_pcie_fixup_class(struct pci_dev *dev)
+237
drivers/pci/host/pci-versatile.c
··· 1 + /* 2 + * Copyright 2004 Koninklijke Philips Electronics NV 3 + * 4 + * Conversion to platform driver and DT: 5 + * Copyright 2014 Linaro Ltd. 6 + * 7 + * This software is licensed under the terms of the GNU General Public 8 + * License version 2, as published by the Free Software Foundation, and 9 + * may be copied, distributed, and modified under those terms. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * 14/04/2005 Initial version, colin.king@philips.com 17 + */ 18 + #include <linux/kernel.h> 19 + #include <linux/module.h> 20 + #include <linux/of_address.h> 21 + #include <linux/of_pci.h> 22 + #include <linux/of_platform.h> 23 + #include <linux/pci.h> 24 + #include <linux/platform_device.h> 25 + 26 + static void __iomem *versatile_pci_base; 27 + static void __iomem *versatile_cfg_base[2]; 28 + 29 + #define PCI_IMAP(m) (versatile_pci_base + ((m) * 4)) 30 + #define PCI_SMAP(m) (versatile_pci_base + 0x14 + ((m) * 4)) 31 + #define PCI_SELFID (versatile_pci_base + 0xc) 32 + 33 + #define VP_PCI_DEVICE_ID 0x030010ee 34 + #define VP_PCI_CLASS_ID 0x0b400000 35 + 36 + static u32 pci_slot_ignore; 37 + 38 + static int __init versatile_pci_slot_ignore(char *str) 39 + { 40 + int retval; 41 + int slot; 42 + 43 + while ((retval = get_option(&str, &slot))) { 44 + if ((slot < 0) || (slot > 31)) 45 + pr_err("Illegal slot value: %d\n", slot); 46 + else 47 + pci_slot_ignore |= (1 << slot); 48 + } 49 + return 1; 50 + } 51 + __setup("pci_slot_ignore=", versatile_pci_slot_ignore); 52 + 53 + 54 + static void __iomem *versatile_map_bus(struct pci_bus *bus, 55 + unsigned int devfn, int offset) 56 + { 57 + unsigned int busnr = bus->number; 58 + 59 + if (pci_slot_ignore & (1 << PCI_SLOT(devfn))) 60 + return NULL; 61 + 62 + return versatile_cfg_base[1] + ((busnr << 16) | (devfn << 8) | offset); 63 + } 64 + 65 + static struct pci_ops pci_versatile_ops = { 66 + .map_bus = versatile_map_bus, 67 + .read = pci_generic_config_read32, 68 + .write = pci_generic_config_write, 69 + }; 70 + 71 + static int versatile_pci_parse_request_of_pci_ranges(struct device *dev, 72 + struct list_head *res) 73 + { 74 + int err, mem = 1, res_valid = 0; 75 + struct device_node *np = dev->of_node; 76 + resource_size_t iobase; 77 + struct pci_host_bridge_window *win; 78 + 79 + err = of_pci_get_host_bridge_resources(np, 0, 0xff, res, &iobase); 80 + if (err) 81 + return err; 82 + 83 + list_for_each_entry(win, res, list) { 84 + struct resource *parent, *res = win->res; 85 + 86 + switch (resource_type(res)) { 87 + case IORESOURCE_IO: 88 + parent = &ioport_resource; 89 + err = pci_remap_iospace(res, iobase); 90 + if (err) { 91 + dev_warn(dev, "error %d: failed to map resource %pR\n", 92 + err, res); 93 + continue; 94 + } 95 + break; 96 + case IORESOURCE_MEM: 97 + parent = &iomem_resource; 98 + res_valid |= !(res->flags & IORESOURCE_PREFETCH); 99 + 100 + writel(res->start >> 28, PCI_IMAP(mem)); 101 + writel(PHYS_OFFSET >> 28, PCI_SMAP(mem)); 102 + mem++; 103 + 104 + break; 105 + case IORESOURCE_BUS: 106 + default: 107 + continue; 108 + } 109 + 110 + err = devm_request_resource(dev, parent, res); 111 + if (err) 112 + goto out_release_res; 113 + } 114 + 115 + if (!res_valid) { 116 + dev_err(dev, "non-prefetchable memory resource required\n"); 117 + err = -EINVAL; 118 + goto out_release_res; 119 + } 120 + 121 + return 0; 122 + 123 + out_release_res: 124 + pci_free_resource_list(res); 125 + return err; 126 + } 127 + 128 + /* Unused, temporary to satisfy ARM arch code */ 129 + struct pci_sys_data sys; 130 + 131 + static int versatile_pci_probe(struct platform_device *pdev) 132 + { 133 + struct resource *res; 134 + int ret, i, myslot = -1; 135 + u32 val; 136 + void __iomem *local_pci_cfg_base; 137 + struct pci_bus *bus; 138 + LIST_HEAD(pci_res); 139 + 140 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 141 + if (!res) 142 + return -ENODEV; 143 + versatile_pci_base = devm_ioremap_resource(&pdev->dev, res); 144 + 145 + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 146 + if (!res) 147 + return -ENODEV; 148 + versatile_cfg_base[0] = devm_ioremap_resource(&pdev->dev, res); 149 + 150 + res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 151 + if (!res) 152 + return -ENODEV; 153 + versatile_cfg_base[1] = devm_ioremap_resource(&pdev->dev, res); 154 + 155 + ret = versatile_pci_parse_request_of_pci_ranges(&pdev->dev, &pci_res); 156 + if (ret) 157 + return ret; 158 + 159 + /* 160 + * We need to discover the PCI core first to configure itself 161 + * before the main PCI probing is performed 162 + */ 163 + for (i = 0; i < 32; i++) { 164 + if ((readl(versatile_cfg_base[0] + (i << 11) + PCI_VENDOR_ID) == VP_PCI_DEVICE_ID) && 165 + (readl(versatile_cfg_base[0] + (i << 11) + PCI_CLASS_REVISION) == VP_PCI_CLASS_ID)) { 166 + myslot = i; 167 + break; 168 + } 169 + } 170 + if (myslot == -1) { 171 + dev_err(&pdev->dev, "Cannot find PCI core!\n"); 172 + return -EIO; 173 + } 174 + /* 175 + * Do not to map Versatile FPGA PCI device into memory space 176 + */ 177 + pci_slot_ignore |= (1 << myslot); 178 + 179 + dev_info(&pdev->dev, "PCI core found (slot %d)\n", myslot); 180 + 181 + writel(myslot, PCI_SELFID); 182 + local_pci_cfg_base = versatile_cfg_base[1] + (myslot << 11); 183 + 184 + val = readl(local_pci_cfg_base + PCI_COMMAND); 185 + val |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; 186 + writel(val, local_pci_cfg_base + PCI_COMMAND); 187 + 188 + /* 189 + * Configure the PCI inbound memory windows to be 1:1 mapped to SDRAM 190 + */ 191 + writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_0); 192 + writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_1); 193 + writel(PHYS_OFFSET, local_pci_cfg_base + PCI_BASE_ADDRESS_2); 194 + 195 + /* 196 + * For many years the kernel and QEMU were symbiotically buggy 197 + * in that they both assumed the same broken IRQ mapping. 198 + * QEMU therefore attempts to auto-detect old broken kernels 199 + * so that they still work on newer QEMU as they did on old 200 + * QEMU. Since we now use the correct (ie matching-hardware) 201 + * IRQ mapping we write a definitely different value to a 202 + * PCI_INTERRUPT_LINE register to tell QEMU that we expect 203 + * real hardware behaviour and it need not be backwards 204 + * compatible for us. This write is harmless on real hardware. 205 + */ 206 + writel(0, versatile_cfg_base[0] + PCI_INTERRUPT_LINE); 207 + 208 + pci_add_flags(PCI_ENABLE_PROC_DOMAINS); 209 + pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC); 210 + 211 + bus = pci_scan_root_bus(&pdev->dev, 0, &pci_versatile_ops, &sys, &pci_res); 212 + if (!bus) 213 + return -ENOMEM; 214 + 215 + pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); 216 + pci_assign_unassigned_bus_resources(bus); 217 + 218 + return 0; 219 + } 220 + 221 + static const struct of_device_id versatile_pci_of_match[] = { 222 + { .compatible = "arm,versatile-pci", }, 223 + { }, 224 + }; 225 + MODULE_DEVICE_TABLE(of, versatile_pci_of_match); 226 + 227 + static struct platform_driver versatile_pci_driver = { 228 + .driver = { 229 + .name = "versatile-pci", 230 + .of_match_table = versatile_pci_of_match, 231 + }, 232 + .probe = versatile_pci_probe, 233 + }; 234 + module_platform_driver(versatile_pci_driver); 235 + 236 + MODULE_DESCRIPTION("Versatile PCI driver"); 237 + MODULE_LICENSE("GPL v2");
+10 -142
drivers/pci/host/pci-xgene.c
··· 16 16 * GNU General Public License for more details. 17 17 * 18 18 */ 19 - #include <linux/clk-private.h> 19 + #include <linux/clk.h> 20 20 #include <linux/delay.h> 21 21 #include <linux/io.h> 22 22 #include <linux/jiffies.h> ··· 74 74 return (addr & PCI_BASE_ADDRESS_MEM_MASK) | flags; 75 75 } 76 76 77 - /* PCIe Configuration Out/In */ 78 - static inline void xgene_pcie_cfg_out32(void __iomem *addr, int offset, u32 val) 79 - { 80 - writel(val, addr + offset); 81 - } 82 - 83 - static inline void xgene_pcie_cfg_out16(void __iomem *addr, int offset, u16 val) 84 - { 85 - u32 val32 = readl(addr + (offset & ~0x3)); 86 - 87 - switch (offset & 0x3) { 88 - case 2: 89 - val32 &= ~0xFFFF0000; 90 - val32 |= (u32)val << 16; 91 - break; 92 - case 0: 93 - default: 94 - val32 &= ~0xFFFF; 95 - val32 |= val; 96 - break; 97 - } 98 - writel(val32, addr + (offset & ~0x3)); 99 - } 100 - 101 - static inline void xgene_pcie_cfg_out8(void __iomem *addr, int offset, u8 val) 102 - { 103 - u32 val32 = readl(addr + (offset & ~0x3)); 104 - 105 - switch (offset & 0x3) { 106 - case 0: 107 - val32 &= ~0xFF; 108 - val32 |= val; 109 - break; 110 - case 1: 111 - val32 &= ~0xFF00; 112 - val32 |= (u32)val << 8; 113 - break; 114 - case 2: 115 - val32 &= ~0xFF0000; 116 - val32 |= (u32)val << 16; 117 - break; 118 - case 3: 119 - default: 120 - val32 &= ~0xFF000000; 121 - val32 |= (u32)val << 24; 122 - break; 123 - } 124 - writel(val32, addr + (offset & ~0x3)); 125 - } 126 - 127 - static inline void xgene_pcie_cfg_in32(void __iomem *addr, int offset, u32 *val) 128 - { 129 - *val = readl(addr + offset); 130 - } 131 - 132 - static inline void xgene_pcie_cfg_in16(void __iomem *addr, int offset, u32 *val) 133 - { 134 - *val = readl(addr + (offset & ~0x3)); 135 - 136 - switch (offset & 0x3) { 137 - case 2: 138 - *val >>= 16; 139 - break; 140 - } 141 - 142 - *val &= 0xFFFF; 143 - } 144 - 145 - static inline void xgene_pcie_cfg_in8(void __iomem *addr, int offset, u32 *val) 146 - { 147 - *val = readl(addr + (offset & ~0x3)); 148 - 149 - switch (offset & 0x3) { 150 - case 3: 151 - *val = *val >> 24; 152 - break; 153 - case 2: 154 - *val = *val >> 16; 155 - break; 156 - case 1: 157 - *val = *val >> 8; 158 - break; 159 - } 160 - *val &= 0xFF; 161 - } 162 - 163 77 /* 164 78 * When the address bit [17:16] is 2'b01, the Configuration access will be 165 79 * treated as Type 1 and it will be forwarded to external PCIe device. ··· 127 213 return false; 128 214 } 129 215 130 - static int xgene_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 131 - int offset, int len, u32 *val) 216 + static int xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn, 217 + int offset) 132 218 { 133 219 struct xgene_pcie_port *port = bus->sysdata; 134 - void __iomem *addr; 135 220 136 - if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up) 137 - return PCIBIOS_DEVICE_NOT_FOUND; 138 - 139 - if (xgene_pcie_hide_rc_bars(bus, offset)) { 140 - *val = 0; 141 - return PCIBIOS_SUCCESSFUL; 142 - } 221 + if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up || 222 + xgene_pcie_hide_rc_bars(bus, offset)) 223 + return NULL; 143 224 144 225 xgene_pcie_set_rtdid_reg(bus, devfn); 145 - addr = xgene_pcie_get_cfg_base(bus); 146 - switch (len) { 147 - case 1: 148 - xgene_pcie_cfg_in8(addr, offset, val); 149 - break; 150 - case 2: 151 - xgene_pcie_cfg_in16(addr, offset, val); 152 - break; 153 - default: 154 - xgene_pcie_cfg_in32(addr, offset, val); 155 - break; 156 - } 157 - 158 - return PCIBIOS_SUCCESSFUL; 159 - } 160 - 161 - static int xgene_pcie_write_config(struct pci_bus *bus, unsigned int devfn, 162 - int offset, int len, u32 val) 163 - { 164 - struct xgene_pcie_port *port = bus->sysdata; 165 - void __iomem *addr; 166 - 167 - if ((pci_is_root_bus(bus) && devfn != 0) || !port->link_up) 168 - return PCIBIOS_DEVICE_NOT_FOUND; 169 - 170 - if (xgene_pcie_hide_rc_bars(bus, offset)) 171 - return PCIBIOS_SUCCESSFUL; 172 - 173 - xgene_pcie_set_rtdid_reg(bus, devfn); 174 - addr = xgene_pcie_get_cfg_base(bus); 175 - switch (len) { 176 - case 1: 177 - xgene_pcie_cfg_out8(addr, offset, (u8)val); 178 - break; 179 - case 2: 180 - xgene_pcie_cfg_out16(addr, offset, (u16)val); 181 - break; 182 - default: 183 - xgene_pcie_cfg_out32(addr, offset, val); 184 - break; 185 - } 186 - 187 - return PCIBIOS_SUCCESSFUL; 226 + return xgene_pcie_get_cfg_base(bus); 188 227 } 189 228 190 229 static struct pci_ops xgene_pcie_ops = { 191 - .read = xgene_pcie_read_config, 192 - .write = xgene_pcie_write_config 230 + .map_bus = xgene_pcie_map_bus, 231 + .read = pci_generic_config_read32, 232 + .write = pci_generic_config_write32, 193 233 }; 194 234 195 235 static u64 xgene_pcie_set_ib_mask(void __iomem *csr_base, u32 addr,
-3
drivers/pci/host/pcie-designware.c
··· 511 511 dw_pci.private_data = (void **)&pp; 512 512 513 513 pci_common_init_dev(pp->dev, &dw_pci); 514 - #ifdef CONFIG_PCI_DOMAINS 515 - dw_pci.domain++; 516 - #endif 517 514 518 515 return 0; 519 516 }
+2 -5
drivers/pci/host/pcie-rcar.c
··· 397 397 #endif 398 398 399 399 pci_common_init_dev(&pdev->dev, &rcar_pci); 400 - #ifdef CONFIG_PCI_DOMAINS 401 - rcar_pci.domain++; 402 - #endif 403 400 } 404 401 405 402 static int phy_wait_for_ack(struct rcar_pcie *pcie) ··· 754 757 goto err_map_reg; 755 758 756 759 i = irq_of_parse_and_map(pdev->dev.of_node, 0); 757 - if (i < 0) { 760 + if (!i) { 758 761 dev_err(pcie->dev, "cannot get platform resources for msi interrupt\n"); 759 762 err = -ENOENT; 760 763 goto err_map_reg; ··· 762 765 pcie->msi.irq1 = i; 763 766 764 767 i = irq_of_parse_and_map(pdev->dev.of_node, 1); 765 - if (i < 0) { 768 + if (!i) { 766 769 dev_err(pcie->dev, "cannot get platform resources for msi interrupt\n"); 767 770 err = -ENOENT; 768 771 goto err_map_reg;
+11 -81
drivers/pci/host/pcie-xilinx.c
··· 148 148 */ 149 149 static void xilinx_pcie_clear_err_interrupts(struct xilinx_pcie_port *port) 150 150 { 151 - u32 val = pcie_read(port, XILINX_PCIE_REG_RPEFR); 151 + unsigned long val = pcie_read(port, XILINX_PCIE_REG_RPEFR); 152 152 153 153 if (val & XILINX_PCIE_RPEFR_ERR_VALID) { 154 - dev_dbg(port->dev, "Requester ID %d\n", 154 + dev_dbg(port->dev, "Requester ID %lu\n", 155 155 val & XILINX_PCIE_RPEFR_REQ_ID); 156 156 pcie_write(port, XILINX_PCIE_RPEFR_ALL_MASK, 157 157 XILINX_PCIE_REG_RPEFR); ··· 189 189 } 190 190 191 191 /** 192 - * xilinx_pcie_config_base - Get configuration base 192 + * xilinx_pcie_map_bus - Get configuration base 193 193 * @bus: PCI Bus structure 194 194 * @devfn: Device/function 195 195 * @where: Offset from base ··· 197 197 * Return: Base address of the configuration space needed to be 198 198 * accessed. 199 199 */ 200 - static void __iomem *xilinx_pcie_config_base(struct pci_bus *bus, 201 - unsigned int devfn, int where) 200 + static void __iomem *xilinx_pcie_map_bus(struct pci_bus *bus, 201 + unsigned int devfn, int where) 202 202 { 203 203 struct xilinx_pcie_port *port = sys_to_pcie(bus->sysdata); 204 204 int relbus; 205 + 206 + if (!xilinx_pcie_valid_device(bus, devfn)) 207 + return NULL; 205 208 206 209 relbus = (bus->number << ECAM_BUS_NUM_SHIFT) | 207 210 (devfn << ECAM_DEV_NUM_SHIFT); ··· 212 209 return port->reg_base + relbus + where; 213 210 } 214 211 215 - /** 216 - * xilinx_pcie_read_config - Read configuration space 217 - * @bus: PCI Bus structure 218 - * @devfn: Device/function 219 - * @where: Offset from base 220 - * @size: Byte/word/dword 221 - * @val: Value to be read 222 - * 223 - * Return: PCIBIOS_SUCCESSFUL on success 224 - * PCIBIOS_DEVICE_NOT_FOUND on failure 225 - */ 226 - static int xilinx_pcie_read_config(struct pci_bus *bus, unsigned int devfn, 227 - int where, int size, u32 *val) 228 - { 229 - void __iomem *addr; 230 - 231 - if (!xilinx_pcie_valid_device(bus, devfn)) { 232 - *val = 0xFFFFFFFF; 233 - return PCIBIOS_DEVICE_NOT_FOUND; 234 - } 235 - 236 - addr = xilinx_pcie_config_base(bus, devfn, where); 237 - 238 - switch (size) { 239 - case 1: 240 - *val = readb(addr); 241 - break; 242 - case 2: 243 - *val = readw(addr); 244 - break; 245 - default: 246 - *val = readl(addr); 247 - break; 248 - } 249 - 250 - return PCIBIOS_SUCCESSFUL; 251 - } 252 - 253 - /** 254 - * xilinx_pcie_write_config - Write configuration space 255 - * @bus: PCI Bus structure 256 - * @devfn: Device/function 257 - * @where: Offset from base 258 - * @size: Byte/word/dword 259 - * @val: Value to be written to device 260 - * 261 - * Return: PCIBIOS_SUCCESSFUL on success 262 - * PCIBIOS_DEVICE_NOT_FOUND on failure 263 - */ 264 - static int xilinx_pcie_write_config(struct pci_bus *bus, unsigned int devfn, 265 - int where, int size, u32 val) 266 - { 267 - void __iomem *addr; 268 - 269 - if (!xilinx_pcie_valid_device(bus, devfn)) 270 - return PCIBIOS_DEVICE_NOT_FOUND; 271 - 272 - addr = xilinx_pcie_config_base(bus, devfn, where); 273 - 274 - switch (size) { 275 - case 1: 276 - writeb(val, addr); 277 - break; 278 - case 2: 279 - writew(val, addr); 280 - break; 281 - default: 282 - writel(val, addr); 283 - break; 284 - } 285 - 286 - return PCIBIOS_SUCCESSFUL; 287 - } 288 - 289 212 /* PCIe operations */ 290 213 static struct pci_ops xilinx_pcie_ops = { 291 - .read = xilinx_pcie_read_config, 292 - .write = xilinx_pcie_write_config, 214 + .map_bus = xilinx_pcie_map_bus, 215 + .read = pci_generic_config_read, 216 + .write = pci_generic_config_write, 293 217 }; 294 218 295 219 /* MSI functions */
+1 -2
drivers/pci/hotplug/cpci_hotplug_core.c
··· 214 214 215 215 kfree(slot->hotplug_slot->info); 216 216 kfree(slot->hotplug_slot); 217 - if (slot->dev) 218 - pci_dev_put(slot->dev); 217 + pci_dev_put(slot->dev); 219 218 kfree(slot); 220 219 } 221 220
-2
drivers/pci/hotplug/pciehp_ctrl.c
··· 532 532 pciehp_green_led_off(p_slot); 533 533 break; 534 534 case INT_PRESENCE_ON: 535 - if (!HP_SUPR_RM(ctrl)) 536 - break; 537 535 ctrl_dbg(ctrl, "Surprise Insertion\n"); 538 536 handle_surprise_event(p_slot); 539 537 break;
+5
drivers/pci/msi.c
··· 694 694 { 695 695 resource_size_t phys_addr; 696 696 u32 table_offset; 697 + unsigned long flags; 697 698 u8 bir; 698 699 699 700 pci_read_config_dword(dev, dev->msix_cap + PCI_MSIX_TABLE, 700 701 &table_offset); 701 702 bir = (u8)(table_offset & PCI_MSIX_TABLE_BIR); 703 + flags = pci_resource_flags(dev, bir); 704 + if (!flags || (flags & IORESOURCE_UNSET)) 705 + return NULL; 706 + 702 707 table_offset &= PCI_MSIX_TABLE_OFFSET; 703 708 phys_addr = pci_resource_start(dev, bir) + table_offset; 704 709
+1 -1
drivers/pci/pci-driver.c
··· 1383 1383 if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev))) 1384 1384 return -ENOMEM; 1385 1385 1386 - if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", 1386 + if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X", 1387 1387 pdev->vendor, pdev->device, 1388 1388 pdev->subsystem_vendor, pdev->subsystem_device, 1389 1389 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
+50 -1
drivers/pci/pci.c
··· 10 10 #include <linux/kernel.h> 11 11 #include <linux/delay.h> 12 12 #include <linux/init.h> 13 + #include <linux/of.h> 14 + #include <linux/of_pci.h> 13 15 #include <linux/pci.h> 14 16 #include <linux/pm.h> 15 17 #include <linux/slab.h> ··· 3199 3197 { 3200 3198 u16 csr; 3201 3199 3202 - if (!dev->pm_cap) 3200 + if (!dev->pm_cap || dev->dev_flags & PCI_DEV_FLAGS_NO_PM_RESET) 3203 3201 return -ENOTTY; 3204 3202 3205 3203 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &csr); ··· 4473 4471 { 4474 4472 return atomic_inc_return(&__domain_nr); 4475 4473 } 4474 + 4475 + #ifdef CONFIG_PCI_DOMAINS_GENERIC 4476 + void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) 4477 + { 4478 + static int use_dt_domains = -1; 4479 + int domain = of_get_pci_domain_nr(parent->of_node); 4480 + 4481 + /* 4482 + * Check DT domain and use_dt_domains values. 4483 + * 4484 + * If DT domain property is valid (domain >= 0) and 4485 + * use_dt_domains != 0, the DT assignment is valid since this means 4486 + * we have not previously allocated a domain number by using 4487 + * pci_get_new_domain_nr(); we should also update use_dt_domains to 4488 + * 1, to indicate that we have just assigned a domain number from 4489 + * DT. 4490 + * 4491 + * If DT domain property value is not valid (ie domain < 0), and we 4492 + * have not previously assigned a domain number from DT 4493 + * (use_dt_domains != 1) we should assign a domain number by 4494 + * using the: 4495 + * 4496 + * pci_get_new_domain_nr() 4497 + * 4498 + * API and update the use_dt_domains value to keep track of method we 4499 + * are using to assign domain numbers (use_dt_domains = 0). 4500 + * 4501 + * All other combinations imply we have a platform that is trying 4502 + * to mix domain numbers obtained from DT and pci_get_new_domain_nr(), 4503 + * which is a recipe for domain mishandling and it is prevented by 4504 + * invalidating the domain value (domain = -1) and printing a 4505 + * corresponding error. 4506 + */ 4507 + if (domain >= 0 && use_dt_domains) { 4508 + use_dt_domains = 1; 4509 + } else if (domain < 0 && use_dt_domains != 1) { 4510 + use_dt_domains = 0; 4511 + domain = pci_get_new_domain_nr(); 4512 + } else { 4513 + dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n", 4514 + parent->of_node->full_name); 4515 + domain = -1; 4516 + } 4517 + 4518 + bus->domain_nr = domain; 4519 + } 4520 + #endif 4476 4521 #endif 4477 4522 4478 4523 /**
+7 -5
drivers/pci/pcie/aspm.c
··· 859 859 { 860 860 struct pci_dev *pdev = to_pci_dev(dev); 861 861 struct pcie_link_state *link, *root = pdev->link_state->root; 862 - u32 val = buf[0] - '0', state = 0; 862 + u32 val, state = 0; 863 + 864 + if (kstrtouint(buf, 10, &val)) 865 + return -EINVAL; 863 866 864 867 if (aspm_disabled) 865 868 return -EPERM; ··· 903 900 size_t n) 904 901 { 905 902 struct pci_dev *pdev = to_pci_dev(dev); 906 - int state; 903 + bool state; 907 904 908 - if (n < 1) 905 + if (strtobool(buf, &state)) 909 906 return -EINVAL; 910 - state = buf[0]-'0'; 911 907 912 908 down_read(&pci_bus_sem); 913 909 mutex_lock(&aspm_lock); 914 - pcie_set_clkpm_nocheck(pdev->link_state, !!state); 910 + pcie_set_clkpm_nocheck(pdev->link_state, state); 915 911 mutex_unlock(&aspm_lock); 916 912 up_read(&pci_bus_sem); 917 913
+64
drivers/pci/quirks.c
··· 3076 3076 */ 3077 3077 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); 3078 3078 3079 + static void quirk_no_pm_reset(struct pci_dev *dev) 3080 + { 3081 + /* 3082 + * We can't do a bus reset on root bus devices, but an ineffective 3083 + * PM reset may be better than nothing. 3084 + */ 3085 + if (!pci_is_root_bus(dev->bus)) 3086 + dev->dev_flags |= PCI_DEV_FLAGS_NO_PM_RESET; 3087 + } 3088 + 3089 + /* 3090 + * Some AMD/ATI GPUS (HD8570 - Oland) report that a D3hot->D0 transition 3091 + * causes a reset (i.e., they advertise NoSoftRst-). This transition seems 3092 + * to have no effect on the device: it retains the framebuffer contents and 3093 + * monitor sync. Advertising this support makes other layers, like VFIO, 3094 + * assume pci_reset_function() is viable for this device. Mark it as 3095 + * unavailable to skip it when testing reset methods. 3096 + */ 3097 + DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_ATI, PCI_ANY_ID, 3098 + PCI_CLASS_DISPLAY_VGA, 8, quirk_no_pm_reset); 3099 + 3079 3100 #ifdef CONFIG_ACPI 3080 3101 /* 3081 3102 * Apple: Shutdown Cactus Ridge Thunderbolt controller. ··· 3597 3576 quirk_dma_func1_alias); 3598 3577 3599 3578 /* 3579 + * Some devices DMA with the wrong devfn, not just the wrong function. 3580 + * quirk_fixed_dma_alias() uses this table to create fixed aliases, where 3581 + * the alias is "fixed" and independent of the device devfn. 3582 + * 3583 + * For example, the Adaptec 3405 is a PCIe card with an Intel 80333 I/O 3584 + * processor. To software, this appears as a PCIe-to-PCI/X bridge with a 3585 + * single device on the secondary bus. In reality, the single exposed 3586 + * device at 0e.0 is the Address Translation Unit (ATU) of the controller 3587 + * that provides a bridge to the internal bus of the I/O processor. The 3588 + * controller supports private devices, which can be hidden from PCI config 3589 + * space. In the case of the Adaptec 3405, a private device at 01.0 3590 + * appears to be the DMA engine, which therefore needs to become a DMA 3591 + * alias for the device. 3592 + */ 3593 + static const struct pci_device_id fixed_dma_alias_tbl[] = { 3594 + { PCI_DEVICE_SUB(PCI_VENDOR_ID_ADAPTEC2, 0x0285, 3595 + PCI_VENDOR_ID_ADAPTEC2, 0x02bb), /* Adaptec 3405 */ 3596 + .driver_data = PCI_DEVFN(1, 0) }, 3597 + { 0 } 3598 + }; 3599 + 3600 + static void quirk_fixed_dma_alias(struct pci_dev *dev) 3601 + { 3602 + const struct pci_device_id *id; 3603 + 3604 + id = pci_match_id(fixed_dma_alias_tbl, dev); 3605 + if (id) { 3606 + dev->dma_alias_devfn = id->driver_data; 3607 + dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN; 3608 + dev_info(&dev->dev, "Enabling fixed DMA alias to %02x.%d\n", 3609 + PCI_SLOT(dev->dma_alias_devfn), 3610 + PCI_FUNC(dev->dma_alias_devfn)); 3611 + } 3612 + } 3613 + 3614 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADAPTEC2, 0x0285, quirk_fixed_dma_alias); 3615 + 3616 + /* 3600 3617 * A few PCIe-to-PCI bridges fail to expose a PCIe capability, resulting in 3601 3618 * using the wrong DMA alias for the device. Some of these devices can be 3602 3619 * used as either forward or reverse bridges, so we need to test whether the ··· 3737 3678 0x9c98, 0x9c99, 0x9c9a, 0x9c9b, 3738 3679 /* Patsburg (X79) PCH */ 3739 3680 0x1d10, 0x1d12, 0x1d14, 0x1d16, 0x1d18, 0x1d1a, 0x1d1c, 0x1d1e, 3681 + /* Wellsburg (X99) PCH */ 3682 + 0x8d10, 0x8d11, 0x8d12, 0x8d13, 0x8d14, 0x8d15, 0x8d16, 0x8d17, 3683 + 0x8d18, 0x8d19, 0x8d1a, 0x8d1b, 0x8d1c, 0x8d1d, 0x8d1e, 3740 3684 }; 3741 3685 3742 3686 static bool pci_quirk_intel_pch_acs_match(struct pci_dev *dev) ··· 3823 3761 { PCI_VENDOR_ID_INTEL, 0x1551, pci_quirk_mf_endpoint_acs }, 3824 3762 { PCI_VENDOR_ID_INTEL, 0x1558, pci_quirk_mf_endpoint_acs }, 3825 3763 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs }, 3764 + { 0x19a2, 0x710, pci_quirk_mf_endpoint_acs }, /* Emulex BE3-R */ 3765 + { 0x10df, 0x720, pci_quirk_mf_endpoint_acs }, /* Emulex Skyhawk-R */ 3826 3766 { 0 } 3827 3767 }; 3828 3768
+4 -3
drivers/pci/rom.c
··· 71 71 { 72 72 void __iomem *image; 73 73 int last_image; 74 + unsigned length; 74 75 75 76 image = rom; 76 77 do { ··· 94 93 if (readb(pds + 3) != 'R') 95 94 break; 96 95 last_image = readb(pds + 21) & 0x80; 97 - /* this length is reliable */ 98 - image += readw(pds + 16) * 512; 99 - } while (!last_image); 96 + length = readw(pds + 16); 97 + image += length * 512; 98 + } while (length && !last_image); 100 99 101 100 /* never return a size larger than the PCI resource window */ 102 101 /* there are known ROMs that get the size wrong */
+1 -1
drivers/rapidio/devices/tsi721.c
··· 2430 2430 pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL, 2431 2431 PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_RELAX_EN | 2432 2432 PCI_EXP_DEVCTL_NOSNOOP_EN, 2433 - 0x2 << MAX_READ_REQUEST_SZ_SHIFT); 2433 + PCI_EXP_DEVCTL_READRQ_512B); 2434 2434 2435 2435 /* Adjust PCIe completion timeout. */ 2436 2436 pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL2, 0xf, 0x2);
-2
drivers/rapidio/devices/tsi721.h
··· 72 72 #define TSI721_MSIXPBA_OFFSET 0x2a000 73 73 #define TSI721_PCIECFG_EPCTL 0x400 74 74 75 - #define MAX_READ_REQUEST_SZ_SHIFT 12 76 - 77 75 /* 78 76 * Event Management Registers 79 77 */
+3 -2
drivers/scsi/esas2r/esas2r_init.c
··· 813 813 pci_read_config_word(a->pcid, pcie_cap_reg + PCI_EXP_DEVCTL, 814 814 &devcontrol); 815 815 816 - if ((devcontrol & PCI_EXP_DEVCTL_READRQ) > 0x2000) { 816 + if ((devcontrol & PCI_EXP_DEVCTL_READRQ) > 817 + PCI_EXP_DEVCTL_READRQ_512B) { 817 818 esas2r_log(ESAS2R_LOG_INFO, 818 819 "max read request size > 512B"); 819 820 820 821 devcontrol &= ~PCI_EXP_DEVCTL_READRQ; 821 - devcontrol |= 0x2000; 822 + devcontrol |= PCI_EXP_DEVCTL_READRQ_512B; 822 823 pci_write_config_word(a->pcid, 823 824 pcie_cap_reg + PCI_EXP_DEVCTL, 824 825 devcontrol);
+15
include/linux/pci.h
··· 177 177 PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5), 178 178 /* Do not use bus resets for device */ 179 179 PCI_DEV_FLAGS_NO_BUS_RESET = (__force pci_dev_flags_t) (1 << 6), 180 + /* Do not use PM reset even if device advertises NoSoftRst- */ 181 + PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), 180 182 }; 181 183 182 184 enum pci_irq_reroute_variant { ··· 564 562 /* Low-level architecture-dependent routines */ 565 563 566 564 struct pci_ops { 565 + void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int where); 567 566 int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val); 568 567 int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val); 569 568 }; ··· 862 859 int where, u16 val); 863 860 int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, 864 861 int where, u32 val); 862 + 863 + int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn, 864 + int where, int size, u32 *val); 865 + int pci_generic_config_write(struct pci_bus *bus, unsigned int devfn, 866 + int where, int size, u32 val); 867 + int pci_generic_config_read32(struct pci_bus *bus, unsigned int devfn, 868 + int where, int size, u32 *val); 869 + int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn, 870 + int where, int size, u32 val); 871 + 865 872 struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); 866 873 867 874 static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) ··· 1863 1850 static inline void pci_release_of_node(struct pci_dev *dev) { } 1864 1851 static inline void pci_set_bus_of_node(struct pci_bus *bus) { } 1865 1852 static inline void pci_release_bus_of_node(struct pci_bus *bus) { } 1853 + static inline struct device_node * 1854 + pci_device_to_OF_node(const struct pci_dev *pdev) { return NULL; } 1866 1855 #endif /* CONFIG_OF */ 1867 1856 1868 1857 #ifdef CONFIG_EEH
+4
include/uapi/linux/pci_regs.h
··· 451 451 #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ 452 452 #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ 453 453 #define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ 454 + #define PCI_EXP_DEVCTL_READRQ_128B 0x0000 /* 128 Bytes */ 455 + #define PCI_EXP_DEVCTL_READRQ_256B 0x1000 /* 256 Bytes */ 456 + #define PCI_EXP_DEVCTL_READRQ_512B 0x2000 /* 512 Bytes */ 457 + #define PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */ 454 458 #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */ 455 459 #define PCI_EXP_DEVSTA 10 /* Device Status */ 456 460 #define PCI_EXP_DEVSTA_CED 0x0001 /* Correctable Error Detected */