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