diff options
Diffstat (limited to 'arch/x86/kernel/early-quirks.c')
-rw-r--r-- | arch/x86/kernel/early-quirks.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index a4665f37cfc5..4353cf5e6fac 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 | ||
24 | static void __init fix_hypertransport_config(int num, int slot, int func) | 21 | static void __init fix_hypertransport_config(int num, int slot, int func) |
25 | { | 22 | { |
@@ -120,7 +117,18 @@ static struct chipset early_qrk[] __initdata = { | |||
120 | {} | 117 | {} |
121 | }; | 118 | }; |
122 | 119 | ||
123 | static void __init check_dev_quirk(int num, int slot, int func) | 120 | /** |
121 | * check_dev_quirk - apply early quirks to a given PCI device | ||
122 | * @num: bus number | ||
123 | * @slot: slot number | ||
124 | * @func: PCI function | ||
125 | * | ||
126 | * Check the vendor & device ID against the early quirks table. | ||
127 | * | ||
128 | * If the device is single function, let early_quirks() know so we don't | ||
129 | * poke at this device again. | ||
130 | */ | ||
131 | static int __init check_dev_quirk(int num, int slot, int func) | ||
124 | { | 132 | { |
125 | u16 class; | 133 | u16 class; |
126 | u16 vendor; | 134 | u16 vendor; |
@@ -131,7 +139,7 @@ static void __init check_dev_quirk(int num, int slot, int func) | |||
131 | class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); | 139 | class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); |
132 | 140 | ||
133 | if (class == 0xffff) | 141 | if (class == 0xffff) |
134 | return; | 142 | return -1; /* no class, treat as single function */ |
135 | 143 | ||
136 | vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); | 144 | vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); |
137 | 145 | ||
@@ -154,7 +162,9 @@ static void __init check_dev_quirk(int num, int slot, int func) | |||
154 | type = read_pci_config_byte(num, slot, func, | 162 | type = read_pci_config_byte(num, slot, func, |
155 | PCI_HEADER_TYPE); | 163 | PCI_HEADER_TYPE); |
156 | if (!(type & 0x80)) | 164 | if (!(type & 0x80)) |
157 | return; | 165 | return -1; |
166 | |||
167 | return 0; | ||
158 | } | 168 | } |
159 | 169 | ||
160 | void __init early_quirks(void) | 170 | void __init early_quirks(void) |
@@ -167,6 +177,9 @@ void __init early_quirks(void) | |||
167 | /* Poor man's PCI discovery */ | 177 | /* Poor man's PCI discovery */ |
168 | for (num = 0; num < 32; num++) | 178 | for (num = 0; num < 32; num++) |
169 | for (slot = 0; slot < 32; slot++) | 179 | for (slot = 0; slot < 32; slot++) |
170 | for (func = 0; func < 8; func++) | 180 | for (func = 0; func < 8; func++) { |
171 | check_dev_quirk(num, slot, func); | 181 | /* Only probe function 0 on single fn devices */ |
182 | if (check_dev_quirk(num, slot, func)) | ||
183 | break; | ||
184 | } | ||
172 | } | 185 | } |