Path: blob/master/arch/arm/mach-realview/platsmp.c
10817 views
/*1* linux/arch/arm/mach-realview/platsmp.c2*3* Copyright (C) 2002 ARM Ltd.4* All Rights Reserved5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License version 2 as8* published by the Free Software Foundation.9*/10#include <linux/init.h>11#include <linux/errno.h>12#include <linux/smp.h>13#include <linux/io.h>1415#include <mach/hardware.h>16#include <asm/hardware/gic.h>17#include <asm/mach-types.h>18#include <asm/smp_scu.h>19#include <asm/unified.h>2021#include <mach/board-eb.h>22#include <mach/board-pb11mp.h>23#include <mach/board-pbx.h>2425#include "core.h"2627extern void versatile_secondary_startup(void);2829static void __iomem *scu_base_addr(void)30{31if (machine_is_realview_eb_mp())32return __io_address(REALVIEW_EB11MP_SCU_BASE);33else if (machine_is_realview_pb11mp())34return __io_address(REALVIEW_TC11MP_SCU_BASE);35else if (machine_is_realview_pbx() &&36(core_tile_pbx11mp() || core_tile_pbxa9mp()))37return __io_address(REALVIEW_PBX_TILE_SCU_BASE);38else39return (void __iomem *)0;40}4142/*43* Initialise the CPU possible map early - this describes the CPUs44* which may be present or become present in the system.45*/46void __init smp_init_cpus(void)47{48void __iomem *scu_base = scu_base_addr();49unsigned int i, ncores;5051ncores = scu_base ? scu_get_core_count(scu_base) : 1;5253/* sanity check */54if (ncores > NR_CPUS) {55printk(KERN_WARNING56"Realview: no. of cores (%d) greater than configured "57"maximum of %d - clipping\n",58ncores, NR_CPUS);59ncores = NR_CPUS;60}6162for (i = 0; i < ncores; i++)63set_cpu_possible(i, true);6465set_smp_cross_call(gic_raise_softirq);66}6768void __init platform_smp_prepare_cpus(unsigned int max_cpus)69{70int i;7172/*73* Initialise the present map, which describes the set of CPUs74* actually populated at the present time.75*/76for (i = 0; i < max_cpus; i++)77set_cpu_present(i, true);7879scu_enable(scu_base_addr());8081/*82* Write the address of secondary startup into the83* system-wide flags register. The BootMonitor waits84* until it receives a soft interrupt, and then the85* secondary CPU branches to this address.86*/87__raw_writel(BSYM(virt_to_phys(versatile_secondary_startup)),88__io_address(REALVIEW_SYS_FLAGSSET));89}909192