diff options
Diffstat (limited to 'arch/x86/kernel/early-quirks.c')
-rw-r--r-- | arch/x86/kernel/early-quirks.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 510b8e36773..4353cf5e6fa 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -117,7 +117,18 @@ static struct chipset early_qrk[] __initdata = { | |||
117 | {} | 117 | {} |
118 | }; | 118 | }; |
119 | 119 | ||
120 | 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) | ||
121 | { | 132 | { |
122 | u16 class; | 133 | u16 class; |
123 | u16 vendor; | 134 | u16 vendor; |
@@ -128,7 +139,7 @@ static void __init check_dev_quirk(int num, int slot, int func) | |||
128 | class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); | 139 | class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); |
129 | 140 | ||
130 | if (class == 0xffff) | 141 | if (class == 0xffff) |
131 | return; | 142 | return -1; /* no class, treat as single function */ |
132 | 143 | ||
133 | vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); | 144 | vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); |
134 | 145 | ||
@@ -151,7 +162,9 @@ static void __init check_dev_quirk(int num, int slot, int func) | |||
151 | type = read_pci_config_byte(num, slot, func, | 162 | type = read_pci_config_byte(num, slot, func, |
152 | PCI_HEADER_TYPE); | 163 | PCI_HEADER_TYPE); |
153 | if (!(type & 0x80)) | 164 | if (!(type & 0x80)) |
154 | return; | 165 | return -1; |
166 | |||
167 | return 0; | ||
155 | } | 168 | } |
156 | 169 | ||
157 | void __init early_quirks(void) | 170 | void __init early_quirks(void) |
@@ -164,6 +177,9 @@ void __init early_quirks(void) | |||
164 | /* Poor man's PCI discovery */ | 177 | /* Poor man's PCI discovery */ |
165 | for (num = 0; num < 32; num++) | 178 | for (num = 0; num < 32; num++) |
166 | for (slot = 0; slot < 32; slot++) | 179 | for (slot = 0; slot < 32; slot++) |
167 | for (func = 0; func < 8; func++) | 180 | for (func = 0; func < 8; func++) { |
168 | 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 | } | ||
169 | } | 185 | } |