Commit 1597cacbe39802d86656d1f2e6329895bd2ef531

Authored by Alan Cox
Committed by Greg Kroah-Hartman
1 parent beb7cc8238

PCI: Fix multiple problems with VIA hardware

This patch is designed to fix:
- Disk eating corruptor on KT7 after resume from RAM
- VIA IRQ handling
- VIA fixups for bus lockups after resume from RAM

The core of this is to add a table of resume fixups run at resume time.
We need to do this for a variety of boards and features, but particularly
we need to do this to get various critical VIA fixups done on resume.

The second part of the problem is to handle VIA IRQ number rules which
are a bit odd and need special handling for PIC interrupts. Various
patches broke various boxes and while this one may not be perfect
(hopefully it is) it ensures the workaround is applied to the right
devices only.

From: Jean Delvare <khali@linux-fr.org>

Now that PCI quirks are replayed on software resume, we can safely
re-enable the Asus SMBus unhiding quirk even when software suspend support
is enabled.

[akpm@osdl.org: fix const warning]
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 6 changed files with 144 additions and 63 deletions Side-by-side Diff

arch/i386/pci/fixup.c
... ... @@ -115,7 +115,7 @@
115 115 #define VIA_8363_KL133_REVISION_ID 0x81
116 116 #define VIA_8363_KM133_REVISION_ID 0x84
117 117  
118   -static void __devinit pci_fixup_via_northbridge_bug(struct pci_dev *d)
  118 +static void pci_fixup_via_northbridge_bug(struct pci_dev *d)
119 119 {
120 120 u8 v;
121 121 u8 revision;
... ... @@ -151,6 +151,10 @@
151 151 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug);
152 152 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug);
153 153 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug);
  154 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_via_northbridge_bug);
  155 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug);
  156 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug);
  157 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug);
154 158  
155 159 /*
156 160 * For some reasons Intel decided that certain parts of their
... ... @@ -181,7 +185,7 @@
181 185 * issue another HALT within 80 ns of the initial HALT, the failure condition
182 186 * is avoided.
183 187 */
184   -static void __init pci_fixup_nforce2(struct pci_dev *dev)
  188 +static void pci_fixup_nforce2(struct pci_dev *dev)
185 189 {
186 190 u32 val;
187 191  
... ... @@ -204,6 +208,7 @@
204 208 }
205 209 }
206 210 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2);
  211 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2);
207 212  
208 213 /* Max PCI Express root ports */
209 214 #define MAX_PCIEROOT 6
... ... @@ -419,7 +424,7 @@
419 424 * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device
420 425 * configuration space.
421 426 */
422   -static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev)
  427 +static void pci_early_fixup_cyrix_5530(struct pci_dev *dev)
423 428 {
424 429 u8 r;
425 430 /* clear 'F4 Video Configuration Trap' bit */
... ... @@ -428,5 +433,7 @@
428 433 pci_write_config_byte(dev, 0x42, r);
429 434 }
430 435 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
  436 + pci_early_fixup_cyrix_5530);
  437 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
431 438 pci_early_fixup_cyrix_5530);
drivers/pci/pci-driver.c
... ... @@ -353,6 +353,8 @@
353 353 struct pci_dev * pci_dev = to_pci_dev(dev);
354 354 struct pci_driver * drv = pci_dev->driver;
355 355  
  356 + pci_fixup_device(pci_fixup_resume, pci_dev);
  357 +
356 358 if (drv && drv->resume_early)
357 359 error = drv->resume_early(pci_dev);
358 360 return error;
drivers/pci/quirks.c
... ... @@ -36,7 +36,7 @@
36 36  
37 37 /* Deal with broken BIOS'es that neglect to enable passive release,
38 38 which can cause problems in combination with the 82441FX/PPro MTRRs */
39   -static void __devinit quirk_passive_release(struct pci_dev *dev)
  39 +static void quirk_passive_release(struct pci_dev *dev)
40 40 {
41 41 struct pci_dev *d = NULL;
42 42 unsigned char dlc;
... ... @@ -53,6 +53,7 @@
53 53 }
54 54 }
55 55 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release );
  56 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release );
