-/*
- * Lets check how many CPUs we have.
- */
-static void __init smp_count_cpus(unsigned int *configured_cpus,
- unsigned int *standby_cpus)
-{
- unsigned int cpu;
- struct sclp_cpu_info *info;
- u16 boot_cpu_addr, cpu_addr;
-
- boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
- current_thread_info()->cpu = 0;
- *configured_cpus = 1;
- *standby_cpus = 0;
-
- info = alloc_bootmem_pages(sizeof(*info));
- if (!info)
- disabled_wait((unsigned long) __builtin_return_address(0));
-
- /* Use sigp detection algorithm if sclp doesn't work. */
- if (sclp_get_cpu_info(info)) {
- smp_use_sigp_detection = 1;
- for (cpu = 0; cpu <= 65535; cpu++) {
- if (cpu == boot_cpu_addr)
- continue;
- __cpu_logical_map[CPU_INIT_NO] = cpu;
- if (cpu_stopped(CPU_INIT_NO))
- (*configured_cpus)++;
- }
- goto out;
- }
-
- if (info->has_cpu_type) {
- for (cpu = 0; cpu < info->combined; cpu++) {
- if (info->cpu[cpu].address == boot_cpu_addr) {
- smp_cpu_type = info->cpu[cpu].type;
- break;
- }
- }
- }
- /* Count cpus. */
- for (cpu = 0; cpu < info->combined; cpu++) {
- if (info->has_cpu_type && info->cpu[cpu].type != smp_cpu_type)
- continue;
- cpu_addr = info->cpu[cpu].address;
- if (cpu_addr == boot_cpu_addr)
- continue;
- __cpu_logical_map[CPU_INIT_NO] = cpu_addr;
- if (!cpu_stopped(CPU_INIT_NO)) {
- (*standby_cpus)++;
- continue;
- }
- smp_get_save_area(*configured_cpus, cpu_addr);
- (*configured_cpus)++;
- }
-out:
- printk(KERN_INFO "CPUs: %d configured, %d standby\n",
- *configured_cpus, *standby_cpus);
- free_bootmem((unsigned long) info, sizeof(*info));
-}
-