mpspec.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_MPSPEC_H
  3. #define _ASM_X86_MPSPEC_H
  4. #include <asm/mpspec_def.h>
  5. #include <asm/x86_init.h>
  6. #include <asm/apicdef.h>
  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 u8 boot_cpu_apic_version;
  31. extern unsigned long mp_lapic_addr;
  32. #ifdef CONFIG_X86_LOCAL_APIC
  33. extern int smp_found_config;
  34. #else
  35. # define smp_found_config 0
  36. #endif
  37. static inline void get_smp_config(void)
  38. {
  39. x86_init.mpparse.get_smp_config(0);
  40. }
  41. static inline void early_get_smp_config(void)
  42. {
  43. x86_init.mpparse.get_smp_config(1);
  44. }
  45. static inline void find_smp_config(void)
  46. {
  47. x86_init.mpparse.find_smp_config();
  48. }
  49. #ifdef CONFIG_X86_MPPARSE
  50. extern void e820__memblock_alloc_reserved_mpc_new(void);
  51. extern int enable_update_mptable;
  52. extern void default_find_smp_config(void);
  53. extern void default_get_smp_config(unsigned int early);
  54. #else
  55. static inline void e820__memblock_alloc_reserved_mpc_new(void) { }
  56. #define enable_update_mptable 0
  57. #define default_find_smp_config x86_init_noop
  58. #define default_get_smp_config x86_init_uint_noop
  59. #endif
  60. int generic_processor_info(int apicid, int version);
  61. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC)
  62. struct physid_mask {
  63. unsigned long mask[PHYSID_ARRAY_SIZE];
  64. };
  65. typedef struct physid_mask physid_mask_t;
  66. #define physid_set(physid, map) set_bit(physid, (map).mask)
  67. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  68. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  69. #define physid_test_and_set(physid, map) \
  70. test_and_set_bit(physid, (map).mask)
  71. #define physids_and(dst, src1, src2) \
  72. bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_LOCAL_APIC)
  73. #define physids_or(dst, src1, src2) \
  74. bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_LOCAL_APIC)
  75. #define physids_clear(map) \
  76. bitmap_zero((map).mask, MAX_LOCAL_APIC)
  77. #define physids_complement(dst, src) \
  78. bitmap_complement((dst).mask, (src).mask, MAX_LOCAL_APIC)
  79. #define physids_empty(map) \
  80. bitmap_empty((map).mask, MAX_LOCAL_APIC)
  81. #define physids_equal(map1, map2) \
  82. bitmap_equal((map1).mask, (map2).mask, MAX_LOCAL_APIC)
  83. #define physids_weight(map) \
  84. bitmap_weight((map).mask, MAX_LOCAL_APIC)
  85. #define physids_shift_right(d, s, n) \
  86. bitmap_shift_right((d).mask, (s).mask, n, MAX_LOCAL_APIC)
  87. #define physids_shift_left(d, s, n) \
  88. bitmap_shift_left((d).mask, (s).mask, n, MAX_LOCAL_APIC)
  89. static inline unsigned long physids_coerce(physid_mask_t *map)
  90. {
  91. return map->mask[0];
  92. }
  93. static inline void physids_promote(unsigned long physids, physid_mask_t *map)
  94. {
  95. physids_clear(*map);
  96. map->mask[0] = physids;
  97. }
  98. static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
  99. {
  100. physids_clear(*map);
  101. physid_set(physid, *map);
  102. }
  103. #define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
  104. #define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
  105. extern physid_mask_t phys_cpu_present_map;
  106. #endif /* _ASM_X86_MPSPEC_H */