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>
16 #include <asm/proto.h>
19 static void via_bugs(void)
22 if ((end_pfn
> MAX_DMA32_PFN
|| force_iommu
) &&
23 !iommu_aperture_allowed
) {
25 "Looks like a VIA chipset. Disabling IOMMU. Override with iommu=allowed\n");
26 iommu_aperture_disabled
= 1;
33 static int nvidia_hpet_detected __initdata
;
35 static int __init
nvidia_hpet_check(unsigned long phys
, unsigned long size
)
37 nvidia_hpet_detected
= 1;
42 static void nvidia_bugs(void)
46 * All timer overrides on Nvidia are
47 * wrong unless HPET is enabled.
48 * Unfortunately that's not true on many Asus boards.
49 * We don't know yet how to detect this automatically, but
50 * at least allow a command line override.
52 if (acpi_use_timer_override
)
55 nvidia_hpet_detected
= 0;
56 acpi_table_parse(ACPI_HPET
, nvidia_hpet_check
);
57 if (nvidia_hpet_detected
== 0) {
58 acpi_skip_timer_override
= 1;
59 printk(KERN_INFO
"Nvidia board "
60 "detected. Ignoring ACPI "
62 printk(KERN_INFO
"If you got timer trouble "
63 "try acpi_use_timer_override\n");
66 /* RED-PEN skip them on mptables too? */
70 static void ati_bugs(void)
72 if (timer_over_8254
== 1) {
75 "ATI board detected. Disabling timer routing over 8254.\n");
84 static struct chipset early_qrk
[] = {
85 { PCI_VENDOR_ID_NVIDIA
, nvidia_bugs
},
86 { PCI_VENDOR_ID_VIA
, via_bugs
},
87 { PCI_VENDOR_ID_ATI
, ati_bugs
},
91 void __init
early_quirks(void)
95 if (!early_pci_allowed())
98 /* Poor man's PCI discovery */
99 for (num
= 0; num
< 32; num
++) {
100 for (slot
= 0; slot
< 32; slot
++) {
101 for (func
= 0; func
< 8; func
++) {
106 class = read_pci_config(num
,slot
,func
,
108 if (class == 0xffffffff)
111 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI
)
114 vendor
= read_pci_config(num
, slot
, func
,
118 for (i
= 0; early_qrk
[i
].f
; i
++)
119 if (early_qrk
[i
].vendor
== vendor
) {
124 type
= read_pci_config_byte(num
, slot
, func
,