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