Commit bb63b4219976d48ed6d22ac33c18be334fb5a78c

Authored by Yinghai Lu
Committed by Ingo Molnar
1 parent d2ebdf4bae

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>

Showing 4 changed files with 27 additions and 28 deletions Side-by-side Diff

arch/x86/pci/direct.c
... ... @@ -258,7 +258,8 @@
258 258 {
259 259 if (type == 0)
260 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 263 if (type == 1)
263 264 raw_pci_ops = &pci_direct_conf1;
264 265 else
265 266  
... ... @@ -275,8 +276,10 @@
275 276 if (!region)
276 277 goto type2;
277 278  
278   - if (pci_check_type1())
  279 + if (pci_check_type1()) {
  280 + raw_pci_ops = &pci_direct_conf1;
279 281 return 1;
  282 + }
280 283 release_resource(region);
281 284  
282 285 type2:
... ... @@ -290,7 +293,6 @@
290 293 goto fail2;
291 294  
292 295 if (pci_check_type2()) {
293   - printk(KERN_INFO "PCI: Using configuration type 2\n");
294 296 raw_pci_ops = &pci_direct_conf2;
295 297 return 2;
296 298 }
... ... @@ -6,14 +6,13 @@
6 6 in the right sequence from here. */
7 7 static __init int pci_access_init(void)
8 8 {
9   - int type __maybe_unused = 0;
10   -
11 9 #ifdef CONFIG_PCI_DIRECT
  10 + int type = 0;
  11 +
12 12 type = pci_direct_probe();
13 13 #endif
14   - pci_mmcfg_early_init(type);
15   - if (raw_pci_ops)
16   - return 0;
  14 + pci_mmcfg_early_init();
  15 +
17 16 #ifdef CONFIG_PCI_BIOS
18 17 pci_pcbios_init();
19 18 #endif
... ... @@ -26,7 +25,7 @@
26 25 #ifdef CONFIG_PCI_DIRECT
27 26 pci_direct_init(type);
28 27 #endif
29   - if (!raw_pci_ops)
  28 + if (!raw_pci_ops && !raw_pci_ext_ops)
30 29 printk(KERN_ERR
31 30 "PCI: Fatal: No config space access function found\n");
32 31  
arch/x86/pci/mmconfig-shared.c
... ... @@ -28,7 +28,7 @@
28 28 static const char __init *pci_mmcfg_e7520(void)
29 29 {
30 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 33 win = win & 0xf000;
34 34 if(win == 0x0000 || win == 0xf000)
... ... @@ -53,7 +53,7 @@
53 53  
54 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 58 /* Enable bit */
59 59 if (!(pciexbar & 1))
... ... @@ -179,6 +179,9 @@
179 179 int i;
180 180 const char *name;
181 181  
  182 + if (!raw_pci_ops)
  183 + return 0;
  184 +
182 185 pci_mmcfg_config_num = 0;
183 186 pci_mmcfg_config = NULL;
184 187 name = NULL;
... ... @@ -186,7 +189,7 @@
186 189 for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
187 190 bus = pci_mmcfg_probes[i].bus;
188 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 193 vendor = l & 0xffff;
191 194 device = (l >> 16) & 0xffff;
192 195  
... ... @@ -304,7 +307,7 @@
304 307 return mcfg_res.flags;
305 308 }
306 309  
307   -static void __init pci_mmcfg_reject_broken(int type, int early)
  310 +static void __init pci_mmcfg_reject_broken(int early)
308 311 {
309 312 typeof(pci_mmcfg_config[0]) *cfg;
310 313 int i;
... ... @@ -342,8 +345,8 @@
342 345 " reserved in ACPI motherboard resources\n",
343 346 cfg->address);
344 347 /* Don't try to do this check unless configuration
345   - type 1 is available. */
346   - if (type == 1 && e820_all_mapped(cfg->address,
  348 + type 1 is available. how about type 2 ?*/
  349 + if (raw_pci_ops && e820_all_mapped(cfg->address,
347 350 cfg->address + size - 1,
348 351 E820_RESERVED)) {
349 352 printk(KERN_NOTICE
... ... @@ -368,7 +371,7 @@
368 371  
369 372 static int __initdata known_bridge;
370 373  
371   -void __init __pci_mmcfg_init(int type, int early)
  374 +void __init __pci_mmcfg_init(int early)
372 375 {
373 376 /* MMCONFIG disabled */
374 377 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
375 378  
... ... @@ -382,14 +385,14 @@
382 385 if (known_bridge)
383 386 return;
384 387  
385   - if (early && type == 1) {
  388 + if (early) {
386 389 if (pci_mmcfg_check_hostbridge())
387 390 known_bridge = 1;
388 391 }
389 392  
390 393 if (!known_bridge) {
391 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 398 if ((pci_mmcfg_config_num == 0) ||
396 399  
397 400  
... ... @@ -410,19 +413,14 @@
410 413 }
411 414 }
412 415  
413   -void __init pci_mmcfg_early_init(int type)
  416 +void __init pci_mmcfg_early_init(void)
414 417 {
415   - __pci_mmcfg_init(type, 1);
  418 + __pci_mmcfg_init(1);
416 419 }
417 420  
418 421 void __init pci_mmcfg_late_init(void)
419 422 {
420   - int type = 0;
421   -
422   - if (pci_probe & PCI_PROBE_CONF1)
423   - type = 1;
424   -
425   - __pci_mmcfg_init(type, 0);
  423 + __pci_mmcfg_init(0);
426 424 }
427 425  
428 426 static int __init pci_mmcfg_late_insert_resources(void)
... ... @@ -1055,10 +1055,10 @@
1055 1055 extern int pcibios_add_platform_entries(struct pci_dev *dev);
1056 1056  
1057 1057 #ifdef CONFIG_PCI_MMCONFIG
1058   -extern void __init pci_mmcfg_early_init(int type);
  1058 +extern void __init pci_mmcfg_early_init(void);
1059 1059 extern void __init pci_mmcfg_late_init(void);
1060 1060 #else
1061   -static inline void pci_mmcfg_early_init(int type) { }
  1061 +static inline void pci_mmcfg_early_init(void) { }
1062 1062 static inline void pci_mmcfg_late_init(void) { }
1063 1063 #endif
1064 1064