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