aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/quirks.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r--drivers/pci/quirks.c217
1 files changed, 145 insertions, 72 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 9ca9b9bf6160..8f0322d6f3bf 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -36,7 +36,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX,PCI_DEVICE_ID_MELLANOX_TAVOR_BRID
36 36
37/* Deal with broken BIOS'es that neglect to enable passive release, 37/* Deal with broken BIOS'es that neglect to enable passive release,
38 which can cause problems in combination with the 82441FX/PPro MTRRs */ 38 which can cause problems in combination with the 82441FX/PPro MTRRs */
39static void __devinit quirk_passive_release(struct pci_dev *dev) 39static void quirk_passive_release(struct pci_dev *dev)
40{ 40{
41 struct pci_dev *d = NULL; 41 struct pci_dev *d = NULL;
42 unsigned char dlc; 42 unsigned char dlc;
@@ -53,6 +53,7 @@ static void __devinit quirk_passive_release(struct pci_dev *dev)
53 } 53 }
54} 54}
55DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release ); 55DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release );
56DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release );
56 57
57/* The VIA VP2/VP3/MVP3 seem to have some 'features'. There may be a workaround 58/* The VIA VP2/VP3/MVP3 seem to have some 'features'. There may be a workaround
58 but VIA don't answer queries. If you happen to have good contacts at VIA 59 but VIA don't answer queries. If you happen to have good contacts at VIA
@@ -134,7 +135,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82439TX, quir
134 * Updated based on further information from the site and also on 135 * Updated based on further information from the site and also on
135 * information provided by VIA 136 * information provided by VIA
136 */ 137 */
137static void __devinit quirk_vialatency(struct pci_dev *dev) 138static void quirk_vialatency(struct pci_dev *dev)
138{ 139{
139 struct pci_dev *p; 140 struct pci_dev *p;
140 u8 rev; 141 u8 rev;
@@ -185,6 +186,10 @@ exit:
185DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency ); 186DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency );
186DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency ); 187DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency );
187DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency ); 188DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency );
189/* Must restore this on a resume from RAM */
190DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency );
191DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency );
192DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency );
188 193
189/* 194/*
190 * VIA Apollo VP3 needs ETBF on BT848/878 195 * VIA Apollo VP3 needs ETBF on BT848/878
@@ -532,7 +537,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235
532 * TODO: When we have device-specific interrupt routers, 537 * TODO: When we have device-specific interrupt routers,
533 * this code will go away from quirks. 538 * this code will go away from quirks.
534 */ 539 */
535static void __devinit quirk_via_ioapic(struct pci_dev *dev) 540static void quirk_via_ioapic(struct pci_dev *dev)
536{ 541{
537 u8 tmp; 542 u8 tmp;
538 543
@@ -548,6 +553,7 @@ static void __devinit quirk_via_ioapic(struct pci_dev *dev)
548 pci_write_config_byte (dev, 0x58, tmp); 553 pci_write_config_byte (dev, 0x58, tmp);
549} 554}
550DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic ); 555DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic );
556DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic );
551 557
552/* 558/*
553 * VIA 8237: Some BIOSs don't set the 'Bypass APIC De-Assert Message' Bit. 559 * VIA 8237: Some BIOSs don't set the 'Bypass APIC De-Assert Message' Bit.
@@ -555,7 +561,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_i
555 * Set this bit to get rid of cycle wastage. 561 * Set this bit to get rid of cycle wastage.
556 * Otherwise uncritical. 562 * Otherwise uncritical.
557 */ 563 */
558static void __devinit quirk_via_vt8237_bypass_apic_deassert(struct pci_dev *dev) 564static void quirk_via_vt8237_bypass_apic_deassert(struct pci_dev *dev)
559{ 565{
560 u8 misc_control2; 566 u8 misc_control2;
561#define BYPASS_APIC_DEASSERT 8 567#define BYPASS_APIC_DEASSERT 8
@@ -567,6 +573,7 @@ static void __devinit quirk_via_vt8237_bypass_apic_deassert(struct pci_dev *dev)
567 } 573 }
568} 574}
569DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert); 575DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert);
576DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert);
570 577
571/* 578/*
572 * The AMD io apic can hang the box when an apic irq is masked. 579 * The AMD io apic can hang the box when an apic irq is masked.
@@ -600,7 +607,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw );
600#define AMD8131_revB0 0x11 607#define AMD8131_revB0 0x11
601#define AMD8131_MISC 0x40 608#define AMD8131_MISC 0x40
602#define AMD8131_NIOAMODE_BIT 0 609#define AMD8131_NIOAMODE_BIT 0
603static void __init quirk_amd_8131_ioapic(struct pci_dev *dev) 610static void quirk_amd_8131_ioapic(struct pci_dev *dev)
604{ 611{
605 unsigned char revid, tmp; 612 unsigned char revid, tmp;
606 613
@@ -616,6 +623,7 @@ static void __init quirk_amd_8131_ioapic(struct pci_dev *dev)
616 } 623 }
617} 624}
618DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic); 625DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic);
626DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic);
619#endif /* CONFIG_X86_IO_APIC */ 627#endif /* CONFIG_X86_IO_APIC */
620 628
621 629
@@ -641,65 +649,84 @@ static void __devinit quirk_via_acpi(struct pci_dev *d)
641DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_acpi ); 649DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_acpi );
642DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_acpi ); 650DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_acpi );
643 651
644/*
645 * Via 686A/B: The PCI_INTERRUPT_LINE register for the on-chip
646 * devices, USB0/1, AC97, MC97, and ACPI, has an unusual feature:
647 * when written, it makes an internal connection to the PIC.
648 * For these devices, this register is defined to be 4 bits wide.
649 * Normally this is fine. However for IO-APIC motherboards, or
650 * non-x86 architectures (yes Via exists on PPC among other places),
651 * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get
652 * interrupts delivered properly.
653 *
654 * Some of the on-chip devices are actually '586 devices' so they are
655 * listed here.
656 */
657
658static int via_irq_fixup_needed = -1;
659 652
660/* 653/*
661 * As some VIA hardware is available in PCI-card form, we need to restrict 654 * VIA bridges which have VLink
662 * this quirk to VIA PCI hardware built onto VIA-based motherboards only.
663 * We try to locate a VIA southbridge before deciding whether the quirk
664 * should be applied.
665 */ 655 */
666static const struct pci_device_id via_irq_fixup_tbl[] = { 656
667 { 657static const struct pci_device_id via_vlink_fixup_tbl[] = {
668 .vendor = PCI_VENDOR_ID_VIA, 658 /* Internal devices need IRQ line routing, pre VLink */
669 .device = PCI_ANY_ID, 659 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C686), 0 },
670 .subvendor = PCI_ANY_ID, 660 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8231), 17 },
671 .subdevice = PCI_ANY_ID, 661 /* Devices with VLink */
672 .class = PCI_CLASS_BRIDGE_ISA << 8, 662 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233_0), 17},
673 .class_mask = 0xffff00, 663 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233A), 17 },
674 }, 664 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233C_0), 17 },
665 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8235), 16 },
666 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237), 15 },
667 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237A), 15 },
675 { 0, }, 668 { 0, },
676}; 669};
677 670
678static void quirk_via_irq(struct pci_dev *dev) 671/**
672 * quirk_via_vlink - VIA VLink IRQ number update
673 * @dev: PCI device
674 *
675 * If the device we are dealing with is on a PIC IRQ we need to
676 * ensure that the IRQ line register which usually is not relevant
677 * for PCI cards, is actually written so that interrupts get sent
678 * to the right place
679 */
680
681static void quirk_via_vlink(struct pci_dev *dev)
679{ 682{
683 const struct pci_device_id *via_vlink_fixup;
684 static int dev_lo = -1, dev_hi = 18;
680 u8 irq, new_irq; 685 u8 irq, new_irq;
681 686
682 if (via_irq_fixup_needed == -1) 687 /* Check if we have VLink and cache the result */
683 via_irq_fixup_needed = pci_dev_present(via_irq_fixup_tbl);
684 688
685 if (!via_irq_fixup_needed) 689 /* Checked already - no */
690 if (dev_lo == -2)
686 return; 691 return;
687 692
693 /* Not checked - see what bridge we have and find the device
694 ranges */
695
696 if (dev_lo == -1) {
697 via_vlink_fixup = pci_find_present(via_vlink_fixup_tbl);
698 if (via_vlink_fixup == NULL) {
699 dev_lo = -2;
700 return;
701 }
702 dev_lo = via_vlink_fixup->driver_data;
703 /* 82C686 is special - 0/0 */
704 if (dev_lo == 0)
705 dev_hi = 0;
706 }
688 new_irq = dev->irq; 707 new_irq = dev->irq;
689 708
690 /* Don't quirk interrupts outside the legacy IRQ range */ 709 /* Don't quirk interrupts outside the legacy IRQ range */
691 if (!new_irq || new_irq > 15) 710 if (!new_irq || new_irq > 15)
692 return; 711 return;
693 712
713 /* Internal device ? */
714 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) > dev_hi ||
715 PCI_SLOT(dev->devfn) < dev_lo)
716 return;
717
718 /* This is an internal VLink device on a PIC interrupt. The BIOS
719 ought to have set this but may not have, so we redo it */
720
694 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq); 721 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
695 if (new_irq != irq) { 722 if (new_irq != irq) {
696 printk(KERN_INFO "PCI: VIA IRQ fixup for %s, from %d to %d\n", 723 printk(KERN_INFO "PCI: VIA VLink IRQ fixup for %s, from %d to %d\n",
697 pci_name(dev), irq, new_irq); 724 pci_name(dev), irq, new_irq);
698 udelay(15); /* unknown if delay really needed */ 725 udelay(15); /* unknown if delay really needed */
699 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); 726 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
700 } 727 }
701} 728}
702DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq); 729DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_vlink);
703 730
704/* 731/*
705 * VIA VT82C598 has its device ID settable and many BIOSes 732 * VIA VT82C598 has its device ID settable and many BIOSes
@@ -720,13 +747,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt
720 * do this even if the Linux CardBus driver is not loaded, because 747 * do this even if the Linux CardBus driver is not loaded, because
721 * the Linux i82365 driver does not (and should not) handle CardBus. 748 * the Linux i82365 driver does not (and should not) handle CardBus.
722 */ 749 */
723static void __devinit quirk_cardbus_legacy(struct pci_dev *dev) 750static void quirk_cardbus_legacy(struct pci_dev *dev)
724{ 751{
725 if ((PCI_CLASS_BRIDGE_CARDBUS << 8) ^ dev->class) 752 if ((PCI_CLASS_BRIDGE_CARDBUS << 8) ^ dev->class)
726 return; 753 return;
727 pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0); 754 pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0);
728} 755}
729DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy); 756DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
757DECLARE_PCI_FIXUP_RESUME(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
730 758
731/* 759/*
732 * Following the PCI ordering rules is optional on the AMD762. I'm not 760 * Following the PCI ordering rules is optional on the AMD762. I'm not
@@ -735,7 +763,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
735 * To be fair to AMD, it follows the spec by default, its BIOS people 763 * To be fair to AMD, it follows the spec by default, its BIOS people
736 * who turn it off! 764 * who turn it off!
737 */ 765 */
738static void __devinit quirk_amd_ordering(struct pci_dev *dev) 766static void quirk_amd_ordering(struct pci_dev *dev)
739{ 767{
740 u32 pcic; 768 u32 pcic;
741 pci_read_config_dword(dev, 0x4C, &pcic); 769 pci_read_config_dword(dev, 0x4C, &pcic);
@@ -749,6 +777,7 @@ static void __devinit quirk_amd_ordering(struct pci_dev *dev)
749 } 777 }
750} 778}
751DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering ); 779DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering );
780DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering );
752 781
753/* 782/*
754 * DreamWorks provided workaround for Dunord I-3000 problem 783 * DreamWorks provided workaround for Dunord I-3000 problem
@@ -784,7 +813,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge
784 * datasheets found at http://www.national.com/ds/GX for info on what 813 * datasheets found at http://www.national.com/ds/GX for info on what
785 * these bits do. <christer@weinigel.se> 814 * these bits do. <christer@weinigel.se>
786 */ 815 */
787static void __init quirk_mediagx_master(struct pci_dev *dev) 816static void quirk_mediagx_master(struct pci_dev *dev)
788{ 817{
789 u8 reg; 818 u8 reg;
790 pci_read_config_byte(dev, 0x41, &reg); 819 pci_read_config_byte(dev, 0x41, &reg);
@@ -795,13 +824,14 @@ static void __init quirk_mediagx_master(struct pci_dev *dev)
795 } 824 }
796} 825}
797DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master ); 826DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master );
827DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master );
798 828
799/* 829/*
800 * Ensure C0 rev restreaming is off. This is normally done by 830 * Ensure C0 rev restreaming is off. This is normally done by
801 * the BIOS but in the odd case it is not the results are corruption 831 * the BIOS but in the odd case it is not the results are corruption
802 * hence the presence of a Linux check 832 * hence the presence of a Linux check
803 */ 833 */
804static void __init quirk_disable_pxb(struct pci_dev *pdev) 834static void quirk_disable_pxb(struct pci_dev *pdev)
805{ 835{
806 u16 config; 836 u16 config;
807 u8 rev; 837 u8 rev;
@@ -817,7 +847,25 @@ static void __init quirk_disable_pxb(struct pci_dev *pdev)
817 } 847 }
818} 848}
819DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb ); 849DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb );
850DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb );
851
852
853static void __devinit quirk_sb600_sata(struct pci_dev *pdev)
854{
855 /* set sb600 sata to ahci mode */
856 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
857 u8 tmp;
820 858
859 pci_read_config_byte(pdev, 0x40, &tmp);
860 pci_write_config_byte(pdev, 0x40, tmp|1);
861 pci_write_config_byte(pdev, 0x9, 1);
862 pci_write_config_byte(pdev, 0xa, 6);
863 pci_write_config_byte(pdev, 0x40, tmp);
864
865 pdev->class = 0x010601;
866 }
867}
868DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_sb600_sata);
821 869
822/* 870/*
823 * Serverworks CSB5 IDE does not fully support native mode 871 * Serverworks CSB5 IDE does not fully support native mode
@@ -874,7 +922,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_e
874 * runs everywhere at present we suppress the printk output in most 922 * runs everywhere at present we suppress the printk output in most
875 * irrelevant cases. 923 * irrelevant cases.
876 */ 924 */
877static void __init k8t_sound_hostbridge(struct pci_dev *dev) 925static void k8t_sound_hostbridge(struct pci_dev *dev)
878{ 926{
879 unsigned char val; 927 unsigned char val;
880 928
@@ -893,8 +941,8 @@ static void __init k8t_sound_hostbridge(struct pci_dev *dev)
893 } 941 }
894} 942}
895DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); 943DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
944DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
896 945
897#ifndef CONFIG_ACPI_SLEEP
898/* 946/*
899 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge 947 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
900 * is not activated. The myth is that Asus said that they do not want the 948 * is not activated. The myth is that Asus said that they do not want the
@@ -906,10 +954,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho
906 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 954 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
907 * becomes necessary to do this tweak in two steps -- I've chosen the Host 955 * becomes necessary to do this tweak in two steps -- I've chosen the Host
908 * bridge as trigger. 956 * bridge as trigger.
909 *
910 * Actually, leaving it unhidden and not redoing the quirk over suspend2ram
911 * will cause thermal management to break down, and causing machine to
912 * overheat.
913 */ 957 */
914static int __initdata asus_hides_smbus; 958static int __initdata asus_hides_smbus;
915 959
@@ -1019,7 +1063,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855PM_HB, as
1019DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge ); 1063DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge );
1020DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82915GM_HB, asus_hides_smbus_hostbridge ); 1064DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82915GM_HB, asus_hides_smbus_hostbridge );
1021 1065
1022static void __init asus_hides_smbus_lpc(struct pci_dev *dev) 1066static void asus_hides_smbus_lpc(struct pci_dev *dev)
1023{ 1067{
1024 u16 val; 1068 u16 val;
1025 1069
@@ -1042,8 +1086,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, asu
1042DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc ); 1086DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc );
1043DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc ); 1087DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc );
1044DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc ); 1088DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc );
1089DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, asus_hides_smbus_lpc );
1090DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, asus_hides_smbus_lpc );
1091DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, asus_hides_smbus_lpc );
1092DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc );
1093DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc );
1094DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc );
1045 1095
1046static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev) 1096static void asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
1047{ 1097{
1048 u32 val, rcba; 1098 u32 val, rcba;
1049 void __iomem *base; 1099 void __iomem *base;
@@ -1059,13 +1109,12 @@ static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
1059 printk(KERN_INFO "PCI: Enabled ICH6/i801 SMBus device\n"); 1109 printk(KERN_INFO "PCI: Enabled ICH6/i801 SMBus device\n");
1060} 1110}
1061DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); 1111DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 );
1062 1112DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 );
1063#endif
1064 1113
1065/* 1114/*
1066 * SiS 96x south bridge: BIOS typically hides SMBus device... 1115 * SiS 96x south bridge: BIOS typically hides SMBus device...
1067 */ 1116 */
1068static void __init quirk_sis_96x_smbus(struct pci_dev *dev) 1117static void quirk_sis_96x_smbus(struct pci_dev *dev)
1069{ 1118{
1070 u8 val = 0; 1119 u8 val = 0;
1071 printk(KERN_INFO "Enabling SiS 96x SMBus.\n"); 1120 printk(KERN_INFO "Enabling SiS 96x SMBus.\n");
@@ -1086,7 +1135,7 @@ static int __devinitdata sis_96x_compatible = 0;
1086 1135
1087#define SIS_DETECT_REGISTER 0x40 1136#define SIS_DETECT_REGISTER 0x40
1088 1137
1089static void __init quirk_sis_503(struct pci_dev *dev) 1138static void quirk_sis_503(struct pci_dev *dev)
1090{ 1139{
1091 u8 reg; 1140 u8 reg;
1092 u16 devid; 1141 u16 devid;
@@ -1122,13 +1171,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_651, quirk_sis_96x_
1122DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_735, quirk_sis_96x_compatible ); 1171DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_735, quirk_sis_96x_compatible );
1123 1172
1124DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503 ); 1173DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503 );
1174DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503 );
1125/* 1175/*
1126 * On ASUS A8V and A8V Deluxe boards, the onboard AC97 audio controller 1176 * On ASUS A8V and A8V Deluxe boards, the onboard AC97 audio controller
1127 * and MC97 modem controller are disabled when a second PCI soundcard is 1177 * and MC97 modem controller are disabled when a second PCI soundcard is
1128 * present. This patch, tweaking the VT8237 ISA bridge, enables them. 1178 * present. This patch, tweaking the VT8237 ISA bridge, enables them.
1129 * -- bjd 1179 * -- bjd
1130 */ 1180 */
1131static void __init asus_hides_ac97_lpc(struct pci_dev *dev) 1181static void asus_hides_ac97_lpc(struct pci_dev *dev)
1132{ 1182{
1133 u8 val; 1183 u8 val;
1134 int asus_hides_ac97 = 0; 1184 int asus_hides_ac97 = 0;
@@ -1159,6 +1209,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_
1159DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); 1209DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus );
1160DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); 1210DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus );
1161 1211
1212DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, asus_hides_ac97_lpc );
1213
1214
1215DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_961, quirk_sis_96x_smbus );
1216DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_smbus );
1217DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus );
1218DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus );
1219
1162#if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE) 1220#if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE)
1163 1221
1164/* 1222/*
@@ -1167,7 +1225,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_
1167 * the PCI scanning. 1225 * the PCI scanning.
1168 */ 1226 */
1169 1227
1170static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev) 1228static void quirk_jmicron_dualfn(struct pci_dev *pdev)
1171{ 1229{
1172 u32 conf; 1230 u32 conf;
1173 u8 hdr; 1231 u8 hdr;
@@ -1205,6 +1263,7 @@ static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev)
1205} 1263}
1206 1264
1207DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); 1265DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn);
1266DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn);
1208 1267
1209#endif 1268#endif
1210 1269
@@ -1532,6 +1591,8 @@ extern struct pci_fixup __start_pci_fixups_final[];
1532extern struct pci_fixup __end_pci_fixups_final[]; 1591extern struct pci_fixup __end_pci_fixups_final[];
1533extern struct pci_fixup __start_pci_fixups_enable[]; 1592extern struct pci_fixup __start_pci_fixups_enable[];
1534extern struct pci_fixup __end_pci_fixups_enable[]; 1593extern struct pci_fixup __end_pci_fixups_enable[];
1594extern struct pci_fixup __start_pci_fixups_resume[];
1595extern struct pci_fixup __end_pci_fixups_resume[];
1535 1596
1536 1597
1537void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) 1598void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
@@ -1559,6 +1620,11 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
1559 end = __end_pci_fixups_enable; 1620 end = __end_pci_fixups_enable;
1560 break; 1621 break;
1561 1622
1623 case pci_fixup_resume:
1624 start = __start_pci_fixups_resume;
1625 end = __end_pci_fixups_resume;
1626 break;
1627
1562 default: 1628 default:
1563 /* stupid compiler warning, you would think with an enum... */ 1629 /* stupid compiler warning, you would think with an enum... */
1564 return; 1630 return;
@@ -1596,7 +1662,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io);
1596 * Force it to be linked by setting the corresponding control bit in the 1662 * Force it to be linked by setting the corresponding control bit in the
1597 * config space. 1663 * config space.
1598 */ 1664 */
1599static void __devinit quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev) 1665static void quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev)
1600{ 1666{
1601 uint8_t b; 1667 uint8_t b;
1602 if (pci_read_config_byte(dev, 0xf41, &b) == 0) { 1668 if (pci_read_config_byte(dev, 0xf41, &b) == 0) {
@@ -1610,6 +1676,8 @@ static void __devinit quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev)
1610} 1676}
1611DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1677DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1612 quirk_nvidia_ck804_pcie_aer_ext_cap); 1678 quirk_nvidia_ck804_pcie_aer_ext_cap);
1679DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1680 quirk_nvidia_ck804_pcie_aer_ext_cap);
1613 1681
1614#ifdef CONFIG_PCI_MSI 1682#ifdef CONFIG_PCI_MSI
1615/* To disable MSI globally */ 1683/* To disable MSI globally */
@@ -1644,19 +1712,23 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_
1644 * return 1 if a HT MSI capability is found and enabled */ 1712 * return 1 if a HT MSI capability is found and enabled */
1645static int __devinit msi_ht_cap_enabled(struct pci_dev *dev) 1713static int __devinit msi_ht_cap_enabled(struct pci_dev *dev)
1646{ 1714{
1647 u8 pos; 1715 int pos, ttl = 48;
1648 int ttl; 1716
1649 for (pos = pci_find_capability(dev, PCI_CAP_ID_HT), ttl = 48; 1717 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
1650 pos && ttl; 1718 while (pos && ttl--) {
1651 pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_HT), ttl--) { 1719 u8 flags;
1652 u32 cap_hdr; 1720
1653 /* MSI mapping section according to Hypertransport spec */ 1721 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
1654 if (pci_read_config_dword(dev, pos, &cap_hdr) == 0 1722 &flags) == 0)
1655 && (cap_hdr & 0xf8000000) == 0xa8000000 /* MSI mapping */) { 1723 {
1656 printk(KERN_INFO "PCI: Found HT MSI mapping on %s with capability %s\n", 1724 printk(KERN_INFO "PCI: Found %s HT MSI Mapping on %s\n",
1657 pci_name(dev), cap_hdr & 0x10000 ? "enabled" : "disabled"); 1725 flags & HT_MSI_FLAGS_ENABLE ?
1658 return (cap_hdr & 0x10000) != 0; /* MSI mapping cap enabled */ 1726 "enabled" : "disabled", pci_name(dev));
1727 return (flags & HT_MSI_FLAGS_ENABLE) != 0;
1659 } 1728 }
1729
1730 pos = pci_find_next_ht_capability(dev, pos,
1731 HT_CAPTYPE_MSI_MAPPING);
1660 } 1732 }
1661 return 0; 1733 return 0;
1662} 1734}
@@ -1688,8 +1760,9 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1688 * a single one having MSI is enough to be sure that MSI are supported. 1760 * a single one having MSI is enough to be sure that MSI are supported.
1689 */ 1761 */
1690 pdev = pci_get_slot(dev->bus, 0); 1762 pdev = pci_get_slot(dev->bus, 0);
1691 if (dev->subordinate && !msi_ht_cap_enabled(dev) 1763 if (!pdev)
1692 && !msi_ht_cap_enabled(pdev)) { 1764 return;
1765 if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
1693 printk(KERN_WARNING "PCI: MSI quirk detected. " 1766 printk(KERN_WARNING "PCI: MSI quirk detected. "
1694 "MSI disabled on chipset %s.\n", 1767 "MSI disabled on chipset %s.\n",
1695 pci_name(dev)); 1768 pci_name(dev));