aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/pci/fixup.c22
-rw-r--r--arch/powerpc/kernel/pci-common.c11
-rw-r--r--arch/x86/include/asm/vga.h6
-rw-r--r--arch/x86/kernel/resource.c8
-rw-r--r--arch/x86/pci/fixup.c21
-rw-r--r--arch/x86/pci/i386.c4
-rw-r--r--drivers/pci/host/pci-host-generic.c2
-rw-r--r--drivers/pci/host/pci-mvebu.c2
-rw-r--r--drivers/pci/host/pci-tegra.c2
-rw-r--r--drivers/pci/host/pcie-rcar.c158
-rw-r--r--drivers/pci/hotplug/cpqphp_sysfs.c3
-rw-r--r--drivers/pci/hotplug/pciehp.h3
-rw-r--r--drivers/pci/hotplug/pciehp_core.c7
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c101
-rw-r--r--drivers/pci/pci-label.c18
-rw-r--r--drivers/pci/pci.c19
-rw-r--r--drivers/pci/pcie/portdrv_pci.c4
-rw-r--r--drivers/pci/quirks.c2
-rw-r--r--drivers/pci/setup-bus.c2
-rw-r--r--drivers/pci/setup-res.c75
-rw-r--r--drivers/video/fbdev/efifb.c39
-rw-r--r--include/linux/pci.h2
-rw-r--r--include/linux/pci_ids.h4
23 files changed, 252 insertions, 263 deletions
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index 1fe9aa5068ea..ec73b2cf912a 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -6,6 +6,7 @@
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/vgaarb.h> 8#include <linux/vgaarb.h>
9#include <linux/screen_info.h>
9 10
10#include <asm/machvec.h> 11#include <asm/machvec.h>
11 12
@@ -37,6 +38,27 @@ static void pci_fixup_video(struct pci_dev *pdev)
37 return; 38 return;
38 /* Maybe, this machine supports legacy memory map. */ 39 /* Maybe, this machine supports legacy memory map. */
39 40
41 if (!vga_default_device()) {
42 resource_size_t start, end;
43 int i;
44
45 /* Does firmware framebuffer belong to us? */
46 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
47 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
48 continue;
49
50 start = pci_resource_start(pdev, i);
51 end = pci_resource_end(pdev, i);
52
53 if (!start || !end)
54 continue;
55
56 if (screen_info.lfb_base >= start &&
57 (screen_info.lfb_base + screen_info.lfb_size) < end)
58 vga_set_default_device(pdev);
59 }
60 }
61
40 /* Is VGA routed to us? */ 62 /* Is VGA routed to us? */
41 bus = pdev->bus; 63 bus = pdev->bus;
42 while (bus) { 64 while (bus) {
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index b49c72fd7f16..b2814e23e1ed 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -123,21 +123,12 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
123 123
124void pcibios_reset_secondary_bus(struct pci_dev *dev) 124void pcibios_reset_secondary_bus(struct pci_dev *dev)
125{ 125{
126 u16 ctrl;
127
128 if (ppc_md.pcibios_reset_secondary_bus) { 126 if (ppc_md.pcibios_reset_secondary_bus) {
129 ppc_md.pcibios_reset_secondary_bus(dev); 127 ppc_md.pcibios_reset_secondary_bus(dev);
130 return; 128 return;
131 } 129 }
132 130
133 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &ctrl); 131 pci_reset_secondary_bus(dev);
134 ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
135 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
136 msleep(2);
137
138 ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
139 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
140 ssleep(1);
141} 132}
142 133
143static resource_size_t pcibios_io_size(const struct pci_controller *hose) 134static resource_size_t pcibios_io_size(const struct pci_controller *hose)
diff --git a/arch/x86/include/asm/vga.h b/arch/x86/include/asm/vga.h
index 44282fbf7bf9..c4b9dc2f67c5 100644
--- a/arch/x86/include/asm/vga.h
+++ b/arch/x86/include/asm/vga.h
@@ -17,10 +17,4 @@
17#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
18#define vga_writeb(x, y) (*(y) = (x)) 18#define vga_writeb(x, y) (*(y) = (x))
19 19
20#ifdef CONFIG_FB_EFI
21#define __ARCH_HAS_VGA_DEFAULT_DEVICE
22extern struct pci_dev *vga_default_device(void);
23extern void vga_set_default_device(struct pci_dev *pdev);
24#endif
25
26#endif /* _ASM_X86_VGA_H */ 20#endif /* _ASM_X86_VGA_H */
diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c
index 2a26819bb6a8..80eab01c1a68 100644
--- a/arch/x86/kernel/resource.c
+++ b/arch/x86/kernel/resource.c
@@ -37,10 +37,12 @@ static void remove_e820_regions(struct resource *avail)
37 37
38void arch_remove_reservations(struct resource *avail) 38void arch_remove_reservations(struct resource *avail)
39{ 39{
40 /* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */ 40 /*
41 * Trim out BIOS area (high 2MB) and E820 regions. We do not remove
42 * the low 1MB unconditionally, as this area is needed for some ISA
43 * cards requiring a memory range, e.g. the i82365 PCMCIA controller.
44 */
41 if (avail->flags & IORESOURCE_MEM) { 45 if (avail->flags & IORESOURCE_MEM) {
42 if (avail->start < BIOS_END)
43 avail->start = BIOS_END;
44 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); 46 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
45 47
46 remove_e820_regions(avail); 48 remove_e820_regions(avail);
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index b5e60268d93f..c61ea57d1ba1 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -326,6 +326,27 @@ static void pci_fixup_video(struct pci_dev *pdev)
326 struct pci_bus *bus; 326 struct pci_bus *bus;
327 u16 config; 327 u16 config;
328 328
329 if (!vga_default_device()) {
330 resource_size_t start, end;
331 int i;
332
333 /* Does firmware framebuffer belong to us? */
334 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
335 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
336 continue;
337
338 start = pci_resource_start(pdev, i);
339 end = pci_resource_end(pdev, i);
340
341 if (!start || !end)
342 continue;
343
344 if (screen_info.lfb_base >= start &&
345 (screen_info.lfb_base + screen_info.lfb_size) < end)
346 vga_set_default_device(pdev);
347 }
348 }
349
329 /* Is VGA routed to us? */ 350 /* Is VGA routed to us? */
330 bus = pdev->bus; 351 bus = pdev->bus;
331 while (bus) { 352 while (bus) {
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index a19ed92e74e4..2ae525e0d8ba 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -162,6 +162,10 @@ pcibios_align_resource(void *data, const struct resource *res,
162 return start; 162 return start;
163 if (start & 0x300) 163 if (start & 0x300)
164 start = (start + 0x3ff) & ~0x3ff; 164 start = (start + 0x3ff) & ~0x3ff;
165 } else if (res->flags & IORESOURCE_MEM) {
166 /* The low 1MB range is reserved for ISA cards */
167 if (start < BIOS_END)
168 start = BIOS_END;
165 } 169 }
166 return start; 170 return start;
167} 171}
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
index 44fe6aa6a43f..3d2076f59911 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -385,4 +385,4 @@ module_platform_driver(gen_pci_driver);
385 385
386MODULE_DESCRIPTION("Generic PCI host driver"); 386MODULE_DESCRIPTION("Generic PCI host driver");
387MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>"); 387MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
388MODULE_LICENSE("GPLv2"); 388MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index ce23e0f076b6..a8c6f1a92e0f 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1094,4 +1094,4 @@ module_platform_driver(mvebu_pcie_driver);
1094 1094
1095MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 1095MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
1096MODULE_DESCRIPTION("Marvell EBU PCIe driver"); 1096MODULE_DESCRIPTION("Marvell EBU PCIe driver");
1097MODULE_LICENSE("GPLv2"); 1097MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 083cf37ca047..c284e841e3ea 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -1716,4 +1716,4 @@ module_platform_driver(tegra_pcie_driver);
1716 1716
1717MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>"); 1717MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1718MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver"); 1718MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver");
1719MODULE_LICENSE("GPLv2"); 1719MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index f7d3de32c9a0..4884ee5e07d4 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -105,7 +105,7 @@
105#define PCIE_CONF_DEV(d) (((d) & 0x1f) << 19) 105#define PCIE_CONF_DEV(d) (((d) & 0x1f) << 19)
106#define PCIE_CONF_FUNC(f) (((f) & 0x7) << 16) 106#define PCIE_CONF_FUNC(f) (((f) & 0x7) << 16)
107 107
108#define PCI_MAX_RESOURCES 4 108#define RCAR_PCI_MAX_RESOURCES 4
109#define MAX_NR_INBOUND_MAPS 6 109#define MAX_NR_INBOUND_MAPS 6
110 110
111struct rcar_msi { 111struct rcar_msi {
@@ -127,7 +127,7 @@ static inline struct rcar_msi *to_rcar_msi(struct msi_chip *chip)
127struct rcar_pcie { 127struct rcar_pcie {
128 struct device *dev; 128 struct device *dev;
129 void __iomem *base; 129 void __iomem *base;
130 struct resource res[PCI_MAX_RESOURCES]; 130 struct resource res[RCAR_PCI_MAX_RESOURCES];
131 struct resource busn; 131 struct resource busn;
132 int root_bus_nr; 132 int root_bus_nr;
133 struct clk *clk; 133 struct clk *clk;
@@ -140,36 +140,37 @@ static inline struct rcar_pcie *sys_to_pcie(struct pci_sys_data *sys)
140 return sys->private_data; 140 return sys->private_data;
141} 141}
142 142
143static void pci_write_reg(struct rcar_pcie *pcie, unsigned long val, 143static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
144 unsigned long reg) 144 unsigned long reg)
145{ 145{
146 writel(val, pcie->base + reg); 146 writel(val, pcie->base + reg);
147} 147}
148 148
149static unsigned long pci_read_reg(struct rcar_pcie *pcie, unsigned long reg) 149static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
150 unsigned long reg)
150{ 151{
151 return readl(pcie->base + reg); 152 return readl(pcie->base + reg);
152} 153}
153 154
154enum { 155enum {
155 PCI_ACCESS_READ, 156 RCAR_PCI_ACCESS_READ,
156 PCI_ACCESS_WRITE, 157 RCAR_PCI_ACCESS_WRITE,
157}; 158};
158 159
159static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data) 160static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data)
160{ 161{
161 int shift = 8 * (where & 3); 162 int shift = 8 * (where & 3);
162 u32 val = pci_read_reg(pcie, where & ~3); 163 u32 val = rcar_pci_read_reg(pcie, where & ~3);
163 164
164 val &= ~(mask << shift); 165 val &= ~(mask << shift);
165 val |= data << shift; 166 val |= data << shift;
166 pci_write_reg(pcie, val, where & ~3); 167 rcar_pci_write_reg(pcie, val, where & ~3);
167} 168}
168 169
169static u32 rcar_read_conf(struct rcar_pcie *pcie, int where) 170static u32 rcar_read_conf(struct rcar_pcie *pcie, int where)
170{ 171{
171 int shift = 8 * (where & 3); 172 int shift = 8 * (where & 3);
172 u32 val = pci_read_reg(pcie, where & ~3); 173 u32 val = rcar_pci_read_reg(pcie, where & ~3);
173 174
174 return val >> shift; 175 return val >> shift;
175} 176}
@@ -205,14 +206,14 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
205 if (dev != 0) 206 if (dev != 0)
206 return PCIBIOS_DEVICE_NOT_FOUND; 207 return PCIBIOS_DEVICE_NOT_FOUND;
207 208
208 if (access_type == PCI_ACCESS_READ) { 209 if (access_type == RCAR_PCI_ACCESS_READ) {
209 *data = pci_read_reg(pcie, PCICONF(index)); 210 *data = rcar_pci_read_reg(pcie, PCICONF(index));
210 } else { 211 } else {
211 /* Keep an eye out for changes to the root bus number */ 212 /* Keep an eye out for changes to the root bus number */
212 if (pci_is_root_bus(bus) && (reg == PCI_PRIMARY_BUS)) 213 if (pci_is_root_bus(bus) && (reg == PCI_PRIMARY_BUS))
213 pcie->root_bus_nr = *data & 0xff; 214 pcie->root_bus_nr = *data & 0xff;
214 215
215 pci_write_reg(pcie, *data, PCICONF(index)); 216 rcar_pci_write_reg(pcie, *data, PCICONF(index));
216 } 217 }
217 218
218 return PCIBIOS_SUCCESSFUL; 219 return PCIBIOS_SUCCESSFUL;
@@ -222,20 +223,20 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
222 return PCIBIOS_DEVICE_NOT_FOUND; 223 return PCIBIOS_DEVICE_NOT_FOUND;
223 224
224 /* Clear errors */ 225 /* Clear errors */
225 pci_write_reg(pcie, pci_read_reg(pcie, PCIEERRFR), PCIEERRFR); 226 rcar_pci_write_reg(pcie, rcar_pci_read_reg(pcie, PCIEERRFR), PCIEERRFR);
226 227
227 /* Set the PIO address */ 228 /* Set the PIO address */
228 pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) | PCIE_CONF_DEV(dev) | 229 rcar_pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) |
229 PCIE_CONF_FUNC(func) | reg, PCIECAR); 230 PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) | reg, PCIECAR);
230 231
231 /* Enable the configuration access */ 232 /* Enable the configuration access */
232 if (bus->parent->number == pcie->root_bus_nr) 233 if (bus->parent->number == pcie->root_bus_nr)
233 pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR); 234 rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR);
234 else 235 else
235 pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR); 236 rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR);
236 237
237 /* Check for errors */ 238 /* Check for errors */
238 if (pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST) 239 if (rcar_pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST)
239 return PCIBIOS_DEVICE_NOT_FOUND; 240 return PCIBIOS_DEVICE_NOT_FOUND;
240 241
241 /* Check for master and target aborts */ 242 /* Check for master and target aborts */
@@ -243,13 +244,13 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
243 (PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT)) 244 (PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT))
244 return PCIBIOS_DEVICE_NOT_FOUND; 245 return PCIBIOS_DEVICE_NOT_FOUND;
245 246
246 if (access_type == PCI_ACCESS_READ) 247 if (access_type == RCAR_PCI_ACCESS_READ)
247 *data = pci_read_reg(pcie, PCIECDR); 248 *data = rcar_pci_read_reg(pcie, PCIECDR);
248 else 249 else
249 pci_write_reg(pcie, *data, PCIECDR); 250 rcar_pci_write_reg(pcie, *data, PCIECDR);
250 251
251 /* Disable the configuration access */ 252 /* Disable the configuration access */
252 pci_write_reg(pcie, 0, PCIECCTLR); 253 rcar_pci_write_reg(pcie, 0, PCIECCTLR);
253 254
254 return PCIBIOS_SUCCESSFUL; 255 return PCIBIOS_SUCCESSFUL;
255} 256}
@@ -260,12 +261,7 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
260 struct rcar_pcie *pcie = sys_to_pcie(bus->sysdata); 261 struct rcar_pcie *pcie = sys_to_pcie(bus->sysdata);
261 int ret; 262 int ret;
262 263
263 if ((size == 2) && (where & 1)) 264 ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
264 return PCIBIOS_BAD_REGISTER_NUMBER;
265 else if ((size == 4) && (where & 3))
266 return PCIBIOS_BAD_REGISTER_NUMBER;
267
268 ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ,
269 bus, devfn, where, val); 265 bus, devfn, where, val);
270 if (ret != PCIBIOS_SUCCESSFUL) { 266 if (ret != PCIBIOS_SUCCESSFUL) {
271 *val = 0xffffffff; 267 *val = 0xffffffff;
@@ -291,12 +287,7 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
291 int shift, ret; 287 int shift, ret;
292 u32 data; 288 u32 data;
293 289
294 if ((size == 2) && (where & 1)) 290 ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
295 return PCIBIOS_BAD_REGISTER_NUMBER;
296 else if ((size == 4) && (where & 3))
297 return PCIBIOS_BAD_REGISTER_NUMBER;
298
299 ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ,
300 bus, devfn, where, &data); 291 bus, devfn, where, &data);
301 if (ret != PCIBIOS_SUCCESSFUL) 292 if (ret != PCIBIOS_SUCCESSFUL)
302 return ret; 293 return ret;
@@ -315,7 +306,7 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
315 } else 306 } else
316 data = val; 307 data = val;
317 308
318 ret = rcar_pcie_config_access(pcie, PCI_ACCESS_WRITE, 309 ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_WRITE,
319 bus, devfn, where, &data); 310 bus, devfn, where, &data);
320 311
321 return ret; 312 return ret;
@@ -326,14 +317,15 @@ static struct pci_ops rcar_pcie_ops = {
326 .write = rcar_pcie_write_conf, 317 .write = rcar_pcie_write_conf,
327}; 318};
328 319
329static void rcar_pcie_setup_window(int win, struct resource *res, 320static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie)
330 struct rcar_pcie *pcie)
331{ 321{
322 struct resource *res = &pcie->res[win];
323
332 /* Setup PCIe address space mappings for each resource */ 324 /* Setup PCIe address space mappings for each resource */
333 resource_size_t size; 325 resource_size_t size;
334 u32 mask; 326 u32 mask;
335 327
336 pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win)); 328 rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win));
337 329
338 /* 330 /*
339 * The PAMR mask is calculated in units of 128Bytes, which 331 * The PAMR mask is calculated in units of 128Bytes, which
@@ -341,17 +333,17 @@ static void rcar_pcie_setup_window(int win, struct resource *res,
341 */ 333 */
342 size = resource_size(res); 334 size = resource_size(res);
343 mask = (roundup_pow_of_two(size) / SZ_128) - 1; 335 mask = (roundup_pow_of_two(size) / SZ_128) - 1;
344 pci_write_reg(pcie, mask << 7, PCIEPAMR(win)); 336 rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win));
345 337
346 pci_write_reg(pcie, upper_32_bits(res->start), PCIEPARH(win)); 338 rcar_pci_write_reg(pcie, upper_32_bits(res->start), PCIEPARH(win));
347 pci_write_reg(pcie, lower_32_bits(res->start), PCIEPARL(win)); 339 rcar_pci_write_reg(pcie, lower_32_bits(res->start), PCIEPARL(win));
348 340
349 /* First resource is for IO */ 341 /* First resource is for IO */
350 mask = PAR_ENABLE; 342 mask = PAR_ENABLE;
351 if (res->flags & IORESOURCE_IO) 343 if (res->flags & IORESOURCE_IO)
352 mask |= IO_SPACE; 344 mask |= IO_SPACE;
353 345
354 pci_write_reg(pcie, mask, PCIEPTCTLR(win)); 346 rcar_pci_write_reg(pcie, mask, PCIEPTCTLR(win));
355} 347}
356 348
357static int rcar_pcie_setup(int nr, struct pci_sys_data *sys) 349static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
@@ -363,13 +355,13 @@ static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
363 pcie->root_bus_nr = -1; 355 pcie->root_bus_nr = -1;
364 356
365 /* Setup PCI resources */ 357 /* Setup PCI resources */
366 for (i = 0; i < PCI_MAX_RESOURCES; i++) { 358 for (i = 0; i < RCAR_PCI_MAX_RESOURCES; i++) {
367 359
368 res = &pcie->res[i]; 360 res = &pcie->res[i];
369 if (!res->flags) 361 if (!res->flags)
370 continue; 362 continue;
371 363
372 rcar_pcie_setup_window(i, res, pcie); 364 rcar_pcie_setup_window(i, pcie);
373 365
374 if (res->flags & IORESOURCE_IO) 366 if (res->flags & IORESOURCE_IO)
375 pci_ioremap_io(nr * SZ_64K, res->start); 367 pci_ioremap_io(nr * SZ_64K, res->start);
@@ -415,7 +407,7 @@ static int phy_wait_for_ack(struct rcar_pcie *pcie)
415 unsigned int timeout = 100; 407 unsigned int timeout = 100;
416 408
417 while (timeout--) { 409 while (timeout--) {
418 if (pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK) 410 if (rcar_pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK)
419 return 0; 411 return 0;
420 412
421 udelay(100); 413 udelay(100);
@@ -438,15 +430,15 @@ static void phy_write_reg(struct rcar_pcie *pcie,
438 ((addr & 0xff) << ADR_POS); 430 ((addr & 0xff) << ADR_POS);
439 431
440 /* Set write data */ 432 /* Set write data */
441 pci_write_reg(pcie, data, H1_PCIEPHYDOUTR); 433 rcar_pci_write_reg(pcie, data, H1_PCIEPHYDOUTR);
442 pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR); 434 rcar_pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR);
443 435
444 /* Ignore errors as they will be dealt with if the data link is down */ 436 /* Ignore errors as they will be dealt with if the data link is down */
445 phy_wait_for_ack(pcie); 437 phy_wait_for_ack(pcie);
446 438
447 /* Clear command */ 439 /* Clear command */
448 pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR); 440 rcar_pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR);
449 pci_write_reg(pcie, 0, H1_PCIEPHYADRR); 441 rcar_pci_write_reg(pcie, 0, H1_PCIEPHYADRR);
450 442
451 /* Ignore errors as they will be dealt with if the data link is down */ 443 /* Ignore errors as they will be dealt with if the data link is down */
452 phy_wait_for_ack(pcie); 444 phy_wait_for_ack(pcie);
@@ -457,7 +449,7 @@ static int rcar_pcie_wait_for_dl(struct rcar_pcie *pcie)
457 unsigned int timeout = 10; 449 unsigned int timeout = 10;
458 450
459 while (timeout--) { 451 while (timeout--) {
460 if ((pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE)) 452 if ((rcar_pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE))
461 return 0; 453 return 0;
462 454
463 msleep(5); 455 msleep(5);
@@ -471,17 +463,17 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
471 int err; 463 int err;
472 464
473 /* Begin initialization */ 465 /* Begin initialization */
474 pci_write_reg(pcie, 0, PCIETCTLR); 466 rcar_pci_write_reg(pcie, 0, PCIETCTLR);
475 467
476 /* Set mode */ 468 /* Set mode */
477 pci_write_reg(pcie, 1, PCIEMSR); 469 rcar_pci_write_reg(pcie, 1, PCIEMSR);
478 470
479 /* 471 /*
480 * Initial header for port config space is type 1, set the device 472 * Initial header for port config space is type 1, set the device
481 * class to match. Hardware takes care of propagating the IDSETR 473 * class to match. Hardware takes care of propagating the IDSETR
482 * settings, so there is no need to bother with a quirk. 474 * settings, so there is no need to bother with a quirk.
483 */ 475 */
484 pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1); 476 rcar_pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1);
485 477
486 /* 478 /*
487 * Setup Secondary Bus Number & Subordinate Bus Number, even though 479 * Setup Secondary Bus Number & Subordinate Bus Number, even though
@@ -491,33 +483,31 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
491 rcar_rmw32(pcie, RCONF(PCI_SUBORDINATE_BUS), 0xff, 1); 483 rcar_rmw32(pcie, RCONF(PCI_SUBORDINATE_BUS), 0xff, 1);
492 484
493 /* Initialize default capabilities. */ 485 /* Initialize default capabilities. */
494 rcar_rmw32(pcie, REXPCAP(0), 0, PCI_CAP_ID_EXP); 486 rcar_rmw32(pcie, REXPCAP(0), 0xff, PCI_CAP_ID_EXP);
495 rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS), 487 rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS),
496 PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ROOT_PORT << 4); 488 PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ROOT_PORT << 4);
497 rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f, 489 rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f,
498 PCI_HEADER_TYPE_BRIDGE); 490 PCI_HEADER_TYPE_BRIDGE);
499 491
500 /* Enable data link layer active state reporting */ 492 /* Enable data link layer active state reporting */
501 rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), 0, PCI_EXP_LNKCAP_DLLLARC); 493 rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), PCI_EXP_LNKCAP_DLLLARC,
494 PCI_EXP_LNKCAP_DLLLARC);
502 495
503 /* Write out the physical slot number = 0 */ 496 /* Write out the physical slot number = 0 */
504 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0); 497 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0);
505 498
506 /* Set the completion timer timeout to the maximum 50ms. */ 499 /* Set the completion timer timeout to the maximum 50ms. */
507 rcar_rmw32(pcie, TLCTLR+1, 0x3f, 50); 500 rcar_rmw32(pcie, TLCTLR + 1, 0x3f, 50);
508 501
509 /* Terminate list of capabilities (Next Capability Offset=0) */ 502 /* Terminate list of capabilities (Next Capability Offset=0) */
510 rcar_rmw32(pcie, RVCCAP(0), 0xfff0, 0); 503 rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0);
511
512 /* Enable MAC data scrambling. */
513 rcar_rmw32(pcie, MACCTLR, SCRAMBLE_DISABLE, 0);
514 504
515 /* Enable MSI */ 505 /* Enable MSI */
516 if (IS_ENABLED(CONFIG_PCI_MSI)) 506 if (IS_ENABLED(CONFIG_PCI_MSI))
517 pci_write_reg(pcie, 0x101f0000, PCIEMSITXR); 507 rcar_pci_write_reg(pcie, 0x101f0000, PCIEMSITXR);
518 508
519 /* Finish initialization - establish a PCI Express link */ 509 /* Finish initialization - establish a PCI Express link */
520 pci_write_reg(pcie, CFINIT, PCIETCTLR); 510 rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
521 511
522 /* This will timeout if we don't have a link. */ 512 /* This will timeout if we don't have a link. */
523 err = rcar_pcie_wait_for_dl(pcie); 513 err = rcar_pcie_wait_for_dl(pcie);
@@ -527,11 +517,6 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
527 /* Enable INTx interrupts */ 517 /* Enable INTx interrupts */
528 rcar_rmw32(pcie, PCIEINTXR, 0, 0xF << 8); 518 rcar_rmw32(pcie, PCIEINTXR, 0, 0xF << 8);
529 519
530 /* Enable slave Bus Mastering */
531 rcar_rmw32(pcie, RCONF(PCI_STATUS), PCI_STATUS_DEVSEL_MASK,
532 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
533 PCI_STATUS_CAP_LIST | PCI_STATUS_DEVSEL_FAST);
534
535 wmb(); 520 wmb();
536 521
537 return 0; 522 return 0;
@@ -560,7 +545,7 @@ static int rcar_pcie_hw_init_h1(struct rcar_pcie *pcie)
560 phy_write_reg(pcie, 0, 0x66, 0x1, 0x00008000); 545 phy_write_reg(pcie, 0, 0x66, 0x1, 0x00008000);
561 546
562 while (timeout--) { 547 while (timeout--) {
563 if (pci_read_reg(pcie, H1_PCIEPHYSR)) 548 if (rcar_pci_read_reg(pcie, H1_PCIEPHYSR))
564 return rcar_pcie_hw_init(pcie); 549 return rcar_pcie_hw_init(pcie);
565 550
566 msleep(5); 551 msleep(5);
@@ -599,7 +584,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
599 struct rcar_msi *msi = &pcie->msi; 584 struct rcar_msi *msi = &pcie->msi;
600 unsigned long reg; 585 unsigned long reg;
601 586
602 reg = pci_read_reg(pcie, PCIEMSIFR); 587 reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
603 588
604 /* MSI & INTx share an interrupt - we only handle MSI here */ 589 /* MSI & INTx share an interrupt - we only handle MSI here */
605 if (!reg) 590 if (!reg)
@@ -610,7 +595,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
610 unsigned int irq; 595 unsigned int irq;
611 596
612 /* clear the interrupt */ 597 /* clear the interrupt */
613 pci_write_reg(pcie, 1 << index, PCIEMSIFR); 598 rcar_pci_write_reg(pcie, 1 << index, PCIEMSIFR);
614 599
615 irq = irq_find_mapping(msi->domain, index); 600 irq = irq_find_mapping(msi->domain, index);
616 if (irq) { 601 if (irq) {
@@ -624,7 +609,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
624 } 609 }
625 610
626 /* see if there's any more pending in this vector */ 611 /* see if there's any more pending in this vector */
627 reg = pci_read_reg(pcie, PCIEMSIFR); 612 reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
628 } 613 }
629 614
630 return IRQ_HANDLED; 615 return IRQ_HANDLED;
@@ -651,8 +636,8 @@ static int rcar_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
651 636
652 irq_set_msi_desc(irq, desc); 637 irq_set_msi_desc(irq, desc);
653 638
654 msg.address_lo = pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE; 639 msg.address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
655 msg.address_hi = pci_read_reg(pcie, PCIEMSIAUR); 640 msg.address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
656 msg.data = hwirq; 641 msg.data = hwirq;
657 642
658 write_msi_msg(irq, &msg); 643 write_msi_msg(irq, &msg);
@@ -729,11 +714,11 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
729 msi->pages = __get_free_pages(GFP_KERNEL, 0); 714 msi->pages = __get_free_pages(GFP_KERNEL, 0);
730 base = virt_to_phys((void *)msi->pages); 715 base = virt_to_phys((void *)msi->pages);
731 716
732 pci_write_reg(pcie, base | MSIFE, PCIEMSIALR); 717 rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
733 pci_write_reg(pcie, 0, PCIEMSIAUR); 718 rcar_pci_write_reg(pcie, 0, PCIEMSIAUR);
734 719
735 /* enable all MSI interrupts */ 720 /* enable all MSI interrupts */
736 pci_write_reg(pcie, 0xffffffff, PCIEMSIIER); 721 rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);
737 722
738 return 0; 723 return 0;
739 724
@@ -826,6 +811,7 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
826 if (cpu_addr > 0) { 811 if (cpu_addr > 0) {
827 unsigned long nr_zeros = __ffs64(cpu_addr); 812 unsigned long nr_zeros = __ffs64(cpu_addr);
828 u64 alignment = 1ULL << nr_zeros; 813 u64 alignment = 1ULL << nr_zeros;
814
829 size = min(range->size, alignment); 815 size = min(range->size, alignment);
830 } else { 816 } else {
831 size = range->size; 817 size = range->size;
@@ -841,13 +827,13 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
841 * Set up 64-bit inbound regions as the range parser doesn't 827 * Set up 64-bit inbound regions as the range parser doesn't
842 * distinguish between 32 and 64-bit types. 828 * distinguish between 32 and 64-bit types.
843 */ 829 */
844 pci_write_reg(pcie, lower_32_bits(pci_addr), PCIEPRAR(idx)); 830 rcar_pci_write_reg(pcie, lower_32_bits(pci_addr), PCIEPRAR(idx));
845 pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx)); 831 rcar_pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx));
846 pci_write_reg(pcie, lower_32_bits(mask) | flags, PCIELAMR(idx)); 832 rcar_pci_write_reg(pcie, lower_32_bits(mask) | flags, PCIELAMR(idx));
847 833
848 pci_write_reg(pcie, upper_32_bits(pci_addr), PCIEPRAR(idx+1)); 834 rcar_pci_write_reg(pcie, upper_32_bits(pci_addr), PCIEPRAR(idx+1));
849 pci_write_reg(pcie, upper_32_bits(cpu_addr), PCIELAR(idx+1)); 835 rcar_pci_write_reg(pcie, upper_32_bits(cpu_addr), PCIELAR(idx+1));
850 pci_write_reg(pcie, 0, PCIELAMR(idx+1)); 836 rcar_pci_write_reg(pcie, 0, PCIELAMR(idx + 1));
851 837
852 pci_addr += size; 838 pci_addr += size;
853 cpu_addr += size; 839 cpu_addr += size;
@@ -952,7 +938,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
952 of_pci_range_to_resource(&range, pdev->dev.of_node, 938 of_pci_range_to_resource(&range, pdev->dev.of_node,
953 &pcie->res[win++]); 939 &pcie->res[win++]);
954 940
955 if (win > PCI_MAX_RESOURCES) 941 if (win > RCAR_PCI_MAX_RESOURCES)
956 break; 942 break;
957 } 943 }
958 944
@@ -982,7 +968,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
982 return 0; 968 return 0;
983 } 969 }
984 970
985 data = pci_read_reg(pcie, MACSR); 971 data = rcar_pci_read_reg(pcie, MACSR);
986 dev_info(&pdev->dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f); 972 dev_info(&pdev->dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f);
987 973
988 rcar_pcie_enable(pcie); 974 rcar_pcie_enable(pcie);
@@ -1003,4 +989,4 @@ module_platform_driver(rcar_pcie_driver);
1003 989
1004MODULE_AUTHOR("Phil Edworthy <phil.edworthy@renesas.com>"); 990MODULE_AUTHOR("Phil Edworthy <phil.edworthy@renesas.com>");
1005MODULE_DESCRIPTION("Renesas R-Car PCIe driver"); 991MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
1006MODULE_LICENSE("GPLv2"); 992MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c
index 4a392c44e3d3..d81648f71425 100644
--- a/drivers/pci/hotplug/cpqphp_sysfs.c
+++ b/drivers/pci/hotplug/cpqphp_sysfs.c
@@ -216,8 +216,7 @@ void cpqhp_create_debugfs_files(struct controller *ctrl)
216 216
217void cpqhp_remove_debugfs_files(struct controller *ctrl) 217void cpqhp_remove_debugfs_files(struct controller *ctrl)
218{ 218{
219 if (ctrl->dentry) 219 debugfs_remove(ctrl->dentry);
220 debugfs_remove(ctrl->dentry);
221 ctrl->dentry = NULL; 220 ctrl->dentry = NULL;
222} 221}
223 222
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 8e9012dca450..9e5a9fbb93d7 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -92,9 +92,10 @@ struct controller {
92 struct slot *slot; 92 struct slot *slot;
93 wait_queue_head_t queue; /* sleep & wake process */ 93 wait_queue_head_t queue; /* sleep & wake process */
94 u32 slot_cap; 94 u32 slot_cap;
95 u32 slot_ctrl;
95 struct timer_list poll_timer; 96 struct timer_list poll_timer;
97 unsigned long cmd_started; /* jiffies */
96 unsigned int cmd_busy:1; 98 unsigned int cmd_busy:1;
97 unsigned int no_cmd_complete:1;
98 unsigned int link_active_reporting:1; 99 unsigned int link_active_reporting:1;
99 unsigned int notification_enabled:1; 100 unsigned int notification_enabled:1;
100 unsigned int power_fault_detected; 101 unsigned int power_fault_detected;
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index a2297db80813..07aa722bb12c 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -255,6 +255,13 @@ static int pciehp_probe(struct pcie_device *dev)
255 else if (pciehp_acpi_slot_detection_check(dev->port)) 255 else if (pciehp_acpi_slot_detection_check(dev->port))
256 goto err_out_none; 256 goto err_out_none;
257 257
258 if (!dev->port->subordinate) {
259 /* Can happen if we run out of bus numbers during probe */
260 dev_err(&dev->device,
261 "Hotplug bridge without secondary bus, ignoring\n");
262 goto err_out_none;
263 }
264
258 ctrl = pcie_init(dev); 265 ctrl = pcie_init(dev);
259 if (!ctrl) { 266 if (!ctrl) {
260 dev_err(&dev->device, "Controller initialization failed\n"); 267 dev_err(&dev->device, "Controller initialization failed\n");
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 42914e04d110..9da84b8b27d8 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -104,11 +104,10 @@ static inline void pciehp_free_irq(struct controller *ctrl)
104 free_irq(ctrl->pcie->irq, ctrl); 104 free_irq(ctrl->pcie->irq, ctrl);
105} 105}
106 106
107static int pcie_poll_cmd(struct controller *ctrl) 107static int pcie_poll_cmd(struct controller *ctrl, int timeout)
108{ 108{
109 struct pci_dev *pdev = ctrl_dev(ctrl); 109 struct pci_dev *pdev = ctrl_dev(ctrl);
110 u16 slot_status; 110 u16 slot_status;
111 int timeout = 1000;
112 111
113 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); 112 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
114 if (slot_status & PCI_EXP_SLTSTA_CC) { 113 if (slot_status & PCI_EXP_SLTSTA_CC) {
@@ -129,18 +128,52 @@ static int pcie_poll_cmd(struct controller *ctrl)
129 return 0; /* timeout */ 128 return 0; /* timeout */
130} 129}
131 130
132static void pcie_wait_cmd(struct controller *ctrl, int poll) 131static void pcie_wait_cmd(struct controller *ctrl)
133{ 132{
134 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; 133 unsigned int msecs = pciehp_poll_mode ? 2500 : 1000;
135 unsigned long timeout = msecs_to_jiffies(msecs); 134 unsigned long duration = msecs_to_jiffies(msecs);
135 unsigned long cmd_timeout = ctrl->cmd_started + duration;
136 unsigned long now, timeout;
136 int rc; 137 int rc;
137 138
138 if (poll) 139 /*
139 rc = pcie_poll_cmd(ctrl); 140 * If the controller does not generate notifications for command
141 * completions, we never need to wait between writes.
142 */
143 if (NO_CMD_CMPL(ctrl))
144 return;
145
146 if (!ctrl->cmd_busy)
147 return;
148
149 /*
150 * Even if the command has already timed out, we want to call
151 * pcie_poll_cmd() so it can clear PCI_EXP_SLTSTA_CC.
152 */
153 now = jiffies;
154 if (time_before_eq(cmd_timeout, now))
155 timeout = 1;
140 else 156 else
157 timeout = cmd_timeout - now;
158
159 if (ctrl->slot_ctrl & PCI_EXP_SLTCTL_HPIE &&
160 ctrl->slot_ctrl & PCI_EXP_SLTCTL_CCIE)
141 rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); 161 rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout);
162 else
163 rc = pcie_poll_cmd(ctrl, timeout);
164
165 /*
166 * Controllers with errata like Intel CF118 don't generate
167 * completion notifications unless the power/indicator/interlock
168 * control bits are changed. On such controllers, we'll emit this
169 * timeout message when we wait for completion of commands that
170 * don't change those bits, e.g., commands that merely enable
171 * interrupts.
172 */
142 if (!rc) 173 if (!rc)
143 ctrl_dbg(ctrl, "Command not completed in 1000 msec\n"); 174 ctrl_info(ctrl, "Timeout on hotplug command %#010x (issued %u msec ago)\n",
175 ctrl->slot_ctrl,
176 jiffies_to_msecs(now - ctrl->cmd_started));
144} 177}
145 178
146/** 179/**
@@ -152,34 +185,12 @@ static void pcie_wait_cmd(struct controller *ctrl, int poll)
152static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) 185static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
153{ 186{
154 struct pci_dev *pdev = ctrl_dev(ctrl); 187 struct pci_dev *pdev = ctrl_dev(ctrl);
155 u16 slot_status;
156 u16 slot_ctrl; 188 u16 slot_ctrl;
157 189
158 mutex_lock(&ctrl->ctrl_lock); 190 mutex_lock(&ctrl->ctrl_lock);
159 191
160 pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); 192 /* Wait for any previous command that might still be in progress */
161 if (slot_status & PCI_EXP_SLTSTA_CC) { 193 pcie_wait_cmd(ctrl);
162 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
163 PCI_EXP_SLTSTA_CC);
164 if (!ctrl->no_cmd_complete) {
165 /*
166 * After 1 sec and CMD_COMPLETED still not set, just
167 * proceed forward to issue the next command according
168 * to spec. Just print out the error message.
169 */
170 ctrl_dbg(ctrl, "CMD_COMPLETED not clear after 1 sec\n");
171 } else if (!NO_CMD_CMPL(ctrl)) {
172 /*
173 * This controller seems to notify of command completed
174 * event even though it supports none of power
175 * controller, attention led, power led and EMI.
176 */
177 ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to wait for command completed event\n");
178 ctrl->no_cmd_complete = 0;
179 } else {
180 ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe the controller is broken\n");
181 }
182 }
183 194
184 pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &slot_ctrl); 195 pcie_capability_read_word(pdev, PCI_EXP_SLTCTL, &slot_ctrl);
185 slot_ctrl &= ~mask; 196 slot_ctrl &= ~mask;
@@ -187,22 +198,9 @@ static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
187 ctrl->cmd_busy = 1; 198 ctrl->cmd_busy = 1;
188 smp_mb(); 199 smp_mb();
189 pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl); 200 pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl);
201 ctrl->cmd_started = jiffies;
202 ctrl->slot_ctrl = slot_ctrl;
190 203
191 /*
192 * Wait for command completion.
193 */
194 if (!ctrl->no_cmd_complete) {
195 int poll = 0;
196 /*
197 * if hotplug interrupt is not enabled or command
198 * completed interrupt is not enabled, we need to poll
199 * command completed event.
200 */
201 if (!(slot_ctrl & PCI_EXP_SLTCTL_HPIE) ||
202 !(slot_ctrl & PCI_EXP_SLTCTL_CCIE))
203 poll = 1;
204 pcie_wait_cmd(ctrl, poll);
205 }
206 mutex_unlock(&ctrl->ctrl_lock); 204 mutex_unlock(&ctrl->ctrl_lock);
207} 205}
208 206
@@ -773,15 +771,6 @@ struct controller *pcie_init(struct pcie_device *dev)
773 mutex_init(&ctrl->ctrl_lock); 771 mutex_init(&ctrl->ctrl_lock);
774 init_waitqueue_head(&ctrl->queue); 772 init_waitqueue_head(&ctrl->queue);
775 dbg_ctrl(ctrl); 773 dbg_ctrl(ctrl);
776 /*
777 * Controller doesn't notify of command completion if the "No
778 * Command Completed Support" bit is set in Slot Capability
779 * register or the controller supports none of power
780 * controller, attention led, power led and EMI.
781 */
782 if (NO_CMD_CMPL(ctrl) ||
783 !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl)))
784 ctrl->no_cmd_complete = 1;
785 774
786 /* Check if Data Link Layer Link Active Reporting is implemented */ 775 /* Check if Data Link Layer Link Active Reporting is implemented */
787 pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap); 776 pcie_capability_read_dword(pdev, PCI_EXP_LNKCAP, &link_cap);
@@ -794,7 +783,7 @@ struct controller *pcie_init(struct pcie_device *dev)
794 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, 783 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
795 PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD | 784 PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD |
796 PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC | 785 PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC |
797 PCI_EXP_SLTSTA_CC); 786 PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC);
798 787
799 /* Disable software notification */ 788 /* Disable software notification */
800 pcie_disable_notification(ctrl); 789 pcie_disable_notification(ctrl);
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index a3fbe2012ea3..2ab1b47c7651 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -161,8 +161,8 @@ enum acpi_attr_enum {
161static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) 161static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
162{ 162{
163 int len; 163 int len;
164 len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer, 164 len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer,
165 obj->string.length, 165 obj->buffer.length,
166 UTF16_LITTLE_ENDIAN, 166 UTF16_LITTLE_ENDIAN,
167 buf, PAGE_SIZE); 167 buf, PAGE_SIZE);
168 buf[len] = '\n'; 168 buf[len] = '\n';
@@ -187,16 +187,22 @@ static int dsm_get_label(struct device *dev, char *buf,
187 tmp = obj->package.elements; 187 tmp = obj->package.elements;
188 if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && 188 if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
189 tmp[0].type == ACPI_TYPE_INTEGER && 189 tmp[0].type == ACPI_TYPE_INTEGER &&
190 tmp[1].type == ACPI_TYPE_STRING) { 190 (tmp[1].type == ACPI_TYPE_STRING ||
191 tmp[1].type == ACPI_TYPE_BUFFER)) {
191 /* 192 /*
192 * The second string element is optional even when 193 * The second string element is optional even when
193 * this _DSM is implemented; when not implemented, 194 * this _DSM is implemented; when not implemented,
194 * this entry must return a null string. 195 * this entry must return a null string.
195 */ 196 */
196 if (attr == ACPI_ATTR_INDEX_SHOW) 197 if (attr == ACPI_ATTR_INDEX_SHOW) {
197 scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value); 198 scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value);
198 else if (attr == ACPI_ATTR_LABEL_SHOW) 199 } else if (attr == ACPI_ATTR_LABEL_SHOW) {
199 dsm_label_utf16s_to_utf8s(tmp + 1, buf); 200 if (tmp[1].type == ACPI_TYPE_STRING)
201 scnprintf(buf, PAGE_SIZE, "%s\n",
202 tmp[1].string.pointer);
203 else if (tmp[1].type == ACPI_TYPE_BUFFER)
204 dsm_label_utf16s_to_utf8s(tmp + 1, buf);
205 }
200 len = strlen(buf) > 0 ? strlen(buf) : -1; 206 len = strlen(buf) > 0 ? strlen(buf) : -1;
201 } 207 }
202 208
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 63a54a340863..74043a2a2da8 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -839,12 +839,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
839 839
840 if (!__pci_complete_power_transition(dev, state)) 840 if (!__pci_complete_power_transition(dev, state))
841 error = 0; 841 error = 0;
842 /*
843 * When aspm_policy is "powersave" this call ensures
844 * that ASPM is configured.
845 */
846 if (!error && dev->bus->self)
847 pcie_aspm_powersave_config_link(dev->bus->self);
848 842
849 return error; 843 return error;
850} 844}
@@ -1195,12 +1189,18 @@ int __weak pcibios_enable_device(struct pci_dev *dev, int bars)
1195static int do_pci_enable_device(struct pci_dev *dev, int bars) 1189static int do_pci_enable_device(struct pci_dev *dev, int bars)
1196{ 1190{
1197 int err; 1191 int err;
1192 struct pci_dev *bridge;
1198 u16 cmd; 1193 u16 cmd;
1199 u8 pin; 1194 u8 pin;
1200 1195
1201 err = pci_set_power_state(dev, PCI_D0); 1196 err = pci_set_power_state(dev, PCI_D0);
1202 if (err < 0 && err != -EIO) 1197 if (err < 0 && err != -EIO)
1203 return err; 1198 return err;
1199
1200 bridge = pci_upstream_bridge(dev);
1201 if (bridge)
1202 pcie_aspm_powersave_config_link(bridge);
1203
1204 err = pcibios_enable_device(dev, bars); 1204 err = pcibios_enable_device(dev, bars);
1205 if (err < 0) 1205 if (err < 0)
1206 return err; 1206 return err;
@@ -3193,7 +3193,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)
3193 return 0; 3193 return 0;
3194} 3194}
3195 3195
3196void __weak pcibios_reset_secondary_bus(struct pci_dev *dev) 3196void pci_reset_secondary_bus(struct pci_dev *dev)
3197{ 3197{
3198 u16 ctrl; 3198 u16 ctrl;
3199 3199
@@ -3219,6 +3219,11 @@ void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
3219 ssleep(1); 3219 ssleep(1);
3220} 3220}
3221 3221
3222void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
3223{
3224 pci_reset_secondary_bus(dev);
3225}
3226
3222/** 3227/**
3223 * pci_reset_bridge_secondary_bus - Reset the secondary bus on a PCI bridge. 3228 * pci_reset_bridge_secondary_bus - Reset the secondary bus on a PCI bridge.
3224 * @dev: Bridge device 3229 * @dev: Bridge device
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 80887eaa0668..2ccc9b926ea7 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -203,10 +203,6 @@ static int pcie_portdrv_probe(struct pci_dev *dev,
203 (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM))) 203 (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM)))
204 return -ENODEV; 204 return -ENODEV;
205 205
206 if (!dev->irq && dev->pin) {
207 dev_warn(&dev->dev, "device [%04x:%04x] has invalid IRQ; check vendor BIOS\n",
208 dev->vendor, dev->device);
209 }
210 status = pcie_port_device_register(dev); 206 status = pcie_port_device_register(dev);
211 if (status) 207 if (status)
212 return status; 208 return status;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d0f69269eb6c..ad566827b547 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3405,6 +3405,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ASMEDIA, 0x1080,
3405DECLARE_PCI_FIXUP_HEADER(0x10e3, 0x8113, quirk_use_pcie_bridge_dma_alias); 3405DECLARE_PCI_FIXUP_HEADER(0x10e3, 0x8113, quirk_use_pcie_bridge_dma_alias);
3406/* ITE 8892, https://bugzilla.kernel.org/show_bug.cgi?id=73551 */ 3406/* ITE 8892, https://bugzilla.kernel.org/show_bug.cgi?id=73551 */
3407DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias); 3407DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias);
3408/* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */
3409DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias);
3408 3410
3409static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev) 3411static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
3410{ 3412{
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index a5a63ecfb628..6373985ad3f7 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -925,7 +925,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
925{ 925{
926 struct pci_dev *dev; 926 struct pci_dev *dev;
927 resource_size_t min_align, align, size, size0, size1; 927 resource_size_t min_align, align, size, size0, size1;
928 resource_size_t aligns[14]; /* Alignments from 1Mb to 8Gb */ 928 resource_size_t aligns[18]; /* Alignments from 1Mb to 128Gb */
929 int order, max_order; 929 int order, max_order;
930 struct resource *b_res = find_free_bus_resource(bus, 930 struct resource *b_res = find_free_bus_resource(bus,
931 mask | IORESOURCE_PREFETCH, type); 931 mask | IORESOURCE_PREFETCH, type);
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index caed1ce6facd..b7c3a5ea1fca 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -166,11 +166,10 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
166{ 166{
167 struct resource *root, *conflict; 167 struct resource *root, *conflict;
168 resource_size_t fw_addr, start, end; 168 resource_size_t fw_addr, start, end;
169 int ret = 0;
170 169
171 fw_addr = pcibios_retrieve_fw_addr(dev, resno); 170 fw_addr = pcibios_retrieve_fw_addr(dev, resno);
172 if (!fw_addr) 171 if (!fw_addr)
173 return 1; 172 return -ENOMEM;
174 173
175 start = res->start; 174 start = res->start;
176 end = res->end; 175 end = res->end;
@@ -189,14 +188,13 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
189 resno, res); 188 resno, res);
190 conflict = request_resource_conflict(root, res); 189 conflict = request_resource_conflict(root, res);
191 if (conflict) { 190 if (conflict) {
192 dev_info(&dev->dev, 191 dev_info(&dev->dev, "BAR %d: %pR conflicts with %s %pR\n",
193 "BAR %d: %pR conflicts with %s %pR\n", resno, 192 resno, res, conflict->name, conflict);
194 res, conflict->name, conflict);
195 res->start = start; 193 res->start = start;
196 res->end = end; 194 res->end = end;
197 ret = 1; 195 return -EBUSY;
198 } 196 }
199 return ret; 197 return 0;
200} 198}
201 199
202static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev, 200static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
@@ -250,10 +248,8 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
250static int _pci_assign_resource(struct pci_dev *dev, int resno, 248static int _pci_assign_resource(struct pci_dev *dev, int resno,
251 resource_size_t size, resource_size_t min_align) 249 resource_size_t size, resource_size_t min_align)
252{ 250{
253 struct resource *res = dev->resource + resno;
254 struct pci_bus *bus; 251 struct pci_bus *bus;
255 int ret; 252 int ret;
256 char *type;
257 253
258 bus = dev->bus; 254 bus = dev->bus;
259 while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) { 255 while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) {
@@ -262,21 +258,6 @@ static int _pci_assign_resource(struct pci_dev *dev, int resno,
262 bus = bus->parent; 258 bus = bus->parent;
263 } 259 }
264 260
265 if (ret) {
266 if (res->flags & IORESOURCE_MEM)
267 if (res->flags & IORESOURCE_PREFETCH)
268 type = "mem pref";
269 else
270 type = "mem";
271 else if (res->flags & IORESOURCE_IO)
272 type = "io";
273 else
274 type = "unknown";
275 dev_info(&dev->dev,
276 "BAR %d: can't assign %s (size %#llx)\n",
277 resno, type, (unsigned long long) resource_size(res));
278 }
279
280 return ret; 261 return ret;
281} 262}
282 263
@@ -302,17 +283,24 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
302 * where firmware left it. That at least has a chance of 283 * where firmware left it. That at least has a chance of
303 * working, which is better than just leaving it disabled. 284 * working, which is better than just leaving it disabled.
304 */ 285 */
305 if (ret < 0) 286 if (ret < 0) {
287 dev_info(&dev->dev, "BAR %d: no space for %pR\n", resno, res);
306 ret = pci_revert_fw_address(res, dev, resno, size); 288 ret = pci_revert_fw_address(res, dev, resno, size);
289 }
307 290
308 if (!ret) { 291 if (ret < 0) {
309 res->flags &= ~IORESOURCE_UNSET; 292 dev_info(&dev->dev, "BAR %d: failed to assign %pR\n", resno,
310 res->flags &= ~IORESOURCE_STARTALIGN; 293 res);
311 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); 294 return ret;
312 if (resno < PCI_BRIDGE_RESOURCES)
313 pci_update_resource(dev, resno);
314 } 295 }
315 return ret; 296
297 res->flags &= ~IORESOURCE_UNSET;
298 res->flags &= ~IORESOURCE_STARTALIGN;
299 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res);
300 if (resno < PCI_BRIDGE_RESOURCES)
301 pci_update_resource(dev, resno);
302
303 return 0;
316} 304}
317EXPORT_SYMBOL(pci_assign_resource); 305EXPORT_SYMBOL(pci_assign_resource);
318 306
@@ -320,9 +308,11 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
320 resource_size_t min_align) 308 resource_size_t min_align)
321{ 309{
322 struct resource *res = dev->resource + resno; 310 struct resource *res = dev->resource + resno;
311 unsigned long flags;
323 resource_size_t new_size; 312 resource_size_t new_size;
324 int ret; 313 int ret;
325 314
315 flags = res->flags;
326 res->flags |= IORESOURCE_UNSET; 316 res->flags |= IORESOURCE_UNSET;
327 if (!res->parent) { 317 if (!res->parent) {
328 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n", 318 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n",
@@ -333,14 +323,21 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
333 /* already aligned with min_align */ 323 /* already aligned with min_align */
334 new_size = resource_size(res) + addsize; 324 new_size = resource_size(res) + addsize;
335 ret = _pci_assign_resource(dev, resno, new_size, min_align); 325 ret = _pci_assign_resource(dev, resno, new_size, min_align);
336 if (!ret) { 326 if (ret) {
337 res->flags &= ~IORESOURCE_UNSET; 327 res->flags = flags;
338 res->flags &= ~IORESOURCE_STARTALIGN; 328 dev_info(&dev->dev, "BAR %d: %pR (failed to expand by %#llx)\n",
339 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res); 329 resno, res, (unsigned long long) addsize);
340 if (resno < PCI_BRIDGE_RESOURCES) 330 return ret;
341 pci_update_resource(dev, resno);
342 } 331 }
343 return ret; 332
333 res->flags &= ~IORESOURCE_UNSET;
334 res->flags &= ~IORESOURCE_STARTALIGN;
335 dev_info(&dev->dev, "BAR %d: reassigned %pR (expanded by %#llx)\n",
336 resno, res, (unsigned long long) addsize);
337 if (resno < PCI_BRIDGE_RESOURCES)
338 pci_update_resource(dev, resno);
339
340 return 0;
344} 341}
345 342
346int pci_enable_resources(struct pci_dev *dev, int mask) 343int pci_enable_resources(struct pci_dev *dev, int mask)
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index ae9618ff6735..982f6abe6faf 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -19,8 +19,6 @@
19 19
20static bool request_mem_succeeded = false; 20static bool request_mem_succeeded = false;
21 21
22static struct pci_dev *default_vga;
23
24static struct fb_var_screeninfo efifb_defined = { 22static struct fb_var_screeninfo efifb_defined = {
25 .activate = FB_ACTIVATE_NOW, 23 .activate = FB_ACTIVATE_NOW,
26 .height = -1, 24 .height = -1,
@@ -84,23 +82,10 @@ static struct fb_ops efifb_ops = {
84 .fb_imageblit = cfb_imageblit, 82 .fb_imageblit = cfb_imageblit,
85}; 83};
86 84
87struct pci_dev *vga_default_device(void)
88{
89 return default_vga;
90}
91
92EXPORT_SYMBOL_GPL(vga_default_device);
93
94void vga_set_default_device(struct pci_dev *pdev)
95{
96 default_vga = pdev;
97}
98
99static int efifb_setup(char *options) 85static int efifb_setup(char *options)
100{ 86{
101 char *this_opt; 87 char *this_opt;
102 int i; 88 int i;
103 struct pci_dev *dev = NULL;
104 89
105 if (options && *options) { 90 if (options && *options) {
106 while ((this_opt = strsep(&options, ",")) != NULL) { 91 while ((this_opt = strsep(&options, ",")) != NULL) {
@@ -126,30 +111,6 @@ static int efifb_setup(char *options)
126 } 111 }
127 } 112 }
128 113
129 for_each_pci_dev(dev) {
130 int i;
131
132 if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
133 continue;
134
135 for (i=0; i < DEVICE_COUNT_RESOURCE; i++) {
136 resource_size_t start, end;
137
138 if (!(pci_resource_flags(dev, i) & IORESOURCE_MEM))
139 continue;
140
141 start = pci_resource_start(dev, i);
142 end = pci_resource_end(dev, i);
143
144 if (!start || !end)
145 continue;
146
147 if (screen_info.lfb_base >= start &&
148 (screen_info.lfb_base + screen_info.lfb_size) < end)
149 default_vga = dev;
150 }
151 }
152
153 return 0; 114 return 0;
154} 115}
155 116
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 66bd22fec38f..6ed3647b38df 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -978,6 +978,8 @@ int pci_try_reset_slot(struct pci_slot *slot);
978int pci_probe_reset_bus(struct pci_bus *bus); 978int pci_probe_reset_bus(struct pci_bus *bus);
979int pci_reset_bus(struct pci_bus *bus); 979int pci_reset_bus(struct pci_bus *bus);
980int pci_try_reset_bus(struct pci_bus *bus); 980int pci_try_reset_bus(struct pci_bus *bus);
981void pci_reset_secondary_bus(struct pci_dev *dev);
982void pcibios_reset_secondary_bus(struct pci_dev *dev);
981void pci_reset_bridge_secondary_bus(struct pci_dev *dev); 983void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
982void pci_update_resource(struct pci_dev *dev, int resno); 984void pci_update_resource(struct pci_dev *dev, int resno);
983int __must_check pci_assign_resource(struct pci_dev *dev, int i); 985int __must_check pci_assign_resource(struct pci_dev *dev, int i);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7fa31731c854..6ed0bb73a864 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -6,6 +6,8 @@
6 * Do not add new entries to this file unless the definitions 6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers. 7 * are shared between multiple drivers.
8 */ 8 */
9#ifndef _LINUX_PCI_IDS_H
10#define _LINUX_PCI_IDS_H
9 11
10/* Device classes and subclasses */ 12/* Device classes and subclasses */
11 13
@@ -2968,3 +2970,5 @@
2968#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 2970#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
2969 2971
2970#define PCI_VENDOR_ID_OCZ 0x1b85 2972#define PCI_VENDOR_ID_OCZ 0x1b85
2973
2974#endif /* _LINUX_PCI_IDS_H */