1 /* 2 * smp.h: PPC64 specific SMP code. 3 * 4 * Original was a copy of sparc smp.h. Now heavily modified 5 * for PPC. 6 * 7 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 8 * Copyright (C) 1996-2001 Cort Dougan <cort@fsmlabs.com> 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 13 * 2 of the License, or (at your option) any later version. 14 */ 15 16 #ifdef __KERNEL__ 17 #ifndef _PPC64_SMP_H 18 #define _PPC64_SMP_H 19 20 #include <linux/config.h> 21 #include <linux/kernel.h> 22 #include <linux/threads.h> /* for NR_CPUS */ 23 24 25 #ifndef __ASSEMBLY__ 26 #ifdef CONFIG_SMP 27 28 #include <asm/paca.h> 29 30 struct current_set_struct { 31 struct task_struct *task; 32 unsigned long *sp_real; 33 }; 34 35 extern unsigned long cpu_online_map; 36 37 extern void smp_message_pass(int target, int msg, unsigned long data, int wait); 38 extern void smp_store_cpu_info(int id); 39 extern void smp_send_tlb_invalidate(int); 40 extern void smp_send_xmon_break(int cpu); 41 struct pt_regs; 42 extern void smp_message_recv(int, struct pt_regs *); 43 44 /* 45 * Retrieve the state of a CPU: 46 * online: CPU is in a normal run state 47 * possible: CPU is a candidate to be made online 48 * available: CPU is candidate for the 'possible' pool 49 */ 50 #define cpu_possible(cpu) paca[cpu].active 51 #define cpu_available(cpu) paca[cpu].available 52 53 #define NO_PROC_ID 0xFF /* No processor magic marker */ 54 #define PROC_CHANGE_PENALTY 20 55 56 /* 1 to 1 mapping on PPC -- Cort */ 57 #define cpu_logical_map(cpu) (cpu) 58 #define cpu_number_map(x) (x) 59 extern volatile unsigned long cpu_callin_map[NR_CPUS]; 60 61 #define smp_processor_id() (get_paca()->xPacaIndex) 62 #define hard_smp_processor_id() (get_paca()->xHwProcNum) 63 64 65 66 /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. 67 * 68 * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up 69 * in /proc/interrupts will be wrong!!! --Troy */ 70 #define PPC_MSG_CALL_FUNCTION 0 71 #define PPC_MSG_RESCHEDULE 1 72 #define PPC_MSG_INVALIDATE_TLB 2 73 #define PPC_MSG_XMON_BREAK 3 74 75 void smp_init_iSeries(void); 76 void smp_init_pSeries(void); 77 78 #else /* CONFIG_SMP */ 79 #define cpu_possible(cpu) ((cpu) == 0) 80 #define cpu_available(cpu) ((cpu) == 0) 81 82 #endif /* !(CONFIG_SMP) */ 83 #endif /* __ASSEMBLY__ */ 84 #endif /* !(_PPC64_SMP_H) */ 85 #endif /* __KERNEL__ */ 86