/*1* Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.2*3* This program is free software; you can distribute it and/or modify it4* under the terms of the GNU General Public License (Version 2) as5* published by the Free Software Foundation.6*7* This program is distributed in the hope it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* for more details.11*12* You should have received a copy of the GNU General Public License along13* with this program; if not, write to the Free Software Foundation, Inc.,14* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.15*16*/17/*18* Simulator Platform-specific hooks for SMTC operation19*/20#include <linux/kernel.h>21#include <linux/sched.h>22#include <linux/cpumask.h>23#include <linux/interrupt.h>24#include <linux/smp.h>2526#include <asm/atomic.h>27#include <asm/cpu.h>28#include <asm/processor.h>29#include <asm/smtc.h>30#include <asm/system.h>31#include <asm/mmu_context.h>32#include <asm/smtc_ipi.h>3334/* VPE/SMP Prototype implements platform interfaces directly */3536/*37* Cause the specified action to be performed on a targeted "CPU"38*/3940static void ssmtc_send_ipi_single(int cpu, unsigned int action)41{42smtc_send_ipi(cpu, LINUX_SMP_IPI, action);43/* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */44}4546static inline void ssmtc_send_ipi_mask(const struct cpumask *mask,47unsigned int action)48{49unsigned int i;5051for_each_cpu(i, mask)52ssmtc_send_ipi_single(i, action);53}5455/*56* Post-config but pre-boot cleanup entry point57*/58static void __cpuinit ssmtc_init_secondary(void)59{60smtc_init_secondary();61}6263/*64* SMP initialization finalization entry point65*/66static void __cpuinit ssmtc_smp_finish(void)67{68smtc_smp_finish();69}7071/*72* Hook for after all CPUs are online73*/74static void ssmtc_cpus_done(void)75{76}7778/*79* Platform "CPU" startup hook80*/81static void __cpuinit ssmtc_boot_secondary(int cpu, struct task_struct *idle)82{83smtc_boot_secondary(cpu, idle);84}8586static void __init ssmtc_smp_setup(void)87{88if (read_c0_config3() & (1 << 2))89mipsmt_build_cpu_map(0);90}9192/*93* Platform SMP pre-initialization94*/95static void ssmtc_prepare_cpus(unsigned int max_cpus)96{97/*98* As noted above, we can assume a single CPU for now99* but it may be multithreaded.100*/101102if (read_c0_config3() & (1 << 2)) {103mipsmt_prepare_cpus();104}105}106107struct plat_smp_ops ssmtc_smp_ops = {108.send_ipi_single = ssmtc_send_ipi_single,109.send_ipi_mask = ssmtc_send_ipi_mask,110.init_secondary = ssmtc_init_secondary,111.smp_finish = ssmtc_smp_finish,112.cpus_done = ssmtc_cpus_done,113.boot_secondary = ssmtc_boot_secondary,114.smp_setup = ssmtc_smp_setup,115.prepare_cpus = ssmtc_prepare_cpus,116};117118119