smp.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 (*mtrr_hook) (void);
  35. extern void zap_low_mappings (void);
  36. extern void lock_ipi_call_lock(void);
  37. extern void unlock_ipi_call_lock(void);
  38. #define MAX_APICID 256
  39. extern u8 x86_cpu_to_apicid[];
  40. #ifdef CONFIG_HOTPLUG_CPU
  41. extern void cpu_exit_clear(void);
  42. extern void cpu_uninit(void);
  43. #endif
  44. /*
  45. * This function is needed by all SMP systems. It must _always_ be valid
  46. * from the initial startup. We map APIC_BASE very early in page_setup(),
  47. * so this is correct in the x86 case.
  48. */
  49. #define raw_smp_processor_id() (current_thread_info()->cpu)
  50. extern cpumask_t cpu_callout_map;
  51. extern cpumask_t cpu_callin_map;
  52. extern cpumask_t cpu_possible_map;
  53. /* We don't mark CPUs online until __cpu_up(), so we need another measure */
  54. static inline int num_booting_cpus(void)
  55. {
  56. return cpus_weight(cpu_callout_map);
  57. }
  58. #ifdef CONFIG_X86_LOCAL_APIC
  59. #ifdef APIC_DEFINITION
  60. extern int hard_smp_processor_id(void);
  61. #else
  62. #include <mach_apicdef.h>
  63. static inline int hard_smp_processor_id(void)
  64. {
  65. /* we don't want to mark this access volatile - bad code generation */
  66. return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID));
  67. }
  68. #endif
  69. static __inline int logical_smp_processor_id(void)
  70. {
  71. /* we don't want to mark this access volatile - bad code generation */
  72. return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR));
  73. }
  74. #endif
  75. extern int __cpu_disable(void);
  76. extern void __cpu_die(unsigned int cpu);
  77. #endif /* !__ASSEMBLY__ */
  78. #define NO_PROC_ID 0xFF /* No processor magic marker */
  79. #endif
  80. #endif