56 57  
57 58 /* The VIA VP2/VP3/MVP3 seem to have some 'features'. There may be a workaround
58 59 but VIA don't answer queries. If you happen to have good contacts at VIA
... ... @@ -134,7 +135,7 @@
134 135 * Updated based on further information from the site and also on
135 136 * information provided by VIA
136 137 */
137   -static void __devinit quirk_vialatency(struct pci_dev *dev)
  138 +static void quirk_vialatency(struct pci_dev *dev)
138 139 {
139 140 struct pci_dev *p;
140 141 u8 rev;
... ... @@ -185,6 +186,10 @@
185 186 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency );
186 187 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency );
187 188 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency );
  189 +/* Must restore this on a resume from RAM */
  190 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency );
  191 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency );
  192 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency );
188 193  
189 194 /*
190 195 * VIA Apollo VP3 needs ETBF on BT848/878
... ... @@ -532,7 +537,7 @@
532 537 * TODO: When we have device-specific interrupt routers,
533 538 * this code will go away from quirks.
534 539 */
535   -static void __devinit quirk_via_ioapic(struct pci_dev *dev)
  540 +static void quirk_via_ioapic(struct pci_dev *dev)
536 541 {
537 542 u8 tmp;
538 543  
... ... @@ -548,6 +553,7 @@
548 553 pci_write_config_byte (dev, 0x58, tmp);
549 554 }
550 555 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic );
  556 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic );
551 557  
552 558 /*
553 559 * VIA 8237: Some BIOSs don't set the 'Bypass APIC De-Assert Message' Bit.
... ... @@ -555,7 +561,7 @@
555 561 * Set this bit to get rid of cycle wastage.
556 562 * Otherwise uncritical.
557 563 */
558   -static void __devinit quirk_via_vt8237_bypass_apic_deassert(struct pci_dev *dev)
  564 +static void quirk_via_vt8237_bypass_apic_deassert(struct pci_dev *dev)
559 565 {
560 566 u8 misc_control2;
561 567 #define BYPASS_APIC_DEASSERT 8
... ... @@ -567,6 +573,7 @@
567 573 }
568 574 }
569 575 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert);
  576 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert);
570 577  
571 578 /*
572 579 * The AMD io apic can hang the box when an apic irq is masked.
... ... @@ -600,7 +607,7 @@
600 607 #define AMD8131_revB0 0x11
601 608 #define AMD8131_MISC 0x40
602 609 #define AMD8131_NIOAMODE_BIT 0
603   -static void __init quirk_amd_8131_ioapic(struct pci_dev *dev)
  610 +static void quirk_amd_8131_ioapic(struct pci_dev *dev)
604 611 {
605 612 unsigned char revid, tmp;
606 613  
... ... @@ -616,6 +623,7 @@
616 623 }
617 624 }
618 625 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic);
  626 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic);
619 627 #endif /* CONFIG_X86_IO_APIC */
620 628  
621 629  
622 630  
623 631  
624 632  
625 633  
626 634  
627 635  
628 636  
629 637  
630 638  
631 639  
632 640  
... ... @@ -641,65 +649,84 @@
641 649 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_acpi );
642 650 DECLARE_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 652  
658   -static int via_irq_fixup_needed = -1;
659   -
660 653 /*
661   - * As some VIA hardware is available in PCI-card form, we need to restrict
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.
  654 + * VIA bridges which have VLink
665 655 */
666   -static const struct pci_device_id via_irq_fixup_tbl[] = {
667   - {
668   - .vendor = PCI_VENDOR_ID_VIA,
669   - .device = PCI_ANY_ID,
670   - .subvendor = PCI_ANY_ID,
671   - .subdevice = PCI_ANY_ID,
672   - .class = PCI_CLASS_BRIDGE_ISA << 8,
673   - .class_mask = 0xffff00,
674   - },
  656 +
  657 +static const struct pci_device_id via_vlink_fixup_tbl[] = {
  658 + /* Internal devices need IRQ line routing, pre VLink */
  659 + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C686), 0 },
  660 + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8231), 17 },
  661 + /* Devices with VLink */
  662 + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233_0), 17},
  663 + { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233A), 17 },
  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 668 { 0, },
676 669 };
677 670  
678   -static 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 +
  681 +static 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 685 u8 irq, new_irq;
