mpspec.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef _ASM_X86_MPSPEC_H
  2. #define _ASM_X86_MPSPEC_H
  3. #include <linux/init.h>
  4. #include <asm/mpspec_def.h>
  5. extern int apic_version[MAX_APICS];
  6. extern int pic_mode;
  7. #ifdef CONFIG_X86_32
  8. #include <mach_mpspec.h>
  9. extern unsigned int def_to_bigsmp;
  10. extern u8 apicid_2_node[];
  11. #ifdef CONFIG_X86_NUMAQ
  12. extern int mp_bus_id_to_node[MAX_MP_BUSSES];
  13. extern int mp_bus_id_to_local[MAX_MP_BUSSES];
  14. extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
  15. #endif
  16. #define MAX_APICID 256
  17. #else
  18. #define MAX_MP_BUSSES 256
  19. /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
  20. #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
  21. #endif
  22. extern void early_find_smp_config(void);
  23. extern void early_get_smp_config(void);
  24. #if defined(CONFIG_MCA) || defined(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 unsigned int max_physical_apicid;
  30. extern int smp_found_config;
  31. extern int mpc_default_type;
  32. extern unsigned long mp_lapic_addr;
  33. extern void find_smp_config(void);
  34. extern void get_smp_config(void);
  35. #ifdef CONFIG_X86_MPPARSE
  36. extern void early_reserve_e820_mpc_new(void);
  37. #else
  38. static inline void early_reserve_e820_mpc_new(void) { }
  39. #endif
  40. void __cpuinit generic_processor_info(int apicid, int version);
  41. #ifdef CONFIG_ACPI
  42. extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
  43. extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
  44. u32 gsi);
  45. extern void mp_config_acpi_legacy_irqs(void);
  46. extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low);
  47. extern int acpi_probe_gsi(void);
  48. #ifdef CONFIG_X86_IO_APIC
  49. extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
  50. u32 gsi, int triggering, int polarity);
  51. #else
  52. static inline int
  53. mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
  54. u32 gsi, int triggering, int polarity)
  55. {
  56. return 0;
  57. }
  58. #endif
  59. #else /* !CONFIG_ACPI: */
  60. static inline int acpi_probe_gsi(void)
  61. {
  62. return 0;
  63. }
  64. #endif /* CONFIG_ACPI */
  65. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
  66. struct physid_mask {
  67. unsigned long mask[PHYSID_ARRAY_SIZE];
  68. };
  69. typedef struct physid_mask physid_mask_t;
  70. #define physid_set(physid, map) set_bit(physid, (map).mask)
  71. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  72. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  73. #define physid_test_and_set(physid, map) \
  74. test_and_set_bit(physid, (map).mask)
  75. #define physids_and(dst, src1, src2) \
  76. bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  77. #define physids_or(dst, src1, src2) \
  78. bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  79. #define physids_clear(map) \
  80. bitmap_zero((map).mask, MAX_APICS)
  81. #define physids_complement(dst, src) \
  82. bitmap_complement((dst).mask, (src).mask, MAX_APICS)
  83. #define physids_empty(map) \
  84. bitmap_empty((map).mask, MAX_APICS)
  85. #define physids_equal(map1, map2) \
  86. bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
  87. #define physids_weight(map) \
  88. bitmap_weight((map).mask, MAX_APICS)
  89. #define physids_shift_right(d, s, n) \
  90. bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
  91. #define physids_shift_left(d, s, n) \
  92. bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
  93. #define physids_coerce(map) ((map).mask[0])
  94. #define physids_promote(physids) \
  95. ({ \
  96. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  97. __physid_mask.mask[0] = physids; \
  98. __physid_mask; \
  99. })
  100. /* Note: will create very large stack frames if physid_mask_t is big */
  101. #define physid_mask_of_physid(physid) \
  102. ({ \
  103. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  104. physid_set(physid, __physid_mask); \
  105. __physid_mask; \
  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 */