diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2014-01-10 16:23:15 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-01-10 16:23:15 -0500 |
commit | 96702be560374ee7e7139a34cab03554129abbb4 (patch) | |
tree | ede7f763c471fad6d268a2e6a1d17d029b3eaf31 /drivers/pci | |
parent | 04f982beb900f37bc216d63c9dbc5bdddb4a3d3a (diff) | |
parent | d56dbf5bab8ce44c5407bb099f71987f58d18bb4 (diff) |
Merge branch 'pci/resource' into next
* pci/resource:
PCI: Allocate 64-bit BARs above 4G when possible
PCI: Enforce bus address limits in resource allocation
PCI: Split out bridge window override of minimum allocation address
agp/ati: Use PCI_COMMAND instead of hard-coded 4
agp/intel: Use CPU physical address, not bus address, for ioremap()
agp/intel: Use pci_bus_address() to get GTTADR bus address
agp/intel: Use pci_bus_address() to get MMADR bus address
agp/intel: Support 64-bit GMADR
agp/intel: Rename gtt_bus_addr to gtt_phys_addr
drm/i915: Rename gtt_bus_addr to gtt_phys_addr
agp: Use pci_resource_start() to get CPU physical address for BAR
agp: Support 64-bit APBASE
PCI: Add pci_bus_address() to get bus address of a BAR
PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev
PCI: Change pci_bus_region addresses to dma_addr_t
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/bus.c | 132 | ||||
-rw-r--r-- | drivers/pci/host-bridge.c | 19 | ||||
-rw-r--r-- | drivers/pci/probe.c | 18 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 2 | ||||
-rw-r--r-- | drivers/pci/rom.c | 2 | ||||
-rw-r--r-- | drivers/pci/setup-bus.c | 16 | ||||
-rw-r--r-- | drivers/pci/setup-res.c | 2 |
7 files changed, 130 insertions, 61 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index a037d81f21ed..00660cc502c5 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -98,41 +98,54 @@ void pci_bus_remove_resources(struct pci_bus *bus) | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | /** | 101 | static struct pci_bus_region pci_32_bit = {0, 0xffffffffULL}; |
102 | * pci_bus_alloc_resource - allocate a resource from a parent bus | 102 | #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT |
103 | * @bus: PCI bus | 103 | static struct pci_bus_region pci_64_bit = {0, |
104 | * @res: resource to allocate | 104 | (dma_addr_t) 0xffffffffffffffffULL}; |
105 | * @size: size of resource to allocate | 105 | static struct pci_bus_region pci_high = {(dma_addr_t) 0x100000000ULL, |
106 | * @align: alignment of resource to allocate | 106 | (dma_addr_t) 0xffffffffffffffffULL}; |
107 | * @min: minimum /proc/iomem address to allocate | 107 | #endif |
108 | * @type_mask: IORESOURCE_* type flags | 108 | |
109 | * @alignf: resource alignment function | 109 | /* |
110 | * @alignf_data: data argument for resource alignment function | 110 | * @res contains CPU addresses. Clip it so the corresponding bus addresses |
111 | * | 111 | * on @bus are entirely within @region. This is used to control the bus |
112 | * Given the PCI bus a device resides on, the size, minimum address, | 112 | * addresses of resources we allocate, e.g., we may need a resource that |
113 | * alignment and type, try to find an acceptable resource allocation | 113 | * can be mapped by a 32-bit BAR. |
114 | * for a specific device resource. | ||
115 | */ | 114 | */ |
116 | int | 115 | static void pci_clip_resource_to_region(struct pci_bus *bus, |
117 | pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | 116 | struct resource *res, |
117 | struct pci_bus_region *region) | ||
118 | { | ||
119 | struct pci_bus_region r; | ||
120 | |||
121 | pcibios_resource_to_bus(bus, &r, res); | ||
122 | if (r.start < region->start) | ||
123 | r.start = region->start; | ||
124 | if (r.end > region->end) | ||
125 | r.end = region->end; | ||
126 | |||
127 | if (r.end < r.start) | ||
128 | res->end = res->start - 1; | ||
129 | else | ||
130 | pcibios_bus_to_resource(bus, res, &r); | ||
131 | } | ||
132 | |||
133 | static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, | ||
118 | resource_size_t size, resource_size_t align, | 134 | resource_size_t size, resource_size_t align, |
119 | resource_size_t min, unsigned int type_mask, | 135 | resource_size_t min, unsigned int type_mask, |
120 | resource_size_t (*alignf)(void *, | 136 | resource_size_t (*alignf)(void *, |
121 | const struct resource *, | 137 | const struct resource *, |
122 | resource_size_t, | 138 | resource_size_t, |
123 | resource_size_t), | 139 | resource_size_t), |
124 | void *alignf_data) | 140 | void *alignf_data, |
141 | struct pci_bus_region *region) | ||
125 | { | 142 | { |
126 | int i, ret = -ENOMEM; | 143 | int i, ret; |
127 | struct resource *r; | 144 | struct resource *r, avail; |
128 | resource_size_t max = -1; | 145 | resource_size_t max; |
129 | 146 | ||
130 | type_mask |= IORESOURCE_IO | IORESOURCE_MEM; | 147 | type_mask |= IORESOURCE_IO | IORESOURCE_MEM; |
131 | 148 | ||
132 | /* don't allocate too high if the pref mem doesn't support 64bit*/ | ||
133 | if (!(res->flags & IORESOURCE_MEM_64)) | ||
134 | max = PCIBIOS_MAX_MEM_32; | ||
135 | |||
136 | pci_bus_for_each_resource(bus, r, i) { | 149 | pci_bus_for_each_resource(bus, r, i) { |
137 | if (!r) | 150 | if (!r) |
138 | continue; | 151 | continue; |
@@ -147,15 +160,74 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
147 | !(res->flags & IORESOURCE_PREFETCH)) | 160 | !(res->flags & IORESOURCE_PREFETCH)) |
148 | continue; | 161 | continue; |
149 | 162 | ||
163 | avail = *r; | ||
164 | pci_clip_resource_to_region(bus, &avail, region); | ||
165 | if (!resource_size(&avail)) | ||
166 | continue; | ||
167 | |||
168 | /* | ||
169 | * "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to | ||
170 | * protect badly documented motherboard resources, but if | ||
171 | * this is an already-configured bridge window, its start | ||
172 | * overrides "min". | ||
173 | */ | ||
174 | if (avail.start) | ||
175 | min = avail.start; | ||
176 | |||
177 | max = avail.end; | ||
178 | |||
150 | /* Ok, try it out.. */ | 179 | /* Ok, try it out.. */ |
151 | ret = allocate_resource(r, res, size, | 180 | ret = allocate_resource(r, res, size, min, max, |
152 | r->start ? : min, | 181 | align, alignf, alignf_data); |
153 | max, align, | ||
154 | alignf, alignf_data); | ||
155 | if (ret == 0) | 182 | if (ret == 0) |
156 | break; | 183 | return 0; |
157 | } | 184 | } |
158 | return ret; | 185 | return -ENOMEM; |
186 | } | ||
187 | |||
188 | /** | ||
189 | * pci_bus_alloc_resource - allocate a resource from a parent bus | ||
190 | * @bus: PCI bus | ||
191 | * @res: resource to allocate | ||
192 | * @size: size of resource to allocate | ||
193 | * @align: alignment of resource to allocate | ||
194 | * @min: minimum /proc/iomem address to allocate | ||
195 | * @type_mask: IORESOURCE_* type flags | ||
196 | * @alignf: resource alignment function | ||
197 | * @alignf_data: data argument for resource alignment function | ||
198 | * | ||
199 | * Given the PCI bus a device resides on, the size, minimum address, | ||
200 | * alignment and type, try to find an acceptable resource allocation | ||
201 | * for a specific device resource. | ||
202 | */ | ||
203 | int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | ||
204 | resource_size_t size, resource_size_t align, | ||
205 | resource_size_t min, unsigned int type_mask, | ||
206 | resource_size_t (*alignf)(void *, | ||
207 | const struct resource *, | ||
208 | resource_size_t, | ||
209 | resource_size_t), | ||
210 | void *alignf_data) | ||
211 | { | ||
212 | #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT | ||
213 | int rc; | ||
214 | |||
215 | if (res->flags & IORESOURCE_MEM_64) { | ||
216 | rc = pci_bus_alloc_from_region(bus, res, size, align, min, | ||
217 | type_mask, alignf, alignf_data, | ||
218 | &pci_high); | ||
219 | if (rc == 0) | ||
220 | return 0; | ||
221 | |||
222 | return pci_bus_alloc_from_region(bus, res, size, align, min, | ||
223 | type_mask, alignf, alignf_data, | ||
224 | &pci_64_bit); | ||
225 | } | ||
226 | #endif | ||
227 | |||
228 | return pci_bus_alloc_from_region(bus, res, size, align, min, | ||
229 | type_mask, alignf, alignf_data, | ||
230 | &pci_32_bit); | ||
159 | } | 231 | } |
160 | 232 | ||
161 | void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } | 233 | void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } |
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index a68dc613a5be..06ace6248c61 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c | |||
@@ -9,22 +9,19 @@ | |||
9 | 9 | ||
10 | #include "pci.h" | 10 | #include "pci.h" |
11 | 11 | ||
12 | static struct pci_bus *find_pci_root_bus(struct pci_dev *dev) | 12 | static struct pci_bus *find_pci_root_bus(struct pci_bus *bus) |
13 | { | 13 | { |
14 | struct pci_bus *bus; | ||
15 | |||
16 | bus = dev->bus; | ||
17 | while (bus->parent) | 14 | while (bus->parent) |
18 | bus = bus->parent; | 15 | bus = bus->parent; |
19 | 16 | ||
20 | return bus; | 17 | return bus; |
21 | } | 18 | } |
22 | 19 | ||
23 | static struct pci_host_bridge *find_pci_host_bridge(struct pci_dev *dev) | 20 | static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus) |
24 | { | 21 | { |
25 | struct pci_bus *bus = find_pci_root_bus(dev); | 22 | struct pci_bus *root_bus = find_pci_root_bus(bus); |
26 | 23 | ||
27 | return to_pci_host_bridge(bus->bridge); | 24 | return to_pci_host_bridge(root_bus->bridge); |
28 | } | 25 | } |
29 | 26 | ||
30 | void pci_set_host_bridge_release(struct pci_host_bridge *bridge, | 27 | void pci_set_host_bridge_release(struct pci_host_bridge *bridge, |
@@ -40,10 +37,10 @@ static bool resource_contains(struct resource *res1, struct resource *res2) | |||
40 | return res1->start <= res2->start && res1->end >= res2->end; | 37 | return res1->start <= res2->start && res1->end >= res2->end; |
41 | } | 38 | } |
42 | 39 | ||
43 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | 40 | void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, |
44 | struct resource *res) | 41 | struct resource *res) |
45 | { | 42 | { |
46 | struct pci_host_bridge *bridge = find_pci_host_bridge(dev); | 43 | struct pci_host_bridge *bridge = find_pci_host_bridge(bus); |
47 | struct pci_host_bridge_window *window; | 44 | struct pci_host_bridge_window *window; |
48 | resource_size_t offset = 0; | 45 | resource_size_t offset = 0; |
49 | 46 | ||
@@ -68,10 +65,10 @@ static bool region_contains(struct pci_bus_region *region1, | |||
68 | return region1->start <= region2->start && region1->end >= region2->end; | 65 | return region1->start <= region2->start && region1->end >= region2->end; |
69 | } | 66 | } |
70 | 67 | ||
71 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | 68 | void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res, |
72 | struct pci_bus_region *region) | 69 | struct pci_bus_region *region) |
73 | { | 70 | { |
74 | struct pci_host_bridge *bridge = find_pci_host_bridge(dev); | 71 | struct pci_host_bridge *bridge = find_pci_host_bridge(bus); |
75 | struct pci_host_bridge_window *window; | 72 | struct pci_host_bridge_window *window; |
76 | resource_size_t offset = 0; | 73 | resource_size_t offset = 0; |
77 | 74 | ||
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 12ec56c9a913..23cdfac0bdb3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -269,8 +269,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
269 | region.end = l + sz; | 269 | region.end = l + sz; |
270 | } | 270 | } |
271 | 271 | ||
272 | pcibios_bus_to_resource(dev, res, ®ion); | 272 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
273 | pcibios_resource_to_bus(dev, &inverted_region, res); | 273 | pcibios_resource_to_bus(dev->bus, &inverted_region, res); |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is | 276 | * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is |
@@ -364,7 +364,7 @@ static void pci_read_bridge_io(struct pci_bus *child) | |||
364 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; | 364 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; |
365 | region.start = base; | 365 | region.start = base; |
366 | region.end = limit + io_granularity - 1; | 366 | region.end = limit + io_granularity - 1; |
367 | pcibios_bus_to_resource(dev, res, ®ion); | 367 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
368 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 368 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
369 | } | 369 | } |
370 | } | 370 | } |
@@ -386,7 +386,7 @@ static void pci_read_bridge_mmio(struct pci_bus *child) | |||
386 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; | 386 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; |
387 | region.start = base; | 387 | region.start = base; |
388 | region.end = limit + 0xfffff; | 388 | region.end = limit + 0xfffff; |
389 | pcibios_bus_to_resource(dev, res, ®ion); | 389 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
390 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 390 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
391 | } | 391 | } |
392 | } | 392 | } |
@@ -436,7 +436,7 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
436 | res->flags |= IORESOURCE_MEM_64; | 436 | res->flags |= IORESOURCE_MEM_64; |
437 | region.start = base; | 437 | region.start = base; |
438 | region.end = limit + 0xfffff; | 438 | region.end = limit + 0xfffff; |
439 | pcibios_bus_to_resource(dev, res, ®ion); | 439 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
440 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 440 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
441 | } | 441 | } |
442 | } | 442 | } |
@@ -1084,24 +1084,24 @@ int pci_setup_device(struct pci_dev *dev) | |||
1084 | region.end = 0x1F7; | 1084 | region.end = 0x1F7; |
1085 | res = &dev->resource[0]; | 1085 | res = &dev->resource[0]; |
1086 | res->flags = LEGACY_IO_RESOURCE; | 1086 | res->flags = LEGACY_IO_RESOURCE; |
1087 | pcibios_bus_to_resource(dev, res, ®ion); | 1087 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1088 | region.start = 0x3F6; | 1088 | region.start = 0x3F6; |
1089 | region.end = 0x3F6; | 1089 | region.end = 0x3F6; |
1090 | res = &dev->resource[1]; | 1090 | res = &dev->resource[1]; |
1091 | res->flags = LEGACY_IO_RESOURCE; | 1091 | res->flags = LEGACY_IO_RESOURCE; |
1092 | pcibios_bus_to_resource(dev, res, ®ion); | 1092 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1093 | } | 1093 | } |
1094 | if ((progif & 4) == 0) { | 1094 | if ((progif & 4) == 0) { |
1095 | region.start = 0x170; | 1095 | region.start = 0x170; |
1096 | region.end = 0x177; | 1096 | region.end = 0x177; |
1097 | res = &dev->resource[2]; | 1097 | res = &dev->resource[2]; |
1098 | res->flags = LEGACY_IO_RESOURCE; | 1098 | res->flags = LEGACY_IO_RESOURCE; |
1099 | pcibios_bus_to_resource(dev, res, ®ion); | 1099 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1100 | region.start = 0x376; | 1100 | region.start = 0x376; |
1101 | region.end = 0x376; | 1101 | region.end = 0x376; |
1102 | res = &dev->resource[3]; | 1102 | res = &dev->resource[3]; |
1103 | res->flags = LEGACY_IO_RESOURCE; | 1103 | res->flags = LEGACY_IO_RESOURCE; |
1104 | pcibios_bus_to_resource(dev, res, ®ion); | 1104 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
1105 | } | 1105 | } |
1106 | } | 1106 | } |
1107 | break; | 1107 | break; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b3b1b9aa8863..4ad6bf6c107b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -343,7 +343,7 @@ static void quirk_io_region(struct pci_dev *dev, int port, | |||
343 | /* Convert from PCI bus to resource space */ | 343 | /* Convert from PCI bus to resource space */ |
344 | bus_region.start = region; | 344 | bus_region.start = region; |
345 | bus_region.end = region + size - 1; | 345 | bus_region.end = region + size - 1; |
346 | pcibios_bus_to_resource(dev, res, &bus_region); | 346 | pcibios_bus_to_resource(dev->bus, res, &bus_region); |
347 | 347 | ||
348 | if (!pci_claim_resource(dev, nr)) | 348 | if (!pci_claim_resource(dev, nr)) |
349 | dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name); | 349 | dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name); |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index c5d0a08a8747..5d595724e5f4 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -31,7 +31,7 @@ int pci_enable_rom(struct pci_dev *pdev) | |||
31 | if (!res->flags) | 31 | if (!res->flags) |
32 | return -1; | 32 | return -1; |
33 | 33 | ||
34 | pcibios_resource_to_bus(pdev, ®ion, res); | 34 | pcibios_resource_to_bus(pdev->bus, ®ion, res); |
35 | pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr); | 35 | pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr); |
36 | rom_addr &= ~PCI_ROM_ADDRESS_MASK; | 36 | rom_addr &= ~PCI_ROM_ADDRESS_MASK; |
37 | rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE; | 37 | rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE; |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 2e344a5581ae..138bdd6393be 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -475,7 +475,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
475 | &bus->busn_res); | 475 | &bus->busn_res); |
476 | 476 | ||
477 | res = bus->resource[0]; | 477 | res = bus->resource[0]; |
478 | pcibios_resource_to_bus(bridge, ®ion, res); | 478 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
479 | if (res->flags & IORESOURCE_IO) { | 479 | if (res->flags & IORESOURCE_IO) { |
480 | /* | 480 | /* |
481 | * The IO resource is allocated a range twice as large as it | 481 | * The IO resource is allocated a range twice as large as it |
@@ -489,7 +489,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | res = bus->resource[1]; | 491 | res = bus->resource[1]; |
492 | pcibios_resource_to_bus(bridge, ®ion, res); | 492 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
493 | if (res->flags & IORESOURCE_IO) { | 493 | if (res->flags & IORESOURCE_IO) { |
494 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 494 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
495 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, | 495 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, |
@@ -499,7 +499,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
499 | } | 499 | } |
500 | 500 | ||
501 | res = bus->resource[2]; | 501 | res = bus->resource[2]; |
502 | pcibios_resource_to_bus(bridge, ®ion, res); | 502 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
503 | if (res->flags & IORESOURCE_MEM) { | 503 | if (res->flags & IORESOURCE_MEM) { |
504 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 504 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
505 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, | 505 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, |
@@ -509,7 +509,7 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
509 | } | 509 | } |
510 | 510 | ||
511 | res = bus->resource[3]; | 511 | res = bus->resource[3]; |
512 | pcibios_resource_to_bus(bridge, ®ion, res); | 512 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
513 | if (res->flags & IORESOURCE_MEM) { | 513 | if (res->flags & IORESOURCE_MEM) { |
514 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 514 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
515 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, | 515 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, |
@@ -547,7 +547,7 @@ static void pci_setup_bridge_io(struct pci_bus *bus) | |||
547 | 547 | ||
548 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | 548 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ |
549 | res = bus->resource[0]; | 549 | res = bus->resource[0]; |
550 | pcibios_resource_to_bus(bridge, ®ion, res); | 550 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
551 | if (res->flags & IORESOURCE_IO) { | 551 | if (res->flags & IORESOURCE_IO) { |
552 | pci_read_config_word(bridge, PCI_IO_BASE, &l); | 552 | pci_read_config_word(bridge, PCI_IO_BASE, &l); |
553 | io_base_lo = (region.start >> 8) & io_mask; | 553 | io_base_lo = (region.start >> 8) & io_mask; |
@@ -578,7 +578,7 @@ static void pci_setup_bridge_mmio(struct pci_bus *bus) | |||
578 | 578 | ||
579 | /* Set up the top and bottom of the PCI Memory segment for this bus. */ | 579 | /* Set up the top and bottom of the PCI Memory segment for this bus. */ |
580 | res = bus->resource[1]; | 580 | res = bus->resource[1]; |
581 | pcibios_resource_to_bus(bridge, ®ion, res); | 581 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
582 | if (res->flags & IORESOURCE_MEM) { | 582 | if (res->flags & IORESOURCE_MEM) { |
583 | l = (region.start >> 16) & 0xfff0; | 583 | l = (region.start >> 16) & 0xfff0; |
584 | l |= region.end & 0xfff00000; | 584 | l |= region.end & 0xfff00000; |
@@ -604,7 +604,7 @@ static void pci_setup_bridge_mmio_pref(struct pci_bus *bus) | |||
604 | /* Set up PREF base/limit. */ | 604 | /* Set up PREF base/limit. */ |
605 | bu = lu = 0; | 605 | bu = lu = 0; |
606 | res = bus->resource[2]; | 606 | res = bus->resource[2]; |
607 | pcibios_resource_to_bus(bridge, ®ion, res); | 607 | pcibios_resource_to_bus(bridge->bus, ®ion, res); |
608 | if (res->flags & IORESOURCE_PREFETCH) { | 608 | if (res->flags & IORESOURCE_PREFETCH) { |
609 | l = (region.start >> 16) & 0xfff0; | 609 | l = (region.start >> 16) & 0xfff0; |
610 | l |= region.end & 0xfff00000; | 610 | l |= region.end & 0xfff00000; |
@@ -1424,7 +1424,7 @@ static int iov_resources_unassigned(struct pci_dev *dev, void *data) | |||
1424 | if (!r->flags) | 1424 | if (!r->flags) |
1425 | continue; | 1425 | continue; |
1426 | 1426 | ||
1427 | pcibios_resource_to_bus(dev, ®ion, r); | 1427 | pcibios_resource_to_bus(dev->bus, ®ion, r); |
1428 | if (!region.start) { | 1428 | if (!region.start) { |
1429 | *unassigned = true; | 1429 | *unassigned = true; |
1430 | return 1; /* return early from pci_walk_bus() */ | 1430 | return 1; /* return early from pci_walk_bus() */ |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 83c4d3bc47ab..5c060b152ce6 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -52,7 +52,7 @@ void pci_update_resource(struct pci_dev *dev, int resno) | |||
52 | if (res->flags & IORESOURCE_PCI_FIXED) | 52 | if (res->flags & IORESOURCE_PCI_FIXED) |
53 | return; | 53 | return; |
54 | 54 | ||
55 | pcibios_resource_to_bus(dev, ®ion, res); | 55 | pcibios_resource_to_bus(dev->bus, ®ion, res); |
56 | 56 | ||
57 | new = region.start | (res->flags & PCI_REGION_FLAG_MASK); | 57 | new = region.start | (res->flags & PCI_REGION_FLAG_MASK); |
58 | if (res->flags & IORESOURCE_IO) | 58 | if (res->flags & IORESOURCE_IO) |