mpspec.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #ifndef _ASM_X86_MPSPEC_H
  2. #define _ASM_X86_MPSPEC_H
  3. #include <asm/mpspec_def.h>
  4. #include <asm/x86_init.h>
  5. #include <asm/apicdef.h>
  6. extern int apic_version[];
  7. extern int pic_mode;
  8. #ifdef CONFIG_X86_32
  9. /*
  10. * Summit or generic (i.e. installer) kernels need lots of bus entries.
  11. * Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets.
  12. */
  13. #if CONFIG_BASE_SMALL == 0
  14. # define MAX_MP_BUSSES 260
  15. #else
  16. # define MAX_MP_BUSSES 32
  17. #endif
  18. #define MAX_IRQ_SOURCES 256
  19. extern unsigned int def_to_bigsmp;
  20. #else /* CONFIG_X86_64: */
  21. #define MAX_MP_BUSSES 256
  22. /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
  23. #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
  24. #endif /* CONFIG_X86_64 */
  25. #ifdef CONFIG_EISA
  26. extern int mp_bus_id_to_type[MAX_MP_BUSSES];
  27. #endif
  28. extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
  29. extern unsigned int boot_cpu_physical_apicid;
  30. extern unsigned long mp_lapic_addr;
  31. #ifdef CONFIG_X86_LOCAL_APIC
  32. extern int smp_found_config;
  33. #else
  34. # define smp_found_config 0
  35. #endif
  36. static inline void get_smp_config(void)
  37. {
  38. x86_init.mpparse.get_smp_config(0);
  39. }
  40. static inline void early_get_smp_config(void)
  41. {
  42. x86_init.mpparse.get_smp_config(1);
  43. }
  44. static inline void find_smp_config(void)
  45. {
  46. x86_init.mpparse.find_smp_config();
  47. }
  48. #ifdef CONFIG_X86_MPPARSE
  49. extern void early_reserve_e820_mpc_new(void);
  50. extern int enable_update_mptable;
  51. extern int default_mpc_apic_id(struct mpc_cpu *m);
  52. extern void default_smp_read_mpc_oem(struct mpc_table *mpc);
  53. # ifdef CONFIG_X86_IO_APIC
  54. extern void default_mpc_oem_bus_info(struct mpc_bus *m, char *str);
  55. # else
  56. # define default_mpc_oem_bus_info NULL
  57. # endif
  58. extern void default_find_smp_config(void);
  59. extern void default_get_smp_config(unsigned int early);
  60. #else
  61. static inline void early_reserve_e820_mpc_new(void) { }
  62. #define enable_update_mptable 0
  63. #define default_mpc_apic_id NULL
  64. #define default_smp_read_mpc_oem NULL
  65. #define default_mpc_oem_bus_info NULL
  66. #define default_find_smp_config x86_init_noop
  67. #define default_get_smp_config x86_init_uint_noop
  68. #endif
  69. int generic_processor_info(int apicid, int version);
  70. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC)
  71. struct physid_mask {
  72. unsigned long mask[PHYSID_ARRAY_SIZE];
  73. };
  74. typedef struct physid_mask physid_mask_t;
  75. #define physid_set(physid, map) set_bit(physid, (map).mask)
  76. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  77. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  78. #define physid_test_and_set(physid, map) \
  79. test_and_set_bit(physid, (map).mask)
  80. #define physids_and(dst, src1, src2) \
  81. bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_LOCAL_APIC)
  82. #define physids_or(dst, src1, src2) \
  83. bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_LOCAL_APIC)
  84. #define physids_clear(map) \
  85. bitmap_zero((map).mask, MAX_LOCAL_APIC)
  86. #define physids_complement(dst, src) \
  87. bitmap_complement((dst).mask, (src).mask, MAX_LOCAL_APIC)
  88. #define physids_empty(map) \
  89. bitmap_empty((map).mask, MAX_LOCAL_APIC)
  90. #define physids_equal(map1, map2) \
  91. bitmap_equal((map1).mask, (map2).mask, MAX_LOCAL_APIC)
  92. #define physids_weight(map) \
  93. bitmap_weight((map).mask, MAX_LOCAL_APIC)
  94. #define physids_shift_right(d, s, n) \
  95. bitmap_shift_right((d).mask, (s).mask, n, MAX_LOCAL_APIC)
  96. #define physids_shift_left(d, s, n) \
  97. bitmap_shift_left((d).mask, (s).mask, n, MAX_LOCAL_APIC)
  98. static inline unsigned long physids_coerce(physid_mask_t *map)
  99. {
  100. return map->mask[0];
  101. }
  102. static inline void physids_promote(unsigned long physids, physid_mask_t *map)
  103. {
  104. physids_clear(*map);
  105. map->mask[0] = physids;
  106. }
  107. static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
  108. {
  109. physids_clear(*map);
  110. physid_set(physid, *map);
  111. }
  112. #define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
  113. #define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
  114. extern physid_mask_t phys_cpu_present_map;
  115. #endif /* _ASM_X86_MPSPEC_H */