]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Framework/Legacy16.h
Update revision reference tag.
[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 // EFI_TO_COMPATIBILITY16_INIT_TABLE
92 //
93 typedef struct {
94 UINT32 BiosLessThan1MB;
95 UINT32 HiPmmMemory;
96 UINT32 HiPmmMemorySizeInBytes;
97 UINT16 ReverseThunkCallSegment;
98 UINT16 ReverseThunkCallOffset;
99 UINT32 NumberE820Entries;
100 UINT32 OsMemoryAbove1Mb;
101 UINT32 ThunkStart;
102 UINT32 ThunkSizeInBytes;
103 UINT32 LowPmmMemory;
104 UINT32 LowPmmMemorySizeInBytes;
105 } EFI_TO_COMPATIBILITY16_INIT_TABLE;
106
107 //
108 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
109 //
110
111 //
112 // DEVICE_PRODUCER_SERIAL & its modes
113 //
114 typedef struct {
115 UINT16 Address;
116 UINT8 Irq;
117 SERIAL_MODE Mode;
118 } DEVICE_PRODUCER_SERIAL;
119
120 #define DEVICE_SERIAL_MODE_NORMAL 0x00
121 #define DEVICE_SERIAL_MODE_IRDA 0x01
122 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
123 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
124 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
125
126 //
127 // DEVICE_PRODUCER_PARALLEL & its modes
128 //
129 typedef struct {
130 UINT16 Address;
131 UINT8 Irq;
132 UINT8 Dma;
133 PARALLEL_MODE Mode;
134 } DEVICE_PRODUCER_PARALLEL;
135
136 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
137 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
138 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
139 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
140
141 //
142 // DEVICE_PRODUCER_FLOPPY
143 //
144 typedef struct {
145 UINT16 Address;
146 UINT8 Irq;
147 UINT8 Dma;
148 UINT8 NumberOfFloppy;
149 } DEVICE_PRODUCER_FLOPPY;
150
151 //
152 // LEGACY_DEVICE_FLAGS
153 //
154 typedef struct {
155 UINT32 A20Kybd : 1;
156 UINT32 A20Port90 : 1;
157 UINT32 Reserved : 30;
158 } LEGACY_DEVICE_FLAGS;
159
160 //
161 // DEVICE_PRODUCER_DATA_HEADER
162 //
163 typedef struct {
164 DEVICE_PRODUCER_SERIAL Serial[4];
165 DEVICE_PRODUCER_PARALLEL Parallel[3];
166 DEVICE_PRODUCER_FLOPPY Floppy;
167 UINT8 MousePresent;
168 LEGACY_DEVICE_FLAGS Flags;
169 } DEVICE_PRODUCER_DATA_HEADER;
170
171 //
172 // ATAPI_IDENTIFY
173 //
174 typedef struct {
175 UINT16 Raw[256];
176 } ATAPI_IDENTIFY;
177
178 //
179 // HDD_INFO & its status
180 //
181 typedef struct {
182 UINT16 Status;
183 UINT32 Bus;
184 UINT32 Device;
185 UINT32 Function;
186 UINT16 CommandBaseAddress;
187 UINT16 ControlBaseAddress;
188 UINT16 BusMasterAddress;
189 UINT8 HddIrq;
190 ATAPI_IDENTIFY IdentifyDrive[2];
191 } HDD_INFO;
192
193 #define HDD_PRIMARY 0x01
194 #define HDD_SECONDARY 0x02
195 #define HDD_MASTER_ATAPI_CDROM 0x04
196 #define HDD_SLAVE_ATAPI_CDROM 0x08
197 #define HDD_MASTER_IDE 0x20
198 #define HDD_SLAVE_IDE 0x40
199 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
200 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
201
202 //
203 // BBS_STATUS_FLAGS
204 //
205 typedef struct {
206 UINT16 OldPosition : 4;
207 UINT16 Reserved1 : 4;
208 UINT16 Enabled : 1;
209 UINT16 Failed : 1;
210 UINT16 MediaPresent : 2;
211 UINT16 Reserved2 : 4;
212 } BBS_STATUS_FLAGS;
213
214 //
215 // BBS_TABLE, device type values & boot priority values
216 //
217 typedef struct {
218 UINT16 BootPriority;
219 UINT32 Bus;
220 UINT32 Device;
221 UINT32 Function;
222 UINT8 Class;
223 UINT8 SubClass;
224 UINT16 MfgStringOffset;
225 UINT16 MfgStringSegment;
226 UINT16 DeviceType;
227 BBS_STATUS_FLAGS StatusFlags;
228 UINT16 BootHandlerOffset;
229 UINT16 BootHandlerSegment;
230 UINT16 DescStringOffset;
231 UINT16 DescStringSegment;
232 UINT32 InitPerReserved;
233 UINT32 AdditionalIrq13Handler;
234 UINT32 AdditionalIrq18Handler;
235 UINT32 AdditionalIrq19Handler;
236 UINT32 AdditionalIrq40Handler;
237 UINT8 AssignedDriveNumber;
238 UINT32 AdditionalIrq41Handler;
239 UINT32 AdditionalIrq46Handler;
240 UINT32 IBV1;
241 UINT32 IBV2;
242 } BBS_TABLE;
243
244 #define BBS_FLOPPY 0x01
245 #define BBS_HARDDISK 0x02
246 #define BBS_CDROM 0x03
247 #define BBS_PCMCIA 0x04
248 #define BBS_USB 0x05
249 #define BBS_EMBED_NETWORK 0x06
250 #define BBS_BEV_DEVICE 0x80
251 #define BBS_UNKNOWN 0xff
252
253 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
254 #define BBS_LOWEST_PRIORITY 0xFFFD
255 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
256 #define BBS_IGNORE_ENTRY 0xFFFF
257
258 //
259 // SMM_ATTRIBUTES & relating type, port and data size constants
260 //
261 typedef struct {
262 UINT16 Type : 3;
263 UINT16 PortGranularity : 3;
264 UINT16 DataGranularity : 3;
265 UINT16 Reserved : 7;
266 } SMM_ATTRIBUTES;
267
268 #define STANDARD_IO 0x00
269 #define STANDARD_MEMORY 0x01
270
271 #define PORT_SIZE_8 0x00
272 #define PORT_SIZE_16 0x01
273 #define PORT_SIZE_32 0x02
274 #define PORT_SIZE_64 0x03
275
276 #define DATA_SIZE_8 0x00
277 #define DATA_SIZE_16 0x01
278 #define DATA_SIZE_32 0x02
279 #define DATA_SIZE_64 0x03
280
281 //
282 // SMM_FUNCTION & relating constants
283 //
284 typedef struct {
285 UINT16 Function : 15;
286 UINT16 Owner : 1;
287 } SMM_FUNCTION;
288
289 #define INT15_D042 0x0000
290 #define GET_USB_BOOT_INFO 0x0001
291 #define DMI_PNP_50_57 0x0002
292
293 #define STANDARD_OWNER 0x0
294 #define OEM_OWNER 0x1
295
296 //
297 // SMM_ENTRY
298 //
299 // This structure assumes both port and data sizes are 1. SmmAttribute must be
300 // properly to reflect that assumption.
301 //
302 typedef struct {
303 SMM_ATTRIBUTES SmmAttributes;
304 SMM_FUNCTION SmmFunction;
305 UINT8 SmmPort;
306 UINT8 SmmData;
307 } SMM_ENTRY;
308
309 //
310 // SMM_TABLE
311 //
312 typedef struct {
313 UINT16 NumSmmEntries;
314 SMM_ENTRY SmmEntry;
315 } SMM_TABLE;
316
317 //
318 // UDC_ATTRIBUTES
319 //
320 typedef struct {
321 UINT8 DirectoryServiceValidity : 1;
322 UINT8 RabcaUsedFlag : 1;
323 UINT8 ExecuteHddDiagnosticsFlag : 1;
324 UINT8 Reserved : 5;
325 } UDC_ATTRIBUTES;
326
327 //
328 // UD_TABLE
329 //
330 typedef struct {
331 UDC_ATTRIBUTES Attributes;
332 UINT8 DeviceNumber;
333 UINT8 BbsTableEntryNumberForParentDevice;
334 UINT8 BbsTableEntryNumberForBoot;
335 UINT8 BbsTableEntryNumberForHddDiag;
336 UINT8 BeerData[128];
337 UINT8 ServiceAreaData[64];
338 } UD_TABLE;
339
340 //
341 // EFI_TO_COMPATIBILITY16_BOOT_TABLE
342 //
343 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
344 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
345 #define MAX_IDE_CONTROLLER 8
346
347 typedef struct {
348 UINT16 MajorVersion;
349 UINT16 MinorVersion;
350 UINT32 AcpiTable; // 4 GB range
351 UINT32 SmbiosTable; // 4 GB range
352 UINT32 SmbiosTableLength;
353 //
354 // Legacy SIO state
355 //
356 DEVICE_PRODUCER_DATA_HEADER SioData;
357 UINT16 DevicePathType;
358 UINT16 PciIrqMask;
359 UINT32 NumberE820Entries;
360 //
361 // Controller & Drive Identify[2] per controller information
362 //
363 HDD_INFO HddInfo[MAX_IDE_CONTROLLER];
364 UINT32 NumberBbsEntries;
365 UINT32 BbsTable;
366 UINT32 SmmTable;
367 UINT32 OsMemoryAbove1Mb;
368 UINT32 UnconventionalDeviceTable;
369 } EFI_TO_COMPATIBILITY16_BOOT_TABLE;
370
371 //
372 // EFI_LEGACY_INSTALL_PCI_HANDLER
373 //
374 typedef struct {
375 UINT8 PciBus;
376 UINT8 PciDeviceFun;
377 UINT8 PciSegment;
378 UINT8 PciClass;
379 UINT8 PciSubclass;
380 UINT8 PciInterface;
381 //
382 // Primary section
383 //
384 UINT8 PrimaryIrq;
385 UINT8 PrimaryReserved;
386 UINT16 PrimaryControl;
387 UINT16 PrimaryBase;
388 UINT16 PrimaryBusMaster;
389 //
390 // Secondary Section
391 //
392 UINT8 SecondaryIrq;
393 UINT8 SecondaryReserved;
394 UINT16 SecondaryControl;
395 UINT16 SecondaryBase;
396 UINT16 SecondaryBusMaster;
397 } EFI_LEGACY_INSTALL_PCI_HANDLER;
398
399 //
400 // Restore default pack value
401 //
402 #pragma pack()
403
404 #endif