Update revision reference tag.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Framework / Legacy16.h
CommitLineData
79964ac8 1/** @file\r
2 API between 16-bit Legacy BIOS and EFI\r
3\r
4 We need to figure out what the 16-bit code is going to use to\r
5 represent these data structures. Is a pointer SEG:OFF or 32-bit...\r
6\r
7 Copyright (c) 2007, Intel Corporation\r
8 All rights reserved. This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16 Module Name: FrameworkLegacy16.h\r
17\r
18 @par Revision Reference:\r
0f899407 19 These definitions are from Compatibility Support Module Spec \r
20 Version 0.97.\r
79964ac8 21\r
22**/\r
23\r
24#ifndef _FRAMEWORK_LEGACY_16_H_\r
25#define _FRAMEWORK_LEGACY_16_H_\r
26\r
27#include <Base.h>\r
28\r
79964ac8 29#pragma pack(1)\r
30\r
9205b2d7 31typedef UINT8 SERIAL_MODE;\r
32typedef UINT8 PARALLEL_MODE;\r
b80fbe85 33\r
9205b2d7 34//\r
79964ac8 35// EFI_COMPATIBILITY16_TABLE is located at a 16-byte boundary starting with the\r
36// signature "$EFI"\r
9205b2d7 37//\r
e89ec8f6 38#define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')\r
79964ac8 39typedef struct {\r
9205b2d7 40 UINT32 Signature;\r
41 UINT8 TableChecksum;\r
42 UINT8 TableLength;\r
43 UINT8 EfiMajorRevision;\r
44 UINT8 EfiMinorRevision;\r
45 UINT8 TableMajorRevision;\r
46 UINT8 TableMinorRevision;\r
47 UINT16 Reserved;\r
48 UINT16 Compatibility16CallSegment;\r
49 UINT16 Compatibility16CallOffset;\r
50 UINT16 PnPInstallationCheckSegment;\r
51 UINT16 PnPInstallationCheckOffset;\r
52 UINT32 EfiSystemTable; // The physical address of EFI_SYSTEM_TABLE\r
53 UINT32 OemIdStringPointer;\r
54 UINT32 AcpiRsdPtrPointer;\r
55 UINT16 OemRevision;\r
56 UINT32 E820Pointer;\r
57 UINT32 E820Length;\r
58 UINT32 IrqRoutingTablePointer;\r
59 UINT32 IrqRoutingTableLength;\r
60 UINT32 MpTablePtr;\r
61 UINT32 MpTableLength;\r
62 UINT16 OemIntSegment;\r
63 UINT16 OemIntOffset;\r
64 UINT16 Oem32Segment;\r
65 UINT16 Oem32Offset;\r
66 UINT16 Oem16Segment;\r
67 UINT16 Oem16Offset;\r
68 UINT16 TpmSegment;\r
69 UINT16 TpmOffset;\r
70 UINT32 IbvPointer;\r
71 UINT32 PciExpressBase;\r
72 UINT8 LastPciBus;\r
79964ac8 73} EFI_COMPATIBILITY16_TABLE;\r
74\r
9205b2d7 75//\r
79964ac8 76// Functions provided by the CSM binary\r
9205b2d7 77//\r
79964ac8 78typedef enum {\r
79 Legacy16InitializeYourself = 0x0000,\r
80 Legacy16UpdateBbs = 0x0001,\r
81 Legacy16PrepareToBoot = 0x0002,\r
82 Legacy16Boot = 0x0003,\r
83 Legacy16RetrieveLastBootDevice= 0x0004,\r
84 Legacy16DispatchOprom = 0x0005,\r
85 Legacy16GetTableAddress = 0x0006,\r
86 Legacy16SetKeyboardLeds = 0x0007,\r
87 Legacy16InstallPciHandler = 0x0008\r
88} EFI_COMPATIBILITY_FUNCTIONS;\r
89\r
9205b2d7 90//\r
79964ac8 91// EFI_TO_COMPATIBILITY16_INIT_TABLE\r
9205b2d7 92//\r
79964ac8 93typedef struct {\r
9205b2d7 94 UINT32 BiosLessThan1MB;\r
95 UINT32 HiPmmMemory;\r
96 UINT32 HiPmmMemorySizeInBytes;\r
97 UINT16 ReverseThunkCallSegment;\r
98 UINT16 ReverseThunkCallOffset;\r
99 UINT32 NumberE820Entries;\r
100 UINT32 OsMemoryAbove1Mb;\r
101 UINT32 ThunkStart;\r
102 UINT32 ThunkSizeInBytes;\r
103 UINT32 LowPmmMemory;\r
104 UINT32 LowPmmMemorySizeInBytes;\r
79964ac8 105} EFI_TO_COMPATIBILITY16_INIT_TABLE;\r
106\r
9205b2d7 107//\r
79964ac8 108// EFI_TO_COMPATIBILITY16_BOOT_TABLE\r
9205b2d7 109//\r
79964ac8 110\r
111//\r
112// DEVICE_PRODUCER_SERIAL & its modes\r
113//\r
114typedef struct {\r
9205b2d7 115 UINT16 Address;\r
116 UINT8 Irq;\r
117 SERIAL_MODE Mode;\r
79964ac8 118} DEVICE_PRODUCER_SERIAL;\r
119\r
120#define DEVICE_SERIAL_MODE_NORMAL 0x00\r
121#define DEVICE_SERIAL_MODE_IRDA 0x01\r
122#define DEVICE_SERIAL_MODE_ASK_IR 0x02\r
123#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00\r
124#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10\r
125\r
126//\r
127// DEVICE_PRODUCER_PARALLEL & its modes\r
128//\r
129typedef struct {\r
9205b2d7 130 UINT16 Address;\r
131 UINT8 Irq;\r
132 UINT8 Dma;\r
133 PARALLEL_MODE Mode;\r
79964ac8 134} DEVICE_PRODUCER_PARALLEL;\r
135\r
136#define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00\r
137#define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01\r
138#define DEVICE_PARALLEL_MODE_MODE_EPP 0x02\r
139#define DEVICE_PARALLEL_MODE_MODE_ECP 0x03\r
140\r
141//\r
142// DEVICE_PRODUCER_FLOPPY\r
143//\r
144typedef struct {\r
9205b2d7 145 UINT16 Address;\r
146 UINT8 Irq;\r
147 UINT8 Dma;\r
148 UINT8 NumberOfFloppy;\r
79964ac8 149} DEVICE_PRODUCER_FLOPPY;\r
150\r
151//\r
152// LEGACY_DEVICE_FLAGS\r
153//\r
154typedef struct {\r
9205b2d7 155 UINT32 A20Kybd : 1;\r
156 UINT32 A20Port90 : 1;\r
157 UINT32 Reserved : 30;\r
79964ac8 158} LEGACY_DEVICE_FLAGS;\r
159\r
160//\r
161// DEVICE_PRODUCER_DATA_HEADER\r
162//\r
163typedef struct {\r
9205b2d7 164 DEVICE_PRODUCER_SERIAL Serial[4];\r
165 DEVICE_PRODUCER_PARALLEL Parallel[3];\r
166 DEVICE_PRODUCER_FLOPPY Floppy;\r
167 UINT8 MousePresent;\r
168 LEGACY_DEVICE_FLAGS Flags;\r
79964ac8 169} DEVICE_PRODUCER_DATA_HEADER;\r
170\r
171//\r
172// ATAPI_IDENTIFY\r
173//\r
174typedef struct {\r
9205b2d7 175 UINT16 Raw[256];\r
79964ac8 176} ATAPI_IDENTIFY;\r
177\r
178//\r
179// HDD_INFO & its status\r
180//\r
181typedef struct {\r
9205b2d7 182 UINT16 Status;\r
183 UINT32 Bus;\r
184 UINT32 Device;\r
185 UINT32 Function;\r
186 UINT16 CommandBaseAddress;\r
187 UINT16 ControlBaseAddress;\r
188 UINT16 BusMasterAddress;\r
189 UINT8 HddIrq;\r
190 ATAPI_IDENTIFY IdentifyDrive[2];\r
79964ac8 191} HDD_INFO;\r
192\r
193#define HDD_PRIMARY 0x01\r
194#define HDD_SECONDARY 0x02\r
195#define HDD_MASTER_ATAPI_CDROM 0x04\r
196#define HDD_SLAVE_ATAPI_CDROM 0x08\r
197#define HDD_MASTER_IDE 0x20\r
198#define HDD_SLAVE_IDE 0x40\r
199#define HDD_MASTER_ATAPI_ZIPDISK 0x10\r
200#define HDD_SLAVE_ATAPI_ZIPDISK 0x80\r
201\r
202//\r
203// BBS_STATUS_FLAGS\r
204//\r
205typedef struct {\r
9205b2d7 206 UINT16 OldPosition : 4;\r
207 UINT16 Reserved1 : 4;\r
208 UINT16 Enabled : 1;\r
209 UINT16 Failed : 1;\r
210 UINT16 MediaPresent : 2;\r
211 UINT16 Reserved2 : 4;\r
79964ac8 212} BBS_STATUS_FLAGS;\r
213\r
214//\r
215// BBS_TABLE, device type values & boot priority values\r
216//\r
217typedef struct {\r
9205b2d7 218 UINT16 BootPriority;\r
219 UINT32 Bus;\r
220 UINT32 Device;\r
221 UINT32 Function;\r
222 UINT8 Class;\r
223 UINT8 SubClass;\r
224 UINT16 MfgStringOffset;\r
225 UINT16 MfgStringSegment;\r
226 UINT16 DeviceType;\r
227 BBS_STATUS_FLAGS StatusFlags;\r
228 UINT16 BootHandlerOffset;\r
229 UINT16 BootHandlerSegment;\r
230 UINT16 DescStringOffset;\r
231 UINT16 DescStringSegment;\r
232 UINT32 InitPerReserved;\r
233 UINT32 AdditionalIrq13Handler;\r
234 UINT32 AdditionalIrq18Handler;\r
235 UINT32 AdditionalIrq19Handler;\r
236 UINT32 AdditionalIrq40Handler;\r
237 UINT8 AssignedDriveNumber;\r
238 UINT32 AdditionalIrq41Handler;\r
239 UINT32 AdditionalIrq46Handler;\r
240 UINT32 IBV1;\r
241 UINT32 IBV2;\r
79964ac8 242} BBS_TABLE;\r
243\r
9205b2d7 244#define BBS_FLOPPY 0x01\r
245#define BBS_HARDDISK 0x02\r
246#define BBS_CDROM 0x03\r
247#define BBS_PCMCIA 0x04\r
248#define BBS_USB 0x05\r
249#define BBS_EMBED_NETWORK 0x06\r
250#define BBS_BEV_DEVICE 0x80\r
251#define BBS_UNKNOWN 0xff\r
79964ac8 252\r
253#define BBS_DO_NOT_BOOT_FROM 0xFFFC\r
254#define BBS_LOWEST_PRIORITY 0xFFFD\r
255#define BBS_UNPRIORITIZED_ENTRY 0xFFFE\r
256#define BBS_IGNORE_ENTRY 0xFFFF\r
257\r
258//\r
259// SMM_ATTRIBUTES & relating type, port and data size constants\r
260//\r
261typedef struct {\r
9205b2d7 262 UINT16 Type : 3;\r
263 UINT16 PortGranularity : 3;\r
264 UINT16 DataGranularity : 3;\r
265 UINT16 Reserved : 7;\r
79964ac8 266} SMM_ATTRIBUTES;\r
267\r
268#define STANDARD_IO 0x00\r
269#define STANDARD_MEMORY 0x01\r
270\r
271#define PORT_SIZE_8 0x00\r
272#define PORT_SIZE_16 0x01\r
273#define PORT_SIZE_32 0x02\r
274#define PORT_SIZE_64 0x03\r
275\r
276#define DATA_SIZE_8 0x00\r
277#define DATA_SIZE_16 0x01\r
278#define DATA_SIZE_32 0x02\r
279#define DATA_SIZE_64 0x03\r
280\r
281//\r
282// SMM_FUNCTION & relating constants\r
283//\r
284typedef struct {\r
9205b2d7 285 UINT16 Function : 15;\r
286 UINT16 Owner : 1;\r
79964ac8 287} SMM_FUNCTION;\r
288\r
289#define INT15_D042 0x0000\r
290#define GET_USB_BOOT_INFO 0x0001\r
291#define DMI_PNP_50_57 0x0002\r
292\r
293#define STANDARD_OWNER 0x0\r
294#define OEM_OWNER 0x1\r
295\r
296//\r
297// SMM_ENTRY\r
298//\r
299// This structure assumes both port and data sizes are 1. SmmAttribute must be\r
300// properly to reflect that assumption.\r
301//\r
302typedef struct {\r
9205b2d7 303 SMM_ATTRIBUTES SmmAttributes;\r
304 SMM_FUNCTION SmmFunction;\r
305 UINT8 SmmPort;\r
306 UINT8 SmmData;\r
79964ac8 307} SMM_ENTRY;\r
308\r
309//\r
310// SMM_TABLE\r
311//\r
312typedef struct {\r
9205b2d7 313 UINT16 NumSmmEntries;\r
314 SMM_ENTRY SmmEntry;\r
79964ac8 315} SMM_TABLE;\r
316\r
317//\r
318// UDC_ATTRIBUTES\r
319//\r
320typedef struct {\r
9205b2d7 321 UINT8 DirectoryServiceValidity : 1;\r
322 UINT8 RabcaUsedFlag : 1;\r
323 UINT8 ExecuteHddDiagnosticsFlag : 1;\r
324 UINT8 Reserved : 5;\r
79964ac8 325} UDC_ATTRIBUTES;\r
326\r
327//\r
328// UD_TABLE\r
329//\r
330typedef struct {\r
9205b2d7 331 UDC_ATTRIBUTES Attributes;\r
332 UINT8 DeviceNumber;\r
333 UINT8 BbsTableEntryNumberForParentDevice;\r
334 UINT8 BbsTableEntryNumberForBoot;\r
335 UINT8 BbsTableEntryNumberForHddDiag;\r
336 UINT8 BeerData[128];\r
337 UINT8 ServiceAreaData[64];\r
79964ac8 338} UD_TABLE;\r
339\r
340//\r
341// EFI_TO_COMPATIBILITY16_BOOT_TABLE\r
342//\r
343#define EFI_TO_LEGACY_MAJOR_VERSION 0x02\r
344#define EFI_TO_LEGACY_MINOR_VERSION 0x00\r
345#define MAX_IDE_CONTROLLER 8\r
346\r
347typedef struct {\r
9205b2d7 348 UINT16 MajorVersion;\r
349 UINT16 MinorVersion;\r
350 UINT32 AcpiTable; // 4 GB range\r
351 UINT32 SmbiosTable; // 4 GB range\r
352 UINT32 SmbiosTableLength;\r
79964ac8 353 //\r
354 // Legacy SIO state\r
355 //\r
9205b2d7 356 DEVICE_PRODUCER_DATA_HEADER SioData;\r
357 UINT16 DevicePathType;\r
358 UINT16 PciIrqMask;\r
359 UINT32 NumberE820Entries;\r
79964ac8 360 //\r
361 // Controller & Drive Identify[2] per controller information\r
362 //\r
9205b2d7 363 HDD_INFO HddInfo[MAX_IDE_CONTROLLER];\r
364 UINT32 NumberBbsEntries;\r
365 UINT32 BbsTable;\r
366 UINT32 SmmTable;\r
367 UINT32 OsMemoryAbove1Mb;\r
368 UINT32 UnconventionalDeviceTable;\r
79964ac8 369} EFI_TO_COMPATIBILITY16_BOOT_TABLE;\r
370\r
9205b2d7 371//\r
79964ac8 372// EFI_LEGACY_INSTALL_PCI_HANDLER\r
9205b2d7 373//\r
79964ac8 374typedef struct {\r
9205b2d7 375 UINT8 PciBus;\r
376 UINT8 PciDeviceFun;\r
377 UINT8 PciSegment;\r
378 UINT8 PciClass;\r
379 UINT8 PciSubclass;\r
380 UINT8 PciInterface;\r
79964ac8 381 //\r
382 // Primary section\r
383 //\r
9205b2d7 384 UINT8 PrimaryIrq;\r
385 UINT8 PrimaryReserved;\r
386 UINT16 PrimaryControl;\r
387 UINT16 PrimaryBase;\r
388 UINT16 PrimaryBusMaster;\r
79964ac8 389 //\r
390 // Secondary Section\r
391 //\r
9205b2d7 392 UINT8 SecondaryIrq;\r
393 UINT8 SecondaryReserved;\r
394 UINT16 SecondaryControl;\r
395 UINT16 SecondaryBase;\r
396 UINT16 SecondaryBusMaster;\r
79964ac8 397} EFI_LEGACY_INSTALL_PCI_HANDLER;\r
398\r
399//\r
400// Restore default pack value\r
401//\r
402#pragma pack()\r
403\r
404#endif\r