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 a4665f37cfc5..a0e11c0cc872 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -120,7 +120,18 @@ static struct chipset early_qrk[] __initdata = { | |||
120 | {} | 120 | {} |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static void __init check_dev_quirk(int num, int slot, int func) | 123 | /** |
124 | * check_dev_quirk - apply early quirks to a given PCI device | ||
125 | * @num: bus number | ||
126 | * @slot: slot number | ||
127 | * @func: PCI function | ||
128 | * | ||
129 | * Check the vendor & device ID against the early quirks table. | ||
130 | * | ||
131 | * If the device is single function, let early_quirks() know so we don't | ||
132 | * poke at this device again. | ||
133 | */ | ||
134 | static int __init check_dev_quirk(int num, int slot, int func) | ||
124 | { | 135 | { |
125 | u16 class; | 136 | u16 class; |
126 | u16 vendor; | 137 | u16 vendor; |
@@ -131,7 +142,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); | 142 | class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); |
132 | 143 | ||
133 | if (class == 0xffff) | 144 | if (class == 0xffff) |
134 | return; | 145 | return -1; /* no class, treat as single function */ |
135 | 146 | ||
136 | vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); | 147 | vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); |
137 | 148 | ||
@@ -154,7 +165,9 @@ static void __init check_dev_quirk(int num, int slot, int func) | |||
154 | type = read_pci_config_byte(num, slot, func, | 165 | type = read_pci_config_byte(num, slot, func, |
155 | PCI_HEADER_TYPE); | 166 | PCI_HEADER_TYPE); |
156 | if (!(type & 0x80)) | 167 | if (!(type & 0x80)) |
157 | return; | 168 | return -1; |
169 | |||
170 | return 0; | ||
158 | } | 171 | } |
159 | 172 | ||
160 | void __init early_quirks(void) | 173 | void __init early_quirks(void) |
@@ -167,6 +180,9 @@ void __init early_quirks(void) | |||
167 | /* Poor man's PCI discovery */ | 180 | /* Poor man's PCI discovery */ |
168 | for (num = 0; num < 32; num++) | 181 | for (num = 0; num < 32; num++) |
169 | for (slot = 0; slot < 32; slot++) | 182 | for (slot = 0; slot < 32; slot++) |
170 | for (func = 0; func < 8; func++) | 183 | for (func = 0; func < 8; func++) { |
171 | check_dev_quirk(num, slot, func); | 184 | /* Only probe function 0 on single fn devices */ |
185 | if (check_dev_quirk(num, slot, func)) | ||
186 | break; | ||
187 | } | ||
172 | } | 188 | } |