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 | |
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')
-rw-r--r-- | arch/i386/pci/direct.c | 25 | ||||
-rw-r--r-- | arch/i386/pci/init.c | 9 | ||||
-rw-r--r-- | arch/i386/pci/mmconfig.c | 2 | ||||
-rw-r--r-- | arch/i386/pci/pci.h | 6 |
4 files changed, 28 insertions, 14 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 | } |
diff --git a/arch/i386/pci/init.c b/arch/i386/pci/init.c index 51087a9d9172..d028e1b05c36 100644 --- a/arch/i386/pci/init.c +++ b/arch/i386/pci/init.c | |||
@@ -6,8 +6,13 @@ | |||
6 | in the right sequence from here. */ | 6 | in the right sequence from here. */ |
7 | static __init int pci_access_init(void) | 7 | static __init int pci_access_init(void) |
8 | { | 8 | { |
9 | int type = 0; | ||
10 | |||
11 | #ifdef CONFIG_PCI_DIRECT | ||
12 | type = pci_direct_probe(); | ||
13 | #endif | ||
9 | #ifdef CONFIG_PCI_MMCONFIG | 14 | #ifdef CONFIG_PCI_MMCONFIG |
10 | pci_mmcfg_init(); | 15 | pci_mmcfg_init(type); |
11 | #endif | 16 | #endif |
12 | if (raw_pci_ops) | 17 | if (raw_pci_ops) |
13 | return 0; | 18 | return 0; |
@@ -21,7 +26,7 @@ static __init int pci_access_init(void) | |||
21 | * fails. | 26 | * fails. |
22 | */ | 27 | */ |
23 | #ifdef CONFIG_PCI_DIRECT | 28 | #ifdef CONFIG_PCI_DIRECT |
24 | pci_direct_init(); | 29 | pci_direct_init(type); |
25 | #endif | 30 | #endif |
26 | return 0; | 31 | return 0; |
27 | } | 32 | } |
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c index 972180f738d9..44155c5e85d1 100644 --- a/arch/i386/pci/mmconfig.c +++ b/arch/i386/pci/mmconfig.c | |||
@@ -187,7 +187,7 @@ static __init void unreachable_devices(void) | |||
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | void __init pci_mmcfg_init(void) | 190 | void __init pci_mmcfg_init(int type) |
191 | { | 191 | { |
192 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) | 192 | if ((pci_probe & PCI_PROBE_MMCONF) == 0) |
193 | return; | 193 | return; |
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h index bf4e79335388..8a7cf1f23684 100644 --- a/arch/i386/pci/pci.h +++ b/arch/i386/pci/pci.h | |||
@@ -81,7 +81,9 @@ extern int pci_conf1_write(unsigned int seg, unsigned int bus, | |||
81 | extern int pci_conf1_read(unsigned int seg, unsigned int bus, | 81 | extern int pci_conf1_read(unsigned int seg, unsigned int bus, |
82 | unsigned int devfn, int reg, int len, u32 *value); | 82 | unsigned int devfn, int reg, int len, u32 *value); |
83 | 83 | ||
84 | extern void pci_direct_init(void); | 84 | extern int pci_direct_probe(void); |
85 | extern void pci_direct_init(int type); | ||
85 | extern void pci_pcbios_init(void); | 86 | extern void pci_pcbios_init(void); |
86 | extern void pci_mmcfg_init(void); | 87 | extern void pci_mmcfg_init(int type); |
87 | extern void pcibios_sort(void); | 88 | extern void pcibios_sort(void); |
89 | |||