smp.h (3eb66e91a25497065c5322b1268cbc3953642227) smp.h (ed1cd6deb013a11959d17a94e35ce159197632da)
1/*
2 * smp.h: PowerPC-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>

--- 69 unchanged lines hidden (view full) ---

78
79#ifdef CONFIG_PPC64
80#define raw_smp_processor_id() (local_paca->paca_index)
81#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
82#else
83/* 32-bit */
84extern int smp_hw_index[];
85
1/*
2 * smp.h: PowerPC-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>

--- 69 unchanged lines hidden (view full) ---

78
79#ifdef CONFIG_PPC64
80#define raw_smp_processor_id() (local_paca->paca_index)
81#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
82#else
83/* 32-bit */
84extern int smp_hw_index[];
85
86#define raw_smp_processor_id() (current_thread_info()->cpu)
86/*
87 * This is particularly ugly: it appears we can't actually get the definition
88 * of task_struct here, but we need access to the CPU this task is running on.
89 * Instead of using task_struct we're using _TASK_CPU which is extracted from
90 * asm-offsets.h by kbuild to get the current processor ID.
91 *
92 * This also needs to be safeguarded when building asm-offsets.s because at
93 * that time _TASK_CPU is not defined yet. It could have been guarded by
94 * _TASK_CPU itself, but we want the build to fail if _TASK_CPU is missing
95 * when building something else than asm-offsets.s
96 */
97#ifdef GENERATING_ASM_OFFSETS
98#define raw_smp_processor_id() (0)
99#else
100#define raw_smp_processor_id() (*(unsigned int *)((void *)current + _TASK_CPU))
101#endif
87#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
88
89static inline int get_hard_smp_processor_id(int cpu)
90{
91 return smp_hw_index[cpu];
92}
93
94static inline void set_hard_smp_processor_id(int cpu, int phys)

--- 151 unchanged lines hidden ---
102#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
103
104static inline int get_hard_smp_processor_id(int cpu)
105{
106 return smp_hw_index[cpu];
107}
108
109static inline void set_hard_smp_processor_id(int cpu, int phys)

--- 151 unchanged lines hidden ---