diff options
-rw-r--r-- | drivers/pci/quirks.c | 121 | ||||
-rw-r--r-- | drivers/pci/vpd.c | 120 |
2 files changed, 120 insertions, 121 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index fc734014206f..fbe1127086c8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1967,31 +1967,6 @@ static void quirk_netmos(struct pci_dev *dev) | |||
1967 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, | 1967 | DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, |
1968 | PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos); | 1968 | PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos); |
1969 | 1969 | ||
1970 | /* | ||
1971 | * Quirk non-zero PCI functions to route VPD access through function 0 for | ||
1972 | * devices that share VPD resources between functions. The functions are | ||
1973 | * expected to be identical devices. | ||
1974 | */ | ||
1975 | static void quirk_f0_vpd_link(struct pci_dev *dev) | ||
1976 | { | ||
1977 | struct pci_dev *f0; | ||
1978 | |||
1979 | if (!PCI_FUNC(dev->devfn)) | ||
1980 | return; | ||
1981 | |||
1982 | f0 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | ||
1983 | if (!f0) | ||
1984 | return; | ||
1985 | |||
1986 | if (f0->vpd && dev->class == f0->class && | ||
1987 | dev->vendor == f0->vendor && dev->device == f0->device) | ||
1988 | dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0; | ||
1989 | |||
1990 | pci_dev_put(f0); | ||
1991 | } | ||
1992 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, | ||
1993 | PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link); | ||
1994 | |||
1995 | static void quirk_e100_interrupt(struct pci_dev *dev) | 1970 | static void quirk_e100_interrupt(struct pci_dev *dev) |
1996 | { | 1971 | { |
1997 | u16 command, pmcsr; | 1972 | u16 command, pmcsr; |
@@ -2182,83 +2157,6 @@ static void quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) | |||
2182 | } | 2157 | } |
2183 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); | 2158 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); |
2184 | 2159 | ||
2185 | /* | ||
2186 | * If a device follows the VPD format spec, the PCI core will not read or | ||
2187 | * write past the VPD End Tag. But some vendors do not follow the VPD | ||
2188 | * format spec, so we can't tell how much data is safe to access. Devices | ||
2189 | * may behave unpredictably if we access too much. Blacklist these devices | ||
2190 | * so we don't touch VPD at all. | ||
2191 | */ | ||
2192 | static void quirk_blacklist_vpd(struct pci_dev *dev) | ||
2193 | { | ||
2194 | if (dev->vpd) { | ||
2195 | dev->vpd->len = 0; | ||
2196 | pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n"); | ||
2197 | } | ||
2198 | } | ||
2199 | |||
2200 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, quirk_blacklist_vpd); | ||
2201 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, quirk_blacklist_vpd); | ||
2202 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0413, quirk_blacklist_vpd); | ||
2203 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0078, quirk_blacklist_vpd); | ||
2204 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0079, quirk_blacklist_vpd); | ||
2205 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0073, quirk_blacklist_vpd); | ||
2206 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0071, quirk_blacklist_vpd); | ||
2207 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005b, quirk_blacklist_vpd); | ||
2208 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x002f, quirk_blacklist_vpd); | ||
2209 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd); | ||
2210 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd); | ||
2211 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID, | ||
2212 | quirk_blacklist_vpd); | ||
2213 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd); | ||
2214 | |||
2215 | /* | ||
2216 | * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the | ||
2217 | * VPD end tag will hang the device. This problem was initially | ||
2218 | * observed when a vpd entry was created in sysfs | ||
2219 | * ('/sys/bus/pci/devices/<id>/vpd'). A read to this sysfs entry | ||
2220 | * will dump 32k of data. Reading a full 32k will cause an access | ||
2221 | * beyond the VPD end tag causing the device to hang. Once the device | ||
2222 | * is hung, the bnx2 driver will not be able to reset the device. | ||
2223 | * We believe that it is legal to read beyond the end tag and | ||
2224 | * therefore the solution is to limit the read/write length. | ||
2225 | */ | ||
2226 | static void quirk_brcm_570x_limit_vpd(struct pci_dev *dev) | ||
2227 | { | ||
2228 | /* | ||
2229 | * Only disable the VPD capability for 5706, 5706S, 5708, | ||
2230 | * 5708S and 5709 rev. A | ||
2231 | */ | ||
2232 | if ((dev->device == PCI_DEVICE_ID_NX2_5706) || | ||
2233 | (dev->device == PCI_DEVICE_ID_NX2_5706S) || | ||
2234 | (dev->device == PCI_DEVICE_ID_NX2_5708) || | ||
2235 | (dev->device == PCI_DEVICE_ID_NX2_5708S) || | ||
2236 | ((dev->device == PCI_DEVICE_ID_NX2_5709) && | ||
2237 | (dev->revision & 0xf0) == 0x0)) { | ||
2238 | if (dev->vpd) | ||
2239 | dev->vpd->len = 0x80; | ||
2240 | } | ||
2241 | } | ||
2242 | |||
2243 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
2244 | PCI_DEVICE_ID_NX2_5706, | ||
2245 | quirk_brcm_570x_limit_vpd); | ||
2246 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
2247 | PCI_DEVICE_ID_NX2_5706S, | ||
2248 | quirk_brcm_570x_limit_vpd); | ||
2249 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
2250 | PCI_DEVICE_ID_NX2_5708, | ||
2251 | quirk_brcm_570x_limit_vpd); | ||
2252 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
2253 | PCI_DEVICE_ID_NX2_5708S, | ||
2254 | quirk_brcm_570x_limit_vpd); | ||
2255 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
2256 | PCI_DEVICE_ID_NX2_5709, | ||
2257 | quirk_brcm_570x_limit_vpd); | ||
2258 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
2259 | PCI_DEVICE_ID_NX2_5709S, | ||
2260 | quirk_brcm_570x_limit_vpd); | ||
2261 | |||
2262 | static void quirk_brcm_5719_limit_mrrs(struct pci_dev *dev) | 2160 | static void quirk_brcm_5719_limit_mrrs(struct pci_dev *dev) |
2263 | { | 2161 | { |
2264 | u32 rev; | 2162 | u32 rev; |
@@ -3417,25 +3315,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C | |||
3417 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE, | 3315 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE, |
3418 | quirk_thunderbolt_hotplug_msi); | 3316 | quirk_thunderbolt_hotplug_msi); |
3419 | 3317 | ||
3420 | static void quirk_chelsio_extend_vpd(struct pci_dev *dev) | ||
3421 | { | ||
3422 | pci_set_vpd_size(dev, 8192); | ||
3423 | } | ||
3424 | |||
3425 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x20, quirk_chelsio_extend_vpd); | ||
3426 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x21, quirk_chelsio_extend_vpd); | ||
3427 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x22, quirk_chelsio_extend_vpd); | ||
3428 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x23, quirk_chelsio_extend_vpd); | ||
3429 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x24, quirk_chelsio_extend_vpd); | ||
3430 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x25, quirk_chelsio_extend_vpd); | ||
3431 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x26, quirk_chelsio_extend_vpd); | ||
3432 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x30, quirk_chelsio_extend_vpd); | ||
3433 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x31, quirk_chelsio_extend_vpd); | ||
3434 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x32, quirk_chelsio_extend_vpd); | ||
3435 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x35, quirk_chelsio_extend_vpd); | ||
3436 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x36, quirk_chelsio_extend_vpd); | ||
3437 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x37, quirk_chelsio_extend_vpd); | ||
3438 | |||
3439 | #ifdef CONFIG_ACPI | 3318 | #ifdef CONFIG_ACPI |
3440 | /* | 3319 | /* |
3441 | * Apple: Shutdown Cactus Ridge Thunderbolt controller. | 3320 | * Apple: Shutdown Cactus Ridge Thunderbolt controller. |
diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c index 55477f24d8b9..901b0bedcc5d 100644 --- a/drivers/pci/vpd.c +++ b/drivers/pci/vpd.c | |||
@@ -497,3 +497,123 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, | |||
497 | return -ENOENT; | 497 | return -ENOENT; |
498 | } | 498 | } |
499 | EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword); | 499 | EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword); |
500 | |||
501 | #ifdef CONFIG_PCI_QUIRKS | ||
502 | /* | ||
503 | * Quirk non-zero PCI functions to route VPD access through function 0 for | ||
504 | * devices that share VPD resources between functions. The functions are | ||
505 | * expected to be identical devices. | ||
506 | */ | ||
507 | static void quirk_f0_vpd_link(struct pci_dev *dev) | ||
508 | { | ||
509 | struct pci_dev *f0; | ||
510 | |||
511 | if (!PCI_FUNC(dev->devfn)) | ||
512 | return; | ||
513 | |||
514 | f0 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | ||
515 | if (!f0) | ||
516 | return; | ||
517 | |||
518 | if (f0->vpd && dev->class == f0->class && | ||
519 | dev->vendor == f0->vendor && dev->device == f0->device) | ||
520 | dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0; | ||
521 | |||
522 | pci_dev_put(f0); | ||
523 | } | ||
524 | DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, | ||
525 | PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link); | ||
526 | |||
527 | /* | ||
528 | * If a device follows the VPD format spec, the PCI core will not read or | ||
529 | * write past the VPD End Tag. But some vendors do not follow the VPD | ||
530 | * format spec, so we can't tell how much data is safe to access. Devices | ||
531 | * may behave unpredictably if we access too much. Blacklist these devices | ||
532 | * so we don't touch VPD at all. | ||
533 | */ | ||
534 | static void quirk_blacklist_vpd(struct pci_dev *dev) | ||
535 | { | ||
536 | if (dev->vpd) { | ||
537 | dev->vpd->len = 0; | ||
538 | pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n"); | ||
539 | } | ||
540 | } | ||
541 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, quirk_blacklist_vpd); | ||
542 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, quirk_blacklist_vpd); | ||
543 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0413, quirk_blacklist_vpd); | ||
544 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0078, quirk_blacklist_vpd); | ||
545 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0079, quirk_blacklist_vpd); | ||
546 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0073, quirk_blacklist_vpd); | ||
547 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0071, quirk_blacklist_vpd); | ||
548 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005b, quirk_blacklist_vpd); | ||
549 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x002f, quirk_blacklist_vpd); | ||
550 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd); | ||
551 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd); | ||
552 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID, | ||
553 | quirk_blacklist_vpd); | ||
554 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd); | ||
555 | |||
556 | /* | ||
557 | * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the | ||
558 | * VPD end tag will hang the device. This problem was initially | ||
559 | * observed when a vpd entry was created in sysfs | ||
560 | * ('/sys/bus/pci/devices/<id>/vpd'). A read to this sysfs entry | ||
561 | * will dump 32k of data. Reading a full 32k will cause an access | ||
562 | * beyond the VPD end tag causing the device to hang. Once the device | ||
563 | * is hung, the bnx2 driver will not be able to reset the device. | ||
564 | * We believe that it is legal to read beyond the end tag and | ||
565 | * therefore the solution is to limit the read/write length. | ||
566 | */ | ||
567 | static void quirk_brcm_570x_limit_vpd(struct pci_dev *dev) | ||
568 | { | ||
569 | /* | ||
570 | * Only disable the VPD capability for 5706, 5706S, 5708, | ||
571 | * 5708S and 5709 rev. A | ||
572 | */ | ||
573 | if ((dev->device == PCI_DEVICE_ID_NX2_5706) || | ||
574 | (dev->device == PCI_DEVICE_ID_NX2_5706S) || | ||
575 | (dev->device == PCI_DEVICE_ID_NX2_5708) || | ||
576 | (dev->device == PCI_DEVICE_ID_NX2_5708S) || | ||
577 | ((dev->device == PCI_DEVICE_ID_NX2_5709) && | ||
578 | (dev->revision & 0xf0) == 0x0)) { | ||
579 | if (dev->vpd) | ||
580 | dev->vpd->len = 0x80; | ||
581 | } | ||
582 | } | ||
583 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
584 | PCI_DEVICE_ID_NX2_5706, | ||
585 | quirk_brcm_570x_limit_vpd); | ||
586 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
587 | PCI_DEVICE_ID_NX2_5706S, | ||
588 | quirk_brcm_570x_limit_vpd); | ||
589 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
590 | PCI_DEVICE_ID_NX2_5708, | ||
591 | quirk_brcm_570x_limit_vpd); | ||
592 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
593 | PCI_DEVICE_ID_NX2_5708S, | ||
594 | quirk_brcm_570x_limit_vpd); | ||
595 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
596 | PCI_DEVICE_ID_NX2_5709, | ||
597 | quirk_brcm_570x_limit_vpd); | ||
598 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM, | ||
599 | PCI_DEVICE_ID_NX2_5709S, | ||
600 | quirk_brcm_570x_limit_vpd); | ||
601 | |||
602 | static void quirk_chelsio_extend_vpd(struct pci_dev *dev) | ||
603 | { | ||
604 | pci_set_vpd_size(dev, 8192); | ||
605 | } | ||
606 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x20, quirk_chelsio_extend_vpd); | ||
607 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x21, quirk_chelsio_extend_vpd); | ||
608 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x22, quirk_chelsio_extend_vpd); | ||
609 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x23, quirk_chelsio_extend_vpd); | ||
610 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x24, quirk_chelsio_extend_vpd); | ||
611 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x25, quirk_chelsio_extend_vpd); | ||
612 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x26, quirk_chelsio_extend_vpd); | ||
613 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x30, quirk_chelsio_extend_vpd); | ||
614 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x31, quirk_chelsio_extend_vpd); | ||
615 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x32, quirk_chelsio_extend_vpd); | ||
616 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x35, quirk_chelsio_extend_vpd); | ||
617 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x36, quirk_chelsio_extend_vpd); | ||
618 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x37, quirk_chelsio_extend_vpd); | ||
619 | #endif | ||