681 686  
682   - if (via_irq_fixup_needed == -1)
683   - via_irq_fixup_needed = pci_dev_present(via_irq_fixup_tbl);
  687 + /* Check if we have VLink and cache the result */
684 688  
685   - if (!via_irq_fixup_needed)
  689 + /* Checked already - no */
  690 + if (dev_lo == -2)
686 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 707 new_irq = dev->irq;
689 708  
690 709 /* Don't quirk interrupts outside the legacy IRQ range */
691 710 if (!new_irq || new_irq > 15)
692 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 721 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
695 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 724 pci_name(dev), irq, new_irq);
698 725 udelay(15); /* unknown if delay really needed */
699 726 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
700 727 }
701 728 }
702   -DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq);
  729 +DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_vlink);
703 730  
704 731 /*
705 732 * VIA VT82C598 has its device ID settable and many BIOSes
706 733  
... ... @@ -720,13 +747,14 @@
720 747 * do this even if the Linux CardBus driver is not loaded, because
721 748 * the Linux i82365 driver does not (and should not) handle CardBus.
722 749 */
723   -static void __devinit quirk_cardbus_legacy(struct pci_dev *dev)
  750 +static void quirk_cardbus_legacy(struct pci_dev *dev)
724 751 {
725 752 if ((PCI_CLASS_BRIDGE_CARDBUS << 8) ^ dev->class)
726 753 return;
727 754 pci_write_config_dword(dev, PCI_CB_LEGACY_MODE_BASE, 0);
728 755 }
729 756 DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
  757 +DECLARE_PCI_FIXUP_RESUME(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy);
730 758  
731 759 /*
732 760 * Following the PCI ordering rules is optional on the AMD762. I'm not
... ... @@ -735,7 +763,7 @@
735 763 * To be fair to AMD, it follows the spec by default, its BIOS people
736 764 * who turn it off!
737 765 */
738   -static void __devinit quirk_amd_ordering(struct pci_dev *dev)
  766 +static void quirk_amd_ordering(struct pci_dev *dev)
739 767 {
740 768 u32 pcic;
741 769 pci_read_config_dword(dev, 0x4C, &pcic);
... ... @@ -749,6 +777,7 @@
749 777 }
750 778 }
751 779 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering );
  780 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering );
752 781  
753 782 /*
754 783 * DreamWorks provided workaround for Dunord I-3000 problem
... ... @@ -784,7 +813,7 @@
784 813 * datasheets found at http://www.national.com/ds/GX for info on what
785 814 * these bits do. <christer@weinigel.se>
786 815 */
787   -static void __init quirk_mediagx_master(struct pci_dev *dev)
  816 +static void quirk_mediagx_master(struct pci_dev *dev)
788 817 {
789 818 u8 reg;
790 819 pci_read_config_byte(dev, 0x41, &reg);
791 820  
... ... @@ -795,13 +824,14 @@
795 824 }
796 825 }
797 826 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master );
  827 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master );
798 828  
799 829 /*
800 830 * Ensure C0 rev restreaming is off. This is normally done by
801 831 * the BIOS but in the odd case it is not the results are corruption
802 832 * hence the presence of a Linux check
803 833 */
804   -static void __init quirk_disable_pxb(struct pci_dev *pdev)
  834 +static void quirk_disable_pxb(struct pci_dev *pdev)
805 835 {
806 836 u16 config;
807 837 u8 rev;
... ... @@ -817,6 +847,7 @@
817 847 }
818 848 }
819 849 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb );
  850 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb );
820 851  
821 852  
822 853 /*
... ... @@ -874,7 +905,7 @@
874 905 * runs everywhere at present we suppress the printk output in most
875 906 * irrelevant cases.
876 907 */
877   -static void __init k8t_sound_hostbridge(struct pci_dev *dev)
  908 +static void k8t_sound_hostbridge(struct pci_dev *dev)
878 909 {
879 910 unsigned char val;
880 911  
881 912  
... ... @@ -893,8 +924,8 @@
893 924 }
894 925 }
895 926 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
  927 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
