Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* smp.h: Sparc specific SMP stuff.
0003  *
0004  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
0005  */
0006 
0007 #ifndef _SPARC_SMP_H
0008 #define _SPARC_SMP_H
0009 
0010 #include <linux/threads.h>
0011 #include <asm/head.h>
0012 
0013 #ifndef __ASSEMBLY__
0014 
0015 #include <linux/cpumask.h>
0016 
0017 #endif /* __ASSEMBLY__ */
0018 
0019 #ifdef CONFIG_SMP
0020 
0021 #ifndef __ASSEMBLY__
0022 
0023 #include <asm/ptrace.h>
0024 #include <asm/asi.h>
0025 #include <linux/atomic.h>
0026 
0027 /*
0028  *  Private routines/data
0029  */
0030 
0031 extern unsigned char boot_cpu_id;
0032 extern volatile unsigned long cpu_callin_map[NR_CPUS];
0033 extern cpumask_t smp_commenced_mask;
0034 extern struct linux_prom_registers smp_penguin_ctable;
0035 
0036 void cpu_panic(void);
0037 
0038 /*
0039  *  General functions that each host system must provide.
0040  */
0041 
0042 void sun4m_init_smp(void);
0043 void sun4d_init_smp(void);
0044 
0045 void smp_callin(void);
0046 void smp_store_cpu_info(int);
0047 
0048 void smp_resched_interrupt(void);
0049 void smp_call_function_single_interrupt(void);
0050 void smp_call_function_interrupt(void);
0051 
0052 struct seq_file;
0053 void smp_bogo(struct seq_file *);
0054 void smp_info(struct seq_file *);
0055 
0056 struct sparc32_ipi_ops {
0057     void (*cross_call)(void *func, cpumask_t mask, unsigned long arg1,
0058                unsigned long arg2, unsigned long arg3,
0059                unsigned long arg4);
0060     void (*resched)(int cpu);
0061     void (*single)(int cpu);
0062     void (*mask_one)(int cpu);
0063 };
0064 extern const struct sparc32_ipi_ops *sparc32_ipi_ops;
0065 
0066 static inline void xc0(void *func)
0067 {
0068     sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);
0069 }
0070 
0071 static inline void xc1(void *func, unsigned long arg1)
0072 {
0073     sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);
0074 }
0075 static inline void xc2(void *func, unsigned long arg1, unsigned long arg2)
0076 {
0077     sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);
0078 }
0079 
0080 static inline void xc3(void *func, unsigned long arg1, unsigned long arg2,
0081                unsigned long arg3)
0082 {
0083     sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
0084                     arg1, arg2, arg3, 0);
0085 }
0086 
0087 static inline void xc4(void *func, unsigned long arg1, unsigned long arg2,
0088                unsigned long arg3, unsigned long arg4)
0089 {
0090     sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
0091                     arg1, arg2, arg3, arg4);
0092 }
0093 
0094 void arch_send_call_function_single_ipi(int cpu);
0095 void arch_send_call_function_ipi_mask(const struct cpumask *mask);
0096 
0097 static inline int cpu_logical_map(int cpu)
0098 {
0099     return cpu;
0100 }
0101 
0102 int hard_smp_processor_id(void);
0103 
0104 #define raw_smp_processor_id()      (current_thread_info()->cpu)
0105 
0106 void smp_setup_cpu_possible_map(void);
0107 
0108 #endif /* !(__ASSEMBLY__) */
0109 
0110 /* Sparc specific messages. */
0111 #define MSG_CROSS_CALL         0x0005       /* run func on cpus */
0112 
0113 /* Empirical PROM processor mailbox constants.  If the per-cpu mailbox
0114  * contains something other than one of these then the ipi is from
0115  * Linux's active_kernel_processor.  This facility exists so that
0116  * the boot monitor can capture all the other cpus when one catches
0117  * a watchdog reset or the user enters the monitor using L1-A keys.
0118  */
0119 #define MBOX_STOPCPU          0xFB
0120 #define MBOX_IDLECPU          0xFC
0121 #define MBOX_IDLECPU2         0xFD
0122 #define MBOX_STOPCPU2         0xFE
0123 
0124 #else /* SMP */
0125 
0126 #define hard_smp_processor_id()     0
0127 #define smp_setup_cpu_possible_map() do { } while (0)
0128 
0129 #endif /* !(SMP) */
0130 #endif /* !(_SPARC_SMP_H) */