Commit d6972bb4 authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer Committed by Paul Burton

MIPS: SGI-IP27: use cpu physid already present while scanning for CPUs

By using cpu physid already present when scanning for CPUs
get_cpu_slice() is unsued and can be removed together with two
other then used functions.
Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: default avatarPaul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
parent 2d11e6a4
...@@ -26,6 +26,5 @@ ...@@ -26,6 +26,5 @@
#define INVALID_PARTID (partid_t)-1 #define INVALID_PARTID (partid_t)-1
extern nasid_t get_nasid(void); extern nasid_t get_nasid(void);
extern int get_cpu_slice(cpuid_t);
#endif /* _ASM_SN_ARCH_H */ #endif /* _ASM_SN_ARCH_H */
...@@ -889,10 +889,6 @@ typedef union { ...@@ -889,10 +889,6 @@ typedef union {
extern lboard_t *find_lboard(lboard_t *start, unsigned char type); extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type); extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type); extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class); extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
#endif /* _ASM_SN_KLCONFIG_H */ #endif /* _ASM_SN_KLCONFIG_H */
...@@ -72,54 +72,3 @@ lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type) ...@@ -72,54 +72,3 @@ lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type)
/* Didn't find it. */ /* Didn't find it. */
return (lboard_t *)NULL; return (lboard_t *)NULL;
} }
klcpu_t *nasid_slice_to_cpuinfo(nasid_t nasid, int slice)
{
lboard_t *brd;
klcpu_t *acpu;
if (!(brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27)))
return (klcpu_t *)NULL;
if (!(acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU)))
return (klcpu_t *)NULL;
do {
if ((acpu->cpu_info.physid) == slice)
return acpu;
} while ((acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
KLSTRUCT_CPU)));
return (klcpu_t *)NULL;
}
klcpu_t *sn_get_cpuinfo(cpuid_t cpu)
{
nasid_t nasid;
int slice;
klcpu_t *acpu;
if (!(cpu < MAXCPUS)) {
printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu);
return NULL;
}
nasid = cputonasid(cpu);
if (nasid == INVALID_NASID)
return NULL;
for (slice = 0; slice < CPUS_PER_NODE; slice++) {
acpu = nasid_slice_to_cpuinfo(nasid, slice);
if (acpu && acpu->cpu_info.virtid == cpu)
return acpu;
}
return NULL;
}
int get_cpu_slice(cpuid_t cpu)
{
klcpu_t *acpu;
if ((acpu = sn_get_cpuinfo(cpu)) == NULL)
return -1;
return acpu->cpu_info.physid;
}
...@@ -29,22 +29,11 @@ ...@@ -29,22 +29,11 @@
#include "ip27-common.h" #include "ip27-common.h"
/* static int node_scan_cpus(nasid_t nasid, int highest)
* Takes as first input the PROM assigned cpu id, and the kernel
* assigned cpu id as the second.
*/
static void alloc_cpupda(nasid_t nasid, cpuid_t cpu, int cpunum)
{
cputonasid(cpunum) = nasid;
cputoslice(cpunum) = get_cpu_slice(cpu);
}
static int do_cpumask(nasid_t nasid, int highest)
{ {
static int tot_cpus_found = 0; static int cpus_found;
lboard_t *brd; lboard_t *brd;
klcpu_t *acpu; klcpu_t *acpu;
int cpus_found = 0;
cpuid_t cpuid; cpuid_t cpuid;
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27); brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
...@@ -55,13 +44,13 @@ static int do_cpumask(nasid_t nasid, int highest) ...@@ -55,13 +44,13 @@ static int do_cpumask(nasid_t nasid, int highest)
cpuid = acpu->cpu_info.virtid; cpuid = acpu->cpu_info.virtid;
/* Only let it join in if it's marked enabled */ /* Only let it join in if it's marked enabled */
if ((acpu->cpu_info.flags & KLINFO_ENABLE) && if ((acpu->cpu_info.flags & KLINFO_ENABLE) &&
(tot_cpus_found != NR_CPUS)) { (cpus_found != NR_CPUS)) {
if (cpuid > highest) if (cpuid > highest)
highest = cpuid; highest = cpuid;
set_cpu_possible(cpuid, true); set_cpu_possible(cpuid, true);
alloc_cpupda(nasid, cpuid, tot_cpus_found); cputonasid(cpus_found) = nasid;
cputoslice(cpus_found) = acpu->cpu_info.physid;
cpus_found++; cpus_found++;
tot_cpus_found++;
} }
acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu, acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu,
KLSTRUCT_CPU); KLSTRUCT_CPU);
...@@ -87,7 +76,7 @@ void cpu_node_probe(void) ...@@ -87,7 +76,7 @@ void cpu_node_probe(void)
if (nasid == INVALID_NASID) if (nasid == INVALID_NASID)
break; break;
node_set_online(nasid); node_set_online(nasid);
highest = do_cpumask(nasid, highest); highest = node_scan_cpus(nasid, highest);
} }
printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes()); printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes());
...@@ -180,7 +169,8 @@ static void __init ip27_smp_setup(void) ...@@ -180,7 +169,8 @@ static void __init ip27_smp_setup(void)
/* /*
* PROM sets up system, that boot cpu is always first CPU on nasid 0 * PROM sets up system, that boot cpu is always first CPU on nasid 0
*/ */
alloc_cpupda(0, 0, 0); cputonasid(0) = 0;
cputoslice(0) = LOCAL_HUB_L(PI_CPU_NUM);
} }
static void __init ip27_prepare_cpus(unsigned int max_cpus) static void __init ip27_prepare_cpus(unsigned int max_cpus)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment