1/*++
2
3Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4This program and the accompanying materials
5are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution.  The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13
14  LegacyBiosMpTable.h
15
16Abstract:
17  Defives data structures per Multi Processor Specification Ver 1.4.
18
19--*/
20
21#ifndef LEGACY_BIOS_MPTABLE_H_
22#define LEGACY_BIOS_MPTABLE_H_
23
24#include "Tiano.h"
25
26#define EFI_LEGACY_MP_TABLE_REV_1_4 0x04
27
28//
29// Define MP table structures. All are packed.
30//
31#pragma pack(1)
32
33#define EFI_LEGACY_MP_TABLE_FLOATING_POINTER_SIGNATURE  EFI_SIGNATURE_32 ('_', 'M', 'P', '_')
34typedef struct {
35  UINT32  Signature;
36  UINT32  PhysicalAddress;
37  UINT8   Length;
38  UINT8   SpecRev;
39  UINT8   Checksum;
40  UINT8   FeatureByte1;
41  struct {
42    UINT32  Reserved1 : 6;
43    UINT32  MutipleClk : 1;
44    UINT32  Imcr : 1;
45    UINT32  Reserved2 : 24;
46  } FeatureByte2_5;
47} EFI_LEGACY_MP_TABLE_FLOATING_POINTER;
48
49#define EFI_LEGACY_MP_TABLE_HEADER_SIGNATURE  EFI_SIGNATURE_32 ('P', 'C', 'M', 'P')
50typedef struct {
51  UINT32  Signature;
52  UINT16  BaseTableLength;
53  UINT8   SpecRev;
54  UINT8   Checksum;
55  CHAR8   OemId[8];
56  CHAR8   OemProductId[12];
57  UINT32  OemTablePointer;
58  UINT16  OemTableSize;
59  UINT16  EntryCount;
60  UINT32  LocalApicAddress;
61  UINT16  ExtendedTableLength;
62  UINT8   ExtendedChecksum;
63  UINT8   Reserved;
64} EFI_LEGACY_MP_TABLE_HEADER;
65
66typedef struct {
67  UINT8 EntryType;
68} EFI_LEGACY_MP_TABLE_ENTRY_TYPE;
69
70//
71// Entry Type 0: Processor.
72//
73#define EFI_LEGACY_MP_TABLE_ENTRY_TYPE_PROCESSOR  0x00
74typedef struct {
75  UINT8 EntryType;
76  UINT8 Id;
77  UINT8 Ver;
78  struct {
79    UINT8 Enabled : 1;
80    UINT8 Bsp : 1;
81    UINT8 Reserved : 6;
82  } Flags;
83  struct {
84    UINT32  Stepping : 4;
85    UINT32  Model : 4;
86    UINT32  Family : 4;
87    UINT32  Reserved : 20;
88  } Signature;
89  struct {
90    UINT32  Fpu : 1;
91    UINT32  Reserved1 : 6;
92    UINT32  Mce : 1;
93    UINT32  Cx8 : 1;
94    UINT32  Apic : 1;
95    UINT32  Reserved2 : 22;
96  } Features;
97  UINT32  Reserved1;
98  UINT32  Reserved2;
99} EFI_LEGACY_MP_TABLE_ENTRY_PROCESSOR;
100
101//
102// Entry Type 1: Bus.
103//
104#define EFI_LEGACY_MP_TABLE_ENTRY_TYPE_BUS  0x01
105typedef struct {
106  UINT8 EntryType;
107  UINT8 Id;
108  CHAR8 TypeString[6];
109} EFI_LEGACY_MP_TABLE_ENTRY_BUS;
110
111#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_CBUS   "CBUS  "  // Corollary CBus
112#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_CBUSII "CBUSII"  // Corollary CBUS II
113#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_EISA   "EISA  "  // Extended ISA
114#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_FUTURE "FUTURE"  // IEEE FutureBus
115#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_INTERN "INTERN"  // Internal bus
116#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_ISA    "ISA   "  // Industry Standard Architecture
117#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_MBI    "MBI   "  // Multibus I
118#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_MBII   "MBII  "  // Multibus II
119#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_MCA    "MCA   "  // Micro Channel Architecture
120#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_MPI    "MPI   "  // MPI
121#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_MPSA   "MPSA  "  // MPSA
122#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_NUBUS  "NUBUS "  // Apple Macintosh NuBus
123#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_PCI    "PCI   "  // Peripheral Component Interconnect
124#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_PCMCIA "PCMCIA"  // PC Memory Card International Assoc.
125#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_TC     "TC    "  // DEC TurboChannel
126#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_VL     "VL    "  // VESA Local Bus
127#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_VME    "VME   "  // VMEbus
128#define EFI_LEGACY_MP_TABLE_ENTRY_BUS_STRING_XPRESS "XPRESS"  // Express System Bus
129//
130// Entry Type 2: I/O APIC.
131//
132#define EFI_LEGACY_MP_TABLE_ENTRY_TYPE_IOAPIC 0x02
133typedef struct {
134  UINT8 EntryType;
135  UINT8 Id;
136  UINT8 Ver;
137  struct {
138    UINT8 Enabled : 1;
139    UINT8 Reserved : 7;
140  } Flags;
141  UINT32  Address;
142} EFI_LEGACY_MP_TABLE_ENTRY_IOAPIC;
143
144//
145// Entry Type 3: I/O Interrupt Assignment.
146//
147#define EFI_LEGACY_MP_TABLE_ENTRY_TYPE_IO_INT 0x03
148typedef struct {
149  UINT8 EntryType;
150  UINT8 IntType;
151  struct {
152    UINT16  Polarity : 2;
153    UINT16  Trigger : 2;
154    UINT16  Reserved : 12;
155  } Flags;
156  UINT8 SourceBusId;
157  union {
158    struct {
159      UINT8 IntNo : 2;
160      UINT8 Dev : 5;
161      UINT8 Reserved : 1;
162    } fields;
163    UINT8 byte;
164  } SourceBusIrq;
165  UINT8 DestApicId;
166  UINT8 DestApicIntIn;
167} EFI_LEGACY_MP_TABLE_ENTRY_IO_INT;
168
169typedef enum {
170  EfiLegacyMpTableEntryIoIntTypeInt   = 0,
171  EfiLegacyMpTableEntryIoIntTypeNmi   = 1,
172  EfiLegacyMpTableEntryIoIntTypeSmi   = 2,
173  EfiLegacyMpTableEntryIoIntTypeExtInt= 3,
174} EFI_LEGACY_MP_TABLE_ENTRY_IO_INT_TYPE;
175
176typedef enum {
177  EfiLegacyMpTableEntryIoIntFlagsPolaritySpec       = 0x0,
178  EfiLegacyMpTableEntryIoIntFlagsPolarityActiveHigh = 0x1,
179  EfiLegacyMpTableEntryIoIntFlagsPolarityReserved   = 0x2,
180  EfiLegacyMpTableEntryIoIntFlagsPolarityActiveLow  = 0x3,
181} EFI_LEGACY_MP_TABLE_ENTRY_IO_INT_FLAGS_POLARITY;
182
183typedef enum {
184  EfiLegacyMpTableEntryIoIntFlagsTriggerSpec        = 0x0,
185  EfiLegacyMpTableEntryIoIntFlagsTriggerEdge        = 0x1,
186  EfiLegacyMpTableEntryIoIntFlagsTriggerReserved    = 0x2,
187  EfiLegacyMpTableEntryIoIntFlagsTriggerLevel       = 0x3,
188} EFI_LEGACY_MP_TABLE_ENTRY_IO_INT_FLAGS_TRIGGER;
189
190//
191// Entry Type 4: Local Interrupt Assignment.
192//
193#define EFI_LEGACY_MP_TABLE_ENTRY_TYPE_LOCAL_INT  0x04
194typedef struct {
195  UINT8 EntryType;
196  UINT8 IntType;
197  struct {
198    UINT16  Polarity : 2;
199    UINT16  Trigger : 2;
200    UINT16  Reserved : 12;
201  } Flags;
202  UINT8 SourceBusId;
203  UINT8 SourceBusIrq;
204  UINT8 DestApicId;
205  UINT8 DestApicIntIn;
206} EFI_LEGACY_MP_TABLE_ENTRY_LOCAL_INT;
207
208typedef enum {
209  EfiLegacyMpTableEntryLocalIntTypeInt              = 0,
210  EfiLegacyMpTableEntryLocalIntTypeNmi              = 1,
211  EfiLegacyMpTableEntryLocalIntTypeSmi              = 2,
212  EfiLegacyMpTableEntryLocalIntTypeExtInt           = 3,
213} EFI_LEGACY_MP_TABLE_ENTRY_LOCAL_INT_TYPE;
214
215typedef enum {
216  EfiLegacyMpTableEntryLocalIntFlagsPolaritySpec      = 0x0,
217  EfiLegacyMpTableEntryLocalIntFlagsPolarityActiveHigh= 0x1,
218  EfiLegacyMpTableEntryLocalIntFlagsPolarityReserved  = 0x2,
219  EfiLegacyMpTableEntryLocalIntFlagsPolarityActiveLow = 0x3,
220} EFI_LEGACY_MP_TABLE_ENTRY_LOCAL_INT_FLAGS_POLARITY;
221
222typedef enum {
223  EfiLegacyMpTableEntryLocalIntFlagsTriggerSpec       = 0x0,
224  EfiLegacyMpTableEntryLocalIntFlagsTriggerEdge       = 0x1,
225  EfiLegacyMpTableEntryLocalIntFlagsTriggerReserved   = 0x2,
226  EfiLegacyMpTableEntryLocalIntFlagsTriggerLevel      = 0x3,
227} EFI_LEGACY_MP_TABLE_ENTRY_LOCAL_INT_FLAGS_TRIGGER;
228
229//
230// Entry Type 128: System Address Space Mapping.
231//
232#define EFI_LEGACY_MP_TABLE_ENTRY_EXT_TYPE_SYS_ADDR_SPACE_MAPPING 0x80
233typedef struct {
234  UINT8   EntryType;
235  UINT8   Length;
236  UINT8   BusId;
237  UINT8   AddressType;
238  UINT64  AddressBase;
239  UINT64  AddressLength;
240} EFI_LEGACY_MP_TABLE_ENTRY_EXT_SYS_ADDR_SPACE_MAPPING;
241
242typedef enum {
243  EfiLegacyMpTableEntryExtSysAddrSpaceMappingIo       = 0,
244  EfiLegacyMpTableEntryExtSysAddrSpaceMappingMemory   = 1,
245  EfiLegacyMpTableEntryExtSysAddrSpaceMappingPrefetch = 2,
246} EFI_LEGACY_MP_TABLE_ENTRY_EXT_SYS_ADDR_SPACE_MAPPING_TYPE;
247
248//
249// Entry Type 129: Bus Hierarchy.
250//
251#define EFI_LEGACY_MP_TABLE_ENTRY_EXT_TYPE_BUS_HIERARCHY  0x81
252typedef struct {
253  UINT8 EntryType;
254  UINT8 Length;
255  UINT8 BusId;
256  struct {
257    UINT8 SubtractiveDecode : 1;
258    UINT8 Reserved : 7;
259  } BusInfo;
260  UINT8 ParentBus;
261  UINT8 Reserved1;
262  UINT8 Reserved2;
263  UINT8 Reserved3;
264} EFI_LEGACY_MP_TABLE_ENTRY_EXT_BUS_HIERARCHY;
265
266//
267// Entry Type 130: Compatibility Bus Address Space Modifier.
268//
269#define EFI_LEGACY_MP_TABLE_ENTRY_EXT_TYPE_COMPAT_BUS_ADDR_SPACE_MODIFIER 0x82
270typedef struct {
271  UINT8 EntryType;
272  UINT8 Length;
273  UINT8 BusId;
274  struct {
275    UINT8 RangeMode : 1;
276    UINT8 Reserved : 7;
277  } AddrMode;
278  UINT32  PredefinedRangeList;
279} EFI_LEGACY_MP_TABLE_ENTRY_EXT_COMPAT_BUS_ADDR_SPACE_MODIFIER;
280
281#pragma pack()
282
283#endif
284