smp.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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>
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #ifndef _ASM_POWERPC_SMP_H
  16. #define _ASM_POWERPC_SMP_H
  17. #ifdef __KERNEL__
  18. #include <linux/threads.h>
  19. #include <linux/cpumask.h>
  20. #include <linux/kernel.h>
  21. #ifndef __ASSEMBLY__
  22. #ifdef CONFIG_PPC64
  23. #include <asm/paca.h>
  24. #endif
  25. #include <asm/percpu.h>
  26. extern int boot_cpuid;
  27. extern void cpu_die(void);
  28. #ifdef CONFIG_SMP
  29. extern void smp_send_debugger_break(int cpu);
  30. extern void smp_message_recv(int);
  31. DECLARE_PER_CPU(unsigned int, pvr);
  32. #ifdef CONFIG_HOTPLUG_CPU
  33. extern void fixup_irqs(cpumask_t map);
  34. int generic_cpu_disable(void);
  35. int generic_cpu_enable(unsigned int cpu);
  36. void generic_cpu_die(unsigned int cpu);
  37. void generic_mach_cpu_die(void);
  38. #endif
  39. #ifdef CONFIG_PPC64
  40. #define raw_smp_processor_id() (local_paca->paca_index)
  41. #define hard_smp_processor_id() (get_paca()->hw_cpu_id)
  42. #else
  43. /* 32-bit */
  44. extern int smp_hw_index[];
  45. #define raw_smp_processor_id() (current_thread_info()->cpu)
  46. #define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
  47. static inline int get_hard_smp_processor_id(int cpu)
  48. {
  49. return smp_hw_index[cpu];
  50. }
  51. static inline void set_hard_smp_processor_id(int cpu, int phys)
  52. {
  53. smp_hw_index[cpu] = phys;
  54. }
  55. #endif
  56. DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
  57. DECLARE_PER_CPU(cpumask_t, cpu_core_map);
  58. extern int cpu_to_core_id(int cpu);
  59. /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
  60. *
  61. * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
  62. * in /proc/interrupts will be wrong!!! --Troy */
  63. #define PPC_MSG_CALL_FUNCTION 0
  64. #define PPC_MSG_RESCHEDULE 1
  65. #define PPC_MSG_CALL_FUNC_SINGLE 2
  66. #define PPC_MSG_DEBUGGER_BREAK 3
  67. /*
  68. * irq controllers that have dedicated ipis per message and don't
  69. * need additional code in the action handler may use this
  70. */
  71. extern int smp_request_message_ipi(int virq, int message);
  72. extern const char *smp_ipi_name[];
  73. void smp_init_iSeries(void);
  74. void smp_init_pSeries(void);
  75. void smp_init_cell(void);
  76. void smp_init_celleb(void);
  77. void smp_setup_cpu_maps(void);
  78. void smp_setup_cpu_sibling_map(void);
  79. extern int __cpu_disable(void);
  80. extern void __cpu_die(unsigned int cpu);
  81. #else
  82. /* for UP */
  83. #define hard_smp_processor_id() get_hard_smp_processor_id(0)
  84. #define smp_setup_cpu_maps()
  85. #endif /* CONFIG_SMP */
  86. #ifdef CONFIG_PPC64
  87. static inline int get_hard_smp_processor_id(int cpu)
  88. {
  89. return paca[cpu].hw_cpu_id;
  90. }
  91. static inline void set_hard_smp_processor_id(int cpu, int phys)
  92. {
  93. paca[cpu].hw_cpu_id = phys;
  94. }
  95. extern void smp_release_cpus(void);
  96. #else
  97. /* 32-bit */
  98. #ifndef CONFIG_SMP
  99. extern int boot_cpuid_phys;
  100. static inline int get_hard_smp_processor_id(int cpu)
  101. {
  102. return boot_cpuid_phys;
  103. }
  104. static inline void set_hard_smp_processor_id(int cpu, int phys)
  105. {
  106. boot_cpuid_phys = phys;
  107. }
  108. #endif /* !CONFIG_SMP */
  109. #endif /* !CONFIG_PPC64 */
  110. extern int smt_enabled_at_boot;
  111. extern int smp_mpic_probe(void);
  112. extern void smp_mpic_setup_cpu(int cpu);
  113. extern void smp_generic_kick_cpu(int nr);
  114. extern void smp_generic_give_timebase(void);
  115. extern void smp_generic_take_timebase(void);
  116. extern struct smp_ops_t *smp_ops;
  117. extern void arch_send_call_function_single_ipi(int cpu);
  118. extern void arch_send_call_function_ipi(cpumask_t mask);
  119. #endif /* __ASSEMBLY__ */
  120. #endif /* __KERNEL__ */
  121. #endif /* _ASM_POWERPC_SMP_H) */