percpu.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _ASM_IA64_PERCPU_H
  2. #define _ASM_IA64_PERCPU_H
  3. /*
  4. * Copyright (C) 2002-2003 Hewlett-Packard Co
  5. * David Mosberger-Tang <davidm@hpl.hp.com>
  6. */
  7. #ifdef __ASSEMBLY__
  8. # define THIS_CPU(var) (var) /* use this to mark accesses to per-CPU variables... */
  9. #else /* !__ASSEMBLY__ */
  10. #include <linux/threads.h>
  11. #ifdef CONFIG_SMP
  12. #ifdef HAVE_MODEL_SMALL_ATTRIBUTE
  13. # define PER_CPU_ATTRIBUTES __attribute__((__model__ (__small__)))
  14. #endif
  15. #define __my_cpu_offset __ia64_per_cpu_var(local_per_cpu_offset)
  16. extern void *per_cpu_init(void);
  17. #else /* ! SMP */
  18. #define per_cpu_init() (__phys_per_cpu_start)
  19. #endif /* SMP */
  20. #define PER_CPU_BASE_SECTION ".data..percpu"
  21. /*
  22. * Be extremely careful when taking the address of this variable! Due to virtual
  23. * remapping, it is different from the canonical address returned by this_cpu_ptr(&var)!
  24. * On the positive side, using __ia64_per_cpu_var() instead of this_cpu_ptr() is slightly
  25. * more efficient.
  26. */
  27. #define __ia64_per_cpu_var(var) (*({ \
  28. __verify_pcpu_ptr(&(var)); \
  29. ((typeof(var) __kernel __force *)&(var)); \
  30. }))
  31. #include <asm-generic/percpu.h>
  32. /* Equal to __per_cpu_offset[smp_processor_id()], but faster to access: */
  33. DECLARE_PER_CPU(unsigned long, local_per_cpu_offset);
  34. #endif /* !__ASSEMBLY__ */
  35. #endif /* _ASM_IA64_PERCPU_H */