896 928  
897   -#ifndef CONFIG_ACPI_SLEEP
898 929 /*
899 930 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
900 931 * is not activated. The myth is that Asus said that they do not want the
... ... @@ -906,10 +937,6 @@
906 937 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
907 938 * becomes necessary to do this tweak in two steps -- I've chosen the Host
908 939 * 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 940 */
914 941 static int __initdata asus_hides_smbus;
915 942  
... ... @@ -1019,7 +1046,7 @@
1019 1046 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge );
1020 1047 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82915GM_HB, asus_hides_smbus_hostbridge );
1021 1048  
1022   -static void __init asus_hides_smbus_lpc(struct pci_dev *dev)
  1049 +static void asus_hides_smbus_lpc(struct pci_dev *dev)
1023 1050 {
1024 1051 u16 val;
1025 1052  
1026 1053  
... ... @@ -1042,8 +1069,14 @@
1042 1069 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc );
1043 1070 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc );
1044 1071 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc );
  1072 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, asus_hides_smbus_lpc );
  1073 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, asus_hides_smbus_lpc );
  1074 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, asus_hides_smbus_lpc );
  1075 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc );
  1076 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc );
  1077 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc );
1045 1078  
1046   -static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
  1079 +static void asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
1047 1080 {
1048 1081 u32 val, rcba;
1049 1082 void __iomem *base;
1050 1083  
1051 1084  
... ... @@ -1059,13 +1092,12 @@
1059 1092 printk(KERN_INFO "PCI: Enabled ICH6/i801 SMBus device\n");
1060 1093 }
1061 1094 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 );
  1095 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 );
1062 1096  
1063   -#endif
1064   -
1065 1097 /*
1066 1098 * SiS 96x south bridge: BIOS typically hides SMBus device...
1067 1099 */
1068   -static void __init quirk_sis_96x_smbus(struct pci_dev *dev)
  1100 +static void quirk_sis_96x_smbus(struct pci_dev *dev)
1069 1101 {
1070 1102 u8 val = 0;
1071 1103 printk(KERN_INFO "Enabling SiS 96x SMBus.\n");
... ... @@ -1086,7 +1118,7 @@
1086 1118  
1087 1119 #define SIS_DETECT_REGISTER 0x40
1088 1120  
1089   -static void __init quirk_sis_503(struct pci_dev *dev)
  1121 +static void quirk_sis_503(struct pci_dev *dev)
1090 1122 {
1091 1123 u8 reg;
1092 1124 u16 devid;
1093 1125  
... ... @@ -1122,13 +1154,14 @@
1122 1154 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_735, quirk_sis_96x_compatible );
1123 1155  
1124 1156 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503 );
  1157 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503 );
1125 1158 /*
1126 1159 * On ASUS A8V and A8V Deluxe boards, the onboard AC97 audio controller
1127 1160 * and MC97 modem controller are disabled when a second PCI soundcard is
1128 1161 * present. This patch, tweaking the VT8237 ISA bridge, enables them.
1129 1162 * -- bjd
1130 1163 */
1131   -static void __init asus_hides_ac97_lpc(struct pci_dev *dev)
  1164 +static void asus_hides_ac97_lpc(struct pci_dev *dev)
1132 1165 {
1133 1166 u8 val;
1134 1167 int asus_hides_ac97 = 0;
... ... @@ -1159,6 +1192,14 @@
1159 1192 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus );
1160 1193 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus );
1161 1194  
  1195 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, asus_hides_ac97_lpc );
  1196 +
  1197 +
  1198 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_961, quirk_sis_96x_smbus );
  1199 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_smbus );
  1200 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus );
  1201 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus );
  1202 +
1162 1203 #if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE)
1163 1204  
1164 1205 /*
... ... @@ -1167,7 +1208,7 @@
1167 1208 * the PCI scanning.
1168 1209 */
1169 1210  
1170   -static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev)
  1211 +static void quirk_jmicron_dualfn(struct pci_dev *pdev)
1171 1212 {
1172 1213 u32 conf;
1173 1214 u8 hdr;
... ... @@ -1205,6 +1246,7 @@
1205 1246 }
1206 1247  
1207 1248 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn);
  1249 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn);
1208 1250  
1209 1251 #endif
1210 1252  
... ... @@ -1532,6 +1574,8 @@
1532 1574 extern struct pci_fixup __end_pci_fixups_final[];
1533 1575 extern struct pci_fixup __start_pci_fixups_enable[];
1534 1576 extern struct pci_fixup __end_pci_fixups_enable[];
  1577 +extern struct pci_fixup __start_pci_fixups_resume[];
  1578 +extern struct pci_fixup __end_pci_fixups_resume[];
