mpspec.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 pic_mode;
  7. #ifdef CONFIG_X86_32
  8. /*
  9. * Summit or generic (i.e. installer) kernels need lots of bus entries.
  10. * Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets.
  11. */
  12. #if CONFIG_BASE_SMALL == 0
  13. # define MAX_MP_BUSSES 260
  14. #else
  15. # define MAX_MP_BUSSES 32
  16. #endif
  17. #define MAX_IRQ_SOURCES 256
  18. extern unsigned int def_to_bigsmp;
  19. #else /* CONFIG_X86_64: */
  20. #define MAX_MP_BUSSES 256
  21. /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
  22. #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
  23. #endif /* CONFIG_X86_64 */
  24. #ifdef CONFIG_EISA
  25. extern int mp_bus_id_to_type[MAX_MP_BUSSES];
  26. #endif
  27. extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
  28. extern unsigned int boot_cpu_physical_apicid;
  29. extern u8 boot_cpu_apic_version;
  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. int __generic_processor_info(int apicid, int version, bool enabled);
  71. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_LOCAL_APIC)
  72. struct physid_mask {
  73. unsigned long mask[PHYSID_ARRAY_SIZE];
  74. };
  75. typedef struct physid_mask physid_mask_t;
  76. #define physid_set(physid, map) set_bit(physid, (map).mask)
  77. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  78. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  79. #define physid_test_and_set(physid, map) \
  80. test_and_set_bit(physid, (map).mask)
  81. #define physids_and(dst, src1, src2) \
  82. bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_LOCAL_APIC)
  83. #define physids_or(dst, src1, src2) \
  84. bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_LOCAL_APIC)
  85. #define physids_clear(map) \
  86. bitmap_zero((map).mask, MAX_LOCAL_APIC)
  87. #define physids_complement(dst, src) \
  88. bitmap_complement((dst).mask, (src).mask, MAX_LOCAL_APIC)
  89. #define physids_empty(map) \
  90. bitmap_empty((map).mask, MAX_LOCAL_APIC)
  91. #define physids_equal(map1, map2) \
  92. bitmap_equal((map1).mask, (map2).mask, MAX_LOCAL_APIC)
  93. #define physids_weight(map) \
  94. bitmap_weight((map).mask, MAX_LOCAL_APIC)
  95. #define physids_shift_right(d, s, n) \
  96. bitmap_shift_right((d).mask, (s).mask, n, MAX_LOCAL_APIC)
  97. #define physids_shift_left(d, s, n) \
  98. bitmap_shift_left((d).mask, (s).mask, n, MAX_LOCAL_APIC)
  99. static inline unsigned long physids_coerce(physid_mask_t *map)
  100. {
  101. return map->mask[0];
  102. }
  103. static inline void physids_promote(unsigned long physids, physid_mask_t *map)
  104. {
  105. physids_clear(*map);
  106. map->mask[0] = physids;
  107. }
  108. static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
  109. {
  110. physids_clear(*map);
  111. physid_set(physid, *map);
  112. }
  113. #define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
  114. #define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
  115. extern physid_mask_t phys_cpu_present_map;
  116. #endif /* _ASM_X86_MPSPEC_H */