diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-12-04 18:14:45 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-20 13:54:43 -0500 |
commit | 1597cacbe39802d86656d1f2e6329895bd2ef531 (patch) | |
tree | 23036b221b31f154118582af7dbc5cd35fc97bc8 | |
parent | beb7cc8238a8334d86c96bf32bf66182db3b619f (diff) |
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>
-rw-r--r-- | arch/i386/pci/fixup.c | 13 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 2 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 167 | ||||
-rw-r--r-- | drivers/pci/search.c | 3 | ||||
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 3 | ||||
-rw-r--r-- | include/linux/pci.h | 19 |
6 files changed, 144 insertions, 63 deletions
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c index cde1170b01a1..8053b17ab647 100644 --- a/arch/i386/pci/fixup.c +++ b/arch/i386/pci/fixup.c | |||
@@ -115,7 +115,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, pci | |||
115 | #define VIA_8363_KL133_REVISION_ID 0x81 | 115 | #define VIA_8363_KL133_REVISION_ID 0x81 |
116 | #define VIA_8363_KM133_REVISION_ID 0x84 | 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 | u8 v; | 120 | u8 v; |
121 | u8 revision; | 121 | u8 revision; |
@@ -151,6 +151,10 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, pci_fixup_ | |||
151 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug); | 151 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8622, pci_fixup_via_northbridge_bug); |
152 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug); | 152 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, pci_fixup_via_northbridge_bug); |
153 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_via_northbridge_bug); | 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 | * For some reasons Intel decided that certain parts of their | 160 | * For some reasons Intel decided that certain parts of their |
@@ -181,7 +185,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_fixup_transparent_ | |||
181 | * issue another HALT within 80 ns of the initial HALT, the failure condition | 185 | * issue another HALT within 80 ns of the initial HALT, the failure condition |
182 | * is avoided. | 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 | u32 val; | 190 | u32 val; |
187 | 191 | ||
@@ -204,6 +208,7 @@ static void __init pci_fixup_nforce2(struct pci_dev *dev) | |||
204 | } | 208 | } |
205 | } | 209 | } |
206 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2, pci_fixup_nforce2); | 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 | /* Max PCI Express root ports */ | 213 | /* Max PCI Express root ports */ |
209 | #define MAX_PCIEROOT 6 | 214 | #define MAX_PCIEROOT 6 |
@@ -419,7 +424,7 @@ DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, | |||
419 | * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device | 424 | * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device |
420 | * configuration space. | 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 | u8 r; | 429 | u8 r; |
425 | /* clear 'F4 Video Configuration Trap' bit */ | 430 | /* clear 'F4 Video Configuration Trap' bit */ |
@@ -429,3 +434,5 @@ static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev) | |||
429 | } | 434 | } |
430 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, | 435 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, |
431 | pci_early_fixup_cyrix_5530); | 436 | pci_early_fixup_cyrix_5530); |
437 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, | ||
438 | pci_early_fixup_cyrix_5530); | ||
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index de5b9011d038..b8d2385e29bc 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -353,6 +353,8 @@ static int pci_device_resume_early(struct device * dev) | |||
353 | struct pci_dev * pci_dev = to_pci_dev(dev); | 353 | struct pci_dev * pci_dev = to_pci_dev(dev); |
354 | struct pci_driver * drv = pci_dev->driver; | 354 | struct pci_driver * drv = pci_dev->driver; |
355 | 355 | ||
356 | pci_fixup_device(pci_fixup_resume, pci_dev); | ||
357 | |||
356 | if (drv && drv->resume_early) | 358 | if (drv && drv->resume_early) |
357 | error = drv->resume_early(pci_dev); | 359 | error = drv->resume_early(pci_dev); |
358 | return error; | 360 | return error; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index cf3e7c0ded3f..30c41fc1c996 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 */ |
39 | static void __devinit quirk_passive_release(struct pci_dev *dev) | 39 | static 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 | } |
55 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441, quirk_passive_release ); | 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 | /* 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 | */ |
137 | static void __devinit quirk_vialatency(struct pci_dev *dev) | 138 | static 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: | |||
185 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency ); | 186 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8363_0, quirk_vialatency ); |
186 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency ); | 187 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8371_1, quirk_vialatency ); |
187 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8361, quirk_vialatency ); | 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 | * 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 | */ |
535 | static void __devinit quirk_via_ioapic(struct pci_dev *dev) | 540 | static 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 | } |
550 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_ioapic ); | 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 | * 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 | */ |
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 | 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 | } |
569 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_vt8237_bypass_apic_deassert); | 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 | * 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 |
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 | 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 | } |
618 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic); | 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 | #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) | |||
641 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_acpi ); | 649 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_acpi ); |
642 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_acpi ); | 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 | |||
658 | static 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 | */ |
666 | static const struct pci_device_id via_irq_fixup_tbl[] = { | 656 | |
667 | { | 657 | static 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 | ||
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 | 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 | } |
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 | * 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 | */ |
723 | static void __devinit quirk_cardbus_legacy(struct pci_dev *dev) | 750 | static 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 | } |
729 | DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, quirk_cardbus_legacy); | 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 | * 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 | */ |
738 | static void __devinit quirk_amd_ordering(struct pci_dev *dev) | 766 | static 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 | } |
751 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_700C, quirk_amd_ordering ); | 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 | * 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 | */ |
787 | static void __init quirk_mediagx_master(struct pci_dev *dev) | 816 | static void quirk_mediagx_master(struct pci_dev *dev) |
788 | { | 817 | { |
789 | u8 reg; | 818 | u8 reg; |
790 | pci_read_config_byte(dev, 0x41, ®); | 819 | pci_read_config_byte(dev, 0x41, ®); |
@@ -795,13 +824,14 @@ static void __init quirk_mediagx_master(struct pci_dev *dev) | |||
795 | } | 824 | } |
796 | } | 825 | } |
797 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master ); | 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 | * 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 | */ |
804 | static void __init quirk_disable_pxb(struct pci_dev *pdev) | 834 | static void quirk_disable_pxb(struct pci_dev *pdev) |
805 | { | 835 | { |
806 | u16 config; | 836 | u16 config; |
807 | u8 rev; | 837 | u8 rev; |
@@ -817,6 +847,7 @@ static void __init quirk_disable_pxb(struct pci_dev *pdev) | |||
817 | } | 847 | } |
818 | } | 848 | } |
819 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb ); | 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 @@ 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 | 905 | * runs everywhere at present we suppress the printk output in most |
875 | * irrelevant cases. | 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 | unsigned char val; | 910 | unsigned char val; |
880 | 911 | ||
@@ -893,8 +924,8 @@ static void __init k8t_sound_hostbridge(struct pci_dev *dev) | |||
893 | } | 924 | } |
894 | } | 925 | } |
895 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); | 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 | * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge | 930 | * 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 | 931 | * is not activated. The myth is that Asus said that they do not want the |
@@ -906,10 +937,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 | 937 | * 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 | 938 | * becomes necessary to do this tweak in two steps -- I've chosen the Host |
908 | * bridge as trigger. | 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 | static int __initdata asus_hides_smbus; | 941 | static int __initdata asus_hides_smbus; |
915 | 942 | ||
@@ -1019,7 +1046,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855PM_HB, as | |||
1019 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge ); | 1046 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge ); |
1020 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82915GM_HB, asus_hides_smbus_hostbridge ); | 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 | u16 val; | 1051 | u16 val; |
1025 | 1052 | ||
@@ -1042,8 +1069,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, asu | |||
1042 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc ); | 1069 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, asus_hides_smbus_lpc ); |
1043 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc ); | 1070 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc ); |
1044 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, asus_hides_smbus_lpc ); | 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 | u32 val, rcba; | 1081 | u32 val, rcba; |
1049 | void __iomem *base; | 1082 | void __iomem *base; |
@@ -1059,13 +1092,12 @@ static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev) | |||
1059 | printk(KERN_INFO "PCI: Enabled ICH6/i801 SMBus device\n"); | 1092 | printk(KERN_INFO "PCI: Enabled ICH6/i801 SMBus device\n"); |
1060 | } | 1093 | } |
1061 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); | 1094 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); |
1062 | 1095 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); | |
1063 | #endif | ||
1064 | 1096 | ||
1065 | /* | 1097 | /* |
1066 | * SiS 96x south bridge: BIOS typically hides SMBus device... | 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 | u8 val = 0; | 1102 | u8 val = 0; |
1071 | printk(KERN_INFO "Enabling SiS 96x SMBus.\n"); | 1103 | printk(KERN_INFO "Enabling SiS 96x SMBus.\n"); |
@@ -1086,7 +1118,7 @@ static int __devinitdata sis_96x_compatible = 0; | |||
1086 | 1118 | ||
1087 | #define SIS_DETECT_REGISTER 0x40 | 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 | u8 reg; | 1123 | u8 reg; |
1092 | u16 devid; | 1124 | u16 devid; |
@@ -1122,13 +1154,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_651, quirk_sis_96x_ | |||
1122 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_735, quirk_sis_96x_compatible ); | 1154 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_735, quirk_sis_96x_compatible ); |
1123 | 1155 | ||
1124 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503, quirk_sis_503 ); | 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 | * On ASUS A8V and A8V Deluxe boards, the onboard AC97 audio controller | 1159 | * 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 | 1160 | * and MC97 modem controller are disabled when a second PCI soundcard is |
1128 | * present. This patch, tweaking the VT8237 ISA bridge, enables them. | 1161 | * present. This patch, tweaking the VT8237 ISA bridge, enables them. |
1129 | * -- bjd | 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 | u8 val; | 1166 | u8 val; |
1134 | int asus_hides_ac97 = 0; | 1167 | int asus_hides_ac97 = 0; |
@@ -1159,6 +1192,14 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_ | |||
1159 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); | 1192 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); |
1160 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); | 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 | #if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE) | 1203 | #if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE) |
1163 | 1204 | ||
1164 | /* | 1205 | /* |
@@ -1167,7 +1208,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_ | |||
1167 | * the PCI scanning. | 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 | u32 conf; | 1213 | u32 conf; |
1173 | u8 hdr; | 1214 | u8 hdr; |
@@ -1205,6 +1246,7 @@ static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev) | |||
1205 | } | 1246 | } |
1206 | 1247 | ||
1207 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); | 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 | #endif | 1251 | #endif |
1210 | 1252 | ||
@@ -1532,6 +1574,8 @@ extern struct pci_fixup __start_pci_fixups_final[]; | |||
1532 | extern struct pci_fixup __end_pci_fixups_final[]; | 1574 | extern struct pci_fixup __end_pci_fixups_final[]; |
1533 | extern struct pci_fixup __start_pci_fixups_enable[]; | 1575 | extern struct pci_fixup __start_pci_fixups_enable[]; |
1534 | extern struct pci_fixup __end_pci_fixups_enable[]; | 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 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | 1581 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) |
@@ -1559,6 +1603,11 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | |||
1559 | end = __end_pci_fixups_enable; | 1603 | end = __end_pci_fixups_enable; |
1560 | break; | 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 | default: | 1611 | default: |
1563 | /* stupid compiler warning, you would think with an enum... */ | 1612 | /* stupid compiler warning, you would think with an enum... */ |
1564 | return; | 1613 | return; |
@@ -1596,7 +1645,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 | 1645 | * Force it to be linked by setting the corresponding control bit in the |
1597 | * config space. | 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 | uint8_t b; | 1650 | uint8_t b; |
1602 | if (pci_read_config_byte(dev, 0xf41, &b) == 0) { | 1651 | if (pci_read_config_byte(dev, 0xf41, &b) == 0) { |
@@ -1610,6 +1659,8 @@ static void __devinit quirk_nvidia_ck804_pcie_aer_ext_cap(struct pci_dev *dev) | |||
1610 | } | 1659 | } |
1611 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | 1660 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, |
1612 | quirk_nvidia_ck804_pcie_aer_ext_cap); | 1661 | quirk_nvidia_ck804_pcie_aer_ext_cap); |
1662 | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | ||
1663 | quirk_nvidia_ck804_pcie_aer_ext_cap); | ||
1613 | 1664 | ||
1614 | #ifdef CONFIG_PCI_MSI | 1665 | #ifdef CONFIG_PCI_MSI |
1615 | /* To disable MSI globally */ | 1666 | /* To disable MSI globally */ |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 2bbafe0f79b1..45f2b20ef513 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -416,7 +416,7 @@ exit: | |||
416 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) | 416 | const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) |
417 | { | 417 | { |
418 | struct pci_dev *dev; | 418 | struct pci_dev *dev; |
419 | struct pci_device_id * found = NULL; | 419 | const struct pci_device_id *found = NULL; |
420 | 420 | ||
421 | WARN_ON(in_interrupt()); | 421 | WARN_ON(in_interrupt()); |
422 | down_read(&pci_bus_sem); | 422 | down_read(&pci_bus_sem); |
@@ -442,7 +442,6 @@ const struct pci_device_id *pci_find_present(const struct pci_device_id *ids) | |||
442 | * find devices that are usually built into a system, or for a general hint as | 442 | * find devices that are usually built into a system, or for a general hint as |
443 | * to if another device happens to be present at this specific moment in time. | 443 | * to if another device happens to be present at this specific moment in time. |
444 | */ | 444 | */ |
445 | |||
446 | int pci_dev_present(const struct pci_device_id *ids) | 445 | int pci_dev_present(const struct pci_device_id *ids) |
447 | { | 446 | { |
448 | return pci_find_present(ids) == NULL ? 0 : 1; | 447 | return pci_find_present(ids) == NULL ? 0 : 1; |
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 1587121730c5..9fcc8d9fbb14 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -35,6 +35,9 @@ | |||
35 | VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ | 35 | VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ |
36 | *(.pci_fixup_enable) \ | 36 | *(.pci_fixup_enable) \ |
37 | VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ | 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 | /* RapidIO route ops */ \ | 43 | /* RapidIO route ops */ \ |
diff --git a/include/linux/pci.h b/include/linux/pci.h index b20ffb65300f..c1a2bc8e09de 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -396,6 +396,21 @@ struct pci_driver { | |||
396 | */ | 396 | */ |
397 | #define pci_module_init pci_register_driver | 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 | /* these external functions are only available when PCI support is enabled */ | 414 | /* these external functions are only available when PCI support is enabled */ |
400 | #ifdef CONFIG_PCI | 415 | #ifdef CONFIG_PCI |
401 | 416 | ||
@@ -787,6 +802,7 @@ enum pci_fixup_pass { | |||
787 | pci_fixup_header, /* After reading configuration header */ | 802 | pci_fixup_header, /* After reading configuration header */ |
788 | pci_fixup_final, /* Final phase of device fixups */ | 803 | pci_fixup_final, /* Final phase of device fixups */ |
789 | pci_fixup_enable, /* pci_enable_device() time */ | 804 | pci_fixup_enable, /* pci_enable_device() time */ |
805 | pci_fixup_resume, /* pci_enable_device() time */ | ||
790 | }; | 806 | }; |
791 | 807 | ||
792 | /* Anonymous variables would be nice... */ | 808 | /* Anonymous variables would be nice... */ |
@@ -805,6 +821,9 @@ enum pci_fixup_pass { | |||
805 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ | 821 | #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ |
806 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ | 822 | DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ |
807 | vendor##device##hook, vendor, device, hook) | 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 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 829 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |