mpspec.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. #ifndef __ASM_MPSPEC_H
  2. #define __ASM_MPSPEC_H
  3. /*
  4. * Structure definitions for SMP machines following the
  5. * Intel Multiprocessing Specification 1.1 and 1.4.
  6. */
  7. /*
  8. * This tag identifies where the SMP configuration
  9. * information is.
  10. */
  11. #define SMP_MAGIC_IDENT (('_'<<24)|('P'<<16)|('M'<<8)|'_')
  12. /*
  13. * A maximum of 255 APICs with the current APIC ID architecture.
  14. */
  15. #define MAX_APICS 128
  16. struct intel_mp_floating
  17. {
  18. char mpf_signature[4]; /* "_MP_" */
  19. unsigned int mpf_physptr; /* Configuration table address */
  20. unsigned char mpf_length; /* Our length (paragraphs) */
  21. unsigned char mpf_specification;/* Specification version */
  22. unsigned char mpf_checksum; /* Checksum (makes sum 0) */
  23. unsigned char mpf_feature1; /* Standard or configuration ? */
  24. unsigned char mpf_feature2; /* Bit7 set for IMCR|PIC */
  25. unsigned char mpf_feature3; /* Unused (0) */
  26. unsigned char mpf_feature4; /* Unused (0) */
  27. unsigned char mpf_feature5; /* Unused (0) */
  28. };
  29. struct mp_config_table
  30. {
  31. char mpc_signature[4];
  32. #define MPC_SIGNATURE "PCMP"
  33. unsigned short mpc_length; /* Size of table */
  34. char mpc_spec; /* 0x01 */
  35. char mpc_checksum;
  36. char mpc_oem[8];
  37. char mpc_productid[12];
  38. unsigned int mpc_oemptr; /* 0 if not present */
  39. unsigned short mpc_oemsize; /* 0 if not present */
  40. unsigned short mpc_oemcount;
  41. unsigned int mpc_lapic; /* APIC address */
  42. unsigned int reserved;
  43. };
  44. /* Followed by entries */
  45. #define MP_PROCESSOR 0
  46. #define MP_BUS 1
  47. #define MP_IOAPIC 2
  48. #define MP_INTSRC 3
  49. #define MP_LINTSRC 4
  50. struct mpc_config_processor
  51. {
  52. unsigned char mpc_type;
  53. unsigned char mpc_apicid; /* Local APIC number */
  54. unsigned char mpc_apicver; /* Its versions */
  55. unsigned char mpc_cpuflag;
  56. #define CPU_ENABLED 1 /* Processor is available */
  57. #define CPU_BOOTPROCESSOR 2 /* Processor is the BP */
  58. unsigned int mpc_cpufeature;
  59. #define CPU_STEPPING_MASK 0x0F
  60. #define CPU_MODEL_MASK 0xF0
  61. #define CPU_FAMILY_MASK 0xF00
  62. unsigned int mpc_featureflag; /* CPUID feature value */
  63. unsigned int mpc_reserved[2];
  64. };
  65. struct mpc_config_bus
  66. {
  67. unsigned char mpc_type;
  68. unsigned char mpc_busid;
  69. unsigned char mpc_bustype[6] __attribute((packed));
  70. };
  71. /* List of Bus Type string values, Intel MP Spec. */
  72. #define BUSTYPE_EISA "EISA"
  73. #define BUSTYPE_ISA "ISA"
  74. #define BUSTYPE_INTERN "INTERN" /* Internal BUS */
  75. #define BUSTYPE_MCA "MCA"
  76. #define BUSTYPE_VL "VL" /* Local bus */
  77. #define BUSTYPE_PCI "PCI"
  78. #define BUSTYPE_PCMCIA "PCMCIA"
  79. #define BUSTYPE_CBUS "CBUS"
  80. #define BUSTYPE_CBUSII "CBUSII"
  81. #define BUSTYPE_FUTURE "FUTURE"
  82. #define BUSTYPE_MBI "MBI"
  83. #define BUSTYPE_MBII "MBII"
  84. #define BUSTYPE_MPI "MPI"
  85. #define BUSTYPE_MPSA "MPSA"
  86. #define BUSTYPE_NUBUS "NUBUS"
  87. #define BUSTYPE_TC "TC"
  88. #define BUSTYPE_VME "VME"
  89. #define BUSTYPE_XPRESS "XPRESS"
  90. struct mpc_config_ioapic
  91. {
  92. unsigned char mpc_type;
  93. unsigned char mpc_apicid;
  94. unsigned char mpc_apicver;
  95. unsigned char mpc_flags;
  96. #define MPC_APIC_USABLE 0x01
  97. unsigned int mpc_apicaddr;
  98. };
  99. struct mpc_config_intsrc
  100. {
  101. unsigned char mpc_type;
  102. unsigned char mpc_irqtype;
  103. unsigned short mpc_irqflag;
  104. unsigned char mpc_srcbus;
  105. unsigned char mpc_srcbusirq;
  106. unsigned char mpc_dstapic;
  107. unsigned char mpc_dstirq;
  108. };
  109. enum mp_irq_source_types {
  110. mp_INT = 0,
  111. mp_NMI = 1,
  112. mp_SMI = 2,
  113. mp_ExtINT = 3
  114. };
  115. #define MP_IRQDIR_DEFAULT 0
  116. #define MP_IRQDIR_HIGH 1
  117. #define MP_IRQDIR_LOW 3
  118. struct mpc_config_lintsrc
  119. {
  120. unsigned char mpc_type;
  121. unsigned char mpc_irqtype;
  122. unsigned short mpc_irqflag;
  123. unsigned char mpc_srcbusid;
  124. unsigned char mpc_srcbusirq;
  125. unsigned char mpc_destapic;
  126. #define MP_APIC_ALL 0xFF
  127. unsigned char mpc_destapiclint;
  128. };
  129. /*
  130. * Default configurations
  131. *
  132. * 1 2 CPU ISA 82489DX
  133. * 2 2 CPU EISA 82489DX neither IRQ 0 timer nor IRQ 13 DMA chaining
  134. * 3 2 CPU EISA 82489DX
  135. * 4 2 CPU MCA 82489DX
  136. * 5 2 CPU ISA+PCI
  137. * 6 2 CPU EISA+PCI
  138. * 7 2 CPU MCA+PCI
  139. */
  140. #define MAX_MP_BUSSES 256
  141. #define MAX_IRQ_SOURCES 256
  142. enum mp_bustype {
  143. MP_BUS_ISA = 1,
  144. MP_BUS_EISA,
  145. MP_BUS_PCI,
  146. MP_BUS_MCA
  147. };
  148. extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES];
  149. extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
  150. extern unsigned int boot_cpu_physical_apicid;
  151. extern int smp_found_config;
  152. extern void find_smp_config (void);
  153. extern void get_smp_config (void);
  154. extern int nr_ioapics;
  155. extern int apic_version [MAX_APICS];
  156. extern int mp_irq_entries;
  157. extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
  158. extern int mpc_default_type;
  159. extern unsigned long mp_lapic_addr;
  160. extern int pic_mode;
  161. #ifdef CONFIG_ACPI
  162. extern void mp_register_lapic (u8 id, u8 enabled);
  163. extern void mp_register_lapic_address (u64 address);
  164. #ifdef CONFIG_X86_IO_APIC
  165. extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
  166. extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
  167. extern void mp_config_acpi_legacy_irqs (void);
  168. extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low);
  169. #endif /*CONFIG_X86_IO_APIC*/
  170. #endif
  171. extern int using_apic_timer;
  172. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
  173. struct physid_mask
  174. {
  175. unsigned long mask[PHYSID_ARRAY_SIZE];
  176. };
  177. typedef struct physid_mask physid_mask_t;
  178. #define physid_set(physid, map) set_bit(physid, (map).mask)
  179. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  180. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  181. #define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask)
  182. #define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  183. #define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  184. #define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
  185. #define physids_complement(dst, src) bitmap_complement((dst).mask, (src).mask, MAX_APICS)
  186. #define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
  187. #define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
  188. #define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
  189. #define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
  190. #define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
  191. #define physids_coerce(map) ((map).mask[0])
  192. #define physids_promote(physids) \
  193. ({ \
  194. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  195. __physid_mask.mask[0] = physids; \
  196. __physid_mask; \
  197. })
  198. #define physid_mask_of_physid(physid) \
  199. ({ \
  200. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  201. physid_set(physid, __physid_mask); \
  202. __physid_mask; \
  203. })
  204. #define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
  205. #define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
  206. extern physid_mask_t phys_cpu_present_map;
  207. #endif