aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/pci/quirks.c5
-rw-r--r--drivers/pci/rom.c2
-rw-r--r--drivers/pci/setup-res.c4
4 files changed, 13 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 99293fa40db9..dc9ce62be7aa 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4244,6 +4244,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
4244 "Rounding up size of resource #%d to %#llx.\n", 4244 "Rounding up size of resource #%d to %#llx.\n",
4245 i, (unsigned long long)size); 4245 i, (unsigned long long)size);
4246 } 4246 }
4247 r->flags |= IORESOURCE_UNSET;
4247 r->end = size - 1; 4248 r->end = size - 1;
4248 r->start = 0; 4249 r->start = 0;
4249 } 4250 }
@@ -4257,6 +4258,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
4257 r = &dev->resource[i]; 4258 r = &dev->resource[i];
4258 if (!(r->flags & IORESOURCE_MEM)) 4259 if (!(r->flags & IORESOURCE_MEM))
4259 continue; 4260 continue;
4261 r->flags |= IORESOURCE_UNSET;
4260 r->end = resource_size(r) - 1; 4262 r->end = resource_size(r) - 1;
4261 r->start = 0; 4263 r->start = 0;
4262 } 4264 }
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 5cb726c193de..6e596ab77fb9 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -296,6 +296,7 @@ static void quirk_s3_64M(struct pci_dev *dev)
296 struct resource *r = &dev->resource[0]; 296 struct resource *r = &dev->resource[0];
297 297
298 if ((r->start & 0x3ffffff) || r->end != r->start + 0x3ffffff) { 298 if ((r->start & 0x3ffffff) || r->end != r->start + 0x3ffffff) {
299 r->flags |= IORESOURCE_UNSET;
299 r->start = 0; 300 r->start = 0;
300 r->end = 0x3ffffff; 301 r->end = 0x3ffffff;
301 } 302 }
@@ -937,6 +938,8 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C
937static void quirk_dunord(struct pci_dev *dev) 938static void quirk_dunord(struct pci_dev *dev)
938{ 939{
939 struct resource *r = &dev->resource [1]; 940 struct resource *r = &dev->resource [1];
941
942 r->flags |= IORESOURCE_UNSET;
940 r->start = 0; 943 r->start = 0;
941 r->end = 0xffffff; 944 r->end = 0xffffff;
942} 945}
@@ -1740,6 +1743,7 @@ static void quirk_tc86c001_ide(struct pci_dev *dev)
1740 struct resource *r = &dev->resource[0]; 1743 struct resource *r = &dev->resource[0];
1741 1744
1742 if (r->start & 0x8) { 1745 if (r->start & 0x8) {
1746 r->flags |= IORESOURCE_UNSET;
1743 r->start = 0; 1747 r->start = 0;
1744 r->end = 0xf; 1748 r->end = 0xf;
1745 } 1749 }
@@ -1769,6 +1773,7 @@ static void quirk_plx_pci9050(struct pci_dev *dev)
1769 dev_info(&dev->dev, 1773 dev_info(&dev->dev,
1770 "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n", 1774 "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n",
1771 bar); 1775 bar);
1776 r->flags |= IORESOURCE_UNSET;
1772 r->start = 0; 1777 r->start = 0;
1773 r->end = 0xff; 1778 r->end = 0xff;
1774 } 1779 }
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 5d595724e5f4..c1839450d4d6 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -197,8 +197,10 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom)
197void pci_cleanup_rom(struct pci_dev *pdev) 197void pci_cleanup_rom(struct pci_dev *pdev)
198{ 198{
199 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; 199 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
200
200 if (res->flags & IORESOURCE_ROM_COPY) { 201 if (res->flags & IORESOURCE_ROM_COPY) {
201 kfree((void*)(unsigned long)res->start); 202 kfree((void*)(unsigned long)res->start);
203 res->flags |= IORESOURCE_UNSET;
202 res->flags &= ~IORESOURCE_ROM_COPY; 204 res->flags &= ~IORESOURCE_ROM_COPY;
203 res->start = 0; 205 res->start = 0;
204 res->end = 0; 206 res->end = 0;
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 5c060b152ce6..0474b0217fdf 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -263,6 +263,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
263 resource_size_t align, size; 263 resource_size_t align, size;
264 int ret; 264 int ret;
265 265
266 res->flags |= IORESOURCE_UNSET;
266 align = pci_resource_alignment(dev, res); 267 align = pci_resource_alignment(dev, res);
267 if (!align) { 268 if (!align) {
268 dev_info(&dev->dev, "BAR %d: can't assign %pR " 269 dev_info(&dev->dev, "BAR %d: can't assign %pR "
@@ -282,6 +283,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
282 ret = pci_revert_fw_address(res, dev, resno, size); 283 ret = pci_revert_fw_address(res, dev, resno, size);
283 284
284 if (!ret) { 285 if (!ret) {
286 res->flags &= ~IORESOURCE_UNSET;
285 res->flags &= ~IORESOURCE_STARTALIGN; 287 res->flags &= ~IORESOURCE_STARTALIGN;
286 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); 288 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res);
287 if (resno < PCI_BRIDGE_RESOURCES) 289 if (resno < PCI_BRIDGE_RESOURCES)
@@ -297,6 +299,7 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
297 resource_size_t new_size; 299 resource_size_t new_size;
298 int ret; 300 int ret;
299 301
302 res->flags |= IORESOURCE_UNSET;
300 if (!res->parent) { 303 if (!res->parent) {
301 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR " 304 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR "
302 "\n", resno, res); 305 "\n", resno, res);
@@ -307,6 +310,7 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
307 new_size = resource_size(res) + addsize; 310 new_size = resource_size(res) + addsize;
308 ret = _pci_assign_resource(dev, resno, new_size, min_align); 311 ret = _pci_assign_resource(dev, resno, new_size, min_align);
309 if (!ret) { 312 if (!ret) {
313 res->flags &= ~IORESOURCE_UNSET;
310 res->flags &= ~IORESOURCE_STARTALIGN; 314 res->flags &= ~IORESOURCE_STARTALIGN;
311 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res); 315 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res);
312 if (resno < PCI_BRIDGE_RESOURCES) 316 if (resno < PCI_BRIDGE_RESOURCES)