1633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 2633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * This file is subject to the terms and conditions of the GNU General 3633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Public License. See the file "COPYING" in the main directory of this 4633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * archive for more details. 5633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * 6633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com) 7633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc. 8633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 2000, 2001, 2002 Ralf Baechle 9633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 2000, 2001 Broadcom Corporation 10633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 11633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef __ASM_SMP_H 12633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define __ASM_SMP_H 13633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 14633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <linux/bitops.h> 15633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <linux/linkage.h> 16633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <linux/threads.h> 17633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <linux/cpumask.h> 18633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 19633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/atomic.h> 20633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/smp-ops.h> 21633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 22633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern int smp_num_siblings; 23633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern cpumask_t cpu_sibling_map[]; 24633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 25633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define raw_smp_processor_id() (current_thread_info()->cpu) 26633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 27633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* Map from cpu id to sequential logical cpu number. This will only 28633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham not be idempotent when cpus failed to come on-line. */ 29633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern int __cpu_number_map[NR_CPUS]; 30633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define cpu_number_map(cpu) __cpu_number_map[cpu] 31633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 32633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* The reverse map from sequential logical cpu number to cpu id. */ 33633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern int __cpu_logical_map[NR_CPUS]; 34633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define cpu_logical_map(cpu) __cpu_logical_map[cpu] 35633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 36633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NO_PROC_ID (-1) 37633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 38633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ 39633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define SMP_CALL_FUNCTION 0x2 40633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 41633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern cpumask_t phys_cpu_present_map; 42633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define cpu_possible_map phys_cpu_present_map 43633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 44633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern void asmlinkage smp_bootstrap(void); 45633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 46633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/* 47633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * this function sends a 'reschedule' IPI to another CPU. 48633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * it goes straight through and wastes no time serializing 49633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * anything. Worst case is that we lose a reschedule ... 50633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */ 51633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamstatic inline void smp_send_reschedule(int cpu) 52633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham{ 53633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham extern struct plat_smp_ops *mp_ops; /* private */ 54633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 55633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF); 56633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham} 57633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 58633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern asmlinkage void smp_call_function_interrupt(void); 59633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 60633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern void arch_send_call_function_single_ipi(int cpu); 61633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern void arch_send_call_function_ipi(cpumask_t mask); 62633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham 63633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* __ASM_SMP_H */ 64