aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci
diff options
context:
space:
mode:
authorYinghai Lu <Yinghai.Lu@Sun.COM>2008-02-29 02:56:50 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-26 17:41:04 -0400
commitbb63b4219976d48ed6d22ac33c18be334fb5a78c (patch)
treefd63e9c86b43f246a1f7011881540718118890c9 /arch/x86/pci
parentd2ebdf4bae4f1d7c30e71fd74f270ca4cda024fc (diff)
x86 pci: remove checking type for mmconfig probe
doesn't need to check if it is type1 or type2, we can use raw_pci_ops directly. also make pci_direct_conf1 static again. anyway is there system with type 2 and mmconf support? Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r--arch/x86/pci/direct.c8
-rw-r--r--arch/x86/pci/init.c11
-rw-r--r--arch/x86/pci/mmconfig-shared.c32
3 files changed, 25 insertions, 26 deletions
diff --git a/arch/x86/pci/direct.c b/arch/x86/pci/direct.c
index 42f3e4cad179..21d1e0e0d535 100644
--- a/arch/x86/pci/direct.c
+++ b/arch/x86/pci/direct.c
@@ -258,7 +258,8 @@ void __init pci_direct_init(int type)
258{ 258{
259 if (type == 0) 259 if (type == 0)
260 return; 260 return;
261 printk(KERN_INFO "PCI: Using configuration type %d\n", type); 261 printk(KERN_INFO "PCI: Using configuration type %d for base access\n",
262 type);
262 if (type == 1) 263 if (type == 1)
263 raw_pci_ops = &pci_direct_conf1; 264 raw_pci_ops = &pci_direct_conf1;
264 else 265 else
@@ -275,8 +276,10 @@ int __init pci_direct_probe(void)
275 if (!region) 276 if (!region)
276 goto type2; 277 goto type2;
277 278
278 if (pci_check_type1()) 279 if (pci_check_type1()) {
280 raw_pci_ops = &pci_direct_conf1;
279 return 1; 281 return 1;
282 }
280 release_resource(region); 283 release_resource(region);
281 284
282 type2: 285 type2:
@@ -290,7 +293,6 @@ int __init pci_direct_probe(void)
290 goto fail2; 293 goto fail2;
291 294
292 if (pci_check_type2()) { 295 if (pci_check_type2()) {
293 printk(KERN_INFO "PCI: Using configuration type 2\n");
294 raw_pci_ops = &pci_direct_conf2; 296 raw_pci_ops = &pci_direct_conf2;
295 return 2; 297 return 2;
296 } 298 }
diff --git a/arch/x86/pci/init.c b/arch/x86/pci/init.c
index 2080b04b3bcc..343c36337e69 100644
--- a/arch/x86/pci/init.c
+++ b/arch/x86/pci/init.c
@@ -6,14 +6,13 @@
6 in the right sequence from here. */ 6 in the right sequence from here. */
7static __init int pci_access_init(void) 7static __init int pci_access_init(void)
8{ 8{
9 int type __maybe_unused = 0;
10
11#ifdef CONFIG_PCI_DIRECT 9#ifdef CONFIG_PCI_DIRECT
10 int type = 0;
11
12 type = pci_direct_probe(); 12 type = pci_direct_probe();
13#endif 13#endif
14 pci_mmcfg_early_init(type); 14 pci_mmcfg_early_init();
15 if (raw_pci_ops) 15
16 return 0;
17#ifdef CONFIG_PCI_BIOS 16#ifdef CONFIG_PCI_BIOS
18 pci_pcbios_init(); 17 pci_pcbios_init();
19#endif 18#endif
@@ -26,7 +25,7 @@ static __init int pci_access_init(void)
26#ifdef CONFIG_PCI_DIRECT 25#ifdef CONFIG_PCI_DIRECT
27 pci_direct_init(type); 26 pci_direct_init(type);
28#endif 27#endif
29 if (!raw_pci_ops) 28 if (!raw_pci_ops && !raw_pci_ext_ops)
30 printk(KERN_ERR 29 printk(KERN_ERR
31 "PCI: Fatal: No config space access function found\n"); 30 "PCI: Fatal: No config space access function found\n");
32 31
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 6f68658b519d..bdf62243186a 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -28,7 +28,7 @@ static int __initdata pci_mmcfg_resources_inserted;
28static const char __init *pci_mmcfg_e7520(void) 28static const char __init *pci_mmcfg_e7520(void)
29{ 29{
30 u32 win; 30 u32 win;
31 pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win); 31 raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0xce, 2, &win);
32 32
33 win = win & 0xf000; 33 win = win & 0xf000;
34 if(win == 0x0000 || win == 0xf000) 34 if(win == 0x0000 || win == 0xf000)
@@ -53,7 +53,7 @@ static const char __init *pci_mmcfg_intel_945(void)
53 53
54 pci_mmcfg_config_num = 1; 54 pci_mmcfg_config_num = 1;
55 55
56 pci_direct_conf1.read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar); 56 raw_pci_ops->read(0, 0, PCI_DEVFN(0, 0), 0x48, 4, &pciexbar);
57 57
58 /* Enable bit */ 58 /* Enable bit */
59 if (!(pciexbar & 1)) 59 if (!(pciexbar & 1))
@@ -179,6 +179,9 @@ static int __init pci_mmcfg_check_hostbridge(void)
179 int i; 179 int i;
180 const char *name; 180 const char *name;
181 181
182 if (!raw_pci_ops)
183 return 0;
184
182 pci_mmcfg_config_num = 0; 185 pci_mmcfg_config_num = 0;
183 pci_mmcfg_config = NULL; 186 pci_mmcfg_config = NULL;
184 name = NULL; 187 name = NULL;
@@ -186,7 +189,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
186 for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) { 189 for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
187 bus = pci_mmcfg_probes[i].bus; 190 bus = pci_mmcfg_probes[i].bus;
188 devfn = pci_mmcfg_probes[i].devfn; 191 devfn = pci_mmcfg_probes[i].devfn;
189 pci_direct_conf1.read(0, bus, devfn, 0, 4, &l); 192 raw_pci_ops->read(0, bus, devfn, 0, 4, &l);
190 vendor = l & 0xffff; 193 vendor = l & 0xffff;
191 device = (l >> 16) & 0xffff; 194 device = (l >> 16) & 0xffff;
192 195
@@ -304,7 +307,7 @@ static int __init is_acpi_reserved(unsigned long start, unsigned long end)
304 return mcfg_res.flags; 307 return mcfg_res.flags;
305} 308}
306 309
307static void __init pci_mmcfg_reject_broken(int type, int early) 310static void __init pci_mmcfg_reject_broken(int early)
308{ 311{
309 typeof(pci_mmcfg_config[0]) *cfg; 312 typeof(pci_mmcfg_config[0]) *cfg;
310 int i; 313 int i;
@@ -342,8 +345,8 @@ static void __init pci_mmcfg_reject_broken(int type, int early)
342 " reserved in ACPI motherboard resources\n", 345 " reserved in ACPI motherboard resources\n",
343 cfg->address); 346 cfg->address);
344 /* Don't try to do this check unless configuration 347 /* Don't try to do this check unless configuration
345 type 1 is available. */ 348 type 1 is available. how about type 2 ?*/
346 if (type == 1 && e820_all_mapped(cfg->address, 349 if (raw_pci_ops && e820_all_mapped(cfg->address,
347 cfg->address + size - 1, 350 cfg->address + size - 1,
348 E820_RESERVED)) { 351 E820_RESERVED)) {
349 printk(KERN_NOTICE 352 printk(KERN_NOTICE
@@ -368,7 +371,7 @@ reject:
368 371
369static int __initdata known_bridge; 372static int __initdata known_bridge;
370 373
371void __init __pci_mmcfg_init(int type, int early) 374void __init __pci_mmcfg_init(int early)
372{ 375{
373 /* MMCONFIG disabled */ 376 /* MMCONFIG disabled */
374 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 377 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
@@ -382,14 +385,14 @@ void __init __pci_mmcfg_init(int type, int early)
382 if (known_bridge) 385 if (known_bridge)
383 return; 386 return;
384 387
385 if (early && type == 1) { 388 if (early) {
386 if (pci_mmcfg_check_hostbridge()) 389 if (pci_mmcfg_check_hostbridge())
387 known_bridge = 1; 390 known_bridge = 1;
388 } 391 }
389 392
390 if (!known_bridge) { 393 if (!known_bridge) {
391 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg); 394 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
392 pci_mmcfg_reject_broken(type, early); 395 pci_mmcfg_reject_broken(early);
393 } 396 }
394 397
395 if ((pci_mmcfg_config_num == 0) || 398 if ((pci_mmcfg_config_num == 0) ||
@@ -410,19 +413,14 @@ void __init __pci_mmcfg_init(int type, int early)
410 } 413 }
411} 414}
412 415
413void __init pci_mmcfg_early_init(int type) 416void __init pci_mmcfg_early_init(void)
414{ 417{
415 __pci_mmcfg_init(type, 1); 418 __pci_mmcfg_init(1);
416} 419}
417 420
418void __init pci_mmcfg_late_init(void) 421void __init pci_mmcfg_late_init(void)
419{ 422{
420 int type = 0; 423 __pci_mmcfg_init(0);
421
422 if (pci_probe & PCI_PROBE_CONF1)
423 type = 1;
424
425 __pci_mmcfg_init(type, 0);
426} 424}
427 425
428static int __init pci_mmcfg_late_insert_resources(void) 426static int __init pci_mmcfg_late_insert_resources(void)