Path: blob/master/arch/powerpc/platforms/wsp/smp.c
10818 views
/*1* SMP Support for A2 platforms2*3* Copyright 2007 Benjamin Herrenschmidt, IBM Corp.4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*10*/1112#include <linux/cpumask.h>13#include <linux/init.h>14#include <linux/kernel.h>15#include <linux/of.h>16#include <linux/smp.h>1718#include <asm/dbell.h>19#include <asm/machdep.h>20#include <asm/xics.h>2122#include "ics.h"23#include "wsp.h"2425static void __devinit smp_a2_setup_cpu(int cpu)26{27doorbell_setup_this_cpu();2829if (cpu != boot_cpuid)30xics_setup_cpu();31}3233int __devinit smp_a2_kick_cpu(int nr)34{35const char *enable_method;36struct device_node *np;37int thr_idx;3839if (nr < 0 || nr >= NR_CPUS)40return -ENOENT;4142np = of_get_cpu_node(nr, &thr_idx);43if (!np)44return -ENODEV;4546enable_method = of_get_property(np, "enable-method", NULL);47pr_devel("CPU%d has enable-method: \"%s\"\n", nr, enable_method);4849if (!enable_method) {50printk(KERN_ERR "CPU%d has no enable-method\n", nr);51return -ENOENT;52} else if (strcmp(enable_method, "ibm,a2-scom") == 0) {53if (a2_scom_startup_cpu(nr, thr_idx, np))54return -1;55} else {56printk(KERN_ERR "CPU%d: Don't understand enable-method \"%s\"\n",57nr, enable_method);58return -EINVAL;59}6061/*62* The processor is currently spinning, waiting for the63* cpu_start field to become non-zero After we set cpu_start,64* the processor will continue on to secondary_start65*/66paca[nr].cpu_start = 1;6768return 0;69}7071static int __init smp_a2_probe(void)72{73return cpus_weight(cpu_possible_map);74}7576static struct smp_ops_t a2_smp_ops = {77.message_pass = smp_muxed_ipi_message_pass,78.cause_ipi = doorbell_cause_ipi,79.probe = smp_a2_probe,80.kick_cpu = smp_a2_kick_cpu,81.setup_cpu = smp_a2_setup_cpu,82};8384void __init a2_setup_smp(void)85{86smp_ops = &a2_smp_ops;87}888990