diff options
author | Jack Steiner <steiner@sgi.com> | 2008-03-28 15:12:14 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:33 -0400 |
commit | 8400def8252f90ecd056657c0bac806afadd8511 (patch) | |
tree | 6ea86696639bd2abd605a9dbf4c3808b2eff32f2 | |
parent | 952cf6d7ae52cc5423baa57e978e20e732a89ba6 (diff) |
x86: define the macros and tables for blade functions
Add UV macros for converting between cpu numbers, blade numbers
and node numbers. Note that these are used ONLY within x86_64 UV
modules, and are not for general kernel use.
Signed-off-by: Jack Steiner <steiner@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/asm-x86/uv/uv_hub.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/include/asm-x86/uv/uv_hub.h b/include/asm-x86/uv/uv_hub.h index b4fcf9cf8951..26b9240d1e23 100644 --- a/include/asm-x86/uv/uv_hub.h +++ b/include/asm-x86/uv/uv_hub.h | |||
@@ -206,5 +206,79 @@ static inline void uv_write_local_mmr(unsigned long offset, unsigned long val) | |||
206 | *uv_local_mmr_address(offset) = val; | 206 | *uv_local_mmr_address(offset) = val; |
207 | } | 207 | } |
208 | 208 | ||
209 | /* | ||
210 | * Structures and definitions for converting between cpu, node, and blade | ||
211 | * numbers. | ||
212 | */ | ||
213 | struct uv_blade_info { | ||
214 | unsigned short nr_posible_cpus; | ||
215 | unsigned short nr_online_cpus; | ||
216 | unsigned short nasid; | ||
217 | }; | ||
218 | struct uv_blade_info *uv_blade_info; | ||
219 | extern short *uv_node_to_blade; | ||
220 | extern short *uv_cpu_to_blade; | ||
221 | extern short uv_possible_blades; | ||
222 | |||
223 | /* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */ | ||
224 | static inline int uv_blade_processor_id(void) | ||
225 | { | ||
226 | return uv_hub_info->blade_processor_id; | ||
227 | } | ||
228 | |||
229 | /* Blade number of current cpu. Numnbered 0 .. <#blades -1> */ | ||
230 | static inline int uv_numa_blade_id(void) | ||
231 | { | ||
232 | return uv_hub_info->numa_blade_id; | ||
233 | } | ||
234 | |||
235 | /* Convert a cpu number to the the UV blade number */ | ||
236 | static inline int uv_cpu_to_blade_id(int cpu) | ||
237 | { | ||
238 | return uv_cpu_to_blade[cpu]; | ||
239 | } | ||
240 | |||
241 | /* Convert linux node number to the UV blade number */ | ||
242 | static inline int uv_node_to_blade_id(int nid) | ||
243 | { | ||
244 | return uv_node_to_blade[nid]; | ||
245 | } | ||
246 | |||
247 | /* Convert a blade id to the NASID of the blade */ | ||
248 | static inline int uv_blade_to_nasid(int bid) | ||
249 | { | ||
250 | return uv_blade_info[bid].nasid; | ||
251 | } | ||
252 | |||
253 | /* Determine the number of possible cpus on a blade */ | ||
254 | static inline int uv_blade_nr_possible_cpus(int bid) | ||
255 | { | ||
256 | return uv_blade_info[bid].nr_posible_cpus; | ||
257 | } | ||
258 | |||
259 | /* Determine the number of online cpus on a blade */ | ||
260 | static inline int uv_blade_nr_online_cpus(int bid) | ||
261 | { | ||
262 | return uv_blade_info[bid].nr_online_cpus; | ||
263 | } | ||
264 | |||
265 | /* Convert a cpu id to the NASID of the blade containing the cpu */ | ||
266 | static inline int uv_cpu_to_nasid(int cpu) | ||
267 | { | ||
268 | return uv_blade_info[uv_cpu_to_blade_id(cpu)].nasid; | ||
269 | } | ||
270 | |||
271 | /* Convert a node number to the NASID of the blade */ | ||
272 | static inline int uv_node_to_nasid(int nid) | ||
273 | { | ||
274 | return uv_blade_info[uv_node_to_blade_id(nid)].nasid; | ||
275 | } | ||
276 | |||
277 | /* Maximum possible number of blades */ | ||
278 | static inline int uv_num_possible_blades(void) | ||
279 | { | ||
280 | return uv_possible_blades; | ||
281 | } | ||
282 | |||
209 | #endif /* __ASM_X86_UV_HUB__ */ | 283 | #endif /* __ASM_X86_UV_HUB__ */ |
210 | 284 | ||