diff options
author | Andi Kleen <ak@suse.de> | 2006-09-26 04:52:40 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:40 -0400 |
commit | 5e544d618f0fb21011f36f28d5e3952b9dc109d2 (patch) | |
tree | a91d6e5c640da473204bc48eb7b310fd3d82cd91 /arch/i386/pci/direct.c | |
parent | a15da49debaf7f09460a886b0ecd08588410715e (diff) |
[PATCH] i386/x86-64: PCI: split probing and initialization of type 1 config space access
First probe if type1/2 accesses work, but then only initialize them at the end.
This is useful for a later patch that needs this information inbetween.
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/pci/direct.c')
-rw-r--r-- | arch/i386/pci/direct.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c index 5d81fb510375..5acf0b4743cf 100644 --- a/arch/i386/pci/direct.c +++ b/arch/i386/pci/direct.c | |||
@@ -254,7 +254,16 @@ static int __init pci_check_type2(void) | |||
254 | return works; | 254 | return works; |
255 | } | 255 | } |
256 | 256 | ||
257 | void __init pci_direct_init(void) | 257 | void __init pci_direct_init(int type) |
258 | { | ||
259 | printk(KERN_INFO "PCI: Using configuration type %d\n", type); | ||
260 | if (type == 1) | ||
261 | raw_pci_ops = &pci_direct_conf1; | ||
262 | else | ||
263 | raw_pci_ops = &pci_direct_conf2; | ||
264 | } | ||
265 | |||
266 | int __init pci_direct_probe(void) | ||
258 | { | 267 | { |
259 | struct resource *region, *region2; | 268 | struct resource *region, *region2; |
260 | 269 | ||
@@ -264,19 +273,16 @@ void __init pci_direct_init(void) | |||
264 | if (!region) | 273 | if (!region) |
265 | goto type2; | 274 | goto type2; |
266 | 275 | ||
267 | if (pci_check_type1()) { | 276 | if (pci_check_type1()) |
268 | printk(KERN_INFO "PCI: Using configuration type 1\n"); | 277 | return 1; |
269 | raw_pci_ops = &pci_direct_conf1; | ||
270 | return; | ||
271 | } | ||
272 | release_resource(region); | 278 | release_resource(region); |
273 | 279 | ||
274 | type2: | 280 | type2: |
275 | if ((pci_probe & PCI_PROBE_CONF2) == 0) | 281 | if ((pci_probe & PCI_PROBE_CONF2) == 0) |
276 | return; | 282 | return 0; |
277 | region = request_region(0xCF8, 4, "PCI conf2"); | 283 | region = request_region(0xCF8, 4, "PCI conf2"); |
278 | if (!region) | 284 | if (!region) |
279 | return; | 285 | return 0; |
280 | region2 = request_region(0xC000, 0x1000, "PCI conf2"); | 286 | region2 = request_region(0xC000, 0x1000, "PCI conf2"); |
281 | if (!region2) | 287 | if (!region2) |
282 | goto fail2; | 288 | goto fail2; |
@@ -284,10 +290,11 @@ void __init pci_direct_init(void) | |||
284 | if (pci_check_type2()) { | 290 | if (pci_check_type2()) { |
285 | printk(KERN_INFO "PCI: Using configuration type 2\n"); | 291 | printk(KERN_INFO "PCI: Using configuration type 2\n"); |
286 | raw_pci_ops = &pci_direct_conf2; | 292 | raw_pci_ops = &pci_direct_conf2; |
287 | return; | 293 | return 2; |
288 | } | 294 | } |
289 | 295 | ||
290 | release_resource(region2); | 296 | release_resource(region2); |
291 | fail2: | 297 | fail2: |
292 | release_resource(region); | 298 | release_resource(region); |
299 | return 0; | ||
293 | } | 300 | } |