diff options
-rw-r--r-- | arch/x86/include/asm/amd_nb.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/amd_nb.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/aperture_64.c | 44 | ||||
-rw-r--r-- | arch/x86/pci/amd_bus.c | 33 |
4 files changed, 63 insertions, 28 deletions
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index 980f22567631..64dc82ee19f0 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -3,7 +3,14 @@ | |||
3 | 3 | ||
4 | #include <linux/pci.h> | 4 | #include <linux/pci.h> |
5 | 5 | ||
6 | struct amd_nb_bus_dev_range { | ||
7 | u8 bus; | ||
8 | u8 dev_base; | ||
9 | u8 dev_limit; | ||
10 | }; | ||
11 | |||
6 | extern struct pci_device_id amd_nb_misc_ids[]; | 12 | extern struct pci_device_id amd_nb_misc_ids[]; |
13 | extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[]; | ||
7 | struct bootnode; | 14 | struct bootnode; |
8 | 15 | ||
9 | extern int early_is_amd_nb(u32 value); | 16 | extern int early_is_amd_nb(u32 value); |
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index affacb5e0065..0a99f7198bc3 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -20,6 +20,13 @@ struct pci_device_id amd_nb_misc_ids[] = { | |||
20 | }; | 20 | }; |
21 | EXPORT_SYMBOL(amd_nb_misc_ids); | 21 | EXPORT_SYMBOL(amd_nb_misc_ids); |
22 | 22 | ||
23 | const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[] __initconst = { | ||
24 | { 0x00, 0x18, 0x20 }, | ||
25 | { 0xff, 0x00, 0x20 }, | ||
26 | { 0xfe, 0x00, 0x20 }, | ||
27 | { } | ||
28 | }; | ||
29 | |||
23 | struct amd_northbridge_info amd_northbridges; | 30 | struct amd_northbridge_info amd_northbridges; |
24 | EXPORT_SYMBOL(amd_northbridges); | 31 | EXPORT_SYMBOL(amd_northbridges); |
25 | 32 | ||
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index dcd7c83e1659..5955a7800a96 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c | |||
@@ -39,18 +39,6 @@ int fallback_aper_force __initdata; | |||
39 | 39 | ||
40 | int fix_aperture __initdata = 1; | 40 | int fix_aperture __initdata = 1; |
41 | 41 | ||
42 | struct bus_dev_range { | ||
43 | int bus; | ||
44 | int dev_base; | ||
45 | int dev_limit; | ||
46 | }; | ||
47 | |||
48 | static struct bus_dev_range bus_dev_ranges[] __initdata = { | ||
49 | { 0x00, 0x18, 0x20}, | ||
50 | { 0xff, 0x00, 0x20}, | ||
51 | { 0xfe, 0x00, 0x20} | ||
52 | }; | ||
53 | |||
54 | static struct resource gart_resource = { | 42 | static struct resource gart_resource = { |
55 | .name = "GART", | 43 | .name = "GART", |
56 | .flags = IORESOURCE_MEM, | 44 | .flags = IORESOURCE_MEM, |
@@ -294,13 +282,13 @@ void __init early_gart_iommu_check(void) | |||
294 | search_agp_bridge(&agp_aper_order, &valid_agp); | 282 | search_agp_bridge(&agp_aper_order, &valid_agp); |
295 | 283 | ||
296 | fix = 0; | 284 | fix = 0; |
297 | for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { | 285 | for (i = 0; amd_nb_bus_dev_ranges[i].dev_limit; i++) { |
298 | int bus; | 286 | int bus; |
299 | int dev_base, dev_limit; | 287 | int dev_base, dev_limit; |
300 | 288 | ||
301 | bus = bus_dev_ranges[i].bus; | 289 | bus = amd_nb_bus_dev_ranges[i].bus; |
302 | dev_base = bus_dev_ranges[i].dev_base; | 290 | dev_base = amd_nb_bus_dev_ranges[i].dev_base; |
303 | dev_limit = bus_dev_ranges[i].dev_limit; | 291 | dev_limit = amd_nb_bus_dev_ranges[i].dev_limit; |
304 | 292 | ||
305 | for (slot = dev_base; slot < dev_limit; slot++) { | 293 | for (slot = dev_base; slot < dev_limit; slot++) { |
306 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) | 294 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) |
@@ -349,13 +337,13 @@ void __init early_gart_iommu_check(void) | |||
349 | return; | 337 | return; |
350 | 338 | ||
351 | /* disable them all at first */ | 339 | /* disable them all at first */ |
352 | for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { | 340 | for (i = 0; i < amd_nb_bus_dev_ranges[i].dev_limit; i++) { |
353 | int bus; | 341 | int bus; |
354 | int dev_base, dev_limit; | 342 | int dev_base, dev_limit; |
355 | 343 | ||
356 | bus = bus_dev_ranges[i].bus; | 344 | bus = amd_nb_bus_dev_ranges[i].bus; |
357 | dev_base = bus_dev_ranges[i].dev_base; | 345 | dev_base = amd_nb_bus_dev_ranges[i].dev_base; |
358 | dev_limit = bus_dev_ranges[i].dev_limit; | 346 | dev_limit = amd_nb_bus_dev_ranges[i].dev_limit; |
359 | 347 | ||
360 | for (slot = dev_base; slot < dev_limit; slot++) { | 348 | for (slot = dev_base; slot < dev_limit; slot++) { |
361 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) | 349 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) |
@@ -390,14 +378,14 @@ int __init gart_iommu_hole_init(void) | |||
390 | 378 | ||
391 | fix = 0; | 379 | fix = 0; |
392 | node = 0; | 380 | node = 0; |
393 | for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { | 381 | for (i = 0; i < amd_nb_bus_dev_ranges[i].dev_limit; i++) { |
394 | int bus; | 382 | int bus; |
395 | int dev_base, dev_limit; | 383 | int dev_base, dev_limit; |
396 | u32 ctl; | 384 | u32 ctl; |
397 | 385 | ||
398 | bus = bus_dev_ranges[i].bus; | 386 | bus = amd_nb_bus_dev_ranges[i].bus; |
399 | dev_base = bus_dev_ranges[i].dev_base; | 387 | dev_base = amd_nb_bus_dev_ranges[i].dev_base; |
400 | dev_limit = bus_dev_ranges[i].dev_limit; | 388 | dev_limit = amd_nb_bus_dev_ranges[i].dev_limit; |
401 | 389 | ||
402 | for (slot = dev_base; slot < dev_limit; slot++) { | 390 | for (slot = dev_base; slot < dev_limit; slot++) { |
403 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) | 391 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) |
@@ -505,7 +493,7 @@ out: | |||
505 | } | 493 | } |
506 | 494 | ||
507 | /* Fix up the north bridges */ | 495 | /* Fix up the north bridges */ |
508 | for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { | 496 | for (i = 0; i < amd_nb_bus_dev_ranges[i].dev_limit; i++) { |
509 | int bus, dev_base, dev_limit; | 497 | int bus, dev_base, dev_limit; |
510 | 498 | ||
511 | /* | 499 | /* |
@@ -514,9 +502,9 @@ out: | |||
514 | */ | 502 | */ |
515 | u32 ctl = DISTLBWALKPRB | aper_order << 1; | 503 | u32 ctl = DISTLBWALKPRB | aper_order << 1; |
516 | 504 | ||
517 | bus = bus_dev_ranges[i].bus; | 505 | bus = amd_nb_bus_dev_ranges[i].bus; |
518 | dev_base = bus_dev_ranges[i].dev_base; | 506 | dev_base = amd_nb_bus_dev_ranges[i].dev_base; |
519 | dev_limit = bus_dev_ranges[i].dev_limit; | 507 | dev_limit = amd_nb_bus_dev_ranges[i].dev_limit; |
520 | for (slot = dev_base; slot < dev_limit; slot++) { | 508 | for (slot = dev_base; slot < dev_limit; slot++) { |
521 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) | 509 | if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) |
522 | continue; | 510 | continue; |
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index fc1e8fe07e5c..e27dffbbb1a7 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/cpu.h> | 4 | #include <linux/cpu.h> |
5 | #include <linux/range.h> | 5 | #include <linux/range.h> |
6 | 6 | ||
7 | #include <asm/amd_nb.h> | ||
7 | #include <asm/pci_x86.h> | 8 | #include <asm/pci_x86.h> |
8 | 9 | ||
9 | #include <asm/pci-direct.h> | 10 | #include <asm/pci-direct.h> |
@@ -378,6 +379,34 @@ static struct notifier_block __cpuinitdata amd_cpu_notifier = { | |||
378 | .notifier_call = amd_cpu_notify, | 379 | .notifier_call = amd_cpu_notify, |
379 | }; | 380 | }; |
380 | 381 | ||
382 | static void __init pci_enable_pci_io_ecs(void) | ||
383 | { | ||
384 | #ifdef CONFIG_AMD_NB | ||
385 | unsigned int i, n; | ||
386 | |||
387 | for (n = i = 0; !n && amd_nb_bus_dev_ranges[i].dev_limit; ++i) { | ||
388 | u8 bus = amd_nb_bus_dev_ranges[i].bus; | ||
389 | u8 slot = amd_nb_bus_dev_ranges[i].dev_base; | ||
390 | u8 limit = amd_nb_bus_dev_ranges[i].dev_limit; | ||
391 | |||
392 | for (; slot < limit; ++slot) { | ||
393 | u32 val = read_pci_config(bus, slot, 3, 0); | ||
394 | |||
395 | if (!early_is_amd_nb(val)) | ||
396 | continue; | ||
397 | |||
398 | val = read_pci_config(bus, slot, 3, 0x8c); | ||
399 | if (!(val & (ENABLE_CF8_EXT_CFG >> 32))) { | ||
400 | val |= ENABLE_CF8_EXT_CFG >> 32; | ||
401 | write_pci_config(bus, slot, 3, 0x8c, val); | ||
402 | } | ||
403 | ++n; | ||
404 | } | ||
405 | } | ||
406 | pr_info("Extended Config Space enabled on %u nodes\n", n); | ||
407 | #endif | ||
408 | } | ||
409 | |||
381 | static int __init pci_io_ecs_init(void) | 410 | static int __init pci_io_ecs_init(void) |
382 | { | 411 | { |
383 | int cpu; | 412 | int cpu; |
@@ -386,6 +415,10 @@ static int __init pci_io_ecs_init(void) | |||
386 | if (boot_cpu_data.x86 < 0x10) | 415 | if (boot_cpu_data.x86 < 0x10) |
387 | return 0; | 416 | return 0; |
388 | 417 | ||
418 | /* Try the PCI method first. */ | ||
419 | if (early_pci_allowed()) | ||
420 | pci_enable_pci_io_ecs(); | ||
421 | |||
389 | register_cpu_notifier(&amd_cpu_notifier); | 422 | register_cpu_notifier(&amd_cpu_notifier); |
390 | for_each_online_cpu(cpu) | 423 | for_each_online_cpu(cpu) |
391 | amd_cpu_notify(&amd_cpu_notifier, (unsigned long)CPU_ONLINE, | 424 | amd_cpu_notify(&amd_cpu_notifier, (unsigned long)CPU_ONLINE, |