diff options
-rw-r--r-- | arch/powerpc/Kconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 41 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/Kconfig | 1 |
3 files changed, 45 insertions, 0 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index ccc5410af996..64089b11a9ee 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -389,6 +389,9 @@ config NOT_COHERENT_CACHE | |||
389 | bool | 389 | bool |
390 | depends on 4xx || 8xx || E200 | 390 | depends on 4xx || 8xx || E200 |
391 | default y | 391 | default y |
392 | |||
393 | config CONFIG_CHECK_CACHE_COHERENCY | ||
394 | bool | ||
392 | endmenu | 395 | endmenu |
393 | 396 | ||
394 | source "init/Kconfig" | 397 | source "init/Kconfig" |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 370803722e47..ed07a198f8d6 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -530,3 +530,44 @@ void __init setup_panic(void) | |||
530 | { | 530 | { |
531 | atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); | 531 | atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); |
532 | } | 532 | } |
533 | |||
534 | #ifdef CONFIG_CHECK_CACHE_COHERENCY | ||
535 | /* | ||
536 | * For platforms that have configurable cache-coherency. This function | ||
537 | * checks that the cache coherency setting of the kernel matches the setting | ||
538 | * left by the firmware, as indicated in the device tree. Since a mismatch | ||
539 | * will eventually result in DMA failures, we print * and error and call | ||
540 | * BUG() in that case. | ||
541 | */ | ||
542 | |||
543 | #ifdef CONFIG_NOT_COHERENT_CACHE | ||
544 | #define KERNEL_COHERENCY 0 | ||
545 | #else | ||
546 | #define KERNEL_COHERENCY 1 | ||
547 | #endif | ||
548 | |||
549 | static int __init check_cache_coherency(void) | ||
550 | { | ||
551 | struct device_node *np; | ||
552 | const void *prop; | ||
553 | int devtree_coherency; | ||
554 | |||
555 | np = of_find_node_by_path("/"); | ||
556 | prop = of_get_property(np, "coherency-off", NULL); | ||
557 | of_node_put(np); | ||
558 | |||
559 | devtree_coherency = prop ? 0 : 1; | ||
560 | |||
561 | if (devtree_coherency != KERNEL_COHERENCY) { | ||
562 | printk(KERN_ERR | ||
563 | "kernel coherency:%s != device tree_coherency:%s\n", | ||
564 | KERNEL_COHERENCY ? "on" : "off", | ||
565 | devtree_coherency ? "on" : "off"); | ||
566 | BUG(); | ||
567 | } | ||
568 | |||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | late_initcall(check_cache_coherency); | ||
573 | #endif /* CONFIG_CHECK_CACHE_COHERENCY */ | ||
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index bafd05765a72..15a1e9a77872 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig | |||
@@ -49,6 +49,7 @@ config MPC10X_BRIDGE | |||
49 | config MV64X60 | 49 | config MV64X60 |
50 | bool | 50 | bool |
51 | select PPC_INDIRECT_PCI | 51 | select PPC_INDIRECT_PCI |
52 | select CONFIG_CHECK_CACHE_COHERENCY | ||
52 | 53 | ||
53 | config MPC10X_OPENPIC | 54 | config MPC10X_OPENPIC |
54 | bool | 55 | bool |