mpspec_64.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 255
  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];
  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. /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
  142. #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
  143. extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
  144. extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
  145. extern unsigned int boot_cpu_physical_apicid;
  146. extern int smp_found_config;
  147. extern void find_smp_config (void);
  148. extern void get_smp_config (void);
  149. extern int nr_ioapics;
  150. extern unsigned char apic_version [MAX_APICS];
  151. extern int mp_irq_entries;
  152. extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
  153. extern int mpc_default_type;
  154. extern unsigned long mp_lapic_addr;
  155. #ifdef CONFIG_ACPI
  156. extern void mp_register_lapic (u8 id, u8 enabled);
  157. extern void mp_register_lapic_address (u64 address);
  158. extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
  159. extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
  160. extern void mp_config_acpi_legacy_irqs (void);
  161. extern int mp_register_gsi (u32 gsi, int triggering, int polarity);
  162. #endif
  163. extern int using_apic_timer;
  164. #define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
  165. struct physid_mask
  166. {
  167. unsigned long mask[PHYSID_ARRAY_SIZE];
  168. };
  169. typedef struct physid_mask physid_mask_t;
  170. #define physid_set(physid, map) set_bit(physid, (map).mask)
  171. #define physid_clear(physid, map) clear_bit(physid, (map).mask)
  172. #define physid_isset(physid, map) test_bit(physid, (map).mask)
  173. #define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask)
  174. #define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  175. #define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
  176. #define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
  177. #define physids_complement(dst, src) bitmap_complement((dst).mask, (src).mask, MAX_APICS)
  178. #define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
  179. #define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
  180. #define physids_weight(map) bitmap_weight((map).mask, MAX_APICS)
  181. #define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
  182. #define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
  183. #define physids_coerce(map) ((map).mask[0])
  184. #define physids_promote(physids) \
  185. ({ \
  186. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  187. __physid_mask.mask[0] = physids; \
  188. __physid_mask; \
  189. })
  190. #define physid_mask_of_physid(physid) \
  191. ({ \
  192. physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
  193. physid_set(physid, __physid_mask); \
  194. __physid_mask; \
  195. })
  196. #define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
  197. #define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
  198. extern physid_mask_t phys_cpu_present_map;
  199. #endif