1 /* Various workarounds for chipset bugs.
2 This code runs very early and can't use the regular PCI subsystem
3 The entries are keyed to PCI bridges which usually identify chipsets
5 This is only for whole classes of chipsets with specific problems which
6 need early invasive action (e.g. before the timers are initialized).
7 Most PCI device specific workarounds can be done later and should be
9 Mainboard specific bugs should be handled by DMI entries.
10 CPU specific bugs in setup.c */
12 #include <linux/pci.h>
13 #include <linux/acpi.h>
14 #include <linux/pci_ids.h>
15 #include <asm/pci-direct.h>
17 #include <asm/io_apic.h>
21 #include <asm/iommu.h>
24 static void __init
via_bugs(void)
27 if ((end_pfn
> MAX_DMA32_PFN
|| force_iommu
) &&
28 !iommu_aperture_allowed
) {
30 "Looks like a VIA chipset. Disabling IOMMU."
31 " Override with iommu=allowed\n");
32 iommu_aperture_disabled
= 1;
39 static int __init
nvidia_hpet_check(struct acpi_table_header
*header
)
45 static void __init
nvidia_bugs(void)
48 #ifdef CONFIG_X86_IO_APIC
50 * All timer overrides on Nvidia are
51 * wrong unless HPET is enabled.
52 * Unfortunately that's not true on many Asus boards.
53 * We don't know yet how to detect this automatically, but
54 * at least allow a command line override.
56 if (acpi_use_timer_override
)
59 if (acpi_table_parse(ACPI_SIG_HPET
, nvidia_hpet_check
)) {
60 acpi_skip_timer_override
= 1;
61 printk(KERN_INFO
"Nvidia board "
62 "detected. Ignoring ACPI "
64 printk(KERN_INFO
"If you got timer trouble "
65 "try acpi_use_timer_override\n");
69 /* RED-PEN skip them on mptables too? */
73 static void __init
ati_bugs(void)
75 #ifdef CONFIG_X86_IO_APIC
76 if (timer_over_8254
== 1) {
79 "ATI board detected. Disabling timer routing over 8254.\n");
89 static struct chipset early_qrk
[] __initdata
= {
90 { PCI_VENDOR_ID_NVIDIA
, nvidia_bugs
},
91 { PCI_VENDOR_ID_VIA
, via_bugs
},
92 { PCI_VENDOR_ID_ATI
, ati_bugs
},
96 void __init
early_quirks(void)
100 if (!early_pci_allowed())
103 /* Poor man's PCI discovery */
104 for (num
= 0; num
< 32; num
++) {
105 for (slot
= 0; slot
< 32; slot
++) {
106 for (func
= 0; func
< 8; func
++) {
111 class = read_pci_config(num
,slot
,func
,
113 if (class == 0xffffffff)
116 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI
)
119 vendor
= read_pci_config(num
, slot
, func
,
123 for (i
= 0; early_qrk
[i
].f
; i
++)
124 if (early_qrk
[i
].vendor
== vendor
) {
129 type
= read_pci_config_byte(num
, slot
, func
,