From 6c70b6fc7b6fc321636a014082d9e32333da1f80 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 8 Aug 2007 17:11:39 -0700 Subject: [SPARC64]: Do not assume sun4v chips have load-twin/store-init support. Check the cpu type in the OBP device tree before committing to using the optimized Niagara memcpy and memset implementation. If we don't recognize the cpu type, use a completely generic version. Signed-off-by: David S. Miller --- arch/sparc64/kernel/cpu.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'arch/sparc64/kernel/cpu.c') diff --git a/arch/sparc64/kernel/cpu.c b/arch/sparc64/kernel/cpu.c index e4eff878123d..e43db73f2b91 100644 --- a/arch/sparc64/kernel/cpu.c +++ b/arch/sparc64/kernel/cpu.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; @@ -69,36 +69,24 @@ unsigned int fsr_storage; static void __init sun4v_cpu_probe(void) { - struct device_node *dp; - const char *compat; - int len; - - dp = of_find_node_by_name(NULL, "cpu"); - if (!dp) - goto no_compat; - - compat = of_get_property(dp, "compatible", &len); - if (!compat) - goto no_compat; - - if (of_find_in_proplist(compat, "SUNW,UltraSPARC-T1", len)) { + switch (sun4v_chip_type) { + case SUN4V_CHIP_NIAGARA1: sparc_cpu_type = "UltraSparc T1 (Niagara)"; sparc_fpu_type = "UltraSparc T1 integrated FPU"; - } else if (of_find_in_proplist(compat, "SUNW,UltraSPARC-T2", len)) { + break; + + case SUN4V_CHIP_NIAGARA2: sparc_cpu_type = "UltraSparc T2 (Niagara2)"; sparc_fpu_type = "UltraSparc T2 integrated FPU"; - } else - goto unknown; - - return; - -no_compat: - compat = "no property"; - -unknown: - printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", compat); - sparc_cpu_type = "Unknown SUN4V CPU"; - sparc_fpu_type = "Unknown SUN4V FPU"; + break; + + default: + printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", + prom_cpu_compatible); + sparc_cpu_type = "Unknown SUN4V CPU"; + sparc_fpu_type = "Unknown SUN4V FPU"; + break; + } } void __init cpu_probe(void) -- cgit v1.2.2