diff options
Diffstat (limited to 'arch/sparc/kernel/prom_64.c')
| -rw-r--r-- | arch/sparc/kernel/prom_64.c | 64 | 
1 files changed, 57 insertions, 7 deletions
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 86597d9867f..20cc5d80a47 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -15,12 +15,12 @@   *      2 of the License, or (at your option) any later version.   */ +#include <linux/memblock.h>  #include <linux/kernel.h> -#include <linux/types.h>  #include <linux/string.h> +#include <linux/types.h> +#include <linux/cpu.h>  #include <linux/mm.h> -#include <linux/module.h> -#include <linux/memblock.h>  #include <linux/of.h>  #include <asm/prom.h> @@ -38,7 +38,7 @@ void * __init prom_early_alloc(unsigned long size)  	void *ret;  	if (!paddr) { -		prom_printf("prom_early_alloc(%lu) failed\n"); +		prom_printf("prom_early_alloc(%lu) failed\n", size);  		prom_halt();  	} @@ -374,6 +374,59 @@ static const char *get_mid_prop(void)  	return (tlb_type == spitfire ? "upa-portid" : "portid");  } +bool arch_find_n_match_cpu_physical_id(struct device_node *cpun, +				       int cpu, unsigned int *thread) +{ +	const char *mid_prop = get_mid_prop(); +	int this_cpu_id; + +	/* On hypervisor based platforms we interrogate the 'reg' +	 * property.  On everything else we look for a 'upa-portis', +	 * 'portid', or 'cpuid' property. +	 */ + +	if (tlb_type == hypervisor) { +		struct property *prop = of_find_property(cpun, "reg", NULL); +		u32 *regs; + +		if (!prop) { +			pr_warn("CPU node missing reg property\n"); +			return false; +		} +		regs = prop->value; +		this_cpu_id = regs[0] & 0x0fffffff; +	} else { +		this_cpu_id = of_getintprop_default(cpun, mid_prop, -1); + +		if (this_cpu_id < 0) { +			mid_prop = "cpuid"; +			this_cpu_id = of_getintprop_default(cpun, mid_prop, -1); +		} +		if (this_cpu_id < 0) { +			pr_warn("CPU node missing cpu ID property\n"); +			return false; +		} +	} +	if (this_cpu_id == cpu) { +		if (thread) { +			int proc_id = cpu_data(cpu).proc_id; + +			/* On sparc64, the cpu thread information is obtained +			 * either from OBP or the machine description.  We've +			 * actually probed this information already long before +			 * this interface gets called so instead of interrogating +			 * both the OF node and the MDESC again, just use what +			 * we discovered already. +			 */ +			if (proc_id < 0) +				proc_id = 0; +			*thread = proc_id; +		} +		return true; +	} +	return false; +} +  static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg)  {  	struct device_node *dp; @@ -503,9 +556,6 @@ static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg)  		cpu_data(cpuid).core_id = portid + 1;  		cpu_data(cpuid).proc_id = portid; -#ifdef CONFIG_SMP -		sparc64_multi_core = 1; -#endif  	} else {  		cpu_data(cpuid).dcache_size =  			of_getintprop_default(dp, "dcache-size", 16 * 1024);  | 
