smp.h 3.0 KB

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