platsmp.c 1.1 KB
Newer Older
M
Magnus Damm 已提交
1 2 3 4
/*
 * SMP support for R-Mobile / SH-Mobile
 *
 * Copyright (C) 2010  Magnus Damm
5
 * Copyright (C) 2011  Paul Mundt
M
Magnus Damm 已提交
6 7 8 9 10 11 12 13 14
 *
 * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/init.h>
#include <linux/smp.h>
15 16 17
#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
#include <mach/common.h>
M
Magnus Damm 已提交
18

19
void __init shmobile_smp_init_cpus(unsigned int ncores)
M
Magnus Damm 已提交
20 21 22
{
	unsigned int i;

23 24 25 26 27 28
	if (ncores > nr_cpu_ids) {
		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
			ncores, nr_cpu_ids);
		ncores = nr_cpu_ids;
	}

M
Magnus Damm 已提交
29 30 31
	for (i = 0; i < ncores; i++)
		set_cpu_possible(i, true);
}
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

extern unsigned long shmobile_smp_fn[];
extern unsigned long shmobile_smp_arg[];
extern unsigned long shmobile_smp_mpidr[];

void shmobile_smp_hook(unsigned int cpu, unsigned long fn, unsigned long arg)
{
	shmobile_smp_fn[cpu] = 0;
	flush_cache_all();

	shmobile_smp_mpidr[cpu] = cpu_logical_map(cpu);
	shmobile_smp_fn[cpu] = fn;
	shmobile_smp_arg[cpu] = arg;
	flush_cache_all();
}