Fix a brain-o in platform_cpu_mask() by just specifying a possible

cpuset_t to be copied, rather than return the array.
I can't rely anymore on this being a simple int/long object.

Reported by:	art
This commit is contained in:
Attilio Rao 2011-05-13 19:56:58 +00:00
parent 245a253538
commit f89d6b3f06
5 changed files with 15 additions and 21 deletions

View File

@ -102,20 +102,18 @@ platform_init_ap(int cpuid)
mips_wbflush();
}
cpuset_t
platform_cpu_mask(void)
void
platform_cpu_mask(cpuset_t *mask)
{
cpuset_t cpumask;
CPU_ZERO(&cpumask);
CPU_ZERO(mask);
/*
* XXX: hack in order to simplify CPU set building, assuming that
* core_mask is 32-bits.
*/
memcpy(&cpumask, &octeon_bootinfo->core_mask,
memcpy(mask, &octeon_bootinfo->core_mask,
sizeof(octeon_bootinfo->core_mask));
return (cpumask);
}
struct cpu_group *

View File

@ -93,7 +93,7 @@ extern int platform_processor_id(void);
/*
* Return the cpumask of available processors.
*/
extern cpuset_t platform_cpu_mask(void);
extern void platform_cpu_mask(cpuset_t *mask);
/*
* Return the topology of processors on this platform

View File

@ -205,7 +205,7 @@ cpu_mp_setmaxid(void)
cpuset_t cpumask;
int cpu, last;
cpumask = platform_cpu_mask();
platform_cpu_mask(&cpumask);
mp_ncpus = 0;
last = 1;
while ((cpu = cpusetobj_ffs(&cpumask)) != 0) {
@ -247,7 +247,7 @@ cpu_mp_start(void)
mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN);
CPU_ZERO(&all_cpus);
cpumask = platform_cpu_mask();
platform_cpu_mask(&cpumask);
while (!CPU_EMPTY(&cpumask)) {
cpuid = cpusetobj_ffs(&cpumask) - 1;

View File

@ -614,17 +614,15 @@ platform_processor_id(void)
return (xlr_hwtid_to_cpuid[xlr_cpu_id()]);
}
cpuset_t
platform_cpu_mask(void)
void
platform_cpu_mask(cpuset_t *mask)
{
cpuset_t cpumask;
int i, s;
CPU_ZERO(&cpumask);
CPU_ZERO(mask);
s = xlr_ncores * xlr_threads_per_core;
for (i = 0; i < s; i++)
CPU_SET(i, &cpumask);
return (cpumask);
CPU_SET(i, mask);
}
struct cpu_group *

View File

@ -243,17 +243,15 @@ sb_clear_mailbox(int cpu, uint64_t val)
sb_store64(regaddr, val);
}
cpuset_t
platform_cpu_mask(void)
void
platform_cpu_mask(cpuset_t *mask)
{
cpuset_t cpumask;
int i, s;
CPU_ZERO(&cpumask);
CPU_ZERO(mask);
s = SYSREV_NUM_PROCESSORS(sb_read_sysrev());
for (i = 0; i < s; i++)
CPU_SET(i, &cpumask);
return (cpumask);
CPU_SET(i, mask);
}
#endif /* SMP */