static int smp_secondary_alive __initdata = 0;
/* Which cpus ids came online. */
-unsigned long cpu_present_mask;
+cpumask_t cpu_present_mask;
cpumask_t cpu_online_map;
EXPORT_SYMBOL(cpu_online_map);
smp_num_probed = 1;
hwrpb_cpu_present_mask = (1UL << boot_cpuid);
}
- cpu_present_mask = 1UL << boot_cpuid;
+ cpu_present_mask = cpumask_of_cpu(boot_cpuid);
printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
smp_num_probed, hwrpb_cpu_present_mask);
/* Nothing to do on a UP box, or when told not to. */
if (smp_num_probed == 1 || max_cpus == 0) {
- cpu_present_mask = 1UL << boot_cpuid;
+ cpu_present_mask = cpumask_of_cpu(boot_cpuid);
printk(KERN_INFO "SMP mode deactivated.\n");
return;
}
if (((hwrpb_cpu_present_mask >> i) & 1) == 0)
continue;
- cpu_present_mask |= 1UL << i;
+ cpu_set(i, cpu_possible_map);
cpu_count++;
}
if (cpu_online(cpu))
bogosum += cpu_data[cpu].loops_per_jiffy;
- printk(KERN_INFO "SMP: Total of %ld processors activated "
+ printk(KERN_INFO "SMP: Total of %d processors activated "
"(%lu.%02lu BogoMIPS).\n",
num_online_cpus(),
(bogosum + 2500) / (500000/HZ),
\f
static void
-send_ipi_message(unsigned long to_whom, enum ipi_message_type operation)
+send_ipi_message(cpumask_t to_whom, enum ipi_message_type operation)
{
- unsigned long i, set, n;
+ int i;
mb();
- for (i = to_whom; i ; i &= ~set) {
- set = i & -i;
- n = __ffs(set);
- set_bit(operation, &ipi_data[n].bits);
- }
+ for_each_cpu_mask(i, to_whom)
+ set_bit(operation, &ipi_data[i].bits);
mb();
- for (i = to_whom; i ; i &= ~set) {
- set = i & -i;
- n = __ffs(set);
- wripir(n);
- }
+ for_each_cpu_mask(i, to_whom)
+ wripir(i);
}
/* Structure and data for smp_call_function. This is designed to
printk(KERN_WARNING
"smp_send_reschedule: Sending IPI to self.\n");
#endif
- send_ipi_message(1UL << cpu, IPI_RESCHEDULE);
+ send_ipi_message(cpumask_of_cpu(cpu), IPI_RESCHEDULE);
}
void
smp_send_stop(void)
{
- unsigned long to_whom = cpu_present_mask & ~(1UL << smp_processor_id());
+ cpumask_t to_whom = cpu_possible_map;
+ cpu_clear(smp_processor_id(), to_whom);
#ifdef DEBUG_IPI_MSG
if (hard_smp_processor_id() != boot_cpu_id)
printk(KERN_WARNING "smp_send_stop: Not on boot cpu.\n");
int
smp_call_function_on_cpu (void (*func) (void *info), void *info, int retry,
- int wait, unsigned long to_whom)
+ int wait, cpumask_t to_whom)
{
struct smp_call_struct data;
unsigned long timeout;
data.info = info;
data.wait = wait;
- to_whom &= ~(1L << smp_processor_id());
- num_cpus_to_call = hweight64(to_whom);
+ cpu_clear(smp_processor_id(), to_whom);
+ num_cpus_to_call = cpus_weight(to_whom);
atomic_set(&data.unstarted_count, num_cpus_to_call);
atomic_set(&data.unfinished_count, num_cpus_to_call);
/* We either got one or timed out -- clear the lock. */
mb();
- smp_call_function_data = 0;
+ smp_call_function_data = NULL;
/*
* If after both the initial and long timeout periods we still don't