-static unsigned long processor_map[CONFIG_MAX_CPUS];
-
-static struct mem_range *get_ramsize(void)
-{
- struct mem_range *mem = 0;
- if (!mem) {
- mem = sizeram();
- }
- if (!mem) {
- printk_emerg("No memory size information!\n");
- for(;;) {
- /* Ensure this loop is not optimized away */
- asm volatile("":/* outputs */:/*inputs */ :"memory");
- }
- }
- return mem;
-}
-
-
-#if CONFIG_SMP == 1
-/* Number of cpus that are currently running in linuxbios */
-static atomic_t active_cpus = ATOMIC_INIT(1);
-
-void secondary_cpu_init(void)
-{
- struct mem_range *mem;
- unsigned long id;
- int index;
-
- atomic_inc(&active_cpus);
- printk_debug(__FUNCTION__ "\n");
- mem = get_ramsize();
- id = cpu_initialize(mem);
- index = processor_index(id);
- printk_debug(__FUNCTION__ " %d/%u\n", index, id);
- processor_map[index] = CPU_ENABLED;
- atomic_dec(&active_cpus);
- stop_cpu(id);
-}
-
-static void wait_for_other_cpus(void)
-{
- int old_active_count, active_count;
- int i;
- old_active_count = 1;
-
- active_count = atomic_read(&active_cpus);
- while(active_count > 1) {
- if (active_count != old_active_count) {
- printk_info("Waiting for %d CPUS to stop\n", active_count);
- old_active_count = active_count;
- }
- active_count = atomic_read(&active_cpus);
- }
- for(i = 0; i < CONFIG_MAX_CPUS; i++) {
- if (!(processor_map[i] & CPU_ENABLED)) {
- printk_err("CPU %d did not initialize!\n", i);
- processor_map[i] = 0;
-#warning "FIXME do I need a mainboard_cpu_fixup function?"
- }
- }
- printk_debug("All AP CPUs stopped\n");
-}