diff options
Diffstat (limited to 'drivers/pci/setup-res.c')
-rw-r--r-- | drivers/pci/setup-res.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index c54526b206b5..7d678bb15ffb 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -51,12 +51,6 @@ void pci_update_resource(struct pci_dev *dev, int resno) | |||
51 | 51 | ||
52 | pcibios_resource_to_bus(dev, ®ion, res); | 52 | pcibios_resource_to_bus(dev, ®ion, res); |
53 | 53 | ||
54 | dev_dbg(&dev->dev, "BAR %d: got res %pR bus [%#llx-%#llx] " | ||
55 | "flags %#lx\n", resno, res, | ||
56 | (unsigned long long)region.start, | ||
57 | (unsigned long long)region.end, | ||
58 | (unsigned long)res->flags); | ||
59 | |||
60 | new = region.start | (res->flags & PCI_REGION_FLAG_MASK); | 54 | new = region.start | (res->flags & PCI_REGION_FLAG_MASK); |
61 | if (res->flags & IORESOURCE_IO) | 55 | if (res->flags & IORESOURCE_IO) |
62 | mask = (u32)PCI_BASE_ADDRESS_IO_MASK; | 56 | mask = (u32)PCI_BASE_ADDRESS_IO_MASK; |
@@ -91,9 +85,9 @@ void pci_update_resource(struct pci_dev *dev, int resno) | |||
91 | } | 85 | } |
92 | } | 86 | } |
93 | res->flags &= ~IORESOURCE_UNSET; | 87 | res->flags &= ~IORESOURCE_UNSET; |
94 | dev_dbg(&dev->dev, "BAR %d: moved to bus [%#llx-%#llx] flags %#lx\n", | 88 | dev_info(&dev->dev, "BAR %d: set to %pR (PCI address [%#llx-%#llx]\n", |
95 | resno, (unsigned long long)region.start, | 89 | resno, res, (unsigned long long)region.start, |
96 | (unsigned long long)region.end, res->flags); | 90 | (unsigned long long)region.end); |
97 | } | 91 | } |
98 | 92 | ||
99 | int pci_claim_resource(struct pci_dev *dev, int resource) | 93 | int pci_claim_resource(struct pci_dev *dev, int resource) |
@@ -103,20 +97,17 @@ int pci_claim_resource(struct pci_dev *dev, int resource) | |||
103 | int err; | 97 | int err; |
104 | 98 | ||
105 | root = pci_find_parent_resource(dev, res); | 99 | root = pci_find_parent_resource(dev, res); |
106 | 100 | if (!root) { | |
107 | err = -EINVAL; | 101 | dev_err(&dev->dev, "no compatible bridge window for %pR\n", |
108 | if (root != NULL) | 102 | res); |
109 | err = request_resource(root, res); | 103 | return -EINVAL; |
110 | |||
111 | if (err) { | ||
112 | const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; | ||
113 | dev_err(&dev->dev, "BAR %d: %s of %s %pR\n", | ||
114 | resource, | ||
115 | root ? "address space collision on" : | ||
116 | "no parent found for", | ||
117 | dtype, res); | ||
118 | } | 104 | } |
119 | 105 | ||
106 | err = request_resource(root, res); | ||
107 | if (err) | ||
108 | dev_err(&dev->dev, | ||
109 | "address space collision: %pR already in use\n", res); | ||
110 | |||
120 | return err; | 111 | return err; |
121 | } | 112 | } |
122 | EXPORT_SYMBOL(pci_claim_resource); | 113 | EXPORT_SYMBOL(pci_claim_resource); |
@@ -124,7 +115,7 @@ EXPORT_SYMBOL(pci_claim_resource); | |||
124 | #ifdef CONFIG_PCI_QUIRKS | 115 | #ifdef CONFIG_PCI_QUIRKS |
125 | void pci_disable_bridge_window(struct pci_dev *dev) | 116 | void pci_disable_bridge_window(struct pci_dev *dev) |
126 | { | 117 | { |
127 | dev_dbg(&dev->dev, "Disabling bridge window.\n"); | 118 | dev_info(&dev->dev, "disabling bridge mem windows\n"); |
128 | 119 | ||
129 | /* MMIO Base/Limit */ | 120 | /* MMIO Base/Limit */ |
130 | pci_write_config_dword(dev, PCI_MEMORY_BASE, 0x0000fff0); | 121 | pci_write_config_dword(dev, PCI_MEMORY_BASE, 0x0000fff0); |
@@ -165,6 +156,7 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev, | |||
165 | 156 | ||
166 | if (!ret) { | 157 | if (!ret) { |
167 | res->flags &= ~IORESOURCE_STARTALIGN; | 158 | res->flags &= ~IORESOURCE_STARTALIGN; |
159 | dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); | ||
168 | if (resno < PCI_BRIDGE_RESOURCES) | 160 | if (resno < PCI_BRIDGE_RESOURCES) |
169 | pci_update_resource(dev, resno); | 161 | pci_update_resource(dev, resno); |
170 | } | 162 | } |
@@ -178,12 +170,12 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
178 | resource_size_t align; | 170 | resource_size_t align; |
179 | struct pci_bus *bus; | 171 | struct pci_bus *bus; |
180 | int ret; | 172 | int ret; |
173 | char *type; | ||
181 | 174 | ||
182 | align = pci_resource_alignment(dev, res); | 175 | align = pci_resource_alignment(dev, res); |
183 | if (!align) { | 176 | if (!align) { |
184 | dev_info(&dev->dev, "BAR %d: can't allocate resource (bogus " | 177 | dev_info(&dev->dev, "BAR %d: can't assign %pR " |
185 | "alignment) %pR flags %#lx\n", | 178 | "(bogus alignment)\n", resno, res); |
186 | resno, res, res->flags); | ||
187 | return -EINVAL; | 179 | return -EINVAL; |
188 | } | 180 | } |
189 | 181 | ||
@@ -198,9 +190,20 @@ int pci_assign_resource(struct pci_dev *dev, int resno) | |||
198 | break; | 190 | break; |
199 | } | 191 | } |
200 | 192 | ||
201 | if (ret) | 193 | if (ret) { |
202 | dev_info(&dev->dev, "BAR %d: can't allocate %s resource %pR\n", | 194 | if (res->flags & IORESOURCE_MEM) |
203 | resno, res->flags & IORESOURCE_IO ? "I/O" : "mem", res); | 195 | if (res->flags & IORESOURCE_PREFETCH) |
196 | type = "mem pref"; | ||
197 | else | ||
198 | type = "mem"; | ||
199 | else if (res->flags & IORESOURCE_IO) | ||
200 | type = "io"; | ||
201 | else | ||
202 | type = "unknown"; | ||
203 | dev_info(&dev->dev, | ||
204 | "BAR %d: can't assign %s (size %#llx)\n", | ||
205 | resno, type, (unsigned long long) resource_size(res)); | ||
206 | } | ||
204 | 207 | ||
205 | return ret; | 208 | return ret; |
206 | } | 209 | } |
@@ -225,9 +228,8 @@ void pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) | |||
225 | 228 | ||
226 | r_align = pci_resource_alignment(dev, r); | 229 | r_align = pci_resource_alignment(dev, r); |
227 | if (!r_align) { | 230 | if (!r_align) { |
228 | dev_warn(&dev->dev, "BAR %d: bogus alignment " | 231 | dev_warn(&dev->dev, "BAR %d: %pR has bogus alignment\n", |
229 | "%pR flags %#lx\n", | 232 | i, r); |
230 | i, r, r->flags); | ||
231 | continue; | 233 | continue; |
232 | } | 234 | } |
233 | for (list = head; ; list = list->next) { | 235 | for (list = head; ; list = list->next) { |
@@ -274,8 +276,8 @@ int pci_enable_resources(struct pci_dev *dev, int mask) | |||
274 | continue; | 276 | continue; |
275 | 277 | ||
276 | if (!r->parent) { | 278 | if (!r->parent) { |
277 | dev_err(&dev->dev, "device not available because of " | 279 | dev_err(&dev->dev, "device not available " |
278 | "BAR %d %pR collisions\n", i, r); | 280 | "(can't reserve %pR)\n", r); |
279 | return -EINVAL; | 281 | return -EINVAL; |
280 | } | 282 | } |
281 | 283 | ||