]>
Commit | Line | Data |
---|---|---|
e3e7f36a | 1 | /** @file\r |
2 | The header file provides interface definitions exposed by CSM (Compatible Support Module).\r | |
3 | \r | |
4 | The CSM provides compatibility support between the Framework and traditional, legacy BIOS code \r | |
5 | and allows booting a traditional OS or booting an EFI OS off a device that requires a traditional \r | |
6 | option ROM (OpROM). \r | |
7 | \r | |
8 | These definitions are from Compatibility Support Module Spec Version 0.97.\r | |
9 | ||
8d129536 | 10 | Copyright (c) 2007-2009, Intel Corporation |
11 | All rights reserved. This program and the accompanying materials | |
12 | are licensed and made available under the terms and conditions of the BSD License | |
13 | which accompanies this distribution. The full text of the license may be found at | |
14 | http://opensource.org/licenses/bsd-license.php | |
15 | ||
16 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
17 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
18 | ||
8d129536 | 19 | **/ |
20 | ||
21 | #ifndef _FRAMEWORK_LEGACY_16_H_ | |
22 | #define _FRAMEWORK_LEGACY_16_H_ | |
23 | ||
24 | #include <Base.h> | |
25 | ||
26 | #pragma pack(1) | |
27 | ||
28 | typedef UINT8 SERIAL_MODE; | |
29 | typedef UINT8 PARALLEL_MODE; | |
30 | ||
31 | #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$') | |
32 | ||
e3e7f36a | 33 | ///\r |
34 | /// There is a table located within the traditional BIOS in either the 0xF000:xxxx or 0xE000:xxxx\r | |
35 | /// physical address range. It is located on a 16-byte boundary and provides the physical address of the\r | |
36 | /// entry point for the Compatibility16 functions. These functions provide the platform-specific\r | |
37 | /// information that is required by the generic EfiCompatibility code. The functions are invoked via\r | |
38 | /// thunking by using EFI_LEGACY_BIOS_PROTOCOL.FarCall86() with the 32-bit physical\r | |
39 | /// entry point.\r | |
40 | /// | |
41 | typedef struct {\r | |
42 | ///\r | |
43 | /// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 0 is "I," byte\r | |
44 | /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.\r | |
45 | /// | |
46 | UINT32 Signature;\r | |
47 | \r | |
48 | ///\r | |
49 | /// The value required such that byte checksum of TableLength equals zero.\r | |
50 | /// | |
51 | UINT8 TableChecksum;\r | |
52 | \r | |
53 | ///\r | |
54 | /// The length of this table.\r | |
55 | /// | |
56 | UINT8 TableLength;\r | |
57 | \r | |
58 | ///\r | |
59 | /// The major EFI revision for which this table was generated.\r | |
60 | /// | |
61 | UINT8 EfiMajorRevision;\r | |
62 | \r | |
63 | ///\r | |
64 | /// The minor EFI revision for which this table was generated.\r | |
65 | /// | |
66 | UINT8 EfiMinorRevision;\r | |
67 | \r | |
68 | ///\r | |
69 | /// The major revision of this table.\r | |
70 | /// | |
71 | UINT8 TableMajorRevision;\r | |
72 | \r | |
73 | ///\r | |
74 | /// The minor revision of this table.\r | |
75 | /// | |
76 | UINT8 TableMinorRevision;\r | |
77 | \r | |
78 | ///\r | |
79 | /// Reserved for future usage.\r | |
80 | /// | |
81 | UINT16 Reserved;\r | |
82 | \r | |
83 | ///\r | |
84 | /// The segment of the entry point within the traditional BIOS for Compatibility16 functions.\r | |
85 | /// | |
86 | UINT16 Compatibility16CallSegment;\r | |
87 | \r | |
88 | ///\r | |
89 | /// The offset of the entry point within the traditional BIOS for Compatibility16 functions.\r | |
90 | /// | |
91 | UINT16 Compatibility16CallOffset;\r | |
92 | \r | |
93 | ///\r | |
94 | /// The segment of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.\r | |
95 | /// | |
96 | UINT16 PnPInstallationCheckSegment;\r | |
97 | \r | |
98 | ///\r | |
99 | /// The Offset of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.\r | |
100 | /// | |
101 | UINT16 PnPInstallationCheckOffset;\r | |
102 | \r | |
103 | ///\r | |
104 | /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform Innovation Framework for EFI \r | |
105 | /// Driver Execution Environment Core Interface Specification (DXE CIS).\r | |
106 | /// | |
107 | UINT32 EfiSystemTable; \r | |
108 | \r | |
109 | ///\r | |
110 | /// The address of an OEM-provided identifier string. The string is null terminated.\r | |
111 | /// | |
112 | UINT32 OemIdStringPointer;\r | |
113 | \r | |
114 | ///\r | |
115 | /// The 32-bit physical address where ACPI RSD PTR is stored within the traditional\r | |
116 | /// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size\r | |
117 | /// reserved is the maximum for ACPI 2.0. The EfiCompatibility will fill in the ACPI\r | |
118 | /// RSD PTR with either the ACPI 1.0b or 2.0 values.\r | |
119 | /// | |
120 | UINT32 AcpiRsdPtrPointer;\r | |
121 | \r | |
122 | ///\r | |
123 | /// The OEM revision number. Usage is undefined but provided for OEM module usage.\r | |
124 | /// | |
125 | UINT16 OemRevision;\r | |
126 | \r | |
127 | ///\r | |
128 | /// The 32-bit physical address where INT15 E820 data is stored within the traditional\r | |
129 | /// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the\r | |
130 | /// data to the indicated area.\r | |
131 | /// | |
132 | UINT32 E820Pointer;\r | |
133 | \r | |
134 | ///\r | |
135 | /// The length of the E820 data and is filled in by the EfiCompatibility code.\r | |
136 | /// | |
137 | UINT32 E820Length;\r | |
138 | \r | |
139 | ///\r | |
140 | /// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.\r | |
141 | /// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and\r | |
142 | /// copy the data to the indicated area.\r | |
143 | /// | |
144 | UINT32 IrqRoutingTablePointer;\r | |
145 | \r | |
146 | ///\r | |
147 | /// The length of the $PIR table and is filled in by the EfiCompatibility code.\r | |
148 | /// | |
149 | UINT32 IrqRoutingTableLength;\r | |
150 | \r | |
151 | ///\r | |
152 | /// The 32-bit physical address where the MP table is stored in the traditional BIOS.\r | |
153 | /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data to the indicated area.\r | |
154 | /// | |
155 | UINT32 MpTablePtr;\r | |
156 | \r | |
157 | ///\r | |
158 | /// The length of the MP table and is filled in by the EfiCompatibility code.\r | |
159 | /// | |
160 | UINT32 MpTableLength;\r | |
161 | \r | |
162 | ///\r | |
163 | /// The segment of the OEM-specific INT 15 table/code.\r | |
164 | /// | |
165 | UINT16 OemInt15Segment;\r | |
166 | \r | |
167 | ///\r | |
168 | /// The offset of the OEM-specific INT 15 table/code.\r | |
169 | /// | |
170 | UINT16 OemInt15Offset;\r | |
171 | \r | |
172 | ///\r | |
173 | /// The segment of the OEM-specific 32-bit table/code.\r | |
174 | /// | |
175 | UINT16 Oem32Segment;\r | |
176 | \r | |
177 | ///\r | |
178 | /// The offset of the OEM-specific 32-bit table/code.\r | |
179 | /// | |
8d129536 | 180 | UINT16 Oem32Offset; |
181 | UINT16 Oem16Segment; | |
182 | UINT16 Oem16Offset; | |
183 | UINT16 TpmSegment; | |
e3e7f36a | 184 | UINT16 TpmOffset;\r |
185 | \r | |
186 | ///\r | |
187 | /// A pointer to a string identifying the independent BIOS vendor.\r | |
188 | /// | |
8d129536 | 189 | UINT32 IbvPointer; |
190 | UINT32 PciExpressBase; | |
191 | UINT8 LastPciBus; | |
192 | } EFI_COMPATIBILITY16_TABLE; | |
193 | ||
194 | /// | |
e3e7f36a | 195 | /// Functions provided by the CSM binary which communicate between the EfiCompatibility \r |
196 | /// and Compatability16 code. | |
197 | /// | |
198 | typedef enum {\r | |
199 | ///\r | |
200 | /// Causes the Compatibility16 code to do any internal initialization required.\r | |
201 | /// Input:\r | |
202 | /// AX = Compatibility16InitializeYourself\r | |
203 | /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_INIT_TABLE\r | |
204 | /// Return:\r | |
205 | /// AX = Return Status codes\r | |
206 | /// | |
207 | Compatibility16InitializeYourself = 0x0000,\r | |
208 | \r | |
209 | ///\r | |
210 | /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.\r | |
211 | /// Input:\r | |
212 | /// AX = Compatibility16UpdateBbs\r | |
213 | /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE\r | |
214 | /// Return:\r | |
215 | /// AX = Returned status codes\r | |
216 | /// | |
217 | Compatibility16UpdateBbs = 0x0001,\r | |
218 | \r | |
219 | ///\r | |
220 | /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16\r | |
221 | /// code is read/write.\r | |
222 | /// Input:\r | |
223 | /// AX = Compatibility16PrepareToBoot\r | |
224 | /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure \r | |
225 | /// Return:\r | |
226 | /// AX = Returned status codes\r | |
227 | /// | |
228 | Compatibility16PrepareToBoot = 0x0002,\r | |
229 | \r | |
230 | ///\r | |
231 | /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only.\r | |
232 | /// Input:\r | |
233 | /// AX = Compatibility16Boot\r | |
234 | /// Output:\r | |
235 | /// AX = Returned status codes\r | |
236 | /// | |
237 | Compatibility16Boot = 0x0003,\r | |
238 | \r | |
239 | ///\r | |
240 | /// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is\r | |
241 | /// stored in CMOS and is the priority number of the last attempted boot device.\r | |
242 | /// Input:\r | |
243 | /// AX = Compatibility16RetrieveLastBootDevice\r | |
244 | /// Output:\r | |
245 | /// AX = Returned status codes\r | |
246 | /// BX = Priority number of the boot device.\r | |
247 | /// | |
248 | Compatibility16RetrieveLastBootDevice= 0x0004,\r | |
249 | \r | |
250 | ///\r | |
251 | /// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM.\r | |
252 | /// Input:\r | |
253 | /// AX = Compatibility16DispatchOprom\r | |
254 | /// ES:BX = Pointer to EFI_DISPATCH_OPROM_TABLE\r | |
255 | /// Output:\r | |
256 | /// AX = Returned status codes\r | |
257 | /// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.\r | |
258 | /// | |
259 | Compatibility16DispatchOprom = 0x0005,\r | |
260 | \r | |
261 | ///\r | |
262 | /// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address\r | |
263 | /// of that region.\r | |
264 | /// Input:\r | |
265 | /// AX = Compatibility16GetTableAddress\r | |
266 | /// BX = Allocation region\r | |
267 | /// 00 = Allocate from either 0xE0000 or 0xF0000 64 KB blocks.\r | |
268 | /// Bit 0 = 1 Allocate from 0xF0000 64 KB block\r | |
269 | /// Bit 1 = 1 Allocate from 0xE0000 64 KB block\r | |
270 | /// CX = Requested length in bytes.\r | |
271 | /// DX = Required address alignment. Bit mapped. First non-zero bit from the right is the alignment.\r | |
272 | /// Output:\r | |
273 | /// AX = Returned status codes\r | |
274 | /// DS:BX = Address of the region\r | |
275 | /// | |
276 | Compatibility16GetTableAddress = 0x0006,\r | |
277 | \r | |
278 | ///\r | |
279 | /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.\r | |
280 | /// Input:\r | |
281 | /// AX = Compatibility16SetKeyboardLeds\r | |
282 | /// CL = LED status.\r | |
283 | /// Bit 0 – Scroll Lock 0 = Off\r | |
284 | /// Bit 1 – NumLock\r | |
285 | /// Bit 2 – Caps Lock\r | |
286 | /// Output:\r | |
287 | /// AX = Returned status codes\r | |
288 | /// | |
289 | Compatibility16SetKeyboardLeds = 0x0007,\r | |
290 | \r | |
291 | ///\r | |
292 | /// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that\r | |
293 | /// do not have an OpROM associated with them. An example is SATA.\r | |
294 | /// Input:\r | |
295 | /// AX = Compatibility16InstallPciHandler\r | |
296 | /// ES:BX = Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER structure\r | |
297 | /// Output:\r | |
298 | /// AX = Returned status codes\r | |
299 | /// | |
2e747cee | 300 | Compatibility16InstallPciHandler = 0x0008 |
8d129536 | 301 | } EFI_COMPATIBILITY_FUNCTIONS; |
302 | ||
303 | ||
304 | /// | |
305 | /// EFI_DISPATCH_OPROM_TABLE | |
306 | /// | |
307 | typedef struct { | |
e3e7f36a | 308 | UINT16 PnPInstallationCheckSegment; ///< Pointer to the PnpInstallationCheck data structure. |
309 | UINT16 PnPInstallationCheckOffset; ///< Pointer to the PnpInstallationCheck data structure. | |
310 | UINT16 OpromSegment; ///< The segment where the OpROM was placed. Offset is assumed to be 3. | |
311 | UINT8 PciBus; ///< The PCI bus. | |
312 | UINT8 PciDeviceFunction; ///< The PCI device * 0x08 | PCI function. | |
313 | UINT8 NumberBbsEntries; ///< The number of valid BBS table entries upon entry and exit. The IBV code may\r | |
314 | ///< increase this number, if BBS-compliant devices also hook INTs in order to force the\r | |
315 | ///< OpROM BIOS Setup to be executed. | |
316 | VOID *BbsTable; ///< Pointer to the BBS table. | |
8d129536 | 317 | UINT16 RuntimeSegment; |
318 | } EFI_DISPATCH_OPROM_TABLE; | |
319 | ||
320 | /// | |
321 | /// EFI_TO_COMPATIBILITY16_INIT_TABLE | |
322 | /// | |
e3e7f36a | 323 | typedef struct {\r |
324 | ///\r | |
325 | /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.\r | |
326 | /// | |
327 | UINT32 BiosLessThan1MB;\r | |
328 | \r | |
329 | ///\r | |
330 | /// Starting address of the high memory block.\r | |
331 | /// | |
332 | UINT32 HiPmmMemory;\r | |
333 | \r | |
334 | ///\r | |
335 | /// Length of high memory block.\r | |
336 | /// | |
337 | UINT32 HiPmmMemorySizeInBytes;\r | |
338 | \r | |
339 | ///\r | |
340 | /// The segment of the reverse thunk call code.\r | |
341 | /// | |
342 | UINT16 ReverseThunkCallSegment;\r | |
343 | \r | |
344 | ///\r | |
345 | /// The offset of the reverse thunk call code.\r | |
346 | /// | |
347 | UINT16 ReverseThunkCallOffset;\r | |
348 | \r | |
349 | ///\r | |
350 | /// The number of E820 entries copied to the Compatibility16 BIOS.\r | |
351 | /// | |
352 | UINT32 NumberE820Entries;\r | |
353 | \r | |
354 | ///\r | |
355 | /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.\r | |
356 | /// | |
357 | UINT32 OsMemoryAbove1Mb;\r | |
358 | \r | |
359 | ///\r | |
360 | /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.\r | |
361 | /// | |
362 | UINT32 ThunkStart;\r | |
363 | \r | |
364 | ///\r | |
365 | /// The size of the thunk code.\r | |
366 | /// | |
8d129536 | 367 | UINT32 ThunkSizeInBytes; |
368 | UINT32 LowPmmMemory; | |
369 | UINT32 LowPmmMemorySizeInBytes; | |
370 | } EFI_TO_COMPATIBILITY16_INIT_TABLE; | |
371 | ||
372 | /// | |
373 | /// DEVICE_PRODUCER_SERIAL & its modes | |
374 | /// | |
375 | typedef struct { | |
e3e7f36a | 376 | UINT16 Address; ///< I/O address assigned to the serial port |
377 | UINT8 Irq; ///< IRQ assigned to the serial port. | |
378 | SERIAL_MODE Mode; ///< Mode of serial port. Values are defined below. | |
8d129536 | 379 | } DEVICE_PRODUCER_SERIAL; |
380 | ||
381 | #define DEVICE_SERIAL_MODE_NORMAL 0x00 | |
382 | #define DEVICE_SERIAL_MODE_IRDA 0x01 | |
383 | #define DEVICE_SERIAL_MODE_ASK_IR 0x02 | |
384 | #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00 | |
385 | #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10 | |
386 | ||
387 | /// | |
388 | /// DEVICE_PRODUCER_PARALLEL & its modes | |
389 | /// | |
390 | typedef struct { | |
e3e7f36a | 391 | UINT16 Address; ///< I/O address assigned to the parallel port |
392 | UINT8 Irq; ///< IRQ assigned to the parallel port. | |
393 | UINT8 Dma; ///< DMA assigned to the parallel port. | |
394 | PARALLEL_MODE Mode; ///< Mode of the parallel port. Values are defined below. | |
8d129536 | 395 | } DEVICE_PRODUCER_PARALLEL; |
396 | ||
397 | #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00 | |
398 | #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01 | |
399 | #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02 | |
400 | #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03 | |
401 | ||
402 | /// | |
403 | /// DEVICE_PRODUCER_FLOPPY | |
404 | /// | |
405 | typedef struct { | |
e3e7f36a | 406 | UINT16 Address; ///< I/O address assigned to the floppy |
407 | UINT8 Irq; ///< IRQ assigned to the floppy. | |
408 | UINT8 Dma; ///< DMA assigned to the floppy. | |
409 | UINT8 NumberOfFloppy; ///< Number of floppies in the system. | |
8d129536 | 410 | } DEVICE_PRODUCER_FLOPPY; |
411 | ||
412 | /// | |
413 | /// LEGACY_DEVICE_FLAGS | |
414 | /// | |
415 | typedef struct { | |
e3e7f36a | 416 | UINT32 A20Kybd : 1; ///< A20 controller by keyboard controller. |
417 | UINT32 A20Port90 : 1; ///< A20 controlled by port 0x92. | |
418 | UINT32 Reserved : 30; ///< Reserved for future usage. | |
8d129536 | 419 | } LEGACY_DEVICE_FLAGS; |
420 | ||
421 | /// | |
422 | /// DEVICE_PRODUCER_DATA_HEADER | |
423 | /// | |
424 | typedef struct { | |
e3e7f36a | 425 | DEVICE_PRODUCER_SERIAL Serial[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below. |
426 | DEVICE_PRODUCER_PARALLEL Parallel[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below. | |
427 | DEVICE_PRODUCER_FLOPPY Floppy; ///< Data for floppy. Type DEVICE_PRODUCER_FLOPPY is defined below. | |
428 | UINT8 MousePresent; ///< Flag to indicate if mouse is present. | |
429 | LEGACY_DEVICE_FLAGS Flags; ///< Miscellaneous Boolean state information passed to CSM. | |
8d129536 | 430 | } DEVICE_PRODUCER_DATA_HEADER; |
431 | ||
432 | /// | |
433 | /// ATAPI_IDENTIFY | |
434 | /// | |
435 | typedef struct { | |
e3e7f36a | 436 | UINT16 Raw[256]; ///< Raw data from the IDE IdentifyDrive command. |
8d129536 | 437 | } ATAPI_IDENTIFY; |
438 | ||
439 | /// | |
440 | /// HDD_INFO & its status | |
441 | /// | |
e3e7f36a | 442 | typedef struct {\r |
443 | ///\r | |
444 | /// Status of IDE device. Values are defined below. There is one HDD_INFO structure\r | |
445 | /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index\r | |
446 | /// 1 is slave.\r | |
447 | /// | |
448 | UINT16 Status; \r | |
449 | \r | |
450 | ///\r | |
451 | /// PCI bus of IDE controller.\r | |
452 | /// | |
453 | UINT32 Bus;\r | |
454 | \r | |
455 | ///\r | |
456 | /// PCI device of IDE controller.\r | |
457 | /// | |
458 | UINT32 Device;\r | |
459 | \r | |
460 | ///\r | |
461 | /// PCI function of IDE controller.\r | |
462 | /// | |
463 | UINT32 Function;\r | |
464 | \r | |
465 | ///\r | |
466 | /// Command ports base address.\r | |
467 | /// | |
468 | UINT16 CommandBaseAddress;\r | |
469 | \r | |
470 | ///\r | |
471 | /// Control ports base address.\r | |
472 | /// | |
473 | UINT16 ControlBaseAddress;\r | |
474 | \r | |
475 | ///\r | |
476 | /// Bus master address\r | |
477 | /// | |
478 | UINT16 BusMasterAddress;\r | |
479 | ||
480 | UINT8 HddIrq;\r | |
481 | \r | |
482 | ///\r | |
483 | /// Data that identifies the drive data, one per possible attached drive\r | |
484 | /// | |
8d129536 | 485 | ATAPI_IDENTIFY IdentifyDrive[2]; |
486 | } HDD_INFO; | |
487 | ||
488 | #define HDD_PRIMARY 0x01 | |
489 | #define HDD_SECONDARY 0x02 | |
490 | #define HDD_MASTER_ATAPI_CDROM 0x04 | |
491 | #define HDD_SLAVE_ATAPI_CDROM 0x08 | |
492 | #define HDD_MASTER_IDE 0x20 | |
493 | #define HDD_SLAVE_IDE 0x40 | |
494 | #define HDD_MASTER_ATAPI_ZIPDISK 0x10 | |
495 | #define HDD_SLAVE_ATAPI_ZIPDISK 0x80 | |
496 | ||
497 | /// | |
498 | /// BBS_STATUS_FLAGS | |
499 | /// | |
500 | typedef struct { | |
e3e7f36a | 501 | UINT16 OldPosition : 4; ///< Prior priority. |
502 | UINT16 Reserved1 : 4; ///< Reserved for future use. | |
503 | UINT16 Enabled : 1; ///< If 0, ignore this entry. | |
504 | UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred.\r | |
505 | ///< 1 = Boot attempted failed.\r | |
506 | \r | |
507 | ///\r | |
508 | /// State of media present.\r | |
509 | /// 00 = No bootable media is present in the device.\r | |
510 | /// 01 = Unknown if a bootable media present.\r | |
511 | /// 10 = Media is present and appears bootable.\r | |
512 | /// 11 = Reserved.\r | |
513 | /// | |
8d129536 | 514 | UINT16 MediaPresent : 2; |
e3e7f36a | 515 | UINT16 Reserved2 : 4; ///< Reserved for future use. |
8d129536 | 516 | } BBS_STATUS_FLAGS; |
517 | ||
518 | /// | |
519 | /// BBS_TABLE, device type values & boot priority values | |
520 | /// | |
e3e7f36a | 521 | typedef struct {\r |
522 | ///\r | |
523 | /// The boot priority for this boot device. Values are defined below.\r | |
524 | /// | |
525 | UINT16 BootPriority;\r | |
526 | \r | |
527 | ///\r | |
528 | /// The PCI bus for this boot device.\r | |
529 | /// | |
530 | UINT32 Bus;\r | |
531 | \r | |
532 | ///\r | |
533 | /// The PCI device for this boot device.\r | |
534 | /// | |
535 | UINT32 Device;\r | |
536 | \r | |
537 | ///\r | |
538 | /// The PCI function for the boot device.\r | |
539 | /// | |
540 | UINT32 Function;\r | |
541 | \r | |
542 | ///\r | |
543 | /// The PCI class for this boot device.\r | |
544 | /// | |
545 | UINT8 Class;\r | |
546 | \r | |
547 | ///\r | |
548 | /// The PCI Subclass for this boot device.\r | |
549 | /// | |
550 | UINT8 SubClass;\r | |
551 | \r | |
552 | ///\r | |
553 | /// Segment:offset address of an ASCIIZ description string describing the manufacturer.\r | |
554 | /// | |
555 | UINT16 MfgStringOffset;\r | |
556 | \r | |
557 | ///\r | |
558 | /// Segment:offset address of an ASCIIZ description string describing the manufacturer.\r | |
559 | /// | |
560 | UINT16 MfgStringSegment;\r | |
561 | \r | |
562 | ///\r | |
563 | /// BBS device type. BBS device types are defined below.\r | |
564 | /// | |
565 | UINT16 DeviceType;\r | |
566 | \r | |
567 | ///\r | |
568 | /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.\r | |
569 | /// | |
570 | BBS_STATUS_FLAGS StatusFlags;\r | |
571 | \r | |
572 | ///\r | |
573 | /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for\r | |
574 | /// BCV devices.\r | |
575 | /// | |
576 | UINT16 BootHandlerOffset;\r | |
577 | \r | |
578 | ///\r | |
579 | /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for\r | |
580 | /// BCV devices.\r | |
581 | /// | |
582 | UINT16 BootHandlerSegment;\r | |
583 | \r | |
584 | ///\r | |
585 | /// Segment:offset address of an ASCIIZ description string describing this device.\r | |
586 | /// | |
8d129536 | 587 | UINT16 DescStringOffset; |
e3e7f36a | 588 | \r |
589 | ///\r | |
590 | /// Segment:offset address of an ASCIIZ description string describing this device.\r | |
591 | ///\r | |
592 | UINT16 DescStringSegment;\r | |
593 | \r | |
594 | ///\r | |
595 | /// Reserved.\r | |
596 | /// | |
597 | UINT32 InitPerReserved;\r | |
598 | \r | |
599 | ///\r | |
600 | /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r | |
601 | /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r | |
602 | /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r | |
603 | /// | |
604 | UINT32 AdditionalIrq13Handler;\r | |
605 | \r | |
606 | ///\r | |
607 | /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r | |
608 | /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r | |
609 | /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r | |
610 | /// | |
611 | UINT32 AdditionalIrq18Handler;\r | |
612 | \r | |
613 | ///\r | |
614 | /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r | |
615 | /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r | |
616 | /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r | |
617 | /// | |
618 | UINT32 AdditionalIrq19Handler;\r | |
619 | \r | |
620 | ///\r | |
621 | /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r | |
622 | /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r | |
623 | /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r | |
624 | /// | |
8d129536 | 625 | UINT32 AdditionalIrq40Handler; |
626 | UINT8 AssignedDriveNumber; | |
627 | UINT32 AdditionalIrq41Handler; | |
628 | UINT32 AdditionalIrq46Handler; | |
629 | UINT32 IBV1; | |
630 | UINT32 IBV2; | |
631 | } BBS_TABLE; | |
632 | ||
633 | #define BBS_FLOPPY 0x01 | |
634 | #define BBS_HARDDISK 0x02 | |
635 | #define BBS_CDROM 0x03 | |
636 | #define BBS_PCMCIA 0x04 | |
637 | #define BBS_USB 0x05 | |
638 | #define BBS_EMBED_NETWORK 0x06 | |
639 | #define BBS_BEV_DEVICE 0x80 | |
640 | #define BBS_UNKNOWN 0xff | |
641 | ||
642 | #define BBS_DO_NOT_BOOT_FROM 0xFFFC | |
643 | #define BBS_LOWEST_PRIORITY 0xFFFD | |
644 | #define BBS_UNPRIORITIZED_ENTRY 0xFFFE | |
645 | #define BBS_IGNORE_ENTRY 0xFFFF | |
646 | ||
647 | /// | |
648 | /// SMM_ATTRIBUTES & relating type, port and data size constants | |
649 | /// | |
e3e7f36a | 650 | typedef struct {\r |
651 | ///\r | |
652 | /// Access mechanism used to generate the soft SMI. Defined types are below. The other\r | |
653 | /// values are reserved for future usage.\r | |
654 | /// | |
655 | UINT16 Type : 3;\r | |
656 | \r | |
657 | ///\r | |
658 | /// Size of "port" in bits. Defined values are below.\r | |
659 | /// | |
660 | UINT16 PortGranularity : 3;\r | |
661 | \r | |
662 | ///\r | |
663 | /// Size of data in bits. Defined values are below.\r | |
664 | /// | |
665 | UINT16 DataGranularity : 3;\r | |
666 | \r | |
667 | ///\r | |
668 | /// Reserved for future use.\r | |
669 | /// | |
8d129536 | 670 | UINT16 Reserved : 7; |
671 | } SMM_ATTRIBUTES; | |
672 | ||
673 | #define STANDARD_IO 0x00 | |
674 | #define STANDARD_MEMORY 0x01 | |
675 | ||
676 | #define PORT_SIZE_8 0x00 | |
677 | #define PORT_SIZE_16 0x01 | |
678 | #define PORT_SIZE_32 0x02 | |
679 | #define PORT_SIZE_64 0x03 | |
680 | ||
681 | #define DATA_SIZE_8 0x00 | |
682 | #define DATA_SIZE_16 0x01 | |
683 | #define DATA_SIZE_32 0x02 | |
684 | #define DATA_SIZE_64 0x03 | |
685 | ||
686 | /// | |
687 | /// SMM_FUNCTION & relating constants | |
688 | /// | |
689 | typedef struct { | |
690 | UINT16 Function : 15; | |
691 | UINT16 Owner : 1; | |
692 | } SMM_FUNCTION; | |
693 | ||
694 | #define INT15_D042 0x0000 | |
695 | #define GET_USB_BOOT_INFO 0x0001 | |
696 | #define DMI_PNP_50_57 0x0002 | |
697 | ||
698 | #define STANDARD_OWNER 0x0 | |
699 | #define OEM_OWNER 0x1 | |
700 | ||
701 | /** | |
702 | * SMM_ENTRY | |
703 | * | |
704 | * This structure assumes both port and data sizes are 1. SmmAttribute must be | |
705 | * properly to reflect that assumption. | |
706 | **/ | |
e3e7f36a | 707 | typedef struct {\r |
708 | ///\r | |
709 | /// Describes the access mechanism, SmmPort, and SmmData sizes. Type\r | |
710 | /// SMM_ATTRIBUTES is defined below.\r | |
711 | /// | |
712 | SMM_ATTRIBUTES SmmAttributes;\r | |
713 | \r | |
714 | ///\r | |
715 | /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.\r | |
716 | /// | |
717 | SMM_FUNCTION SmmFunction;\r | |
718 | \r | |
719 | ///\r | |
720 | /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes\r | |
721 | /// | |
722 | UINT8 SmmPort;\r | |
723 | \r | |
724 | ///\r | |
725 | /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes\r | |
726 | /// | |
8d129536 | 727 | UINT8 SmmData; |
728 | } SMM_ENTRY; | |
729 | ||
730 | /// | |
731 | /// SMM_TABLE | |
732 | /// | |
733 | typedef struct { | |
e3e7f36a | 734 | UINT16 NumSmmEntries; ///< Number of entries represented by SmmEntry. |
735 | SMM_ENTRY SmmEntry; ///< One entry per function. Type SMM_ENTRY is defined below. | |
8d129536 | 736 | } SMM_TABLE; |
737 | ||
738 | /// | |
739 | /// UDC_ATTRIBUTES | |
740 | /// | |
e3e7f36a | 741 | typedef struct {\r |
742 | ///\r | |
743 | /// This bit set indicates that the ServiceAreaData is valid.\r | |
744 | /// | |
745 | UINT8 DirectoryServiceValidity : 1;\r | |
746 | \r | |
747 | ///\r | |
748 | /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if\r | |
749 | /// DirectoryServiceValidity is 0.\r | |
750 | /// | |
751 | UINT8 RabcaUsedFlag : 1;\r | |
752 | \r | |
753 | ///\r | |
754 | /// This bit set indicates to execute hard disk diagnostics.\r | |
755 | /// | |
756 | UINT8 ExecuteHddDiagnosticsFlag : 1;\r | |
757 | \r | |
758 | ///\r | |
759 | /// Reserved for future use. Set to 0.\r | |
760 | /// | |
8d129536 | 761 | UINT8 Reserved : 5; |
762 | } UDC_ATTRIBUTES; | |
763 | ||
764 | /// | |
765 | /// UD_TABLE | |
766 | /// | |
e3e7f36a | 767 | typedef struct {\r |
768 | ///\r | |
769 | /// This field contains the bit-mapped attributes of the PARTIES information. Type\r | |
770 | /// UDC_ATTRIBUTES is defined below.\r | |
771 | /// | |
772 | UDC_ATTRIBUTES Attributes;\r | |
773 | \r | |
774 | ///\r | |
775 | /// This field contains the zero-based device on which the selected\r | |
776 | /// ServiceDataArea is present. It is 0 for master and 1 for the slave device. \r | |
777 | /// | |
778 | UINT8 DeviceNumber;\r | |
779 | \r | |
780 | ///\r | |
781 | /// This field contains the zero-based index into the BbsTable for the parent device.\r | |
782 | /// This index allows the user to reference the parent device information such as PCI\r | |
783 | /// bus, device function.\r | |
784 | /// | |
785 | UINT8 BbsTableEntryNumberForParentDevice;\r | |
786 | \r | |
787 | ///\r | |
788 | /// This field contains the zero-based index into the BbsTable for the boot entry.\r | |
789 | /// | |
790 | UINT8 BbsTableEntryNumberForBoot;\r | |
791 | \r | |
792 | ///\r | |
793 | /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.\r | |
794 | /// | |
795 | UINT8 BbsTableEntryNumberForHddDiag;\r | |
796 | \r | |
797 | ///\r | |
798 | /// The raw Beer data.\r | |
799 | /// | |
800 | UINT8 BeerData[128];\r | |
801 | \r | |
802 | ///\r | |
803 | /// The raw data of selected service area.\r | |
804 | /// | |
8d129536 | 805 | UINT8 ServiceAreaData[64]; |
806 | } UD_TABLE; | |
807 | ||
808 | #define EFI_TO_LEGACY_MAJOR_VERSION 0x02 | |
809 | #define EFI_TO_LEGACY_MINOR_VERSION 0x00 | |
810 | #define MAX_IDE_CONTROLLER 8 | |
811 | ||
812 | /// | |
813 | /// EFI_TO_COMPATIBILITY16_BOOT_TABLE | |
814 | /// | |
815 | typedef struct { | |
e3e7f36a | 816 | UINT16 MajorVersion; ///< The EfiCompatibility major version number. |
817 | UINT16 MinorVersion; ///< The EfiCompatibility minor version number. | |
818 | UINT32 AcpiTable; ///< Location of the RSDT ACPI table. < 4G range | |
819 | UINT32 SmbiosTable; ///< Location of the SMBIOS table in EFI memory. < 4G range | |
8d129536 | 820 | UINT32 SmbiosTableLength; |
821 | // | |
822 | // Legacy SIO state | |
823 | // | |
e3e7f36a | 824 | DEVICE_PRODUCER_DATA_HEADER SioData; ///< Standard traditional device information. |
825 | UINT16 DevicePathType; ///< The default boot type. | |
826 | UINT16 PciIrqMask; ///< Mask of which IRQs have been assigned to PCI. | |
827 | UINT32 NumberE820Entries; ///< Number of E820 entries. The number can change from the\r | |
828 | ///< Compatibility16InitializeYourself() function. | |
8d129536 | 829 | // |
830 | // Controller & Drive Identify[2] per controller information | |
831 | // | |
e3e7f36a | 832 | HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data. |
833 | UINT32 NumberBbsEntries; ///< Number of entries in the BBS table | |
834 | UINT32 BbsTable; ///< Pointer to the BBS table. Type BBS_TABLE is defined below. | |
835 | UINT32 SmmTable; ///< Pointer to the SMM table. Type SMM_TABLE is defined below. | |
836 | UINT32 OsMemoryAbove1Mb; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can\r | |
837 | ///< differ from the value in EFI_TO_COMPATIBILITY16_INIT_TABLE as more\r | |
838 | ///< memory may have been discovered. | |
839 | UINT32 UnconventionalDeviceTable; ///< Information to boot off an unconventional device like a PARTIES partition. Type\r | |
840 | ///< UD_TABLE is defined below. | |
8d129536 | 841 | } EFI_TO_COMPATIBILITY16_BOOT_TABLE; |
842 | ||
843 | /// | |
844 | /// EFI_LEGACY_INSTALL_PCI_HANDLER | |
845 | /// | |
846 | typedef struct { | |
e3e7f36a | 847 | UINT8 PciBus; ///< The PCI bus of the device. |
848 | UINT8 PciDeviceFun; ///< The PCI device in bits 7:3 and function in bits 2:0. | |
849 | UINT8 PciSegment; ///< The PCI segment of the device. | |
850 | UINT8 PciClass; ///< The PCI class code of the device. | |
851 | UINT8 PciSubclass; ///< The PCI subclass code of the device. | |
852 | UINT8 PciInterface; ///< The PCI interface code of the device. | |
8d129536 | 853 | // |
854 | // Primary section | |
855 | // | |
e3e7f36a | 856 | UINT8 PrimaryIrq; ///< The primary device IRQ. |
857 | UINT8 PrimaryReserved; ///< Reserved. | |
858 | UINT16 PrimaryControl; ///< The primary device control I/O base. | |
859 | UINT16 PrimaryBase; ///< The primary device I/O base. | |
860 | UINT16 PrimaryBusMaster; ///< The primary device bus master I/O base. | |
8d129536 | 861 | // |
862 | // Secondary Section | |
863 | // | |
e3e7f36a | 864 | UINT8 SecondaryIrq; ///< The secondary device IRQ. |
865 | UINT8 SecondaryReserved; ///< Reserved. | |
866 | UINT16 SecondaryControl; ///< The secondary device control I/O base. | |
867 | UINT16 SecondaryBase; ///< The secondary device I/O base. | |
868 | UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base. | |
8d129536 | 869 | } EFI_LEGACY_INSTALL_PCI_HANDLER; |
870 | ||
871 | // | |
872 | // Restore default pack value | |
873 | // | |
874 | #pragma pack() | |
875 | ||
876 | #endif /* _FRAMEWORK_LEGACY_16_H_ */ |