aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/ioapic.c13
-rw-r--r--drivers/pci/iov.c5
-rw-r--r--drivers/pci/msi.c10
-rw-r--r--drivers/pci/pci-acpi.c4
-rw-r--r--drivers/pci/pci-sysfs.c48
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/pci/pcie/aspm.c29
-rw-r--r--drivers/pci/probe.c31
-rw-r--r--drivers/pci/quirks.c27
9 files changed, 125 insertions, 44 deletions
diff --git a/drivers/pci/ioapic.c b/drivers/pci/ioapic.c
index 3c6bbdd059a4..1b90579b233a 100644
--- a/drivers/pci/ioapic.c
+++ b/drivers/pci/ioapic.c
@@ -113,17 +113,6 @@ static struct pci_driver ioapic_driver = {
113 .remove = ioapic_remove, 113 .remove = ioapic_remove,
114}; 114};
115 115
116static int __init ioapic_init(void) 116module_pci_driver(ioapic_driver);
117{
118 return pci_register_driver(&ioapic_driver);
119}
120
121static void __exit ioapic_exit(void)
122{
123 pci_unregister_driver(&ioapic_driver);
124}
125
126module_init(ioapic_init);
127module_exit(ioapic_exit);
128 117
129MODULE_LICENSE("GPL"); 118MODULE_LICENSE("GPL");
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index c93071d428f5..a971a6f6268d 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -92,6 +92,8 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
92 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device); 92 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
93 pci_setup_device(virtfn); 93 pci_setup_device(virtfn);
94 virtfn->dev.parent = dev->dev.parent; 94 virtfn->dev.parent = dev->dev.parent;
95 virtfn->physfn = pci_dev_get(dev);
96 virtfn->is_virtfn = 1;
95 97
96 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { 98 for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
97 res = dev->resource + PCI_IOV_RESOURCES + i; 99 res = dev->resource + PCI_IOV_RESOURCES + i;
@@ -113,9 +115,6 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
113 pci_device_add(virtfn, virtfn->bus); 115 pci_device_add(virtfn, virtfn->bus);
114 mutex_unlock(&iov->dev->sriov->lock); 116 mutex_unlock(&iov->dev->sriov->lock);
115 117
116 virtfn->physfn = pci_dev_get(dev);
117 virtfn->is_virtfn = 1;
118
119 rc = pci_bus_add_device(virtfn); 118 rc = pci_bus_add_device(virtfn);
120 sprintf(buf, "virtfn%u", id); 119 sprintf(buf, "virtfn%u", id);
121 rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf); 120 rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 2c1075213bec..aca7578b05e5 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -81,7 +81,10 @@ void default_teardown_msi_irqs(struct pci_dev *dev)
81 int i, nvec; 81 int i, nvec;
82 if (entry->irq == 0) 82 if (entry->irq == 0)
83 continue; 83 continue;
84 nvec = 1 << entry->msi_attrib.multiple; 84 if (entry->nvec_used)
85 nvec = entry->nvec_used;
86 else
87 nvec = 1 << entry->msi_attrib.multiple;
85 for (i = 0; i < nvec; i++) 88 for (i = 0; i < nvec; i++)
86 arch_teardown_msi_irq(entry->irq + i); 89 arch_teardown_msi_irq(entry->irq + i);
87 } 90 }
@@ -336,7 +339,10 @@ static void free_msi_irqs(struct pci_dev *dev)
336 int i, nvec; 339 int i, nvec;
337 if (!entry->irq) 340 if (!entry->irq)
338 continue; 341 continue;
339 nvec = 1 << entry->msi_attrib.multiple; 342 if (entry->nvec_used)
343 nvec = entry->nvec_used;
344 else
345 nvec = 1 << entry->msi_attrib.multiple;
340#ifdef CONFIG_GENERIC_HARDIRQS 346#ifdef CONFIG_GENERIC_HARDIRQS
341 for (i = 0; i < nvec; i++) 347 for (i = 0; i < nvec; i++)
342 BUG_ON(irq_has_action(entry->irq + i)); 348 BUG_ON(irq_has_action(entry->irq + i));
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index e4b1fb2c0f5d..6c15d6a96935 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -376,12 +376,12 @@ static int __init acpi_pci_init(void)
376 int ret; 376 int ret;
377 377
378 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) { 378 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) {
379 printk(KERN_INFO"ACPI FADT declares the system doesn't support MSI, so disable it\n"); 379 pr_info("ACPI FADT declares the system doesn't support MSI, so disable it\n");
380 pci_no_msi(); 380 pci_no_msi();
381 } 381 }
382 382
383 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { 383 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
384 printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n"); 384 pr_info("ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n");
385 pcie_no_aspm(); 385 pcie_no_aspm();
386 } 386 }
387 387
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 5b4a9d9cd200..c0dbe1f61362 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -66,7 +66,7 @@ static ssize_t broken_parity_status_store(struct device *dev,
66 struct pci_dev *pdev = to_pci_dev(dev); 66 struct pci_dev *pdev = to_pci_dev(dev);
67 unsigned long val; 67 unsigned long val;
68 68
69 if (strict_strtoul(buf, 0, &val) < 0) 69 if (kstrtoul(buf, 0, &val) < 0)
70 return -EINVAL; 70 return -EINVAL;
71 71
72 pdev->broken_parity_status = !!val; 72 pdev->broken_parity_status = !!val;
@@ -188,7 +188,7 @@ static ssize_t is_enabled_store(struct device *dev,
188{ 188{
189 struct pci_dev *pdev = to_pci_dev(dev); 189 struct pci_dev *pdev = to_pci_dev(dev);
190 unsigned long val; 190 unsigned long val;
191 ssize_t result = strict_strtoul(buf, 0, &val); 191 ssize_t result = kstrtoul(buf, 0, &val);
192 192
193 if (result < 0) 193 if (result < 0)
194 return result; 194 return result;
@@ -259,7 +259,7 @@ msi_bus_store(struct device *dev, struct device_attribute *attr,
259 struct pci_dev *pdev = to_pci_dev(dev); 259 struct pci_dev *pdev = to_pci_dev(dev);
260 unsigned long val; 260 unsigned long val;
261 261
262 if (strict_strtoul(buf, 0, &val) < 0) 262 if (kstrtoul(buf, 0, &val) < 0)
263 return -EINVAL; 263 return -EINVAL;
264 264
265 /* bad things may happen if the no_msi flag is changed 265 /* bad things may happen if the no_msi flag is changed
@@ -291,7 +291,7 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
291 unsigned long val; 291 unsigned long val;
292 struct pci_bus *b = NULL; 292 struct pci_bus *b = NULL;
293 293
294 if (strict_strtoul(buf, 0, &val) < 0) 294 if (kstrtoul(buf, 0, &val) < 0)
295 return -EINVAL; 295 return -EINVAL;
296 296
297 if (val) { 297 if (val) {
@@ -315,7 +315,7 @@ dev_rescan_store(struct device *dev, struct device_attribute *attr,
315 unsigned long val; 315 unsigned long val;
316 struct pci_dev *pdev = to_pci_dev(dev); 316 struct pci_dev *pdev = to_pci_dev(dev);
317 317
318 if (strict_strtoul(buf, 0, &val) < 0) 318 if (kstrtoul(buf, 0, &val) < 0)
319 return -EINVAL; 319 return -EINVAL;
320 320
321 if (val) { 321 if (val) {
@@ -325,6 +325,8 @@ dev_rescan_store(struct device *dev, struct device_attribute *attr,
325 } 325 }
326 return count; 326 return count;
327} 327}
328struct device_attribute dev_rescan_attr = __ATTR(rescan, (S_IWUSR|S_IWGRP),
329 NULL, dev_rescan_store);
328 330
329static void remove_callback(struct device *dev) 331static void remove_callback(struct device *dev)
330{ 332{
@@ -342,7 +344,7 @@ remove_store(struct device *dev, struct device_attribute *dummy,
342 int ret = 0; 344 int ret = 0;
343 unsigned long val; 345 unsigned long val;
344 346
345 if (strict_strtoul(buf, 0, &val) < 0) 347 if (kstrtoul(buf, 0, &val) < 0)
346 return -EINVAL; 348 return -EINVAL;
347 349
348 /* An attribute cannot be unregistered by one of its own methods, 350 /* An attribute cannot be unregistered by one of its own methods,
@@ -354,6 +356,8 @@ remove_store(struct device *dev, struct device_attribute *dummy,
354 count = ret; 356 count = ret;
355 return count; 357 return count;
356} 358}
359struct device_attribute dev_remove_attr = __ATTR(remove, (S_IWUSR|S_IWGRP),
360 NULL, remove_store);
357 361
358static ssize_t 362static ssize_t
359dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, 363dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
@@ -362,7 +366,7 @@ dev_bus_rescan_store(struct device *dev, struct device_attribute *attr,
362 unsigned long val; 366 unsigned long val;
363 struct pci_bus *bus = to_pci_bus(dev); 367 struct pci_bus *bus = to_pci_bus(dev);
364 368
365 if (strict_strtoul(buf, 0, &val) < 0) 369 if (kstrtoul(buf, 0, &val) < 0)
366 return -EINVAL; 370 return -EINVAL;
367 371
368 if (val) { 372 if (val) {
@@ -384,7 +388,7 @@ static ssize_t d3cold_allowed_store(struct device *dev,
384 struct pci_dev *pdev = to_pci_dev(dev); 388 struct pci_dev *pdev = to_pci_dev(dev);
385 unsigned long val; 389 unsigned long val;
386 390
387 if (strict_strtoul(buf, 0, &val) < 0) 391 if (kstrtoul(buf, 0, &val) < 0)
388 return -EINVAL; 392 return -EINVAL;
389 393
390 pdev->d3cold_allowed = !!val; 394 pdev->d3cold_allowed = !!val;
@@ -504,8 +508,6 @@ struct device_attribute pci_dev_attrs[] = {
504 __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR), 508 __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
505 broken_parity_status_show,broken_parity_status_store), 509 broken_parity_status_show,broken_parity_status_store),
506 __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store), 510 __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store),
507 __ATTR(remove, (S_IWUSR|S_IWGRP), NULL, remove_store),
508 __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_rescan_store),
509#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) 511#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
510 __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store), 512 __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store),
511#endif 513#endif
@@ -1236,7 +1238,7 @@ static ssize_t reset_store(struct device *dev,
1236{ 1238{
1237 struct pci_dev *pdev = to_pci_dev(dev); 1239 struct pci_dev *pdev = to_pci_dev(dev);
1238 unsigned long val; 1240 unsigned long val;
1239 ssize_t result = strict_strtoul(buf, 0, &val); 1241 ssize_t result = kstrtoul(buf, 0, &val);
1240 1242
1241 if (result < 0) 1243 if (result < 0)
1242 return result; 1244 return result;
@@ -1463,6 +1465,29 @@ static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
1463 return a->mode; 1465 return a->mode;
1464} 1466}
1465 1467
1468static struct attribute *pci_dev_hp_attrs[] = {
1469 &dev_remove_attr.attr,
1470 &dev_rescan_attr.attr,
1471 NULL,
1472};
1473
1474static umode_t pci_dev_hp_attrs_are_visible(struct kobject *kobj,
1475 struct attribute *a, int n)
1476{
1477 struct device *dev = container_of(kobj, struct device, kobj);
1478 struct pci_dev *pdev = to_pci_dev(dev);
1479
1480 if (pdev->is_virtfn)
1481 return 0;
1482
1483 return a->mode;
1484}
1485
1486static struct attribute_group pci_dev_hp_attr_group = {
1487 .attrs = pci_dev_hp_attrs,
1488 .is_visible = pci_dev_hp_attrs_are_visible,
1489};
1490
1466#ifdef CONFIG_PCI_IOV 1491#ifdef CONFIG_PCI_IOV
1467static struct attribute *sriov_dev_attrs[] = { 1492static struct attribute *sriov_dev_attrs[] = {
1468 &sriov_totalvfs_attr.attr, 1493 &sriov_totalvfs_attr.attr,
@@ -1494,6 +1519,7 @@ static struct attribute_group pci_dev_attr_group = {
1494 1519
1495static const struct attribute_group *pci_dev_attr_groups[] = { 1520static const struct attribute_group *pci_dev_attr_groups[] = {
1496 &pci_dev_attr_group, 1521 &pci_dev_attr_group,
1522 &pci_dev_hp_attr_group,
1497#ifdef CONFIG_PCI_IOV 1523#ifdef CONFIG_PCI_IOV
1498 &sriov_dev_attr_group, 1524 &sriov_dev_attr_group,
1499#endif 1525#endif
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a899d8bb190d..e5f4e55d407d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2421,7 +2421,7 @@ bool pci_acs_path_enabled(struct pci_dev *start,
2421/** 2421/**
2422 * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge 2422 * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge
2423 * @dev: the PCI device 2423 * @dev: the PCI device
2424 * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTD, 4=INTD) 2424 * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTC, 4=INTD)
2425 * 2425 *
2426 * Perform INTx swizzling for a device behind one level of bridge. This is 2426 * Perform INTx swizzling for a device behind one level of bridge. This is
2427 * required by section 9.1 of the PCI-to-PCI bridge specification for devices 2427 * required by section 9.1 of the PCI-to-PCI bridge specification for devices
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index d320df6375a2..403a44374ed5 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -714,19 +714,12 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
714 up_read(&pci_bus_sem); 714 up_read(&pci_bus_sem);
715} 715}
716 716
717/*
718 * pci_disable_link_state - disable pci device's link state, so the link will
719 * never enter specific states
720 */
721static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem, 717static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem,
722 bool force) 718 bool force)
723{ 719{
724 struct pci_dev *parent = pdev->bus->self; 720 struct pci_dev *parent = pdev->bus->self;
725 struct pcie_link_state *link; 721 struct pcie_link_state *link;
726 722
727 if (aspm_disabled && !force)
728 return;
729
730 if (!pci_is_pcie(pdev)) 723 if (!pci_is_pcie(pdev))
731 return; 724 return;
732 725
@@ -736,6 +729,19 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem,
736 if (!parent || !parent->link_state) 729 if (!parent || !parent->link_state)
737 return; 730 return;
738 731
732 /*
733 * A driver requested that ASPM be disabled on this device, but
734 * if we don't have permission to manage ASPM (e.g., on ACPI
735 * systems we have to observe the FADT ACPI_FADT_NO_ASPM bit and
736 * the _OSC method), we can't honor that request. Windows has
737 * a similar mechanism using "PciASPMOptOut", which is also
738 * ignored in this situation.
739 */
740 if (aspm_disabled && !force) {
741 dev_warn(&pdev->dev, "can't disable ASPM; OS doesn't have ASPM control\n");
742 return;
743 }
744
739 if (sem) 745 if (sem)
740 down_read(&pci_bus_sem); 746 down_read(&pci_bus_sem);
741 mutex_lock(&aspm_lock); 747 mutex_lock(&aspm_lock);
@@ -761,6 +767,15 @@ void pci_disable_link_state_locked(struct pci_dev *pdev, int state)
761} 767}
762EXPORT_SYMBOL(pci_disable_link_state_locked); 768EXPORT_SYMBOL(pci_disable_link_state_locked);
763 769
770/**
771 * pci_disable_link_state - Disable device's link state, so the link will
772 * never enter specific states. Note that if the BIOS didn't grant ASPM
773 * control to the OS, this does nothing because we can't touch the LNKCTL
774 * register.
775 *
776 * @pdev: PCI device
777 * @state: ASPM link state to disable
778 */
764void pci_disable_link_state(struct pci_dev *pdev, int state) 779void pci_disable_link_state(struct pci_dev *pdev, int state)
765{ 780{
766 __pci_disable_link_state(pdev, state, true, false); 781 __pci_disable_link_state(pdev, state, true, false);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 70f10fa3c1b2..fe5b50bd7536 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -170,7 +170,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
170{ 170{
171 u32 l, sz, mask; 171 u32 l, sz, mask;
172 u16 orig_cmd; 172 u16 orig_cmd;
173 struct pci_bus_region region; 173 struct pci_bus_region region, inverted_region;
174 bool bar_too_big = false, bar_disabled = false; 174 bool bar_too_big = false, bar_disabled = false;
175 175
176 mask = type ? PCI_ROM_ADDRESS_MASK : ~0; 176 mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
@@ -250,12 +250,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
250 pci_write_config_dword(dev, pos + 4, 0); 250 pci_write_config_dword(dev, pos + 4, 0);
251 region.start = 0; 251 region.start = 0;
252 region.end = sz64; 252 region.end = sz64;
253 pcibios_bus_to_resource(dev, res, &region);
254 bar_disabled = true; 253 bar_disabled = true;
255 } else { 254 } else {
256 region.start = l64; 255 region.start = l64;
257 region.end = l64 + sz64; 256 region.end = l64 + sz64;
258 pcibios_bus_to_resource(dev, res, &region);
259 } 257 }
260 } else { 258 } else {
261 sz = pci_size(l, sz, mask); 259 sz = pci_size(l, sz, mask);
@@ -265,7 +263,28 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
265 263
266 region.start = l; 264 region.start = l;
267 region.end = l + sz; 265 region.end = l + sz;
268 pcibios_bus_to_resource(dev, res, &region); 266 }
267
268 pcibios_bus_to_resource(dev, res, &region);
269 pcibios_resource_to_bus(dev, &inverted_region, res);
270
271 /*
272 * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is
273 * the corresponding resource address (the physical address used by
274 * the CPU. Converting that resource address back to a bus address
275 * should yield the original BAR value:
276 *
277 * resource_to_bus(bus_to_resource(A)) == A
278 *
279 * If it doesn't, CPU accesses to "bus_to_resource(A)" will not
280 * be claimed by the device.
281 */
282 if (inverted_region.start != region.start) {
283 dev_info(&dev->dev, "reg 0x%x: initial BAR value %pa invalid; forcing reassignment\n",
284 pos, &region.start);
285 res->flags |= IORESOURCE_UNSET;
286 res->end -= res->start;
287 res->start = 0;
269 } 288 }
270 289
271 goto out; 290 goto out;
@@ -278,9 +297,9 @@ out:
278 pci_write_config_word(dev, PCI_COMMAND, orig_cmd); 297 pci_write_config_word(dev, PCI_COMMAND, orig_cmd);
279 298
280 if (bar_too_big) 299 if (bar_too_big)
281 dev_err(&dev->dev, "reg %x: can't handle 64-bit BAR\n", pos); 300 dev_err(&dev->dev, "reg 0x%x: can't handle 64-bit BAR\n", pos);
282 if (res->flags && !bar_disabled) 301 if (res->flags && !bar_disabled)
283 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); 302 dev_printk(KERN_DEBUG, &dev->dev, "reg 0x%x: %pR\n", pos, res);
284 303
285 return (res->flags & IORESOURCE_MEM_64) ? 1 : 0; 304 return (res->flags & IORESOURCE_MEM_64) ? 1 : 0;
286} 305}
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7d68aeebf56b..c3a04026cca8 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1022,6 +1022,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk
1022DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); 1022DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
1023DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode); 1023DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
1024DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode); 1024DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
1025DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
1026DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
1025 1027
1026/* 1028/*
1027 * Serverworks CSB5 IDE does not fully support native mode 1029 * Serverworks CSB5 IDE does not fully support native mode
@@ -2865,6 +2867,31 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata);
2865DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata); 2867DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
2866 2868
2867 2869
2870/*
2871 * Ivytown NTB BAR sizes are misreported by the hardware due to an erratum. To
2872 * work around this, query the size it should be configured to by the device and
2873 * modify the resource end to correspond to this new size.
2874 */
2875static void quirk_intel_ntb(struct pci_dev *dev)
2876{
2877 int rc;
2878 u8 val;
2879
2880 rc = pci_read_config_byte(dev, 0x00D0, &val);
2881 if (rc)
2882 return;
2883
2884 dev->resource[2].end = dev->resource[2].start + ((u64) 1 << val) - 1;
2885
2886 rc = pci_read_config_byte(dev, 0x00D1, &val);
2887 if (rc)
2888 return;
2889
2890 dev->resource[4].end = dev->resource[4].start + ((u64) 1 << val) - 1;
2891}
2892DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e08, quirk_intel_ntb);
2893DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x0e0d, quirk_intel_ntb);
2894
2868static ktime_t fixup_debug_start(struct pci_dev *dev, 2895static ktime_t fixup_debug_start(struct pci_dev *dev,
2869 void (*fn)(struct pci_dev *dev)) 2896 void (*fn)(struct pci_dev *dev))
2870{ 2897{