smp.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #ifdef CONFIG_HOTPLUG_CPU
  32. extern void fixup_irqs(cpumask_t map);
  33. int generic_cpu_disable(void);
  34. int generic_cpu_enable(unsigned int cpu);
  35. void generic_cpu_die(unsigned int cpu);
  36. void generic_mach_cpu_die(void);
  37. #endif
  38. #ifdef CONFIG_PPC64
  39. #define raw_smp_processor_id() (local_paca->paca_index)
  40. #define hard_smp_processor_id() (get_paca()->hw_cpu_id)
  41. #else
  42. /* 32-bit */
  43. extern int smp_hw_index[];
  44. #define raw_smp_processor_id() (current_thread_info()->cpu)
  45. #define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
  46. #define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)])
  47. #define set_hard_smp_processor_id(cpu, phys)\
  48. (smp_hw_index[(cpu)] = (phys))
  49. #endif
  50. DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
  51. /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
  52. *
  53. * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
  54. * in /proc/interrupts will be wrong!!! --Troy */
  55. #define PPC_MSG_CALL_FUNCTION 0
  56. #define PPC_MSG_RESCHEDULE 1
  57. /* This is unused now */
  58. #if 0
  59. #define PPC_MSG_MIGRATE_TASK 2
  60. #endif
  61. #define PPC_MSG_DEBUGGER_BREAK 3
  62. void smp_init_iSeries(void);
  63. void smp_init_pSeries(void);
  64. void smp_init_cell(void);
  65. void smp_init_celleb(void);
  66. void smp_setup_cpu_maps(void);
  67. void smp_setup_cpu_sibling_map(void);
  68. extern int __cpu_disable(void);
  69. extern void __cpu_die(unsigned int cpu);
  70. #else
  71. /* for UP */
  72. #define hard_smp_processor_id() 0
  73. #define smp_setup_cpu_maps()
  74. #endif /* CONFIG_SMP */
  75. #ifdef CONFIG_PPC64
  76. #define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id)
  77. #define set_hard_smp_processor_id(CPU, VAL) \
  78. do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0)
  79. extern void smp_release_cpus(void);
  80. #else
  81. /* 32-bit */
  82. #ifndef CONFIG_SMP
  83. extern int boot_cpuid_phys;
  84. #define get_hard_smp_processor_id(cpu) boot_cpuid_phys
  85. #define set_hard_smp_processor_id(cpu, phys)
  86. #endif
  87. #endif
  88. extern int smt_enabled_at_boot;
  89. extern int smp_mpic_probe(void);
  90. extern void smp_mpic_setup_cpu(int cpu);
  91. extern void smp_generic_kick_cpu(int nr);
  92. extern void smp_generic_give_timebase(void);
  93. extern void smp_generic_take_timebase(void);
  94. extern struct smp_ops_t *smp_ops;
  95. #endif /* __ASSEMBLY__ */
  96. #endif /* __KERNEL__ */
  97. #endif /* _ASM_POWERPC_SMP_H) */