smp.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* MN10300 SMP support
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * Modified by Matsushita Electric Industrial Co., Ltd.
  7. * Modifications:
  8. * 13-Nov-2006 MEI Define IPI-IRQ number and add inline/macro function
  9. * for SMP support.
  10. * 22-Jan-2007 MEI Add the define related to SMP_BOOT_IRQ.
  11. * 23-Feb-2007 MEI Add the define related to SMP icahce invalidate.
  12. * 23-Jun-2008 MEI Delete INTC_IPI.
  13. * 22-Jul-2008 MEI Add smp_nmi_call_function and related defines.
  14. * 04-Aug-2008 MEI Delete USE_DOIRQ_CACHE_IPI.
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public Licence
  18. * as published by the Free Software Foundation; either version
  19. * 2 of the Licence, or (at your option) any later version.
  20. */
  21. #ifndef _ASM_SMP_H
  22. #define _ASM_SMP_H
  23. #ifndef __ASSEMBLY__
  24. #include <linux/threads.h>
  25. #include <linux/cpumask.h>
  26. #endif
  27. #ifdef CONFIG_SMP
  28. #include <proc/smp-regs.h>
  29. #define RESCHEDULE_IPI 63
  30. #define CALL_FUNC_SINGLE_IPI 192
  31. #define LOCAL_TIMER_IPI 193
  32. #define FLUSH_CACHE_IPI 194
  33. #define CALL_FUNCTION_NMI_IPI 195
  34. #define DEBUGGER_NMI_IPI 196
  35. #define SMP_BOOT_IRQ 195
  36. #define RESCHEDULE_GxICR_LV GxICR_LEVEL_6
  37. #define CALL_FUNCTION_GxICR_LV GxICR_LEVEL_4
  38. #define LOCAL_TIMER_GxICR_LV GxICR_LEVEL_4
  39. #define FLUSH_CACHE_GxICR_LV GxICR_LEVEL_0
  40. #define SMP_BOOT_GxICR_LV GxICR_LEVEL_0
  41. #define DEBUGGER_GxICR_LV CONFIG_DEBUGGER_IRQ_LEVEL
  42. #define TIME_OUT_COUNT_BOOT_IPI 100
  43. #define DELAY_TIME_BOOT_IPI 75000
  44. #ifndef __ASSEMBLY__
  45. /**
  46. * raw_smp_processor_id - Determine the raw CPU ID of the CPU running it
  47. *
  48. * What we really want to do is to use the CPUID hardware CPU register to get
  49. * this information, but accesses to that aren't cached, and run at system bus
  50. * speed, not CPU speed. A copy of this value is, however, stored in the
  51. * thread_info struct, and that can be cached.
  52. *
  53. * An alternate way of dealing with this could be to use the EPSW.S bits to
  54. * cache this information for systems with up to four CPUs.
  55. */
  56. #define arch_smp_processor_id() (CPUID)
  57. #if 0
  58. #define raw_smp_processor_id() (arch_smp_processor_id())
  59. #else
  60. #define raw_smp_processor_id() (current_thread_info()->cpu)
  61. #endif
  62. static inline int cpu_logical_map(int cpu)
  63. {
  64. return cpu;
  65. }
  66. static inline int cpu_number_map(int cpu)
  67. {
  68. return cpu;
  69. }
  70. extern cpumask_t cpu_boot_map;
  71. extern void smp_init_cpus(void);
  72. extern void smp_cache_interrupt(void);
  73. extern void send_IPI_allbutself(int irq);
  74. extern int smp_nmi_call_function(smp_call_func_t func, void *info, int wait);
  75. extern void arch_send_call_function_single_ipi(int cpu);
  76. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  77. #ifdef CONFIG_HOTPLUG_CPU
  78. extern int __cpu_disable(void);
  79. extern void __cpu_die(unsigned int cpu);
  80. #endif /* CONFIG_HOTPLUG_CPU */
  81. #endif /* __ASSEMBLY__ */
  82. #else /* CONFIG_SMP */
  83. #ifndef __ASSEMBLY__
  84. static inline void smp_init_cpus(void) {}
  85. #endif /* __ASSEMBLY__ */
  86. #endif /* CONFIG_SMP */
  87. #endif /* _ASM_SMP_H */