smp.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * arch/arm/include/asm/smp.h
  3. *
  4. * Copyright (C) 2004-2005 ARM Ltd.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_SMP_H
  11. #define __ASM_ARM_SMP_H
  12. #include <linux/threads.h>
  13. #include <linux/cpumask.h>
  14. #include <linux/thread_info.h>
  15. #ifndef CONFIG_SMP
  16. # error "<asm/smp.h> included in non-SMP build"
  17. #endif
  18. #define raw_smp_processor_id() (current_thread_info()->cpu)
  19. struct seq_file;
  20. /*
  21. * generate IPI list text
  22. */
  23. extern void show_ipi_list(struct seq_file *, int);
  24. /*
  25. * Called from assembly code, this handles an IPI.
  26. */
  27. asmlinkage void do_IPI(int ipinr, struct pt_regs *regs);
  28. /*
  29. * Called from C code, this handles an IPI.
  30. */
  31. void handle_IPI(int ipinr, struct pt_regs *regs);
  32. /*
  33. * Setup the set of possible CPUs (via set_cpu_possible)
  34. */
  35. extern void smp_init_cpus(void);
  36. /*
  37. * Provide a function to raise an IPI cross call on CPUs in callmap.
  38. */
  39. extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int));
  40. /*
  41. * Boot a secondary CPU, and assign it the specified idle task.
  42. * This also gives us the initial stack to use for this CPU.
  43. */
  44. extern int boot_secondary(unsigned int cpu, struct task_struct *);
  45. /*
  46. * Called from platform specific assembly code, this is the
  47. * secondary CPU entry point.
  48. */
  49. asmlinkage void secondary_start_kernel(void);
  50. /*
  51. * Initial data for bringing up a secondary CPU.
  52. */
  53. struct secondary_data {
  54. union {
  55. unsigned long mpu_rgn_szr;
  56. unsigned long pgdir;
  57. };
  58. unsigned long swapper_pg_dir;
  59. void *stack;
  60. };
  61. extern struct secondary_data secondary_data;
  62. extern volatile int pen_release;
  63. extern void secondary_startup(void);
  64. extern int __cpu_disable(void);
  65. extern void __cpu_die(unsigned int cpu);
  66. extern void cpu_die(void);
  67. extern void arch_send_call_function_single_ipi(int cpu);
  68. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  69. extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
  70. extern int register_ipi_completion(struct completion *completion, int cpu);
  71. struct smp_operations {
  72. #ifdef CONFIG_SMP
  73. /*
  74. * Setup the set of possible CPUs (via set_cpu_possible)
  75. */
  76. void (*smp_init_cpus)(void);
  77. /*
  78. * Initialize cpu_possible map, and enable coherency
  79. */
  80. void (*smp_prepare_cpus)(unsigned int max_cpus);
  81. /*
  82. * Perform platform specific initialisation of the specified CPU.
  83. */
  84. void (*smp_secondary_init)(unsigned int cpu);
  85. /*
  86. * Boot a secondary CPU, and assign it the specified idle task.
  87. * This also gives us the initial stack to use for this CPU.
  88. */
  89. int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
  90. #ifdef CONFIG_HOTPLUG_CPU
  91. int (*cpu_kill)(unsigned int cpu);
  92. void (*cpu_die)(unsigned int cpu);
  93. int (*cpu_disable)(unsigned int cpu);
  94. #endif
  95. #endif
  96. };
  97. struct of_cpu_method {
  98. const char *method;
  99. struct smp_operations *ops;
  100. };
  101. #define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
  102. static const struct of_cpu_method __cpu_method_of_table_##name \
  103. __used __section(__cpu_method_of_table) \
  104. = { .method = _method, .ops = _ops }
  105. /*
  106. * set platform specific SMP operations
  107. */
  108. extern void smp_set_ops(struct smp_operations *);
  109. #endif /* ifndef __ASM_ARM_SMP_H */