smp.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* smp.h: Sparc64 specific SMP stuff.
  2. *
  3. * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  4. */
  5. #ifndef _SPARC64_SMP_H
  6. #define _SPARC64_SMP_H
  7. #include <linux/config.h>
  8. #include <linux/threads.h>
  9. #include <asm/asi.h>
  10. #include <asm/starfire.h>
  11. #include <asm/spitfire.h>
  12. #ifndef __ASSEMBLY__
  13. #include <linux/cpumask.h>
  14. #include <linux/cache.h>
  15. #endif /* !(__ASSEMBLY__) */
  16. #ifdef CONFIG_SMP
  17. #ifndef __ASSEMBLY__
  18. /*
  19. * Private routines/data
  20. */
  21. #include <asm/bitops.h>
  22. #include <asm/atomic.h>
  23. extern cpumask_t phys_cpu_present_map;
  24. #define cpu_possible_map phys_cpu_present_map
  25. /*
  26. * General functions that each host system must provide.
  27. */
  28. static __inline__ int hard_smp_processor_id(void)
  29. {
  30. if (tlb_type == cheetah || tlb_type == cheetah_plus) {
  31. unsigned long cfg, ver;
  32. __asm__ __volatile__("rdpr %%ver, %0" : "=r" (ver));
  33. if ((ver >> 32) == 0x003e0016) {
  34. __asm__ __volatile__("ldxa [%%g0] %1, %0"
  35. : "=r" (cfg)
  36. : "i" (ASI_JBUS_CONFIG));
  37. return ((cfg >> 17) & 0x1f);
  38. } else {
  39. __asm__ __volatile__("ldxa [%%g0] %1, %0"
  40. : "=r" (cfg)
  41. : "i" (ASI_SAFARI_CONFIG));
  42. return ((cfg >> 17) & 0x3ff);
  43. }
  44. } else if (this_is_starfire != 0) {
  45. return starfire_hard_smp_processor_id();
  46. } else {
  47. unsigned long upaconfig;
  48. __asm__ __volatile__("ldxa [%%g0] %1, %0"
  49. : "=r" (upaconfig)
  50. : "i" (ASI_UPA_CONFIG));
  51. return ((upaconfig >> 17) & 0x1f);
  52. }
  53. }
  54. #define raw_smp_processor_id() (current_thread_info()->cpu)
  55. #endif /* !(__ASSEMBLY__) */
  56. #endif /* !(CONFIG_SMP) */
  57. #define NO_PROC_ID 0xFF
  58. #endif /* !(_SPARC64_SMP_H) */