mpspec.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #ifndef _ASM_X86_MPSPEC_H
  2. #define _ASM_X86_MPSPEC_H
  3. #include <linux/init.h>
  4. #include <asm/mpspec_def.h>
  5. #include <asm/x86_init.h>
  6. extern int apic_version[MAX_APICS];
  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. extern u8 apicid_2_node[];
  21. #ifdef CONFIG_X86_NUMAQ
  22. extern int mp_bus_id_to_node[MAX_MP_BUSSES];
  23. extern int mp_bus_id_to_local[MAX_MP_BUSSES];
  24. extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
  25. #endif
  26. #define MAX_APICID 256
  27. #else /* CONFIG_X86_64: */
  28. #define MAX_MP_BUSSES 256
  29. /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
  30. #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
  31. #endif /* CONFIG_X86_64 */
  32. #if defined(CONFIG_MCA) || defined(CONFIG_EISA)
  33. extern int mp_bus_id_to_type[MAX_MP_BUSSES];
  34. #endif
  35. extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
  36. extern unsigned int boot_cpu_physical_apicid;
  37. extern unsigned int max_physical_apicid;
  38. extern int mpc_default_type;
  39. extern unsigned long mp_lapic_addr;
  40. #ifdef CONFIG_X86_LOCAL_APIC
  41. extern int smp_found_config;
  42. #else
  43. # define smp_found_config 0
  44. #endif
  45. static inline void get_smp_config(void)
  46. {
  47. x86_init.mpparse.get_smp_config(0);
  48. }
  49. static inline void early_get_smp_config(void)
  50. {
  51. x86_init.mpparse.get_smp_config(1);
  52. }
  53. static inline void find_smp_config(void)
  54. {
  55. x86_init.mpparse.find_smp_config(1);
  56. }
  57. static inline void early_find_smp_config(void)
  58. {
  59. x86_init.mpparse.find_smp_config(0);
  60. }
  61. #ifdef CONFIG_X86_MPPARSE
  62. extern void early_reserve_e820_mpc_new(void);
  63. extern int enable_update_mptable;
  64. extern int default_mpc_apic_id(struct mpc_cpu *m);
  65. extern void default_smp_read_mpc_oem(struct mpc_table *mpc);
  66. # ifdef CONFIG_X86_IO_APIC
  67. extern void default_mpc_oem_bus_info(struct mpc_bus *m, char *str);
  68. # else
  69. # define default_mpc_oem_bus_info NULL
  70. # endif
  71. extern void default_find_smp_config(unsigned int reserve);
  72. extern void default_get_smp_config(unsigned int early);
  73. #else
  74. static inline void early_reserve_e820_mpc_new(void) { }
  75. #define enable_update_mptable 0
  76. #define default_mpc_apic_id NULL
  77. #define default_smp_read_mpc_oem NULL
  78. #define default_mpc_oem_bus_info NULL
  79. #define default_find_smp_config x86_init_uint_noop
  80. #define default_get_smp_config x86_init_uint_noop
  81. #endif
  82. void __cpuinit generic_processor_info(int apicid, int version);
  83. #ifdef CONFIG_ACPI
  84. extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
  85. extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
  86. u32 gsi);
  87. extern void mp_config_acpi_legacy_irqs(void);
  88. struct device;
  89. extern int mp_register_gsi(struct device *dev, u32 gsi, int edge_level,
  90. int active_high_low);
  91. extern int acpi_probe_gsi(void);
  92. #ifdef CONFIG_X86_IO_APIC
  93. extern int mp_find_ioapic(int gsi);
  94. extern int mp_find_ioapic_pin(int ioapic, int gsi);
  95. #endif
  96. #else /* !CONFIG_ACPI: */
  97. static inline int acpi_probe_gsi(void)
  98. {
  99. return 0;
  100. }
  101. #endif /* CONFIG_ACPI */
  102. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
  103. struct physid_mask {
  104. unsigned long mask[PHYSID_ARRAY_SIZE];
  105. };
  106. typedef struct physid_mask physid_mask_t;
  107. #define physid_set(physid, map) set_bit(physid, (map).mask)
  108. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  109. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  110. #define physid_test_and_set(physid, map) \
  111. test_and_set_bit(physid, (map).mask)
  112. #define physids_and(dst, src1, src2) \
  113. bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  114. #define physids_or(dst, src1, src2) \
  115. bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  116. #define physids_clear(map) \
  117. bitmap_zero((map).mask, MAX_APICS)
  118. #define physids_complement(dst, src) \
  119. bitmap_complement((dst).mask, (src).mask, MAX_APICS)
  120. #define physids_empty(map) \
  121. bitmap_empty((map).mask, MAX_APICS)
  122. #define physids_equal(map1, map2) \
  123. bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
  124. #define physids_weight(map) \
  125. bitmap_weight((map).mask, MAX_APICS)
  126. #define physids_shift_right(d, s, n) \
  127. bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
  128. #define physids_shift_left(d, s, n) \
  129. bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
  130. #define physids_coerce(map) ((map).mask[0])
  131. #define physids_promote(physids) \
  132. ({ \
  133. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  134. __physid_mask.mask[0] = physids; \
  135. __physid_mask; \
  136. })
  137. /* Note: will create very large stack frames if physid_mask_t is big */
  138. #define physid_mask_of_physid(physid) \
  139. ({ \
  140. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  141. physid_set(physid, __physid_mask); \
  142. __physid_mask; \
  143. })
  144. static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
  145. {
  146. physids_clear(*map);
  147. physid_set(physid, *map);
  148. }
  149. #define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
  150. #define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
  151. extern physid_mask_t phys_cpu_present_map;
  152. extern int generic_mps_oem_check(struct mpc_table *, char *, char *);
  153. extern int default_acpi_madt_oem_check(char *, char *);
  154. #endif /* _ASM_X86_MPSPEC_H */