| 1 | /* |
| 2 | * arch/ubicom32/include/asm/smp.h |
| 3 | * SMP definitions for Ubicom32 architecture. |
| 4 | * |
| 5 | * (C) Copyright 2009, Ubicom, Inc. |
| 6 | * |
| 7 | * This file is part of the Ubicom32 Linux Kernel Port. |
| 8 | * |
| 9 | * The Ubicom32 Linux Kernel Port is free software: you can redistribute |
| 10 | * it and/or modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation, either version 2 of the |
| 12 | * License, or (at your option) any later version. |
| 13 | * |
| 14 | * The Ubicom32 Linux Kernel Port is distributed in the hope that it |
| 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 16 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 17 | * the GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with the Ubicom32 Linux Kernel Port. If not, |
| 21 | * see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * Ubicom32 implementation derived from (with many thanks): |
| 24 | * arch/m68knommu |
| 25 | * arch/blackfin |
| 26 | * arch/parisc |
| 27 | */ |
| 28 | #ifndef _ASM_UBICOM32_SMP_H |
| 29 | #define _ASM_UBICOM32_SMP_H |
| 30 | |
| 31 | #ifndef CONFIG_SMP |
| 32 | #error you should not include smp.h if smp is off |
| 33 | #endif |
| 34 | |
| 35 | #ifndef ASSEMBLY |
| 36 | #include <linux/bitops.h> |
| 37 | #include <linux/threads.h> |
| 38 | #include <linux/cpumask.h> |
| 39 | #include <asm/ip5000.h> |
| 40 | |
| 41 | typedef unsigned long address_t; |
| 42 | extern unsigned int smp_ipi_irq; |
| 43 | |
| 44 | /* |
| 45 | * This magic constant controls our willingness to transfer |
| 46 | * a process across CPUs. |
| 47 | * |
| 48 | * Such a transfer incurs cache and tlb |
| 49 | * misses. The current value is inherited from i386. Still needs |
| 50 | * to be tuned for parisc. |
| 51 | */ |
| 52 | #define PROC_CHANGE_PENALTY 15 /* Schedule penalty */ |
| 53 | #define NO_PROC_ID 0xFF /* No processor magic marker */ |
| 54 | #define ANY_PROC_ID 0xFF /* Any processor magic marker */ |
| 55 | |
| 56 | #ifdef CONFIG_SMP |
| 57 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
| 58 | #endif /* CONFIG_SMP */ |
| 59 | |
| 60 | static inline int __cpu_disable (void) |
| 61 | { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | static inline void __cpu_die (unsigned int cpu) |
| 66 | { |
| 67 | while(1) { |
| 68 | }; |
| 69 | } |
| 70 | |
| 71 | extern int __cpu_up(unsigned int cpu); |
| 72 | extern void smp_send_timer_all(void); |
| 73 | extern void smp_timer_broadcast(const struct cpumask *mask); |
| 74 | extern void smp_set_affinity(unsigned int irq, const struct cpumask *dest); |
| 75 | extern void arch_send_call_function_single_ipi(int cpu); |
| 76 | #define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask |
| 77 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
| 78 | |
| 79 | /* |
| 80 | * TODO: Once these are fully tested, we should turn them into |
| 81 | * inline macros for performance. |
| 82 | */ |
| 83 | extern unsigned long smp_get_affinity(unsigned int irq, int *all); |
| 84 | extern void smp_reset_ipi(unsigned long mask); |
| 85 | |
| 86 | #endif /* !ASSEMBLY */ |
| 87 | #endif /* _ASM_UBICOM32_SMP_H */ |
| 88 | |