aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/early-quirks.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/early-quirks.c')
-rw-r--r--arch/x86/kernel/early-quirks.c100
1 files changed, 83 insertions, 17 deletions
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 9f51e1ea9e82..733c4f8d42ea 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -16,10 +16,7 @@
16#include <asm/dma.h> 16#include <asm/dma.h>
17#include <asm/io_apic.h> 17#include <asm/io_apic.h>
18#include <asm/apic.h> 18#include <asm/apic.h>
19 19#include <asm/iommu.h>
20#ifdef CONFIG_GART_IOMMU
21#include <asm/gart.h>
22#endif
23 20
24static void __init fix_hypertransport_config(int num, int slot, int func) 21static void __init fix_hypertransport_config(int num, int slot, int func)
25{ 22{
@@ -50,7 +47,7 @@ static void __init fix_hypertransport_config(int num, int slot, int func)
50static void __init via_bugs(int num, int slot, int func) 47static void __init via_bugs(int num, int slot, int func)
51{ 48{
52#ifdef CONFIG_GART_IOMMU 49#ifdef CONFIG_GART_IOMMU
53 if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 50 if ((max_pfn > MAX_DMA32_PFN || force_iommu) &&
54 !gart_iommu_aperture_allowed) { 51 !gart_iommu_aperture_allowed) {
55 printk(KERN_INFO 52 printk(KERN_INFO
56 "Looks like a VIA chipset. Disabling IOMMU." 53 "Looks like a VIA chipset. Disabling IOMMU."
@@ -98,17 +95,66 @@ static void __init nvidia_bugs(int num, int slot, int func)
98 95
99} 96}
100 97
98static u32 ati_ixp4x0_rev(int num, int slot, int func)
99{
100 u32 d;
101 u8 b;
102
103 b = read_pci_config_byte(num, slot, func, 0xac);
104 b &= ~(1<<5);
105 write_pci_config_byte(num, slot, func, 0xac, b);
106
107 d = read_pci_config(num, slot, func, 0x70);
108 d |= 1<<8;
109 write_pci_config(num, slot, func, 0x70, d);
110
111 d = read_pci_config(num, slot, func, 0x8);
112 d &= 0xff;
113 return d;
114}
115
101static void __init ati_bugs(int num, int slot, int func) 116static void __init ati_bugs(int num, int slot, int func)
102{ 117{
103#ifdef CONFIG_X86_IO_APIC 118#if defined(CONFIG_ACPI) && defined (CONFIG_X86_IO_APIC)
104 if (timer_over_8254 == 1) { 119 u32 d;
105 timer_over_8254 = 0; 120 u8 b;
106 printk(KERN_INFO 121
107 "ATI board detected. Disabling timer routing over 8254.\n"); 122 if (acpi_use_timer_override)
123 return;
124
125 d = ati_ixp4x0_rev(num, slot, func);
126 if (d < 0x82)
127 acpi_skip_timer_override = 1;
128 else {
129 /* check for IRQ0 interrupt swap */
130 outb(0x72, 0xcd6); b = inb(0xcd7);
131 if (!(b & 0x2))
132 acpi_skip_timer_override = 1;
133 }
134
135 if (acpi_skip_timer_override) {
136 printk(KERN_INFO "SB4X0 revision 0x%x\n", d);
137 printk(KERN_INFO "Ignoring ACPI timer override.\n");
138 printk(KERN_INFO "If you got timer trouble "
139 "try acpi_use_timer_override\n");
108 } 140 }
109#endif 141#endif
110} 142}
111 143
144#ifdef CONFIG_DMAR
145static void __init intel_g33_dmar(int num, int slot, int func)
146{
147 struct acpi_table_header *dmar_tbl;
148 acpi_status status;
149
150 status = acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_tbl);
151 if (ACPI_SUCCESS(status)) {
152 printk(KERN_INFO "BIOS BUG: DMAR advertised on Intel G31/G33 chipset -- ignoring\n");
153 dmar_disabled = 1;
154 }
155}
156#endif
157
112#define QFLAG_APPLY_ONCE 0x1 158#define QFLAG_APPLY_ONCE 0x1
113#define QFLAG_APPLIED 0x2 159#define QFLAG_APPLIED 0x2
114#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) 160#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -126,14 +172,29 @@ static struct chipset early_qrk[] __initdata = {
126 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, 172 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs },
127 { PCI_VENDOR_ID_VIA, PCI_ANY_ID, 173 { PCI_VENDOR_ID_VIA, PCI_ANY_ID,
128 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs }, 174 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs },
129 { PCI_VENDOR_ID_ATI, PCI_ANY_ID,
130 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, ati_bugs },
131 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, 175 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB,
132 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config }, 176 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config },
177 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS,
178 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
179#ifdef CONFIG_DMAR
180 { PCI_VENDOR_ID_INTEL, 0x29c0,
181 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, intel_g33_dmar },
182#endif
133 {} 183 {}
134}; 184};
135 185
136static void __init check_dev_quirk(int num, int slot, int func) 186/**
187 * check_dev_quirk - apply early quirks to a given PCI device
188 * @num: bus number
189 * @slot: slot number
190 * @func: PCI function
191 *
192 * Check the vendor & device ID against the early quirks table.
193 *
194 * If the device is single function, let early_quirks() know so we don't
195 * poke at this device again.
196 */
197static int __init check_dev_quirk(int num, int slot, int func)
137{ 198{
138 u16 class; 199 u16 class;
139 u16 vendor; 200 u16 vendor;
@@ -144,7 +205,7 @@ static void __init check_dev_quirk(int num, int slot, int func)
144 class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); 205 class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE);
145 206
146 if (class == 0xffff) 207 if (class == 0xffff)
147 return; 208 return -1; /* no class, treat as single function */
148 209
149 vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); 210 vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID);
150 211
@@ -167,7 +228,9 @@ static void __init check_dev_quirk(int num, int slot, int func)
167 type = read_pci_config_byte(num, slot, func, 228 type = read_pci_config_byte(num, slot, func,
168 PCI_HEADER_TYPE); 229 PCI_HEADER_TYPE);
169 if (!(type & 0x80)) 230 if (!(type & 0x80))
170 return; 231 return -1;
232
233 return 0;
171} 234}
172 235
173void __init early_quirks(void) 236void __init early_quirks(void)
@@ -180,6 +243,9 @@ void __init early_quirks(void)
180 /* Poor man's PCI discovery */ 243 /* Poor man's PCI discovery */
181 for (num = 0; num < 32; num++) 244 for (num = 0; num < 32; num++)
182 for (slot = 0; slot < 32; slot++) 245 for (slot = 0; slot < 32; slot++)
183 for (func = 0; func < 8; func++) 246 for (func = 0; func < 8; func++) {
184 check_dev_quirk(num, slot, func); 247 /* Only probe function 0 on single fn devices */
248 if (check_dev_quirk(num, slot, func))
249 break;
250 }
185} 251}