diff options
Diffstat (limited to 'drivers/pci/setup-res.c')
-rw-r--r-- | drivers/pci/setup-res.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 1a5fc83c71b3..2dbd96cce2d8 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -49,10 +49,8 @@ void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) | |||
49 | 49 | ||
50 | pcibios_resource_to_bus(dev, ®ion, res); | 50 | pcibios_resource_to_bus(dev, ®ion, res); |
51 | 51 | ||
52 | dev_dbg(&dev->dev, "BAR %d: got res [%#llx-%#llx] bus [%#llx-%#llx] " | 52 | dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] " |
53 | "flags %#lx\n", resno, | 53 | "flags %#lx\n", resno, res, |
54 | (unsigned long long)res->start, | ||
55 | (unsigned long long)res->end, | ||
56 | (unsigned long long)region.start, | 54 | (unsigned long long)region.start, |
57 | (unsigned long long)region.end, | 55 | (unsigned long long)region.end, |
58 | (unsigned long)res->flags); | 56 | (unsigned long)res->flags); |
@@ -114,13 +112,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource) | |||
114 | err = insert_resource(root, res); | 112 | err = insert_resource(root, res); |
115 | 113 | ||
116 | if (err) { | 114 | if (err) { |
117 | dev_err(&dev->dev, "BAR %d: %s of %s [%#llx-%#llx]\n", | 115 | dev_err(&dev->dev, "BAR %d: %s of %s %pR\n", |
118 | resource, | 116 | resource, |
119 | root ? "address space collision on" : | 117 | root ? "address space collision on" : |
120 | "no parent found for", | 118 | "no parent found for", |
121 | dtype, | 119 | dtype, res); |
122 | (unsigned long long)res->start, | ||
123 | (unsigned long long)res->end); | ||
124 | } | 120 | } |
125 | 121 | ||
126 | return err; | 122 | return err; |
@@ -133,15 +129,14 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
133 | resource_size_t size, min, align; | 129 | resource_size_t size, min, align; |
134 | int ret; | 130 | int ret; |
135 | 131 | ||
136 | size = res->end - res->start + 1; | 132 | size = resource_size(res); |
137 | min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; | 133 | min = (res->flags & IORESOURCE_IO) ? PCIBIOS_MIN_IO : PCIBIOS_MIN_MEM; |
138 | 134 | ||
139 | align = resource_alignment(res); | 135 | align = resource_alignment(res); |
140 | if (!align) { | 136 | if (!align) { |
141 | dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus " | 137 | dev_err(&dev->dev, "BAR %d: can't allocate resource (bogus " |
142 | "alignment) [%#llx-%#llx] flags %#lx\n", | 138 | "alignment) %pR flags %#lx\n", |
143 | resno, (unsigned long long)res->start, | 139 | resno, res, res->flags); |
144 | (unsigned long long)res->end, res->flags); | ||
145 | return -EINVAL; | 140 | return -EINVAL; |
146 | } | 141 | } |
147 | 142 | ||
@@ -162,11 +157,8 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
162 | } | 157 | } |
163 | 158 | ||
164 | if (ret) { | 159 | if (ret) { |
165 | dev_err(&dev->dev, "BAR %d: can't allocate %s resource " | 160 | dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", |
166 | "[%#llx-%#llx]\n", resno, | 161 | resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); |
167 | res->flags & IORESOURCE_IO ? "I/O" : "mem", | ||
168 | (unsigned long long)res->start, | ||
169 | (unsigned long long)res->end); | ||
170 | } else { | 162 | } else { |
171 | res->flags &= ~IORESOURCE_STARTALIGN; | 163 | res->flags &= ~IORESOURCE_STARTALIGN; |
172 | if (resno < PCI_BRIDGE_RESOURCES) | 164 | if (resno < PCI_BRIDGE_RESOURCES) |
@@ -202,11 +194,8 @@ int pci_assign_resource_fixed(struct pci_dev *dev, int resno) | |||
202 | } | 194 | } |
203 | 195 | ||
204 | if (ret) { | 196 | if (ret) { |
205 | dev_err(&dev->dev, "BAR %d: can't allocate %s resource " | 197 | dev_err(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", |
206 | "[%#llx-%#llx\n]", resno, | 198 | resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); |
207 | res->flags & IORESOURCE_IO ? "I/O" : "mem", | ||
208 | (unsigned long long)res->start, | ||
209 | (unsigned long long)res->end); | ||
210 | } else if (resno < PCI_BRIDGE_RESOURCES) { | 199 | } else if (resno < PCI_BRIDGE_RESOURCES) { |
211 | pci_update_resource(dev, res, resno); | 200 | pci_update_resource(dev, res, resno); |
212 | } | 201 | } |
@@ -237,9 +226,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
237 | r_align = resource_alignment(r); | 226 | r_align = resource_alignment(r); |
238 | if (!r_align) { | 227 | if (!r_align) { |
239 | dev_warn(&dev->dev, "BAR %d: bogus alignment " | 228 | dev_warn(&dev->dev, "BAR %d: bogus alignment " |
240 | "[%#llx-%#llx] flags %#lx\n", | 229 | "%pR flags %#lx\n", |
241 | i, (unsigned long long)r->start, | 230 | i, r, r->flags); |
242 | (unsigned long long)r->end, r->flags); | ||
243 | continue; | 231 | continue; |
244 | } | 232 | } |
245 | for (list = head; ; list = list->next) { | 233 | for (list = head; ; list = list->next) { |
@@ -287,9 +275,7 @@ int pci_enable_resources(struct pci_dev *dev, int mask) | |||
287 | 275 | ||
288 | if (!r->parent) { | 276 | if (!r->parent) { |
289 | dev_err(&dev->dev, "device not available because of " | 277 | dev_err(&dev->dev, "device not available because of " |
290 | "BAR %d [%#llx-%#llx] collisions\n", i, | 278 | "BAR %d %pR collisions\n", i, r); |
291 | (unsigned long long) r->start, | ||
292 | (unsigned long long) r->end); | ||
293 | return -EINVAL; | 279 | return -EINVAL; |
294 | } | 280 | } |
295 | 281 | ||