1*7baa34a4Skaashoek /* 2*7baa34a4Skaashoek * MultiProcessor Specification Version 1.[14]. 3*7baa34a4Skaashoek */ 4*7baa34a4Skaashoek struct _MP_ { /* floating pointer */ 5*7baa34a4Skaashoek uint8_t signature[4]; /* "_MP_" */ 6*7baa34a4Skaashoek physaddr_t physaddr; /* physical address of MP configuration table */ 7*7baa34a4Skaashoek uint8_t length; /* 1 */ 8*7baa34a4Skaashoek uint8_t specrev; /* [14] */ 9*7baa34a4Skaashoek uint8_t checksum; /* all bytes must add up to 0 */ 10*7baa34a4Skaashoek uint8_t type; /* MP system configuration type */ 11*7baa34a4Skaashoek uint8_t imcrp; 12*7baa34a4Skaashoek uint8_t reserved[3]; 13*7baa34a4Skaashoek }; 14*7baa34a4Skaashoek 15*7baa34a4Skaashoek struct PCMP { /* configuration table header */ 16*7baa34a4Skaashoek uint8_t signature[4]; /* "PCMP" */ 17*7baa34a4Skaashoek uint16_t length; /* total table length */ 18*7baa34a4Skaashoek uint8_t version; /* [14] */ 19*7baa34a4Skaashoek uint8_t checksum; /* all bytes must add up to 0 */ 20*7baa34a4Skaashoek uint8_t product[20]; /* product id */ 21*7baa34a4Skaashoek uintptr_t oemtable; /* OEM table pointer */ 22*7baa34a4Skaashoek uint16_t oemlength; /* OEM table length */ 23*7baa34a4Skaashoek uint16_t entry; /* entry count */ 24*7baa34a4Skaashoek uintptr_t lapicbase; /* address of local APIC */ 25*7baa34a4Skaashoek uint16_t xlength; /* extended table length */ 26*7baa34a4Skaashoek uint8_t xchecksum; /* extended table checksum */ 27*7baa34a4Skaashoek uint8_t reserved; 28*7baa34a4Skaashoek }; 29*7baa34a4Skaashoek 30*7baa34a4Skaashoek struct PCMPprocessor { /* processor table entry */ 31*7baa34a4Skaashoek uint8_t type; /* entry type (0) */ 32*7baa34a4Skaashoek uint8_t apicno; /* local APIC id */ 33*7baa34a4Skaashoek uint8_t version; /* local APIC verison */ 34*7baa34a4Skaashoek uint8_t flags; /* CPU flags */ 35*7baa34a4Skaashoek uint8_t signature[4]; /* CPU signature */ 36*7baa34a4Skaashoek uint32_t feature; /* feature flags from CPUID instruction */ 37*7baa34a4Skaashoek uint8_t reserved[8]; 38*7baa34a4Skaashoek }; 39*7baa34a4Skaashoek 40*7baa34a4Skaashoek struct PCMPbus { /* bus table entry */ 41*7baa34a4Skaashoek uint8_t type; /* entry type (1) */ 42*7baa34a4Skaashoek uint8_t busno; /* bus id */ 43*7baa34a4Skaashoek char string[6]; /* bus type string */ 44*7baa34a4Skaashoek }; 45*7baa34a4Skaashoek 46*7baa34a4Skaashoek struct PCMPioapic { /* I/O APIC table entry */ 47*7baa34a4Skaashoek uint8_t type; /* entry type (2) */ 48*7baa34a4Skaashoek uint8_t apicno; /* I/O APIC id */ 49*7baa34a4Skaashoek uint8_t version; /* I/O APIC version */ 50*7baa34a4Skaashoek uint8_t flags; /* I/O APIC flags */ 51*7baa34a4Skaashoek uintptr_t addr; /* I/O APIC address */ 52*7baa34a4Skaashoek }; 53*7baa34a4Skaashoek 54*7baa34a4Skaashoek struct PCMPintr { /* interrupt table entry */ 55*7baa34a4Skaashoek uint8_t type; /* entry type ([34]) */ 56*7baa34a4Skaashoek uint8_t intr; /* interrupt type */ 57*7baa34a4Skaashoek uint16_t flags; /* interrupt flag */ 58*7baa34a4Skaashoek uint8_t busno; /* source bus id */ 59*7baa34a4Skaashoek uint8_t irq; /* source bus irq */ 60*7baa34a4Skaashoek uint8_t apicno; /* destination APIC id */ 61*7baa34a4Skaashoek uint8_t intin; /* destination APIC [L]INTIN# */ 62*7baa34a4Skaashoek }; 63*7baa34a4Skaashoek 64*7baa34a4Skaashoek struct PCMPsasm { /* system address space mapping entry */ 65*7baa34a4Skaashoek uint8_t type; /* entry type (128) */ 66*7baa34a4Skaashoek uint8_t length; /* of this entry (20) */ 67*7baa34a4Skaashoek uint8_t busno; /* bus id */ 68*7baa34a4Skaashoek uint8_t addrtype; 69*7baa34a4Skaashoek uintptr_t addrbase[2]; 70*7baa34a4Skaashoek uint32_t addrlength[2]; 71*7baa34a4Skaashoek }; 72*7baa34a4Skaashoek 73*7baa34a4Skaashoek struct PCMPhierarchy { /* bus hierarchy descriptor entry */ 74*7baa34a4Skaashoek uint8_t type; /* entry type (129) */ 75*7baa34a4Skaashoek uint8_t length; /* of this entry (8) */ 76*7baa34a4Skaashoek uint8_t busno; /* bus id */ 77*7baa34a4Skaashoek uint8_t info; /* bus info */ 78*7baa34a4Skaashoek uint8_t parent; /* parent bus */ 79*7baa34a4Skaashoek uint8_t reserved[3]; 80*7baa34a4Skaashoek }; 81*7baa34a4Skaashoek 82*7baa34a4Skaashoek struct PCMPcbasm { /* compatibility bus address space modifier entry */ 83*7baa34a4Skaashoek uint8_t type; /* entry type (130) */ 84*7baa34a4Skaashoek uint8_t length; /* of this entry (8) */ 85*7baa34a4Skaashoek uint8_t busno; /* bus id */ 86*7baa34a4Skaashoek uint8_t modifier; /* address modifier */ 87*7baa34a4Skaashoek uint32_t range; /* predefined range list */ 88*7baa34a4Skaashoek }; 89*7baa34a4Skaashoek 90*7baa34a4Skaashoek enum { /* table entry types */ 91*7baa34a4Skaashoek PcmpPROCESSOR = 0x00, /* one entry per processor */ 92*7baa34a4Skaashoek PcmpBUS = 0x01, /* one entry per bus */ 93*7baa34a4Skaashoek PcmpIOAPIC = 0x02, /* one entry per I/O APIC */ 94*7baa34a4Skaashoek PcmpIOINTR = 0x03, /* one entry per bus interrupt source */ 95*7baa34a4Skaashoek PcmpLINTR = 0x04, /* one entry per system interrupt source */ 96*7baa34a4Skaashoek 97*7baa34a4Skaashoek PcmpSASM = 0x80, 98*7baa34a4Skaashoek PcmpHIERARCHY = 0x81, 99*7baa34a4Skaashoek PcmpCBASM = 0x82, 100*7baa34a4Skaashoek 101*7baa34a4Skaashoek /* PCMPprocessor and PCMPioapic flags */ 102*7baa34a4Skaashoek PcmpEN = 0x01, /* enabled */ 103*7baa34a4Skaashoek PcmpBP = 0x02, /* bootstrap processor */ 104*7baa34a4Skaashoek 105*7baa34a4Skaashoek /* PCMPiointr and PCMPlintr flags */ 106*7baa34a4Skaashoek PcmpPOMASK = 0x03, /* polarity conforms to specifications of bus */ 107*7baa34a4Skaashoek PcmpHIGH = 0x01, /* active high */ 108*7baa34a4Skaashoek PcmpLOW = 0x03, /* active low */ 109*7baa34a4Skaashoek PcmpELMASK = 0x0C, /* trigger mode of APIC input signals */ 110*7baa34a4Skaashoek PcmpEDGE = 0x04, /* edge-triggered */ 111*7baa34a4Skaashoek PcmpLEVEL = 0x0C, /* level-triggered */ 112*7baa34a4Skaashoek 113*7baa34a4Skaashoek /* PCMPiointr and PCMPlintr interrupt type */ 114*7baa34a4Skaashoek PcmpINT = 0x00, /* vectored interrupt from APIC Rdt */ 115*7baa34a4Skaashoek PcmpNMI = 0x01, /* non-maskable interrupt */ 116*7baa34a4Skaashoek PcmpSMI = 0x02, /* system management interrupt */ 117*7baa34a4Skaashoek PcmpExtINT = 0x03, /* vectored interrupt from external PIC */ 118*7baa34a4Skaashoek 119*7baa34a4Skaashoek /* PCMPsasm addrtype */ 120*7baa34a4Skaashoek PcmpIOADDR = 0x00, /* I/O address */ 121*7baa34a4Skaashoek PcmpMADDR = 0x01, /* memory address */ 122*7baa34a4Skaashoek PcmpPADDR = 0x02, /* prefetch address */ 123*7baa34a4Skaashoek 124*7baa34a4Skaashoek /* PCMPhierarchy info */ 125*7baa34a4Skaashoek PcmpSD = 0x01, /* subtractive decode bus */ 126*7baa34a4Skaashoek 127*7baa34a4Skaashoek /* PCMPcbasm modifier */ 128*7baa34a4Skaashoek PcmpPR = 0x01, /* predefined range list */ 129*7baa34a4Skaashoek }; 130*7baa34a4Skaashoek 131*7baa34a4Skaashoek /* 132*7baa34a4Skaashoek * Common bits for 133*7baa34a4Skaashoek * I/O APIC Redirection Table Entry; 134*7baa34a4Skaashoek * Local APIC Local Interrupt Vector Table; 135*7baa34a4Skaashoek * Local APIC Inter-Processor Interrupt; 136*7baa34a4Skaashoek * Local APIC Timer Vector Table. 137*7baa34a4Skaashoek */ 138*7baa34a4Skaashoek enum { 139*7baa34a4Skaashoek ApicFIXED = 0x00000000, /* [10:8] Delivery Mode */ 140*7baa34a4Skaashoek ApicLOWEST = 0x00000100, /* Lowest priority */ 141*7baa34a4Skaashoek ApicSMI = 0x00000200, /* System Management Interrupt */ 142*7baa34a4Skaashoek ApicRR = 0x00000300, /* Remote Read */ 143*7baa34a4Skaashoek ApicNMI = 0x00000400, 144*7baa34a4Skaashoek ApicINIT = 0x00000500, /* INIT/RESET */ 145*7baa34a4Skaashoek ApicSTARTUP = 0x00000600, /* Startup IPI */ 146*7baa34a4Skaashoek ApicExtINT = 0x00000700, 147*7baa34a4Skaashoek 148*7baa34a4Skaashoek ApicPHYSICAL = 0x00000000, /* [11] Destination Mode (RW) */ 149*7baa34a4Skaashoek ApicLOGICAL = 0x00000800, 150*7baa34a4Skaashoek 151*7baa34a4Skaashoek ApicDELIVS = 0x00001000, /* [12] Delivery Status (RO) */ 152*7baa34a4Skaashoek ApicHIGH = 0x00000000, /* [13] Interrupt Input Pin Polarity (RW) */ 153*7baa34a4Skaashoek ApicLOW = 0x00002000, 154*7baa34a4Skaashoek ApicRemoteIRR = 0x00004000, /* [14] Remote IRR (RO) */ 155*7baa34a4Skaashoek ApicEDGE = 0x00000000, /* [15] Trigger Mode (RW) */ 156*7baa34a4Skaashoek ApicLEVEL = 0x00008000, 157*7baa34a4Skaashoek ApicIMASK = 0x00010000, /* [16] Interrupt Mask */ 158*7baa34a4Skaashoek }; 159