diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2014-05-28 18:21:25 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-05-28 18:21:25 -0400 |
commit | fdaf36bd360fe1e74b34262ad705ef39d52c12de (patch) | |
tree | b686d69b0c5bf74ac0cd704123d64bfcdb3c10f5 | |
parent | d1a2523d2adc0b6910dbc2a9aed44c4217134db1 (diff) | |
parent | d97ffe236894856d08146390ef3fbe6448a8ac2b (diff) |
Merge branch 'pci/misc' into next
* 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
-rw-r--r-- | arch/alpha/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/arm/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/blackfin/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/cris/include/asm/pci.h | 1 | ||||
-rw-r--r-- | arch/frv/include/asm/pci.h | 2 | ||||
-rw-r--r-- | arch/frv/mb93090-mb00/pci-irq.c | 4 | ||||
-rw-r--r-- | arch/ia64/include/asm/pci.h | 6 | ||||
-rw-r--r-- | arch/microblaze/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/mips/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/mn10300/include/asm/pci.h | 1 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/pci-irq.c | 4 | ||||
-rw-r--r-- | arch/parisc/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/sh/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/sparc/include/asm/pci_32.h | 5 | ||||
-rw-r--r-- | arch/sparc/include/asm/pci_64.h | 5 | ||||
-rw-r--r-- | arch/unicore32/include/asm/pci.h | 5 | ||||
-rw-r--r-- | arch/x86/include/asm/pci.h | 1 | ||||
-rw-r--r-- | arch/xtensa/include/asm/pci.h | 5 | ||||
-rw-r--r-- | drivers/pci/access.c | 12 | ||||
-rw-r--r-- | drivers/pci/pci.c | 11 | ||||
-rw-r--r-- | drivers/pci/probe.c | 39 | ||||
-rw-r--r-- | include/linux/pci.h | 5 |
23 files changed, 56 insertions, 90 deletions
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h index d01afb78919c..f7f680f7457d 100644 --- a/arch/alpha/include/asm/pci.h +++ b/arch/alpha/include/asm/pci.h | |||
@@ -59,11 +59,6 @@ struct pci_controller { | |||
59 | 59 | ||
60 | extern void pcibios_set_master(struct pci_dev *dev); | 60 | extern void pcibios_set_master(struct pci_dev *dev); |
61 | 61 | ||
62 | extern inline void pcibios_penalize_isa_irq(int irq, int active) | ||
63 | { | ||
64 | /* We don't do dynamic PCI IRQ allocation */ | ||
65 | } | ||
66 | |||
67 | /* IOMMU controls. */ | 62 | /* IOMMU controls. */ |
68 | 63 | ||
69 | /* The PCI address space does not equal the physical memory address space. | 64 | /* The PCI address space does not equal the physical memory address space. |
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h index 680a83e94467..7e95d8535e24 100644 --- a/arch/arm/include/asm/pci.h +++ b/arch/arm/include/asm/pci.h | |||
@@ -31,11 +31,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
31 | } | 31 | } |
32 | #endif /* CONFIG_PCI_DOMAINS */ | 32 | #endif /* CONFIG_PCI_DOMAINS */ |
33 | 33 | ||
34 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
35 | { | ||
36 | /* We don't do dynamic PCI IRQ allocation */ | ||
37 | } | ||
38 | |||
39 | /* | 34 | /* |
40 | * The PCI address space does equal the physical memory address space. | 35 | * The PCI address space does equal the physical memory address space. |
41 | * The networking and block device layers use this boolean for bounce | 36 | * The networking and block device layers use this boolean for bounce |
diff --git a/arch/blackfin/include/asm/pci.h b/arch/blackfin/include/asm/pci.h index 74352c4597d9..c737909fba47 100644 --- a/arch/blackfin/include/asm/pci.h +++ b/arch/blackfin/include/asm/pci.h | |||
@@ -10,9 +10,4 @@ | |||
10 | #define PCIBIOS_MIN_IO 0x00001000 | 10 | #define PCIBIOS_MIN_IO 0x00001000 |
11 | #define PCIBIOS_MIN_MEM 0x10000000 | 11 | #define PCIBIOS_MIN_MEM 0x10000000 |
12 | 12 | ||
13 | static inline void pcibios_penalize_isa_irq(int irq) | ||
14 | { | ||
15 | /* We don't do dynamic PCI IRQ allocation */ | ||
16 | } | ||
17 | |||
18 | #endif /* _ASM_BFIN_PCI_H */ | 13 | #endif /* _ASM_BFIN_PCI_H */ |
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h index f666734926d5..cc2399c175e9 100644 --- a/arch/cris/include/asm/pci.h +++ b/arch/cris/include/asm/pci.h | |||
@@ -20,7 +20,6 @@ void pcibios_config_init(void); | |||
20 | struct pci_bus * pcibios_scan_root(int bus); | 20 | struct pci_bus * pcibios_scan_root(int bus); |
21 | 21 | ||
22 | void pcibios_set_master(struct pci_dev *dev); | 22 | void pcibios_set_master(struct pci_dev *dev); |
23 | void pcibios_penalize_isa_irq(int irq); | ||
24 | struct irq_routing_table *pcibios_get_irq_routing_table(void); | 23 | struct irq_routing_table *pcibios_get_irq_routing_table(void); |
25 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | 24 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); |
26 | 25 | ||
diff --git a/arch/frv/include/asm/pci.h b/arch/frv/include/asm/pci.h index ef03baf5d89d..2035a4d3f9b9 100644 --- a/arch/frv/include/asm/pci.h +++ b/arch/frv/include/asm/pci.h | |||
@@ -24,8 +24,6 @@ struct pci_dev; | |||
24 | 24 | ||
25 | extern void pcibios_set_master(struct pci_dev *dev); | 25 | extern void pcibios_set_master(struct pci_dev *dev); |
26 | 26 | ||
27 | extern void pcibios_penalize_isa_irq(int irq); | ||
28 | |||
29 | #ifdef CONFIG_MMU | 27 | #ifdef CONFIG_MMU |
30 | extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle); | 28 | extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle); |
31 | extern void consistent_free(void *vaddr); | 29 | extern void consistent_free(void *vaddr); |
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c index c677b9d81d30..1c35c93f942b 100644 --- a/arch/frv/mb93090-mb00/pci-irq.c +++ b/arch/frv/mb93090-mb00/pci-irq.c | |||
@@ -55,10 +55,6 @@ void __init pcibios_fixup_irqs(void) | |||
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | void __init pcibios_penalize_isa_irq(int irq) | ||
59 | { | ||
60 | } | ||
61 | |||
62 | void pcibios_enable_irq(struct pci_dev *dev) | 58 | void pcibios_enable_irq(struct pci_dev *dev) |
63 | { | 59 | { |
64 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | 60 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); |
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h index 7d41cc089822..52af5ed9f60b 100644 --- a/arch/ia64/include/asm/pci.h +++ b/arch/ia64/include/asm/pci.h | |||
@@ -50,12 +50,6 @@ struct pci_dev; | |||
50 | extern unsigned long ia64_max_iommu_merge_mask; | 50 | extern unsigned long ia64_max_iommu_merge_mask; |
51 | #define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL) | 51 | #define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL) |
52 | 52 | ||
53 | static inline void | ||
54 | pcibios_penalize_isa_irq (int irq, int active) | ||
55 | { | ||
56 | /* We don't do dynamic PCI IRQ allocation */ | ||
57 | } | ||
58 | |||
59 | #include <asm-generic/pci-dma-compat.h> | 53 | #include <asm-generic/pci-dma-compat.h> |
60 | 54 | ||
61 | #ifdef CONFIG_PCI | 55 | #ifdef CONFIG_PCI |
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h index 935f9bec414a..335524040fff 100644 --- a/arch/microblaze/include/asm/pci.h +++ b/arch/microblaze/include/asm/pci.h | |||
@@ -44,11 +44,6 @@ struct pci_dev; | |||
44 | */ | 44 | */ |
45 | #define pcibios_assign_all_busses() 0 | 45 | #define pcibios_assign_all_busses() 0 |
46 | 46 | ||
47 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
48 | { | ||
49 | /* We don't do dynamic PCI IRQ allocation */ | ||
50 | } | ||
51 | |||
52 | #ifdef CONFIG_PCI | 47 | #ifdef CONFIG_PCI |
53 | extern void set_pci_dma_ops(struct dma_map_ops *dma_ops); | 48 | extern void set_pci_dma_ops(struct dma_map_ops *dma_ops); |
54 | extern struct dma_map_ops *get_pci_dma_ops(void); | 49 | extern struct dma_map_ops *get_pci_dma_ops(void); |
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h index 12d6842962be..974b0e308963 100644 --- a/arch/mips/include/asm/pci.h +++ b/arch/mips/include/asm/pci.h | |||
@@ -73,11 +73,6 @@ extern unsigned long PCIBIOS_MIN_MEM; | |||
73 | 73 | ||
74 | extern void pcibios_set_master(struct pci_dev *dev); | 74 | extern void pcibios_set_master(struct pci_dev *dev); |
75 | 75 | ||
76 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
77 | { | ||
78 | /* We don't do dynamic PCI IRQ allocation */ | ||
79 | } | ||
80 | |||
81 | #define HAVE_PCI_MMAP | 76 | #define HAVE_PCI_MMAP |
82 | 77 | ||
83 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 78 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h index 166323824683..5f70af25c7d0 100644 --- a/arch/mn10300/include/asm/pci.h +++ b/arch/mn10300/include/asm/pci.h | |||
@@ -48,7 +48,6 @@ extern void unit_pci_init(void); | |||
48 | #define PCIBIOS_MIN_MEM 0xB8000000 | 48 | #define PCIBIOS_MIN_MEM 0xB8000000 |
49 | 49 | ||
50 | void pcibios_set_master(struct pci_dev *dev); | 50 | void pcibios_set_master(struct pci_dev *dev); |
51 | void pcibios_penalize_isa_irq(int irq); | ||
52 | 51 | ||
53 | /* Dynamic DMA mapping stuff. | 52 | /* Dynamic DMA mapping stuff. |
54 | * i386 has everything mapped statically. | 53 | * i386 has everything mapped statically. |
diff --git a/arch/mn10300/unit-asb2305/pci-irq.c b/arch/mn10300/unit-asb2305/pci-irq.c index 77439da04671..fcb28ceb824d 100644 --- a/arch/mn10300/unit-asb2305/pci-irq.c +++ b/arch/mn10300/unit-asb2305/pci-irq.c | |||
@@ -40,10 +40,6 @@ void __init pcibios_fixup_irqs(void) | |||
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | void __init pcibios_penalize_isa_irq(int irq) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | void pcibios_enable_irq(struct pci_dev *dev) | 43 | void pcibios_enable_irq(struct pci_dev *dev) |
48 | { | 44 | { |
49 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); | 45 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); |
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h index 465154076d23..20df2b04fc09 100644 --- a/arch/parisc/include/asm/pci.h +++ b/arch/parisc/include/asm/pci.h | |||
@@ -215,11 +215,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
215 | } | 215 | } |
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
219 | { | ||
220 | /* We don't need to penalize isa irq's */ | ||
221 | } | ||
222 | |||
223 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | 218 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
224 | { | 219 | { |
225 | return channel ? 15 : 14; | 220 | return channel ? 15 : 14; |
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h index 95145a15c708..1b0739bc14b5 100644 --- a/arch/powerpc/include/asm/pci.h +++ b/arch/powerpc/include/asm/pci.h | |||
@@ -46,11 +46,6 @@ struct pci_dev; | |||
46 | #define pcibios_assign_all_busses() \ | 46 | #define pcibios_assign_all_busses() \ |
47 | (pci_has_flag(PCI_REASSIGN_ALL_BUS)) | 47 | (pci_has_flag(PCI_REASSIGN_ALL_BUS)) |
48 | 48 | ||
49 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
50 | { | ||
51 | /* We don't do dynamic PCI IRQ allocation */ | ||
52 | } | ||
53 | |||
54 | #define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ | 49 | #define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ |
55 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | 50 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
56 | { | 51 | { |
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index bff96c2e7d25..5b4511552998 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h | |||
@@ -70,11 +70,6 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
70 | enum pci_mmap_state mmap_state, int write_combine); | 70 | enum pci_mmap_state mmap_state, int write_combine); |
71 | extern void pcibios_set_master(struct pci_dev *dev); | 71 | extern void pcibios_set_master(struct pci_dev *dev); |
72 | 72 | ||
73 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
74 | { | ||
75 | /* We don't do dynamic PCI IRQ allocation */ | ||
76 | } | ||
77 | |||
78 | /* Dynamic DMA mapping stuff. | 73 | /* Dynamic DMA mapping stuff. |
79 | * SuperH has everything mapped statically like x86. | 74 | * SuperH has everything mapped statically like x86. |
80 | */ | 75 | */ |
diff --git a/arch/sparc/include/asm/pci_32.h b/arch/sparc/include/asm/pci_32.h index dc503297481f..53e9b4987db0 100644 --- a/arch/sparc/include/asm/pci_32.h +++ b/arch/sparc/include/asm/pci_32.h | |||
@@ -16,11 +16,6 @@ | |||
16 | 16 | ||
17 | #define PCI_IRQ_NONE 0xffffffff | 17 | #define PCI_IRQ_NONE 0xffffffff |
18 | 18 | ||
19 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
20 | { | ||
21 | /* We don't do dynamic PCI IRQ allocation */ | ||
22 | } | ||
23 | |||
24 | /* Dynamic DMA mapping stuff. | 19 | /* Dynamic DMA mapping stuff. |
25 | */ | 20 | */ |
26 | #define PCI_DMA_BUS_IS_PHYS (0) | 21 | #define PCI_DMA_BUS_IS_PHYS (0) |
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h index 1633b718d3bc..c6c7396e7627 100644 --- a/arch/sparc/include/asm/pci_64.h +++ b/arch/sparc/include/asm/pci_64.h | |||
@@ -16,11 +16,6 @@ | |||
16 | 16 | ||
17 | #define PCI_IRQ_NONE 0xffffffff | 17 | #define PCI_IRQ_NONE 0xffffffff |
18 | 18 | ||
19 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
20 | { | ||
21 | /* We don't do dynamic PCI IRQ allocation */ | ||
22 | } | ||
23 | |||
24 | /* The PCI address space does not equal the physical memory | 19 | /* The PCI address space does not equal the physical memory |
25 | * address space. The networking and block device layers use | 20 | * address space. The networking and block device layers use |
26 | * this boolean for bounce buffer decisions. | 21 | * this boolean for bounce buffer decisions. |
diff --git a/arch/unicore32/include/asm/pci.h b/arch/unicore32/include/asm/pci.h index f5e108f4a151..654407e98619 100644 --- a/arch/unicore32/include/asm/pci.h +++ b/arch/unicore32/include/asm/pci.h | |||
@@ -18,11 +18,6 @@ | |||
18 | #include <asm-generic/pci.h> | 18 | #include <asm-generic/pci.h> |
19 | #include <mach/hardware.h> /* for PCIBIOS_MIN_* */ | 19 | #include <mach/hardware.h> /* for PCIBIOS_MIN_* */ |
20 | 20 | ||
21 | static inline void pcibios_penalize_isa_irq(int irq, int active) | ||
22 | { | ||
23 | /* We don't do dynamic PCI IRQ allocation */ | ||
24 | } | ||
25 | |||
26 | #ifdef CONFIG_PCI | 21 | #ifdef CONFIG_PCI |
27 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 22 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
28 | enum pci_dma_burst_strategy *strat, | 23 | enum pci_dma_burst_strategy *strat, |
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 96ae4f4040bb..0892ea0e683f 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
@@ -68,7 +68,6 @@ void pcibios_config_init(void); | |||
68 | void pcibios_scan_root(int bus); | 68 | void pcibios_scan_root(int bus); |
69 | 69 | ||
70 | void pcibios_set_master(struct pci_dev *dev); | 70 | void pcibios_set_master(struct pci_dev *dev); |
71 | void pcibios_penalize_isa_irq(int irq, int active); | ||
72 | struct irq_routing_table *pcibios_get_irq_routing_table(void); | 71 | struct irq_routing_table *pcibios_get_irq_routing_table(void); |
73 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); | 72 | int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq); |
74 | 73 | ||
diff --git a/arch/xtensa/include/asm/pci.h b/arch/xtensa/include/asm/pci.h index 614be031a79a..5d52dc43dfe7 100644 --- a/arch/xtensa/include/asm/pci.h +++ b/arch/xtensa/include/asm/pci.h | |||
@@ -22,11 +22,6 @@ | |||
22 | 22 | ||
23 | extern struct pci_controller* pcibios_alloc_controller(void); | 23 | extern struct pci_controller* pcibios_alloc_controller(void); |
24 | 24 | ||
25 | static inline void pcibios_penalize_isa_irq(int irq) | ||
26 | { | ||
27 | /* We don't do dynamic PCI IRQ allocation */ | ||
28 | } | ||
29 | |||
30 | /* Assume some values. (We should revise them, if necessary) */ | 25 | /* Assume some values. (We should revise them, if necessary) */ |
31 | 26 | ||
32 | #define PCIBIOS_MIN_IO 0x2000 | 27 | #define PCIBIOS_MIN_IO 0x2000 |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 7f8b78c08879..8c148f39e8d7 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -148,7 +148,7 @@ static noinline void pci_wait_cfg(struct pci_dev *dev) | |||
148 | int pci_user_read_config_##size \ | 148 | int pci_user_read_config_##size \ |
149 | (struct pci_dev *dev, int pos, type *val) \ | 149 | (struct pci_dev *dev, int pos, type *val) \ |
150 | { \ | 150 | { \ |
151 | int ret = 0; \ | 151 | int ret = PCIBIOS_SUCCESSFUL; \ |
152 | u32 data = -1; \ | 152 | u32 data = -1; \ |
153 | if (PCI_##size##_BAD) \ | 153 | if (PCI_##size##_BAD) \ |
154 | return -EINVAL; \ | 154 | return -EINVAL; \ |
@@ -159,9 +159,7 @@ int pci_user_read_config_##size \ | |||
159 | pos, sizeof(type), &data); \ | 159 | pos, sizeof(type), &data); \ |
160 | raw_spin_unlock_irq(&pci_lock); \ | 160 | raw_spin_unlock_irq(&pci_lock); \ |
161 | *val = (type)data; \ | 161 | *val = (type)data; \ |
162 | if (ret > 0) \ | 162 | return pcibios_err_to_errno(ret); \ |
163 | ret = -EINVAL; \ | ||
164 | return ret; \ | ||
165 | } \ | 163 | } \ |
166 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); | 164 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); |
167 | 165 | ||
@@ -170,7 +168,7 @@ EXPORT_SYMBOL_GPL(pci_user_read_config_##size); | |||
170 | int pci_user_write_config_##size \ | 168 | int pci_user_write_config_##size \ |
171 | (struct pci_dev *dev, int pos, type val) \ | 169 | (struct pci_dev *dev, int pos, type val) \ |
172 | { \ | 170 | { \ |
173 | int ret = -EIO; \ | 171 | int ret = PCIBIOS_SUCCESSFUL; \ |
174 | if (PCI_##size##_BAD) \ | 172 | if (PCI_##size##_BAD) \ |
175 | return -EINVAL; \ | 173 | return -EINVAL; \ |
176 | raw_spin_lock_irq(&pci_lock); \ | 174 | raw_spin_lock_irq(&pci_lock); \ |
@@ -179,9 +177,7 @@ int pci_user_write_config_##size \ | |||
179 | ret = dev->bus->ops->write(dev->bus, dev->devfn, \ | 177 | ret = dev->bus->ops->write(dev->bus, dev->devfn, \ |
180 | pos, sizeof(type), val); \ | 178 | pos, sizeof(type), val); \ |
181 | raw_spin_unlock_irq(&pci_lock); \ | 179 | raw_spin_unlock_irq(&pci_lock); \ |
182 | if (ret > 0) \ | 180 | return pcibios_err_to_errno(ret); \ |
183 | ret = -EINVAL; \ | ||
184 | return ret; \ | ||
185 | } \ | 181 | } \ |
186 | EXPORT_SYMBOL_GPL(pci_user_write_config_##size); | 182 | EXPORT_SYMBOL_GPL(pci_user_write_config_##size); |
187 | 183 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f988bb18eba5..fd958c8ebd83 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1468,6 +1468,17 @@ void __weak pcibios_release_device(struct pci_dev *dev) {} | |||
1468 | */ | 1468 | */ |
1469 | void __weak pcibios_disable_device (struct pci_dev *dev) {} | 1469 | void __weak pcibios_disable_device (struct pci_dev *dev) {} |
1470 | 1470 | ||
1471 | /** | ||
1472 | * pcibios_penalize_isa_irq - penalize an ISA IRQ | ||
1473 | * @irq: ISA IRQ to penalize | ||
1474 | * @active: IRQ active or not | ||
1475 | * | ||
1476 | * Permits the platform to provide architecture-specific functionality when | ||
1477 | * penalizing ISA IRQs. This is the default implementation. Architecture | ||
1478 | * implementations can override this. | ||
1479 | */ | ||
1480 | void __weak pcibios_penalize_isa_irq(int irq, int active) {} | ||
1481 | |||
1471 | static void do_pci_disable_device(struct pci_dev *dev) | 1482 | static void do_pci_disable_device(struct pci_dev *dev) |
1472 | { | 1483 | { |
1473 | u16 pci_command; | 1484 | u16 pci_command; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 36f1fd174b07..2bbf5221afb3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -994,6 +994,43 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev) | |||
994 | 994 | ||
995 | 995 | ||
996 | /** | 996 | /** |
997 | * pci_ext_cfg_is_aliased - is ext config space just an alias of std config? | ||
998 | * @dev: PCI device | ||
999 | * | ||
1000 | * PCI Express to PCI/PCI-X Bridge Specification, rev 1.0, 4.1.4 says that | ||
1001 | * when forwarding a type1 configuration request the bridge must check that | ||
1002 | * the extended register address field is zero. The bridge is not permitted | ||
1003 | * to forward the transactions and must handle it as an Unsupported Request. | ||
1004 | * Some bridges do not follow this rule and simply drop the extended register | ||
1005 | * bits, resulting in the standard config space being aliased, every 256 | ||
1006 | * bytes across the entire configuration space. Test for this condition by | ||
1007 | * comparing the first dword of each potential alias to the vendor/device ID. | ||
1008 | * Known offenders: | ||
1009 | * ASM1083/1085 PCIe-to-PCI Reversible Bridge (1b21:1080, rev 01 & 03) | ||
1010 | * AMD/ATI SBx00 PCI to PCI Bridge (1002:4384, rev 40) | ||
1011 | */ | ||
1012 | static bool pci_ext_cfg_is_aliased(struct pci_dev *dev) | ||
1013 | { | ||
1014 | #ifdef CONFIG_PCI_QUIRKS | ||
1015 | int pos; | ||
1016 | u32 header, tmp; | ||
1017 | |||
1018 | pci_read_config_dword(dev, PCI_VENDOR_ID, &header); | ||
1019 | |||
1020 | for (pos = PCI_CFG_SPACE_SIZE; | ||
1021 | pos < PCI_CFG_SPACE_EXP_SIZE; pos += PCI_CFG_SPACE_SIZE) { | ||
1022 | if (pci_read_config_dword(dev, pos, &tmp) != PCIBIOS_SUCCESSFUL | ||
1023 | || header != tmp) | ||
1024 | return false; | ||
1025 | } | ||
1026 | |||
1027 | return true; | ||
1028 | #else | ||
1029 | return false; | ||
1030 | #endif | ||
1031 | } | ||
1032 | |||
1033 | /** | ||
997 | * pci_cfg_space_size - get the configuration space size of the PCI device. | 1034 | * pci_cfg_space_size - get the configuration space size of the PCI device. |
998 | * @dev: PCI device | 1035 | * @dev: PCI device |
999 | * | 1036 | * |
@@ -1011,7 +1048,7 @@ static int pci_cfg_space_size_ext(struct pci_dev *dev) | |||
1011 | 1048 | ||
1012 | if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL) | 1049 | if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL) |
1013 | goto fail; | 1050 | goto fail; |
1014 | if (status == 0xffffffff) | 1051 | if (status == 0xffffffff || pci_ext_cfg_is_aliased(dev)) |
1015 | goto fail; | 1052 | goto fail; |
1016 | 1053 | ||
1017 | return PCI_CFG_SPACE_EXP_SIZE; | 1054 | return PCI_CFG_SPACE_EXP_SIZE; |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 4eb99966570e..65f22e85612d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -532,7 +532,7 @@ static inline int pcibios_err_to_errno(int err) | |||
532 | case PCIBIOS_FUNC_NOT_SUPPORTED: | 532 | case PCIBIOS_FUNC_NOT_SUPPORTED: |
533 | return -ENOENT; | 533 | return -ENOENT; |
534 | case PCIBIOS_BAD_VENDOR_ID: | 534 | case PCIBIOS_BAD_VENDOR_ID: |
535 | return -EINVAL; | 535 | return -ENOTTY; |
536 | case PCIBIOS_DEVICE_NOT_FOUND: | 536 | case PCIBIOS_DEVICE_NOT_FOUND: |
537 | return -ENODEV; | 537 | return -ENODEV; |
538 | case PCIBIOS_BAD_REGISTER_NUMBER: | 538 | case PCIBIOS_BAD_REGISTER_NUMBER: |
@@ -543,7 +543,7 @@ static inline int pcibios_err_to_errno(int err) | |||
543 | return -ENOSPC; | 543 | return -ENOSPC; |
544 | } | 544 | } |
545 | 545 | ||
546 | return -ENOTTY; | 546 | return -ERANGE; |
547 | } | 547 | } |
548 | 548 | ||
549 | /* Low-level architecture-dependent routines */ | 549 | /* Low-level architecture-dependent routines */ |
@@ -1592,6 +1592,7 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, | |||
1592 | enum pcie_reset_state state); | 1592 | enum pcie_reset_state state); |
1593 | int pcibios_add_device(struct pci_dev *dev); | 1593 | int pcibios_add_device(struct pci_dev *dev); |
1594 | void pcibios_release_device(struct pci_dev *dev); | 1594 | void pcibios_release_device(struct pci_dev *dev); |
1595 | void pcibios_penalize_isa_irq(int irq, int active); | ||
1595 | 1596 | ||
1596 | #ifdef CONFIG_HIBERNATE_CALLBACKS | 1597 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
1597 | extern struct dev_pm_ops pcibios_pm_ops; | 1598 | extern struct dev_pm_ops pcibios_pm_ops; |