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