smp.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef __ASM_SMP_H
  2. #define __ASM_SMP_H
  3. /*
  4. * We need the APIC definitions automatically as part of 'smp.h'
  5. */
  6. #ifndef __ASSEMBLY__
  7. #include <linux/config.h>
  8. #include <linux/kernel.h>
  9. #include <linux/threads.h>
  10. #include <linux/cpumask.h>
  11. #endif
  12. #ifdef CONFIG_X86_LOCAL_APIC
  13. #ifndef __ASSEMBLY__
  14. #include <asm/fixmap.h>
  15. #include <asm/bitops.h>
  16. #include <asm/mpspec.h>
  17. #ifdef CONFIG_X86_IO_APIC
  18. #include <asm/io_apic.h>
  19. #endif
  20. #include <asm/apic.h>
  21. #endif
  22. #endif
  23. #define BAD_APICID 0xFFu
  24. #ifdef CONFIG_SMP
  25. #ifndef __ASSEMBLY__
  26. /*
  27. * Private routines/data
  28. */
  29. extern void smp_alloc_memory(void);
  30. extern int pic_mode;
  31. extern int smp_num_siblings;
  32. extern cpumask_t cpu_sibling_map[];
  33. extern cpumask_t cpu_core_map[];
  34. extern void smp_flush_tlb(void);
  35. extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
  36. extern void smp_invalidate_rcv(void); /* Process an NMI */
  37. extern void (*mtrr_hook) (void);
  38. extern void zap_low_mappings (void);
  39. extern void lock_ipi_call_lock(void);
  40. extern void unlock_ipi_call_lock(void);
  41. #define MAX_APICID 256
  42. extern u8 x86_cpu_to_apicid[];
  43. #ifdef CONFIG_HOTPLUG_CPU
  44. extern void cpu_exit_clear(void);
  45. extern void cpu_uninit(void);
  46. #endif
  47. /*
  48. * This function is needed by all SMP systems. It must _always_ be valid
  49. * from the initial startup. We map APIC_BASE very early in page_setup(),
  50. * so this is correct in the x86 case.
  51. */
  52. #define raw_smp_processor_id() (current_thread_info()->cpu)
  53. extern cpumask_t cpu_callout_map;
  54. extern cpumask_t cpu_callin_map;
  55. #define cpu_possible_map cpu_callout_map
  56. /* We don't mark CPUs online until __cpu_up(), so we need another measure */
  57. static inline int num_booting_cpus(void)
  58. {
  59. return cpus_weight(cpu_callout_map);
  60. }
  61. #ifdef CONFIG_X86_LOCAL_APIC
  62. #ifdef APIC_DEFINITION
  63. extern int hard_smp_processor_id(void);
  64. #else
  65. #include <mach_apicdef.h>
  66. static inline int hard_smp_processor_id(void)
  67. {
  68. /* we don't want to mark this access volatile - bad code generation */
  69. return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
  70. }
  71. #endif
  72. static __inline int logical_smp_processor_id(void)
  73. {
  74. /* we don't want to mark this access volatile - bad code generation */
  75. return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
  76. }
  77. #endif
  78. extern int __cpu_disable(void);
  79. extern void __cpu_die(unsigned int cpu);
  80. #endif /* !__ASSEMBLY__ */
  81. #define NO_PROC_ID 0xFF /* No processor magic marker */
  82. #endif
  83. #endif