20 #include <linux/kernel.h>
21 #include <linux/export.h>
22 #include <linux/pci.h>
23 #include <linux/errno.h>
26 #include <linux/slab.h>
84 pci_write_config_dword(dev, reg,
new);
85 pci_read_config_dword(dev, reg, &check);
87 if ((
new ^ check) & mask) {
88 dev_err(&dev->
dev,
"BAR %d: error updating (%#08x != %#08x)\n",
93 new = region.
start >> 16 >> 16;
94 pci_write_config_dword(dev, reg + 4,
new);
95 pci_read_config_dword(dev, reg + 4, &check);
98 "(high %#08x != %#08x)\n", resno,
new, check);
106 dev_dbg(&dev->
dev,
"BAR %d: set to %pR (PCI address [%#llx-%#llx])\n",
107 resno, res, (
unsigned long long)region.
start,
108 (
unsigned long long)region.
end);
114 struct resource *
root, *conflict;
118 dev_info(&dev->
dev,
"no compatible bridge window for %pR\n",
126 "address space collision: %pR conflicts with %s %pR\n",
127 res, conflict->
name, conflict);
137 dev_info(&dev->
dev,
"disabling bridge mem windows\n");
175 res->
start = fw_addr;
186 dev_info(&dev->
dev,
"BAR %d: trying firmware assignment %pR\n",
191 "BAR %d: %pR conflicts with %s %pR\n", resno,
192 res, conflict->
name, conflict);
227 static int _pci_assign_resource(
struct pci_dev *dev,
int resno,
236 while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) {
253 "BAR %d: can't assign %s (size %#llx)\n",
254 resno, type, (
unsigned long long) resource_size(res));
267 align = pci_resource_alignment(dev, res);
270 "(bogus alignment)\n", resno, res);
275 size = resource_size(res);
276 ret = _pci_assign_resource(dev, resno, size, align);
284 ret = pci_revert_fw_address(res, dev, resno, size);
288 dev_info(&dev->
dev,
"BAR %d: assigned %pR\n", resno, res);
303 dev_info(&dev->
dev,
"BAR %d: can't reassign an unassigned resource %pR "
309 new_size = resource_size(res) + addsize;
310 ret = _pci_assign_resource(dev, resno, new_size, min_align);
313 dev_info(&dev->
dev,
"BAR %d: reassigned %pR\n", resno, res);
330 if (!(mask & (1 << i)))
343 "(can't reserve %pR)\n", r);
353 if (cmd != old_cmd) {
354 dev_info(&dev->
dev,
"enabling device (%04x -> %04x)\n",