* pci/misc: PCI: Fix return value from pci_user_{read,write}_config_*() PCI: Turn pcibios_penalize_isa_irq() into a weak function PCI: Test for std config alias when testing extended config space
···59596060extern void pcibios_set_master(struct pci_dev *dev);61616262-extern inline void pcibios_penalize_isa_irq(int irq, int active)6363-{6464- /* We don't do dynamic PCI IRQ allocation */6565-}6666-6762/* IOMMU controls. */68636964/* The PCI address space does not equal the physical memory address space.
-5
arch/arm/include/asm/pci.h
···3131}3232#endif /* CONFIG_PCI_DOMAINS */33333434-static inline void pcibios_penalize_isa_irq(int irq, int active)3535-{3636- /* We don't do dynamic PCI IRQ allocation */3737-}3838-3934/*4035 * The PCI address space does equal the physical memory address space.4136 * The networking and block device layers use this boolean for bounce
···215215}216216#endif217217218218-static inline void pcibios_penalize_isa_irq(int irq, int active)219219-{220220- /* We don't need to penalize isa irq's */221221-}222222-223218static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)224219{225220 return channel ? 15 : 14;
-5
arch/powerpc/include/asm/pci.h
···4646#define pcibios_assign_all_busses() \4747 (pci_has_flag(PCI_REASSIGN_ALL_BUS))48484949-static inline void pcibios_penalize_isa_irq(int irq, int active)5050-{5151- /* We don't do dynamic PCI IRQ allocation */5252-}5353-5449#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ5550static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)5651{
-5
arch/sh/include/asm/pci.h
···7070 enum pci_mmap_state mmap_state, int write_combine);7171extern void pcibios_set_master(struct pci_dev *dev);72727373-static inline void pcibios_penalize_isa_irq(int irq, int active)7474-{7575- /* We don't do dynamic PCI IRQ allocation */7676-}7777-7873/* Dynamic DMA mapping stuff.7974 * SuperH has everything mapped statically like x86.8075 */
-5
arch/sparc/include/asm/pci_32.h
···16161717#define PCI_IRQ_NONE 0xffffffff18181919-static inline void pcibios_penalize_isa_irq(int irq, int active)2020-{2121- /* We don't do dynamic PCI IRQ allocation */2222-}2323-2419/* Dynamic DMA mapping stuff.2520 */2621#define PCI_DMA_BUS_IS_PHYS (0)
-5
arch/sparc/include/asm/pci_64.h
···16161717#define PCI_IRQ_NONE 0xffffffff18181919-static inline void pcibios_penalize_isa_irq(int irq, int active)2020-{2121- /* We don't do dynamic PCI IRQ allocation */2222-}2323-2419/* The PCI address space does not equal the physical memory2520 * address space. The networking and block device layers use2621 * this boolean for bounce buffer decisions.
-5
arch/unicore32/include/asm/pci.h
···1818#include <asm-generic/pci.h>1919#include <mach/hardware.h> /* for PCIBIOS_MIN_* */20202121-static inline void pcibios_penalize_isa_irq(int irq, int active)2222-{2323- /* We don't do dynamic PCI IRQ allocation */2424-}2525-2621#ifdef CONFIG_PCI2722static inline void pci_dma_burst_advice(struct pci_dev *pdev,2823 enum pci_dma_burst_strategy *strat,
-1
arch/x86/include/asm/pci.h
···6868void pcibios_scan_root(int bus);69697070void pcibios_set_master(struct pci_dev *dev);7171-void pcibios_penalize_isa_irq(int irq, int active);7271struct irq_routing_table *pcibios_get_irq_routing_table(void);7372int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);7473
-5
arch/xtensa/include/asm/pci.h
···22222323extern struct pci_controller* pcibios_alloc_controller(void);24242525-static inline void pcibios_penalize_isa_irq(int irq)2626-{2727- /* We don't do dynamic PCI IRQ allocation */2828-}2929-3025/* Assume some values. (We should revise them, if necessary) */31263227#define PCIBIOS_MIN_IO 0x2000
+4-8
drivers/pci/access.c
···148148int pci_user_read_config_##size \149149 (struct pci_dev *dev, int pos, type *val) \150150{ \151151- int ret = 0; \151151+ int ret = PCIBIOS_SUCCESSFUL; \152152 u32 data = -1; \153153 if (PCI_##size##_BAD) \154154 return -EINVAL; \···159159 pos, sizeof(type), &data); \160160 raw_spin_unlock_irq(&pci_lock); \161161 *val = (type)data; \162162- if (ret > 0) \163163- ret = -EINVAL; \164164- return ret; \162162+ return pcibios_err_to_errno(ret); \165163} \166164EXPORT_SYMBOL_GPL(pci_user_read_config_##size);167165···168170int pci_user_write_config_##size \169171 (struct pci_dev *dev, int pos, type val) \170172{ \171171- int ret = -EIO; \173173+ int ret = PCIBIOS_SUCCESSFUL; \172174 if (PCI_##size##_BAD) \173175 return -EINVAL; \174176 raw_spin_lock_irq(&pci_lock); \···177179 ret = dev->bus->ops->write(dev->bus, dev->devfn, \178180 pos, sizeof(type), val); \179181 raw_spin_unlock_irq(&pci_lock); \180180- if (ret > 0) \181181- ret = -EINVAL; \182182- return ret; \182182+ return pcibios_err_to_errno(ret); \183183} \184184EXPORT_SYMBOL_GPL(pci_user_write_config_##size);185185
+11
drivers/pci/pci.c
···14681468 */14691469void __weak pcibios_disable_device (struct pci_dev *dev) {}1470147014711471+/**14721472+ * pcibios_penalize_isa_irq - penalize an ISA IRQ14731473+ * @irq: ISA IRQ to penalize14741474+ * @active: IRQ active or not14751475+ *14761476+ * Permits the platform to provide architecture-specific functionality when14771477+ * penalizing ISA IRQs. This is the default implementation. Architecture14781478+ * implementations can override this.14791479+ */14801480+void __weak pcibios_penalize_isa_irq(int irq, int active) {}14811481+14711482static void do_pci_disable_device(struct pci_dev *dev)14721483{14731484 u16 pci_command;
+38-1
drivers/pci/probe.c
···994994995995996996/**997997+ * pci_ext_cfg_is_aliased - is ext config space just an alias of std config?998998+ * @dev: PCI device999999+ *10001000+ * PCI Express to PCI/PCI-X Bridge Specification, rev 1.0, 4.1.4 says that10011001+ * when forwarding a type1 configuration request the bridge must check that10021002+ * the extended register address field is zero. The bridge is not permitted10031003+ * to forward the transactions and must handle it as an Unsupported Request.10041004+ * Some bridges do not follow this rule and simply drop the extended register10051005+ * bits, resulting in the standard config space being aliased, every 25610061006+ * bytes across the entire configuration space. Test for this condition by10071007+ * comparing the first dword of each potential alias to the vendor/device ID.10081008+ * Known offenders:10091009+ * ASM1083/1085 PCIe-to-PCI Reversible Bridge (1b21:1080, rev 01 & 03)10101010+ * AMD/ATI SBx00 PCI to PCI Bridge (1002:4384, rev 40)10111011+ */10121012+static bool pci_ext_cfg_is_aliased(struct pci_dev *dev)10131013+{10141014+#ifdef CONFIG_PCI_QUIRKS10151015+ int pos;10161016+ u32 header, tmp;10171017+10181018+ pci_read_config_dword(dev, PCI_VENDOR_ID, &header);10191019+10201020+ for (pos = PCI_CFG_SPACE_SIZE;10211021+ pos < PCI_CFG_SPACE_EXP_SIZE; pos += PCI_CFG_SPACE_SIZE) {10221022+ if (pci_read_config_dword(dev, pos, &tmp) != PCIBIOS_SUCCESSFUL10231023+ || header != tmp)10241024+ return false;10251025+ }10261026+10271027+ return true;10281028+#else10291029+ return false;10301030+#endif10311031+}10321032+10331033+/**9971034 * pci_cfg_space_size - get the configuration space size of the PCI device.9981035 * @dev: PCI device9991036 *···1048101110491012 if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL)10501013 goto fail;10511051- if (status == 0xffffffff)10141014+ if (status == 0xffffffff || pci_ext_cfg_is_aliased(dev))10521015 goto fail;1053101610541017 return PCI_CFG_SPACE_EXP_SIZE;
+3-2
include/linux/pci.h
···532532 case PCIBIOS_FUNC_NOT_SUPPORTED:533533 return -ENOENT;534534 case PCIBIOS_BAD_VENDOR_ID:535535- return -EINVAL;535535+ return -ENOTTY;536536 case PCIBIOS_DEVICE_NOT_FOUND:537537 return -ENODEV;538538 case PCIBIOS_BAD_REGISTER_NUMBER:···543543 return -ENOSPC;544544 }545545546546- return -ENOTTY;546546+ return -ERANGE;547547}548548549549/* Low-level architecture-dependent routines */···15921592 enum pcie_reset_state state);15931593int pcibios_add_device(struct pci_dev *dev);15941594void pcibios_release_device(struct pci_dev *dev);15951595+void pcibios_penalize_isa_irq(int irq, int active);1595159615961597#ifdef CONFIG_HIBERNATE_CALLBACKS15971598extern struct dev_pm_ops pcibios_pm_ops;