Loading arch/sparc/include/asm/prom.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ extern int of_node_to_nid(struct device_node *dp); #endif extern void prom_build_devicetree(void); extern void of_populate_present_mask(void); /* Dummy ref counting routines - to be implemented later */ static inline struct device_node *of_node_get(struct device_node *node) Loading arch/sparc/kernel/prom_64.c +124 −109 Original line number Diff line number Diff line Loading @@ -374,52 +374,78 @@ static const char *get_mid_prop(void) return (tlb_type == spitfire ? "upa-portid" : "portid"); } struct device_node *of_find_node_by_cpuid(int cpuid) static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg) { struct device_node *dp; const char *mid_prop = get_mid_prop(); const char *mid_prop; mid_prop = get_mid_prop(); for_each_node_by_type(dp, "cpu") { int id = of_getintprop_default(dp, mid_prop, -1); int cpuid = of_getintprop_default(dp, mid_prop, -1); const char *this_mid_prop = mid_prop; void *ret; if (id < 0) { if (cpuid < 0) { this_mid_prop = "cpuid"; id = of_getintprop_default(dp, this_mid_prop, -1); cpuid = of_getintprop_default(dp, this_mid_prop, -1); } if (id < 0) { if (cpuid < 0) { prom_printf("OF: Serious problem, cpu lacks " "%s property", this_mid_prop); prom_halt(); } if (cpuid == id) return dp; #ifdef CONFIG_SMP if (cpuid >= NR_CPUS) { printk(KERN_WARNING "Ignoring CPU %d which is " ">= NR_CPUS (%d)\n", cpuid, NR_CPUS); continue; } #endif ret = func(dp, cpuid, arg); if (ret) return ret; } return NULL; } void __init of_fill_in_cpu_data(void) static void *check_cpu_node(struct device_node *dp, int cpuid, int id) { struct device_node *dp; const char *mid_prop; if (id == cpuid) return dp; return NULL; } struct device_node *of_find_node_by_cpuid(int cpuid) { return of_iterate_over_cpus(check_cpu_node, cpuid); } static void *record_one_cpu(struct device_node *dp, int cpuid, int arg) { ncpus_probed++; #ifdef CONFIG_SMP set_cpu_present(cpuid, true); set_cpu_possible(cpuid, true); #endif return NULL; } void __init of_populate_present_mask(void) { if (tlb_type == hypervisor) return; mid_prop = get_mid_prop(); ncpus_probed = 0; for_each_node_by_type(dp, "cpu") { int cpuid = of_getintprop_default(dp, mid_prop, -1); const char *this_mid_prop = mid_prop; struct device_node *portid_parent; of_iterate_over_cpus(record_one_cpu, 0); } static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg) { struct device_node *portid_parent = NULL; int portid = -1; portid_parent = NULL; if (cpuid < 0) { this_mid_prop = "cpuid"; cpuid = of_getintprop_default(dp, this_mid_prop, -1); if (cpuid >= 0) { if (of_find_property(dp, "cpuid", NULL)) { int limit = 2; portid_parent = dp; Loading @@ -433,30 +459,14 @@ void __init of_fill_in_cpu_data(void) break; } } } if (cpuid < 0) { prom_printf("OF: Serious problem, cpu lacks " "%s property", this_mid_prop); prom_halt(); } ncpus_probed++; #ifdef CONFIG_SMP if (cpuid >= NR_CPUS) { printk(KERN_WARNING "Ignoring CPU %d which is " ">= NR_CPUS (%d)\n", cpuid, NR_CPUS); continue; } #else #ifndef CONFIG_SMP /* On uniprocessor we only want the values for the * real physical cpu the kernel booted onto, however * cpu_data() only has one entry at index 0. */ if (cpuid != real_hard_smp_processor_id()) continue; return NULL; cpuid = 0; #endif Loading Loading @@ -517,12 +527,17 @@ void __init of_fill_in_cpu_data(void) cpu_data(cpuid).proc_id = -1; } #ifdef CONFIG_SMP set_cpu_present(cpuid, true); set_cpu_possible(cpuid, true); #endif return NULL; } void __init of_fill_in_cpu_data(void) { if (tlb_type == hypervisor) return; of_populate_present_mask(); of_iterate_over_cpus(fill_in_one_cpu, 0); smp_fill_in_sib_core_maps(); } Loading Loading
arch/sparc/include/asm/prom.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ extern int of_node_to_nid(struct device_node *dp); #endif extern void prom_build_devicetree(void); extern void of_populate_present_mask(void); /* Dummy ref counting routines - to be implemented later */ static inline struct device_node *of_node_get(struct device_node *node) Loading
arch/sparc/kernel/prom_64.c +124 −109 Original line number Diff line number Diff line Loading @@ -374,52 +374,78 @@ static const char *get_mid_prop(void) return (tlb_type == spitfire ? "upa-portid" : "portid"); } struct device_node *of_find_node_by_cpuid(int cpuid) static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg) { struct device_node *dp; const char *mid_prop = get_mid_prop(); const char *mid_prop; mid_prop = get_mid_prop(); for_each_node_by_type(dp, "cpu") { int id = of_getintprop_default(dp, mid_prop, -1); int cpuid = of_getintprop_default(dp, mid_prop, -1); const char *this_mid_prop = mid_prop; void *ret; if (id < 0) { if (cpuid < 0) { this_mid_prop = "cpuid"; id = of_getintprop_default(dp, this_mid_prop, -1); cpuid = of_getintprop_default(dp, this_mid_prop, -1); } if (id < 0) { if (cpuid < 0) { prom_printf("OF: Serious problem, cpu lacks " "%s property", this_mid_prop); prom_halt(); } if (cpuid == id) return dp; #ifdef CONFIG_SMP if (cpuid >= NR_CPUS) { printk(KERN_WARNING "Ignoring CPU %d which is " ">= NR_CPUS (%d)\n", cpuid, NR_CPUS); continue; } #endif ret = func(dp, cpuid, arg); if (ret) return ret; } return NULL; } void __init of_fill_in_cpu_data(void) static void *check_cpu_node(struct device_node *dp, int cpuid, int id) { struct device_node *dp; const char *mid_prop; if (id == cpuid) return dp; return NULL; } struct device_node *of_find_node_by_cpuid(int cpuid) { return of_iterate_over_cpus(check_cpu_node, cpuid); } static void *record_one_cpu(struct device_node *dp, int cpuid, int arg) { ncpus_probed++; #ifdef CONFIG_SMP set_cpu_present(cpuid, true); set_cpu_possible(cpuid, true); #endif return NULL; } void __init of_populate_present_mask(void) { if (tlb_type == hypervisor) return; mid_prop = get_mid_prop(); ncpus_probed = 0; for_each_node_by_type(dp, "cpu") { int cpuid = of_getintprop_default(dp, mid_prop, -1); const char *this_mid_prop = mid_prop; struct device_node *portid_parent; of_iterate_over_cpus(record_one_cpu, 0); } static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg) { struct device_node *portid_parent = NULL; int portid = -1; portid_parent = NULL; if (cpuid < 0) { this_mid_prop = "cpuid"; cpuid = of_getintprop_default(dp, this_mid_prop, -1); if (cpuid >= 0) { if (of_find_property(dp, "cpuid", NULL)) { int limit = 2; portid_parent = dp; Loading @@ -433,30 +459,14 @@ void __init of_fill_in_cpu_data(void) break; } } } if (cpuid < 0) { prom_printf("OF: Serious problem, cpu lacks " "%s property", this_mid_prop); prom_halt(); } ncpus_probed++; #ifdef CONFIG_SMP if (cpuid >= NR_CPUS) { printk(KERN_WARNING "Ignoring CPU %d which is " ">= NR_CPUS (%d)\n", cpuid, NR_CPUS); continue; } #else #ifndef CONFIG_SMP /* On uniprocessor we only want the values for the * real physical cpu the kernel booted onto, however * cpu_data() only has one entry at index 0. */ if (cpuid != real_hard_smp_processor_id()) continue; return NULL; cpuid = 0; #endif Loading Loading @@ -517,12 +527,17 @@ void __init of_fill_in_cpu_data(void) cpu_data(cpuid).proc_id = -1; } #ifdef CONFIG_SMP set_cpu_present(cpuid, true); set_cpu_possible(cpuid, true); #endif return NULL; } void __init of_fill_in_cpu_data(void) { if (tlb_type == hypervisor) return; of_populate_present_mask(); of_iterate_over_cpus(fill_in_one_cpu, 0); smp_fill_in_sib_core_maps(); } Loading