xref: /xv6-public/mp.h (revision 0cfc7290)
1f5527388Srsc // See MultiProcessor Specification Version 1.[14].
221a88fd4Skaashoek 
3f5527388Srsc struct mp {             // floating pointer
4f5527388Srsc   uchar signature[4];           // "_MP_"
5*0cfc7290Srsc   void *physaddr;               // phys addr of MP config table
6f5527388Srsc   uchar length;                 // 1
7f5527388Srsc   uchar specrev;                // [14]
8f5527388Srsc   uchar checksum;               // all bytes must add up to 0
9*0cfc7290Srsc   uchar type;                   // MP system config type
1029270816Srtm   uchar imcrp;
1129270816Srtm   uchar reserved[3];
127baa34a4Skaashoek };
137baa34a4Skaashoek 
14f5527388Srsc struct mpctb {          // configuration table header
15f5527388Srsc   uchar signature[4];           // "PCMP"
16f5527388Srsc   ushort length;                // total table length
17f5527388Srsc   uchar version;                // [14]
18f5527388Srsc   uchar checksum;               // all bytes must add up to 0
19f5527388Srsc   uchar product[20];            // product id
20f5527388Srsc   uint *oemtable;               // OEM table pointer
21f5527388Srsc   ushort oemlength;             // OEM table length
22f5527388Srsc   ushort entry;                 // entry count
23f5527388Srsc   uint *lapicaddr;              // address of local APIC
24f5527388Srsc   ushort xlength;               // extended table length
25f5527388Srsc   uchar xchecksum;              // extended table checksum
2629270816Srtm   uchar reserved;
277baa34a4Skaashoek };
287baa34a4Skaashoek 
29f5527388Srsc struct mppe {           // processor table entry
30f5527388Srsc   uchar type;                   // entry type (0)
31f5527388Srsc   uchar apicid;                 // local APIC id
32f5527388Srsc   uchar version;                // local APIC verison
33f5527388Srsc   uchar flags;                  // CPU flags
34f5527388Srsc   uchar signature[4];           // CPU signature
35f5527388Srsc   uint feature;                 // feature flags from CPUID instruction
3629270816Srtm   uchar reserved[8];
377baa34a4Skaashoek };
387baa34a4Skaashoek 
39f5527388Srsc struct mpbe {           // bus table entry
40f5527388Srsc   uchar type;                   // entry type (1)
41f5527388Srsc   uchar busno;                  // bus id
42f5527388Srsc   char string[6];               // bus type string
437baa34a4Skaashoek };
447baa34a4Skaashoek 
45f5527388Srsc struct mpioapic {       // I/O APIC table entry
46f5527388Srsc   uchar type;                   // entry type (2)
47f5527388Srsc   uchar apicno;                 // I/O APIC id
48f5527388Srsc   uchar version;                // I/O APIC version
49f5527388Srsc   uchar flags;                  // I/O APIC flags
50f5527388Srsc   uint *addr;                  // I/O APIC address
517baa34a4Skaashoek };
527baa34a4Skaashoek 
53f5527388Srsc struct mpie {           // interrupt table entry
54f5527388Srsc   uchar type;                   // entry type ([34])
55f5527388Srsc   uchar intr;                   // interrupt type
56f5527388Srsc   ushort flags;                 // interrupt flag
57f5527388Srsc   uchar busno;                  // source bus id
58f5527388Srsc   uchar irq;                    // source bus irq
59f5527388Srsc   uchar apicno;                 // destination APIC id
60f5527388Srsc   uchar intin;                  // destination APIC [L]INTIN#
617baa34a4Skaashoek };
627baa34a4Skaashoek 
63f5527388Srsc enum {                  // table entry types
64f5527388Srsc   MPPROCESSOR   = 0x00,         // one entry per processor
65f5527388Srsc   MPBUS = 0x01,                 // one entry per bus
66f5527388Srsc   MPIOAPIC = 0x02,              // one entry per I/O APIC
67f5527388Srsc   MPIOINTR = 0x03,              // one entry per bus interrupt source
68f5527388Srsc   MPLINTR = 0x04,               // one entry per system interrupt source
697baa34a4Skaashoek 
7021a88fd4Skaashoek   MPSASM = 0x80,
7121a88fd4Skaashoek   MPHIERARCHY   = 0x81,
7221a88fd4Skaashoek   MPCBASM = 0x82,
737baa34a4Skaashoek 
74f5527388Srsc                         // PCMPprocessor and PCMPioapic flags
75f5527388Srsc   MPEN = 0x01,                  // enabled
76f5527388Srsc   MPBP = 0x02,                  // bootstrap processor
777baa34a4Skaashoek 
78f5527388Srsc                         // PCMPiointr and PCMPlintr flags
79*0cfc7290Srsc   MPPOMASK = 0x03,              // polarity conforms to bus specs
80f5527388Srsc   MPHIGH = 0x01,                // active high
81f5527388Srsc   MPLOW = 0x03,                 // active low
82f5527388Srsc   MPELMASK = 0x0C,              // trigger mode of APIC input signals
83f5527388Srsc   MPEDGE = 0x04,                // edge-triggered
84f5527388Srsc   MPLEVEL = 0x0C,               // level-triggered
857baa34a4Skaashoek 
86f5527388Srsc                         // PCMPiointr and PCMPlintr interrupt type
87f5527388Srsc   MPINT = 0x00,                 // vectored interrupt from APIC Rdt
88f5527388Srsc   MPNMI = 0x01,                 // non-maskable interrupt
89f5527388Srsc   MPSMI = 0x02,                 // system management interrupt
90f5527388Srsc   MPExtINT = 0x03,              // vectored interrupt from external PIC
917baa34a4Skaashoek };
927baa34a4Skaashoek 
93f5527388Srsc // Common bits for
94f5527388Srsc //      I/O APIC Redirection Table Entry;
95f5527388Srsc //      Local APIC Local Interrupt Vector Table;
96f5527388Srsc //      Local APIC Inter-Processor Interrupt;
97f5527388Srsc //      Local APIC Timer Vector Table.
987baa34a4Skaashoek enum {
99f5527388Srsc   APIC_FIXED     = 0x00000000,  // [10:8] Delivery Mode
100f5527388Srsc   APIC_LOWEST    = 0x00000100,  // Lowest priority
101f5527388Srsc   APIC_SMI       = 0x00000200,  // System Management Interrupt
102f5527388Srsc   APIC_RR        = 0x00000300,  // Remote Read
10321a88fd4Skaashoek   APIC_NMI       = 0x00000400,
104f5527388Srsc   APIC_INIT      = 0x00000500,  // INIT/RESET
105f5527388Srsc   APIC_STARTUP   = 0x00000600,  // Startup IPI
106bd303ed0Skaashoek   APIC_EXTINT    = 0x00000700,
1077baa34a4Skaashoek 
108f5527388Srsc   APIC_PHYSICAL  = 0x00000000,  // [11] Destination Mode (RW)
10921a88fd4Skaashoek   APIC_LOGICAL   = 0x00000800,
1107baa34a4Skaashoek 
111f5527388Srsc   APIC_DELIVS    = 0x00001000,  // [12] Delivery Status (RO)
112f5527388Srsc   APIC_HIGH      = 0x00000000,  // [13] Interrupt Input Pin Polarity (RW)
11321a88fd4Skaashoek   APIC_LOW       = 0x00002000,
114f5527388Srsc   APIC_REMOTEIRR = 0x00004000,  // [14] Remote IRR (RO)
115f5527388Srsc   APIC_EDGE      = 0x00000000,  // [15] Trigger Mode (RW)
11621a88fd4Skaashoek   APIC_LEVEL     = 0x00008000,
117f5527388Srsc   APIC_IMASK     = 0x00010000,  // [16] Interrupt Mask
1187baa34a4Skaashoek };
119