1535 1579  
1536 1580  
1537 1581 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
... ... @@ -1559,6 +1603,11 @@
1559 1603 end = __end_pci_fixups_enable;
1560 1604 break;
1561 1605  
  1606 + case pci_fixup_resume:
  1607 + start = __start_pci_fixups_resume;
  1608 + end = __end_pci_fixups_resume;
  1609 + break;
  1610 +
1562 1611 default:
1563 1612 /* stupid compiler warning, you would think with an enum... */
1564 1613 return;
... ... @@ -1596,7 +1645,7 @@
1596 1645 * Force it to be linked by setting the corresponding control bit in the
1597 1646 * config space.
1598 1647 */
1599   -static void __devinit quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev)
  1648 +static void quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev)
1600 1649 {
1601 1650 uint8_t b;
1602 1651 if (pci_read_config_byte(dev, 0xf41, &b) == 0) {
... ... @@ -1609,6 +1658,8 @@
1609 1658 }
1610 1659 }
1611 1660 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
  1661 + quirk_nvidia_ck804_pcie_aer_ext_cap);
  1662 +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1612 1663 quirk_nvidia_ck804_pcie_aer_ext_cap);
1613 1664  
1614 1665 #ifdef CONFIG_PCI_MSI
drivers/pci/search.c
... ... @@ -416,7 +416,7 @@
416 416 const struct pci_device_id *pci_find_present(const struct pci_device_id *ids)
417 417 {
418 418 struct pci_dev *dev;
419   - struct pci_device_id * found = NULL;
  419 + const struct pci_device_id *found = NULL;
420 420  
421 421 WARN_ON(in_interrupt());
422 422 down_read(&pci_bus_sem);
... ... @@ -442,7 +442,6 @@
442 442 * find devices that are usually built into a system, or for a general hint as
443 443 * to if another device happens to be present at this specific moment in time.
444 444 */
445   -
446 445 int pci_dev_present(const struct pci_device_id *ids)
447 446 {
448 447 return pci_find_present(ids) == NULL ? 0 : 1;
include/asm-generic/vmlinux.lds.h
... ... @@ -35,6 +35,9 @@
35 35 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
36 36 *(.pci_fixup_enable) \
37 37 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
  38 + VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
  39 + *(.pci_fixup_resume) \
  40 + VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
38 41 } \
39 42 \
40 43 /* RapidIO route ops */ \
... ... @@ -396,6 +396,21 @@
396 396 */
397 397 #define pci_module_init pci_register_driver
398 398  
  399 +/**
  400 + * PCI_VDEVICE - macro used to describe a specific pci device in short form
  401 + * @vend: the vendor name
  402 + * @dev: the 16 bit PCI Device ID
  403 + *
  404 + * This macro is used to create a struct pci_device_id that matches a
  405 + * specific PCI device. The subvendor, and subdevice fields will be set
  406 + * to PCI_ANY_ID. The macro allows the next field to follow as the device
  407 + * private data.
  408 + */
  409 +
  410 +#define PCI_VDEVICE(vendor, device) \
  411 + PCI_VENDOR_ID_##vendor, (device), \
  412 + PCI_ANY_ID, PCI_ANY_ID, 0, 0
  413 +
399 414 /* these external functions are only available when PCI support is enabled */
400 415 #ifdef CONFIG_PCI
401 416  
... ... @@ -787,6 +802,7 @@
787 802 pci_fixup_header, /* After reading configuration header */
788 803 pci_fixup_final, /* Final phase of device fixups */
789 804 pci_fixup_enable, /* pci_enable_device() time */
  805 + pci_fixup_resume, /* pci_enable_device() time */
790 806 };
791 807  
792 808 /* Anonymous variables would be nice... */
... ... @@ -805,6 +821,9 @@
805 821 #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \
806 822 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \
807 823 vendor##device##hook, vendor, device, hook)
  824 +#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
  825 + DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
  826 + resume##vendor##device##hook, vendor, device, hook)
808 827  
809 828  
810 829 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);