]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/LegacyBios.h
Committing changes to the comments, after review with engineers.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / LegacyBios.h
CommitLineData
79964ac8 1/** @file\r
2 The EFI Legacy BIOS Protocol is used to abstract legacy Option ROM usage\r
87d63447 3 under EFI and Legacy OS boot. This file also includes all the related\r
4 COMPATIBILIY16 structures and defintions.\r
79964ac8 5\r
6 Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow\r
7 well known naming conventions.\r
8\r
5259c97d 9 Thunk is the code that switches from 32-bit protected environment into the 16-bit real-mode\r
10 environment. Reverse thunk is the code that does the opposite.\r
79964ac8 11\r
5259c97d 12 \r
2bbaeb0d 13 Copyright (c) 2007 - 2009, Intel Corporation\r
79964ac8 14 All rights reserved. This program and the accompanying materials\r
15 are licensed and made available under the terms and conditions of the BSD License\r
16 which accompanies this distribution. The full text of the license may be found at\r
17 http://opensource.org/licenses/bsd-license.php\r
18\r
19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
21\r
79964ac8 22 @par Revision Reference:\r
23 This protocol is defined in Framework for EFI Compatibility Support Module spec\r
0f899407 24 Version 0.97.\r
79964ac8 25\r
26**/\r
27\r
28#ifndef _EFI_LEGACY_BIOS_H_\r
29#define _EFI_LEGACY_BIOS_H_\r
30\r
87d63447 31///\r
32/// \r
33///\r
34#pragma pack(1)\r
35\r
36typedef UINT8 SERIAL_MODE;\r
37typedef UINT8 PARALLEL_MODE;\r
38\r
39#define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')\r
40\r
41///\r
42/// There is a table located within the traditional BIOS in either the 0xF000:xxxx or 0xE000:xxxx\r
43/// physical address range. It is located on a 16-byte boundary and provides the physical address of the\r
44/// entry point for the Compatibility16 functions. These functions provide the platform-specific\r
45/// information that is required by the generic EfiCompatibility code. The functions are invoked via\r
46/// thunking by using EFI_LEGACY_BIOS_PROTOCOL.FarCall86() with the 32-bit physical\r
47/// entry point.\r
48///\r
49typedef struct {\r
50 ///\r
51 /// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 0 is "I," byte\r
52 /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.\r
53 ///\r
54 UINT32 Signature;\r
55 \r
56 ///\r
57 /// The value required such that byte checksum of TableLength equals zero.\r
58 ///\r
59 UINT8 TableChecksum;\r
60 \r
61 ///\r
62 /// The length of this table.\r
63 ///\r
64 UINT8 TableLength;\r
65 \r
66 ///\r
67 /// The major EFI revision for which this table was generated.\r
68 /// \r
69 UINT8 EfiMajorRevision;\r
70 \r
71 ///\r
72 /// The minor EFI revision for which this table was generated.\r
73 ///\r
74 UINT8 EfiMinorRevision;\r
75 \r
76 ///\r
77 /// The major revision of this table.\r
78 ///\r
79 UINT8 TableMajorRevision;\r
80 \r
81 ///\r
82 /// The minor revision of this table.\r
83 ///\r
84 UINT8 TableMinorRevision;\r
85 \r
86 ///\r
87 /// Reserved for future usage.\r
88 ///\r
89 UINT16 Reserved;\r
90 \r
91 ///\r
92 /// The segment of the entry point within the traditional BIOS for Compatibility16 functions.\r
93 ///\r
94 UINT16 Compatibility16CallSegment;\r
95 \r
96 ///\r
97 /// The offset of the entry point within the traditional BIOS for Compatibility16 functions.\r
98 ///\r
99 UINT16 Compatibility16CallOffset;\r
100 \r
101 ///\r
102 /// The segment of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.\r
103 ///\r
104 UINT16 PnPInstallationCheckSegment;\r
105 \r
106 ///\r
107 /// The Offset of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.\r
108 ///\r
109 UINT16 PnPInstallationCheckOffset;\r
110 \r
111 ///\r
112 /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform Innovation Framework for EFI \r
113 /// Driver Execution Environment Core Interface Specification (DXE CIS).\r
114 ///\r
115 UINT32 EfiSystemTable; \r
116 \r
117 ///\r
118 /// The address of an OEM-provided identifier string. The string is null terminated.\r
119 ///\r
120 UINT32 OemIdStringPointer;\r
121 \r
122 ///\r
123 /// The 32-bit physical address where ACPI RSD PTR is stored within the traditional\r
124 /// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size\r
125 /// reserved is the maximum for ACPI 2.0. The EfiCompatibility will fill in the ACPI\r
126 /// RSD PTR with either the ACPI 1.0b or 2.0 values.\r
127 ///\r
128 UINT32 AcpiRsdPtrPointer;\r
129 \r
130 ///\r
131 /// The OEM revision number. Usage is undefined but provided for OEM module usage.\r
132 ///\r
133 UINT16 OemRevision;\r
134 \r
135 ///\r
136 /// The 32-bit physical address where INT15 E820 data is stored within the traditional\r
137 /// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the\r
138 /// data to the indicated area.\r
139 ///\r
140 UINT32 E820Pointer;\r
141 \r
142 ///\r
143 /// The length of the E820 data and is filled in by the EfiCompatibility code.\r
144 ///\r
145 UINT32 E820Length;\r
146 \r
147 ///\r
148 /// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.\r
149 /// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and\r
150 /// copy the data to the indicated area.\r
151 ///\r
152 UINT32 IrqRoutingTablePointer;\r
153 \r
154 ///\r
155 /// The length of the $PIR table and is filled in by the EfiCompatibility code.\r
156 ///\r
157 UINT32 IrqRoutingTableLength;\r
158 \r
159 ///\r
160 /// The 32-bit physical address where the MP table is stored in the traditional BIOS.\r
161 /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data to the indicated area.\r
162 ///\r
163 UINT32 MpTablePtr;\r
164 \r
165 ///\r
166 /// The length of the MP table and is filled in by the EfiCompatibility code.\r
167 ///\r
168 UINT32 MpTableLength;\r
169 \r
170 ///\r
171 /// The segment of the OEM-specific INT table/code.\r
172 /// \r
173 UINT16 OemIntSegment;\r
174 \r
175 ///\r
176 /// The offset of the OEM-specific INT table/code.\r
177 ///\r
178 UINT16 OemIntOffset;\r
179 \r
180 ///\r
181 /// The segment of the OEM-specific 32-bit table/code.\r
182 ///\r
183 UINT16 Oem32Segment;\r
184 \r
185 ///\r
186 /// The offset of the OEM-specific 32-bit table/code.\r
187 ///\r
188 UINT16 Oem32Offset;\r
189 \r
190 ///\r
191 /// The segment of the OEM-specific 16-bit table/code.\r
192 ///\r
193 UINT16 Oem16Segment;\r
194 \r
195 ///\r
196 /// The offset of the OEM-specific 16-bit table/code.\r
197 ///\r
198 UINT16 Oem16Offset;\r
199 \r
200 ///\r
201 /// The segment of the TPM binary passed to 16-bit CSM.\r
202 ///\r
203 UINT16 TpmSegment;\r
204 \r
205 ///\r
206 /// The offset of the TPM binary passed to 16-bit CSM.\r
207 ///\r
208 UINT16 TpmOffset;\r
209 \r
210 ///\r
211 /// A pointer to a string identifying the independent BIOS vendor.\r
212 ///\r
213 UINT32 IbvPointer;\r
214 \r
215 ///\r
216 /// This field is NULL for all systems not supporting PCI Express. This field is the base\r
217 /// value of the start of the PCI Express memory-mapped configuration registers and\r
218 /// must be filled in prior to EfiCompatibility code issuing the Compatibility16 function\r
219 /// Compatibility16InitializeYourself().\r
220 /// Compatibility16InitializeYourself() is defined in Compatability16\r
221 /// Functions.\r
222 ///\r
223 UINT32 PciExpressBase;\r
224 \r
225 ///\r
226 /// Maximum PCI bus number assigned.\r
227 ///\r
228 UINT8 LastPciBus;\r
229} EFI_COMPATIBILITY16_TABLE;\r
230\r
231///\r
232/// Functions provided by the CSM binary which communicate between the EfiCompatibility \r
233/// and Compatability16 code.\r
234///\r
235/// Inconsistent with specification here: \r
236/// The member's name started with "Compatibility16" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version] \r
237/// has been changed to "Legacy16" since keeping backward compatible.\r
238///\r
239typedef enum {\r
240 ///\r
241 /// Causes the Compatibility16 code to do any internal initialization required.\r
242 /// Input:\r
243 /// AX = Compatibility16InitializeYourself\r
244 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_INIT_TABLE\r
245 /// Return:\r
246 /// AX = Return Status codes\r
247 ///\r
248 Legacy16InitializeYourself = 0x0000,\r
249 \r
250 ///\r
251 /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.\r
252 /// Input:\r
253 /// AX = Compatibility16UpdateBbs\r
254 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE\r
255 /// Return:\r
256 /// AX = Returned status codes\r
257 ///\r
258 Legacy16UpdateBbs = 0x0001,\r
259 \r
260 ///\r
261 /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16\r
262 /// code is read/write.\r
263 /// Input:\r
264 /// AX = Compatibility16PrepareToBoot\r
265 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure \r
266 /// Return:\r
267 /// AX = Returned status codes\r
268 ///\r
269 Legacy16PrepareToBoot = 0x0002,\r
270 \r
271 ///\r
272 /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only.\r
273 /// Input:\r
274 /// AX = Compatibility16Boot\r
275 /// Output:\r
276 /// AX = Returned status codes\r
277 ///\r
278 Legacy16Boot = 0x0003,\r
279 \r
280 ///\r
281 /// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is\r
282 /// stored in CMOS and is the priority number of the last attempted boot device.\r
283 /// Input:\r
284 /// AX = Compatibility16RetrieveLastBootDevice\r
285 /// Output:\r
286 /// AX = Returned status codes\r
287 /// BX = Priority number of the boot device.\r
288 ///\r
289 Legacy16RetrieveLastBootDevice = 0x0004,\r
290 \r
291 ///\r
292 /// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM.\r
293 /// Input:\r
294 /// AX = Compatibility16DispatchOprom\r
295 /// ES:BX = Pointer to EFI_DISPATCH_OPROM_TABLE\r
296 /// Output:\r
297 /// AX = Returned status codes\r
298 /// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.\r
299 ///\r
300 Legacy16DispatchOprom = 0x0005,\r
301 \r
302 ///\r
303 /// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address\r
304 /// of that region.\r
305 /// Input:\r
306 /// AX = Compatibility16GetTableAddress\r
307 /// BX = Allocation region\r
308 /// 00 = Allocate from either 0xE0000 or 0xF0000 64 KB blocks.\r
309 /// Bit 0 = 1 Allocate from 0xF0000 64 KB block\r
310 /// Bit 1 = 1 Allocate from 0xE0000 64 KB block\r
311 /// CX = Requested length in bytes.\r
312 /// DX = Required address alignment. Bit mapped. First non-zero bit from the right is the alignment.\r
313 /// Output:\r
314 /// AX = Returned status codes\r
315 /// DS:BX = Address of the region\r
316 ///\r
317 Legacy16GetTableAddress = 0x0006,\r
318 \r
319 ///\r
320 /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.\r
321 /// Input:\r
322 /// AX = Compatibility16SetKeyboardLeds\r
323 /// CL = LED status.\r
324 /// Bit 0 Scroll Lock 0 = Off\r
325 /// Bit 1 NumLock\r
326 /// Bit 2 Caps Lock\r
327 /// Output:\r
328 /// AX = Returned status codes\r
329 ///\r
330 Legacy16SetKeyboardLeds = 0x0007,\r
331 \r
332 ///\r
333 /// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that\r
334 /// do not have an OpROM associated with them. An example is SATA.\r
335 /// Input:\r
336 /// AX = Compatibility16InstallPciHandler\r
337 /// ES:BX = Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER structure\r
338 /// Output:\r
339 /// AX = Returned status codes\r
340 ///\r
341 Legacy16InstallPciHandler = 0x0008\r
342} EFI_COMPATIBILITY_FUNCTIONS;\r
343\r
344\r
345///\r
346/// EFI_DISPATCH_OPROM_TABLE\r
347///\r
348typedef struct {\r
349 UINT16 PnPInstallationCheckSegment; ///< Pointer to the PnpInstallationCheck data structure.\r
350 UINT16 PnPInstallationCheckOffset; ///< Pointer to the PnpInstallationCheck data structure.\r
351 UINT16 OpromSegment; ///< The segment where the OpROM was placed. Offset is assumed to be 3.\r
352 UINT8 PciBus; ///< The PCI bus.\r
353 UINT8 PciDeviceFunction; ///< The PCI device * 0x08 | PCI function.\r
354 UINT8 NumberBbsEntries; ///< The number of valid BBS table entries upon entry and exit. The IBV code may\r
355 ///< increase this number, if BBS-compliant devices also hook INTs in order to force the\r
356 ///< OpROM BIOS Setup to be executed.\r
357 VOID *BbsTablePointer; ///< Pointer to the BBS table.\r
358 UINT16 RuntimeSegment; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this\r
359 ///< means that the relocation of this run time code is not supported.\r
360 ///< Inconsistent with specification here: \r
361 ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version] \r
362 ///< has been changed to "RuntimeSegment" since keeping backward compatible.\r
363\r
364} EFI_DISPATCH_OPROM_TABLE;\r
365\r
366///\r
367/// EFI_TO_COMPATIBILITY16_INIT_TABLE\r
368///\r
369typedef struct {\r
370 ///\r
371 /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.\r
372 ///\r
373 UINT32 BiosLessThan1MB;\r
374 \r
375 ///\r
376 /// Starting address of the high memory block.\r
377 ///\r
378 UINT32 HiPmmMemory;\r
379 \r
380 ///\r
381 /// Length of high memory block.\r
382 ///\r
383 UINT32 HiPmmMemorySizeInBytes;\r
384 \r
385 ///\r
386 /// The segment of the reverse thunk call code.\r
387 ///\r
388 UINT16 ReverseThunkCallSegment;\r
389 \r
390 ///\r
391 /// The offset of the reverse thunk call code.\r
392 ///\r
393 UINT16 ReverseThunkCallOffset;\r
394 \r
395 ///\r
396 /// The number of E820 entries copied to the Compatibility16 BIOS.\r
397 ///\r
398 UINT32 NumberE820Entries;\r
399 \r
400 ///\r
401 /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.\r
402 ///\r
403 UINT32 OsMemoryAbove1Mb;\r
404 \r
405 ///\r
406 /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.\r
407 ///\r
408 UINT32 ThunkStart;\r
409 \r
410 ///\r
411 /// The size of the thunk code.\r
412 ///\r
413 UINT32 ThunkSizeInBytes;\r
414 \r
415 ///\r
416 /// Starting address of memory under 1 MB.\r
417 ///\r
418 UINT32 LowPmmMemory;\r
419 \r
420 ///\r
421 /// Length of low Memory block.\r
422 ///\r
423 UINT32 LowPmmMemorySizeInBytes;\r
424} EFI_TO_COMPATIBILITY16_INIT_TABLE;\r
425\r
426///\r
427/// DEVICE_PRODUCER_SERIAL\r
428///\r
429typedef struct {\r
430 UINT16 Address; ///< I/O address assigned to the serial port\r
431 UINT8 Irq; ///< IRQ assigned to the serial port.\r
432 SERIAL_MODE Mode; ///< Mode of serial port. Values are defined below.\r
433} DEVICE_PRODUCER_SERIAL;\r
434\r
435///\r
436/// DEVICE_PRODUCER_SERIAL's modes\r
437///@{\r
438#define DEVICE_SERIAL_MODE_NORMAL 0x00\r
439#define DEVICE_SERIAL_MODE_IRDA 0x01\r
440#define DEVICE_SERIAL_MODE_ASK_IR 0x02\r
441#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00\r
442#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10\r
443///@)\r
444\r
445///\r
446/// DEVICE_PRODUCER_PARALLEL\r
447///\r
448typedef struct {\r
449 UINT16 Address; ///< I/O address assigned to the parallel port\r
450 UINT8 Irq; ///< IRQ assigned to the parallel port.\r
451 UINT8 Dma; ///< DMA assigned to the parallel port.\r
452 PARALLEL_MODE Mode; ///< Mode of the parallel port. Values are defined below.\r
453} DEVICE_PRODUCER_PARALLEL;\r
454\r
455///\r
456/// DEVICE_PRODUCER_PARALLEL's modes\r
457///@{\r
458#define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00\r
459#define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01\r
460#define DEVICE_PARALLEL_MODE_MODE_EPP 0x02\r
461#define DEVICE_PARALLEL_MODE_MODE_ECP 0x03\r
462///@}\r
463\r
464///\r
465/// DEVICE_PRODUCER_FLOPPY\r
466///\r
467typedef struct {\r
468 UINT16 Address; ///< I/O address assigned to the floppy\r
469 UINT8 Irq; ///< IRQ assigned to the floppy.\r
470 UINT8 Dma; ///< DMA assigned to the floppy.\r
471 UINT8 NumberOfFloppy; ///< Number of floppies in the system.\r
472} DEVICE_PRODUCER_FLOPPY;\r
473\r
474///\r
475/// LEGACY_DEVICE_FLAGS\r
476///\r
477typedef struct {\r
478 UINT32 A20Kybd : 1; ///< A20 controller by keyboard controller.\r
479 UINT32 A20Port90 : 1; ///< A20 controlled by port 0x92.\r
480 UINT32 Reserved : 30; ///< Reserved for future usage.\r
481} LEGACY_DEVICE_FLAGS;\r
482\r
483///\r
484/// DEVICE_PRODUCER_DATA_HEADER\r
485///\r
486typedef struct {\r
487 DEVICE_PRODUCER_SERIAL Serial[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below.\r
488 DEVICE_PRODUCER_PARALLEL Parallel[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below.\r
489 DEVICE_PRODUCER_FLOPPY Floppy; ///< Data for floppy. Type DEVICE_PRODUCER_FLOPPY is defined below.\r
490 UINT8 MousePresent; ///< Flag to indicate if mouse is present.\r
491 LEGACY_DEVICE_FLAGS Flags; ///< Miscellaneous Boolean state information passed to CSM.\r
492} DEVICE_PRODUCER_DATA_HEADER;\r
493\r
494///\r
495/// ATAPI_IDENTIFY\r
496///\r
497typedef struct {\r
498 UINT16 Raw[256]; ///< Raw data from the IDE IdentifyDrive command.\r
499} ATAPI_IDENTIFY;\r
500\r
501///\r
502/// HDD_INFO\r
503///\r
504typedef struct {\r
505 ///\r
506 /// Status of IDE device. Values are defined below. There is one HDD_INFO structure\r
507 /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index\r
508 /// 1 is slave.\r
509 ///\r
510 UINT16 Status; \r
511 \r
512 ///\r
513 /// PCI bus of IDE controller.\r
514 ///\r
515 UINT32 Bus;\r
516 \r
517 ///\r
518 /// PCI device of IDE controller.\r
519 ///\r
520 UINT32 Device;\r
521 \r
522 ///\r
523 /// PCI function of IDE controller.\r
524 ///\r
525 UINT32 Function;\r
526 \r
527 ///\r
528 /// Command ports base address.\r
529 ///\r
530 UINT16 CommandBaseAddress;\r
531 \r
532 ///\r
533 /// Control ports base address.\r
534 ///\r
535 UINT16 ControlBaseAddress;\r
536 \r
537 ///\r
538 /// Bus master address\r
539 ///\r
540 UINT16 BusMasterAddress;\r
541 \r
542 UINT8 HddIrq;\r
543 \r
544 ///\r
545 /// Data that identifies the drive data, one per possible attached drive\r
546 ///\r
547 ATAPI_IDENTIFY IdentifyDrive[2];\r
548} HDD_INFO;\r
549\r
550///\r
551/// HDD_INFO status bits\r
552///\r
553#define HDD_PRIMARY 0x01\r
554#define HDD_SECONDARY 0x02\r
555#define HDD_MASTER_ATAPI_CDROM 0x04\r
556#define HDD_SLAVE_ATAPI_CDROM 0x08\r
557#define HDD_MASTER_IDE 0x20\r
558#define HDD_SLAVE_IDE 0x40\r
559#define HDD_MASTER_ATAPI_ZIPDISK 0x10\r
560#define HDD_SLAVE_ATAPI_ZIPDISK 0x80\r
561\r
562///\r
563/// BBS_STATUS_FLAGS\r
564///\r
565typedef struct {\r
566 UINT16 OldPosition : 4; ///< Prior priority.\r
567 UINT16 Reserved1 : 4; ///< Reserved for future use.\r
568 UINT16 Enabled : 1; ///< If 0, ignore this entry.\r
569 UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred.\r
570 ///< 1 = Boot attempted failed.\r
571 \r
572 ///\r
573 /// State of media present.\r
574 /// 00 = No bootable media is present in the device.\r
575 /// 01 = Unknown if a bootable media present.\r
576 /// 10 = Media is present and appears bootable.\r
577 /// 11 = Reserved.\r
578 ///\r
579 UINT16 MediaPresent : 2;\r
580 UINT16 Reserved2 : 4; ///< Reserved for future use.\r
581} BBS_STATUS_FLAGS;\r
582\r
583///\r
584/// BBS_TABLE, device type values & boot priority values\r
585///\r
586typedef struct {\r
587 ///\r
588 /// The boot priority for this boot device. Values are defined below.\r
589 ///\r
590 UINT16 BootPriority;\r
591 \r
592 ///\r
593 /// The PCI bus for this boot device.\r
594 ///\r
595 UINT32 Bus;\r
596 \r
597 ///\r
598 /// The PCI device for this boot device.\r
599 ///\r
600 UINT32 Device;\r
601 \r
602 ///\r
603 /// The PCI function for the boot device.\r
604 ///\r
605 UINT32 Function;\r
606 \r
607 ///\r
608 /// The PCI class for this boot device.\r
609 ///\r
610 UINT8 Class;\r
611 \r
612 ///\r
613 /// The PCI Subclass for this boot device.\r
614 ///\r
615 UINT8 SubClass;\r
616 \r
617 ///\r
618 /// Segment:offset address of an ASCIIZ description string describing the manufacturer.\r
619 ///\r
620 UINT16 MfgStringOffset;\r
621 \r
622 ///\r
623 /// Segment:offset address of an ASCIIZ description string describing the manufacturer.\r
624 /// \r
625 UINT16 MfgStringSegment;\r
626 \r
627 ///\r
628 /// BBS device type. BBS device types are defined below.\r
629 ///\r
630 UINT16 DeviceType;\r
631 \r
632 ///\r
633 /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.\r
634 ///\r
635 BBS_STATUS_FLAGS StatusFlags;\r
636 \r
637 ///\r
638 /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for\r
639 /// BCV devices.\r
640 ///\r
641 UINT16 BootHandlerOffset;\r
642 \r
643 ///\r
644 /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for\r
645 /// BCV devices.\r
646 /// \r
647 UINT16 BootHandlerSegment;\r
648 \r
649 ///\r
650 /// Segment:offset address of an ASCIIZ description string describing this device.\r
651 ///\r
652 UINT16 DescStringOffset;\r
653\r
654 ///\r
655 /// Segment:offset address of an ASCIIZ description string describing this device.\r
656 ///\r
657 UINT16 DescStringSegment;\r
658 \r
659 ///\r
660 /// Reserved.\r
661 ///\r
662 UINT32 InitPerReserved;\r
663 \r
664 ///\r
665 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r
666 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r
667 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r
668 ///\r
669 UINT32 AdditionalIrq13Handler;\r
670 \r
671 ///\r
672 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r
673 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r
674 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r
675 /// \r
676 UINT32 AdditionalIrq18Handler;\r
677 \r
678 ///\r
679 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r
680 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r
681 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r
682 /// \r
683 UINT32 AdditionalIrq19Handler;\r
684 \r
685 ///\r
686 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM\r
687 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI\r
688 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup\r
689 /// \r
690 UINT32 AdditionalIrq40Handler;\r
691 UINT8 AssignedDriveNumber;\r
692 UINT32 AdditionalIrq41Handler;\r
693 UINT32 AdditionalIrq46Handler;\r
694 UINT32 IBV1;\r
695 UINT32 IBV2;\r
696} BBS_TABLE;\r
697\r
698///\r
699/// BBS device type values\r
700///@{\r
701#define BBS_FLOPPY 0x01\r
702#define BBS_HARDDISK 0x02\r
703#define BBS_CDROM 0x03\r
704#define BBS_PCMCIA 0x04\r
705#define BBS_USB 0x05\r
706#define BBS_EMBED_NETWORK 0x06\r
707#define BBS_BEV_DEVICE 0x80\r
708#define BBS_UNKNOWN 0xff\r
709///@}\r
710\r
711///\r
712/// BBS boot priority values\r
713///@{\r
714#define BBS_DO_NOT_BOOT_FROM 0xFFFC\r
715#define BBS_LOWEST_PRIORITY 0xFFFD\r
716#define BBS_UNPRIORITIZED_ENTRY 0xFFFE\r
717#define BBS_IGNORE_ENTRY 0xFFFF\r
718///@}\r
719\r
720///\r
721/// SMM_ATTRIBUTES\r
722///\r
723typedef struct {\r
724 ///\r
725 /// Access mechanism used to generate the soft SMI. Defined types are below. The other\r
726 /// values are reserved for future usage.\r
727 ///\r
728 UINT16 Type : 3;\r
729 \r
730 ///\r
731 /// Size of "port" in bits. Defined values are below.\r
732 ///\r
733 UINT16 PortGranularity : 3;\r
734 \r
735 ///\r
736 /// Size of data in bits. Defined values are below.\r
737 ///\r
738 UINT16 DataGranularity : 3;\r
739 \r
740 ///\r
741 /// Reserved for future use.\r
742 ///\r
743 UINT16 Reserved : 7;\r
744} SMM_ATTRIBUTES;\r
745\r
746///\r
747/// SMM_ATTRIBUTES type values\r
748///@{\r
749#define STANDARD_IO 0x00\r
750#define STANDARD_MEMORY 0x01\r
751///@}\r
752\r
753///\r
754/// SMM_ATTRIBUTES port size constants\r
755///@{\r
756#define PORT_SIZE_8 0x00\r
757#define PORT_SIZE_16 0x01\r
758#define PORT_SIZE_32 0x02\r
759#define PORT_SIZE_64 0x03\r
760///@}\r
761\r
762///\r
763/// SMM_ATTRIBUTES data size constants\r
764///@{\r
765#define DATA_SIZE_8 0x00\r
766#define DATA_SIZE_16 0x01\r
767#define DATA_SIZE_32 0x02\r
768#define DATA_SIZE_64 0x03\r
769///@}\r
770\r
771///\r
772/// SMM_FUNCTION & relating constants\r
773///\r
774typedef struct {\r
775 UINT16 Function : 15;\r
776 UINT16 Owner : 1;\r
777} SMM_FUNCTION;\r
778\r
779///\r
780/// SMM_FUNCTION Function constants\r
781///@{\r
782#define INT15_D042 0x0000\r
783#define GET_USB_BOOT_INFO 0x0001\r
784#define DMI_PNP_50_57 0x0002\r
785///@}\r
786\r
787///\r
788/// SMM_FUNCTION Owner constants\r
789///@{\r
790#define STANDARD_OWNER 0x0\r
791#define OEM_OWNER 0x1\r
792///@}\r
793\r
050b79eb 794///\r
795/// This structure assumes both port and data sizes are 1. SmmAttribute must be\r
796/// properly to reflect that assumption.\r
797///\r
87d63447 798typedef struct {\r
799 ///\r
800 /// Describes the access mechanism, SmmPort, and SmmData sizes. Type\r
801 /// SMM_ATTRIBUTES is defined below.\r
802 ///\r
803 SMM_ATTRIBUTES SmmAttributes;\r
804 \r
805 ///\r
806 /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.\r
807 ///\r
808 SMM_FUNCTION SmmFunction;\r
809 \r
810 ///\r
811 /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes\r
812 ///\r
813 UINT8 SmmPort;\r
814 \r
815 ///\r
816 /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes\r
817 ///\r
818 UINT8 SmmData;\r
819} SMM_ENTRY;\r
820\r
821///\r
822/// SMM_TABLE\r
823///\r
824typedef struct {\r
825 UINT16 NumSmmEntries; ///< Number of entries represented by SmmEntry.\r
826 SMM_ENTRY SmmEntry; ///< One entry per function. Type SMM_ENTRY is defined below.\r
827} SMM_TABLE;\r
828\r
829///\r
830/// UDC_ATTRIBUTES\r
831///\r
832typedef struct {\r
833 ///\r
834 /// This bit set indicates that the ServiceAreaData is valid.\r
835 ///\r
836 UINT8 DirectoryServiceValidity : 1;\r
837 \r
838 ///\r
839 /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if\r
840 /// DirectoryServiceValidity is 0.\r
841 ///\r
842 UINT8 RabcaUsedFlag : 1;\r
843 \r
844 ///\r
845 /// This bit set indicates to execute hard disk diagnostics.\r
846 ///\r
847 UINT8 ExecuteHddDiagnosticsFlag : 1;\r
848 \r
849 ///\r
850 /// Reserved for future use. Set to 0.\r
851 ///\r
852 UINT8 Reserved : 5;\r
853} UDC_ATTRIBUTES;\r
854\r
855///\r
856/// UD_TABLE\r
857///\r
858typedef struct {\r
859 ///\r
860 /// This field contains the bit-mapped attributes of the PARTIES information. Type\r
861 /// UDC_ATTRIBUTES is defined below.\r
862 ///\r
863 UDC_ATTRIBUTES Attributes;\r
864 \r
865 ///\r
866 /// This field contains the zero-based device on which the selected\r
867 /// ServiceDataArea is present. It is 0 for master and 1 for the slave device. \r
868 ///\r
869 UINT8 DeviceNumber;\r
870 \r
871 ///\r
872 /// This field contains the zero-based index into the BbsTable for the parent device.\r
873 /// This index allows the user to reference the parent device information such as PCI\r
874 /// bus, device function.\r
875 ///\r
876 UINT8 BbsTableEntryNumberForParentDevice;\r
877 \r
878 ///\r
879 /// This field contains the zero-based index into the BbsTable for the boot entry.\r
880 ///\r
881 UINT8 BbsTableEntryNumberForBoot;\r
882 \r
883 ///\r
884 /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.\r
885 ///\r
886 UINT8 BbsTableEntryNumberForHddDiag;\r
887 \r
888 ///\r
889 /// The raw Beer data.\r
890 ///\r
891 UINT8 BeerData[128];\r
892 \r
893 ///\r
894 /// The raw data of selected service area.\r
895 ///\r
896 UINT8 ServiceAreaData[64];\r
897} UD_TABLE;\r
898\r
899#define EFI_TO_LEGACY_MAJOR_VERSION 0x02\r
900#define EFI_TO_LEGACY_MINOR_VERSION 0x00\r
901#define MAX_IDE_CONTROLLER 8\r
902\r
903///\r
904/// EFI_TO_COMPATIBILITY16_BOOT_TABLE\r
905///\r
906typedef struct {\r
907 UINT16 MajorVersion; ///< The EfiCompatibility major version number.\r
908 UINT16 MinorVersion; ///< The EfiCompatibility minor version number.\r
909 UINT32 AcpiTable; ///< Location of the RSDT ACPI table. < 4G range\r
910 UINT32 SmbiosTable; ///< Location of the SMBIOS table in EFI memory. < 4G range\r
911 UINT32 SmbiosTableLength;\r
912 //\r
913 // Legacy SIO state\r
914 //\r
915 DEVICE_PRODUCER_DATA_HEADER SioData; ///< Standard traditional device information.\r
916 UINT16 DevicePathType; ///< The default boot type.\r
917 UINT16 PciIrqMask; ///< Mask of which IRQs have been assigned to PCI.\r
918 UINT32 NumberE820Entries; ///< Number of E820 entries. The number can change from the\r
919 ///< Compatibility16InitializeYourself() function.\r
920 //\r
921 // Controller & Drive Identify[2] per controller information\r
922 //\r
923 HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data.\r
924 UINT32 NumberBbsEntries; ///< Number of entries in the BBS table\r
925 UINT32 BbsTable; ///< Pointer to the BBS table. Type BBS_TABLE is defined below.\r
926 UINT32 SmmTable; ///< Pointer to the SMM table. Type SMM_TABLE is defined below.\r
927 UINT32 OsMemoryAbove1Mb; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can\r
928 ///< differ from the value in EFI_TO_COMPATIBILITY16_INIT_TABLE as more\r
929 ///< memory may have been discovered.\r
930 UINT32 UnconventionalDeviceTable; ///< Information to boot off an unconventional device like a PARTIES partition. Type\r
931 ///< UD_TABLE is defined below.\r
932} EFI_TO_COMPATIBILITY16_BOOT_TABLE;\r
933\r
934///\r
935/// EFI_LEGACY_INSTALL_PCI_HANDLER\r
936///\r
937typedef struct {\r
938 UINT8 PciBus; ///< The PCI bus of the device.\r
939 UINT8 PciDeviceFun; ///< The PCI device in bits 7:3 and function in bits 2:0.\r
940 UINT8 PciSegment; ///< The PCI segment of the device.\r
941 UINT8 PciClass; ///< The PCI class code of the device.\r
942 UINT8 PciSubclass; ///< The PCI subclass code of the device.\r
943 UINT8 PciInterface; ///< The PCI interface code of the device.\r
944 //\r
945 // Primary section\r
946 //\r
947 UINT8 PrimaryIrq; ///< The primary device IRQ.\r
948 UINT8 PrimaryReserved; ///< Reserved.\r
949 UINT16 PrimaryControl; ///< The primary device control I/O base.\r
950 UINT16 PrimaryBase; ///< The primary device I/O base.\r
951 UINT16 PrimaryBusMaster; ///< The primary device bus master I/O base.\r
952 //\r
953 // Secondary Section\r
954 //\r
955 UINT8 SecondaryIrq; ///< The secondary device IRQ.\r
956 UINT8 SecondaryReserved; ///< Reserved.\r
957 UINT16 SecondaryControl; ///< The secondary device control I/O base.\r
958 UINT16 SecondaryBase; ///< The secondary device I/O base.\r
959 UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base.\r
960} EFI_LEGACY_INSTALL_PCI_HANDLER;\r
961\r
962//\r
963// Restore default pack value\r
964//\r
965#pragma pack()\r
b80fbe85 966\r
79964ac8 967#define EFI_LEGACY_BIOS_PROTOCOL_GUID \\r
968 { \\r
969 0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d } \\r
970 }\r
971\r
972typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL;\r
973\r
050b79eb 974///\r
975/// Flags returned by CheckPciRom()\r
976///\r
9226e4ee 977#define NO_ROM 0x00\r
978#define ROM_FOUND 0x01\r
979#define VALID_LEGACY_ROM 0x02\r
a543bca5 980#define ROM_WITH_CONFIG 0x04 ///< Not defined in the Framework CSM Specification\r
9226e4ee 981\r
050b79eb 982///\r
983/// The following macros do not appear in the Framework CSM Specification and \r
984/// are kept for backward compatibility only. They convert 32-bit address (_Adr) \r
985/// to Segment:Offset 16-bit form.\r
986///\r
987/// @{\r
79964ac8 988#define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)\r
989#define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)\r
050b79eb 990/// @}\r
79964ac8 991\r
992#define CARRY_FLAG 0x01\r
993\r
050b79eb 994///\r
995/// EFI_EFLAGS_REG\r
996///\r
79964ac8 997typedef struct {\r
998 UINT32 CF:1;\r
999 UINT32 Reserved1:1;\r
1000 UINT32 PF:1;\r
1001 UINT32 Reserved2:1;\r
1002 UINT32 AF:1;\r
1003 UINT32 Reserved3:1;\r
1004 UINT32 ZF:1;\r
1005 UINT32 SF:1;\r
1006 UINT32 TF:1;\r
1007 UINT32 IF:1;\r
1008 UINT32 DF:1;\r
1009 UINT32 OF:1;\r
1010 UINT32 IOPL:2;\r
1011 UINT32 NT:1;\r
1012 UINT32 Reserved4:2;\r
1013 UINT32 VM:1;\r
1014 UINT32 Reserved5:14;\r
1015} EFI_EFLAGS_REG;\r
1016\r
050b79eb 1017///\r
1018/// EFI_DWORD_REGS\r
1019///\r
79964ac8 1020typedef struct {\r
1021 UINT32 EAX;\r
1022 UINT32 EBX;\r
1023 UINT32 ECX;\r
1024 UINT32 EDX;\r
1025 UINT32 ESI;\r
1026 UINT32 EDI;\r
1027 EFI_EFLAGS_REG EFlags;\r
1028 UINT16 ES;\r
1029 UINT16 CS;\r
1030 UINT16 SS;\r
1031 UINT16 DS;\r
1032 UINT16 FS;\r
1033 UINT16 GS;\r
1034 UINT32 EBP;\r
1035 UINT32 ESP;\r
1036} EFI_DWORD_REGS;\r
1037\r
050b79eb 1038///\r
1039/// EFI_FLAGS_REG\r
1040///\r
79964ac8 1041typedef struct {\r
1042 UINT16 CF:1;\r
1043 UINT16 Reserved1:1;\r
1044 UINT16 PF:1;\r
1045 UINT16 Reserved2:1;\r
1046 UINT16 AF:1;\r
1047 UINT16 Reserved3:1;\r
1048 UINT16 ZF:1;\r
1049 UINT16 SF:1;\r
1050 UINT16 TF:1;\r
1051 UINT16 IF:1;\r
1052 UINT16 DF:1;\r
1053 UINT16 OF:1;\r
1054 UINT16 IOPL:2;\r
1055 UINT16 NT:1;\r
1056 UINT16 Reserved4:1;\r
1057} EFI_FLAGS_REG;\r
1058\r
050b79eb 1059///\r
1060/// EFI_WORD_REGS\r
1061///\r
79964ac8 1062typedef struct {\r
1063 UINT16 AX;\r
1064 UINT16 ReservedAX;\r
1065 UINT16 BX;\r
1066 UINT16 ReservedBX;\r
1067 UINT16 CX;\r
1068 UINT16 ReservedCX;\r
1069 UINT16 DX;\r
1070 UINT16 ReservedDX;\r
1071 UINT16 SI;\r
1072 UINT16 ReservedSI;\r
1073 UINT16 DI;\r
1074 UINT16 ReservedDI;\r
1075 EFI_FLAGS_REG Flags;\r
1076 UINT16 ReservedFlags;\r
1077 UINT16 ES;\r
1078 UINT16 CS;\r
1079 UINT16 SS;\r
1080 UINT16 DS;\r
1081 UINT16 FS;\r
1082 UINT16 GS;\r
1083 UINT16 BP;\r
1084 UINT16 ReservedBP;\r
1085 UINT16 SP;\r
1086 UINT16 ReservedSP;\r
1087} EFI_WORD_REGS;\r
1088\r
050b79eb 1089///\r
1090/// EFI_BYTE_REGS\r
1091///\r
79964ac8 1092typedef struct {\r
1093 UINT8 AL, AH;\r
1094 UINT16 ReservedAX;\r
1095 UINT8 BL, BH;\r
1096 UINT16 ReservedBX;\r
1097 UINT8 CL, CH;\r
1098 UINT16 ReservedCX;\r
1099 UINT8 DL, DH;\r
1100 UINT16 ReservedDX;\r
1101} EFI_BYTE_REGS;\r
1102\r
050b79eb 1103///\r
1104/// EFI_IA32_REGISTER_SET\r
1105///\r
79964ac8 1106typedef union {\r
1107 EFI_DWORD_REGS E;\r
1108 EFI_WORD_REGS X;\r
1109 EFI_BYTE_REGS H;\r
1110} EFI_IA32_REGISTER_SET;\r
1111\r
1112/**\r
1113 Thunk to 16-bit real mode and execute a software interrupt with a vector\r
1114 of BiosInt. Regs will contain the 16-bit register context on entry and\r
1115 exit.\r
1116\r
050b79eb 1117 @param[in] This Protocol instance pointer.\r
1118 @param[in] BiosInt Processor interrupt vector to invoke\r
1119 @param[in,out] Reg Register contexted passed into (and returned) from thunk to\r
1120 16-bit mode\r
79964ac8 1121\r
5259c97d 1122 @retval TRUE Thunk completed with no BIOS errors in the target code. See Regs for status. \r
1123 @retval FALSE There was a BIOS error in the target code.\r
79964ac8 1124**/\r
1125typedef\r
1126BOOLEAN\r
69686d56 1127(EFIAPI *EFI_LEGACY_BIOS_INT86)(\r
050b79eb 1128 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1129 IN UINT8 BiosInt,\r
1130 IN OUT EFI_IA32_REGISTER_SET *Regs\r
79964ac8 1131 );\r
1132\r
1133/**\r
1134 Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the\r
1135 16-bit register context on entry and exit. Arguments can be passed on\r
1136 the Stack argument\r
1137\r
050b79eb 1138 @param[in] This Protocol instance pointer.\r
1139 @param[in] Segment Segemnt of 16-bit mode call\r
1140 @param[in] Offset Offset of 16-bit mdoe call\r
1141 @param[in] Reg Register contexted passed into (and returned) from thunk to\r
1142 16-bit mode\r
1143 @param[in] Stack Caller allocated stack used to pass arguments\r
1144 @param[in] StackSize Size of Stack in bytes\r
79964ac8 1145\r
5259c97d 1146 @retval FALSE Thunk completed with no BIOS errors in the target code. See Regs for status. @retval TRUE There was a BIOS error in the target code.\r
79964ac8 1147**/\r
1148typedef\r
1149BOOLEAN\r
69686d56 1150(EFIAPI *EFI_LEGACY_BIOS_FARCALL86)(\r
050b79eb 1151 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1152 IN UINT16 Segment,\r
1153 IN UINT16 Offset,\r
1154 IN EFI_IA32_REGISTER_SET *Regs,\r
1155 IN VOID *Stack,\r
1156 IN UINTN StackSize\r
79964ac8 1157 );\r
1158\r
1159/**\r
1160 Test to see if a legacy PCI ROM exists for this device. Optionally return\r
1161 the Legacy ROM instance for this PCI device.\r
1162\r
050b79eb 1163 @param[in] This Protocol instance pointer.\r
1164 @param[in] PciHandle The PCI PC-AT OPROM from this devices ROM BAR will be loaded\r
1165 @param[out] RomImage Return the legacy PCI ROM for this device\r
1166 @param[out] RomSize Size of ROM Image\r
1167 @param[out] Flags Indicates if ROM found and if PC-AT. Multiple bits can be set as follows:\r
1168 - 00 = No ROM\r
1169 - 01 = ROM Found\r
1170 - 02 = ROM is a valid legacy ROM\r
79964ac8 1171\r
050b79eb 1172 @retval EFI_SUCCESS Legacy Option ROM availible for this device\r
1173 @retval EFI_UNSUPPORTED Legacy Option ROM not supported.\r
79964ac8 1174\r
1175**/\r
1176typedef\r
1177EFI_STATUS\r
69686d56 1178(EFIAPI *EFI_LEGACY_BIOS_CHECK_ROM)(\r
050b79eb 1179 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1180 IN EFI_HANDLE PciHandle,\r
1181 OUT VOID **RomImage, OPTIONAL\r
1182 OUT UINTN *RomSize, OPTIONAL\r
1183 OUT UINTN *Flags\r
79964ac8 1184 );\r
1185\r
1186/**\r
1187 Load a legacy PC-AT OPROM on the PciHandle device. Return information\r
1188 about how many disks were added by the OPROM and the shadow address and\r
1189 size. DiskStart & DiskEnd are INT 13h drive letters. Thus 0x80 is C:\r
1190\r
050b79eb 1191 @param[in] This Protocol instance pointer.\r
1192 @param[in] PciHandle The PCI PC-AT OPROM from this devices ROM BAR will be loaded.\r
1193 This value is NULL if RomImage is non-NULL. This is the normal\r
1194 case.\r
1195 @param[in] RomImage A PCI PC-AT ROM image. This argument is non-NULL if there is\r
1196 no hardware associated with the ROM and thus no PciHandle,\r
1197 otherwise is must be NULL.\r
1198 Example is PXE base code.\r
1199 @param[out] Flags The type of ROM discovered. Multiple bits can be set, as follows:\r
1200 - 00 = No ROM.\r
1201 - 01 = ROM found.\r
1202 - 02 = ROM is a valid legacy ROM.\r
1203 @param[out] DiskStart Disk number of first device hooked by the ROM. If DiskStart\r
1204 is the same as DiskEnd no disked were hooked.\r
1205 @param[out] DiskEnd disk number of the last device hooked by the ROM.\r
1206 @param[out] RomShadowAddress Shadow address of PC-AT ROM\r
1207 @param[out] RomShadowSize Size of RomShadowAddress in bytes\r
1208\r
1209 @retval EFI_SUCCESS Thunk completed, see Regs for status.\r
1210 @retval EFI_INVALID_PARAMETER PciHandle not found\r
79964ac8 1211\r
1212**/\r
1213typedef\r
1214EFI_STATUS\r
69686d56 1215(EFIAPI *EFI_LEGACY_BIOS_INSTALL_ROM)(\r
050b79eb 1216 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1217 IN EFI_HANDLE PciHandle,\r
1218 IN VOID **RomImage,\r
1219 OUT UINTN *Flags,\r
1220 OUT UINT8 *DiskStart, OPTIONAL\r
1221 OUT UINT8 *DiskEnd, OPTIONAL\r
1222 OUT VOID **RomShadowAddress, OPTIONAL\r
1223 OUT UINT32 *ShadowedRomSize OPTIONAL\r
79964ac8 1224 );\r
1225\r
1226/**\r
ef1ac015 1227 This function attempts to traditionally boot the specified BootOption. If the EFI context has\r
5259c97d 1228 been compromised, this function will not return. This procedure is not used for loading an EFI-aware\r
ef1ac015 1229 OS off a traditional device. The following actions occur:\r
1230 - Get EFI SMBIOS data structures, convert them to a traditional format, and copy to\r
1231 Compatibility16.\r
1232 - Get a pointer to ACPI data structures and copy the Compatibility16 RSD PTR to F0000 block.\r
1233 - Find the traditional SMI handler from a firmware volume and register the traditional SMI\r
1234 handler with the EFI SMI handler.\r
1235 - Build onboard IDE information and pass this information to the Compatibility16 code.\r
1236 - Make sure all PCI Interrupt Line registers are programmed to match 8259.\r
1237 - Reconfigure SIO devices from EFI mode (polled) into traditional mode (interrupt driven).\r
1238 - Shadow all PCI ROMs.\r
1239 - Set up BDA and EBDA standard areas before the legacy boot.\r
1240 - Construct the Compatibility16 boot memory map and pass it to the Compatibility16 code.\r
1241 - Invoke the Compatibility16 table function Compatibility16PrepareToBoot(). This\r
1242 invocation causes a thunk into the Compatibility16 code, which sets all appropriate internal\r
1243 data structures. The boot device list is a parameter.\r
1244 - Invoke the Compatibility16 Table function Compatibility16Boot(). This invocation\r
1245 causes a thunk into the Compatibility16 code, which does an INT19.\r
1246 - If the Compatibility16Boot() function returns, then the boot failed in a graceful\r
5259c97d 1247 manner--meaning that the EFI code is still valid. An ungraceful boot failure causes a reset because the state\r
ef1ac015 1248 of EFI code is unknown.\r
79964ac8 1249\r
050b79eb 1250 @param[in] This Protocol instance pointer.\r
1251 @param[in] BootOption EFI Device Path from BootXXXX variable.\r
1252 @param[in] LoadOptionSize Size of LoadOption in size.\r
1253 @param[in] LoadOption LoadOption from BootXXXX variable\r
79964ac8 1254\r
5259c97d 1255 @retval EFI_DEVICE_ERROR Failed to boot from any boot device and memory is uncorrupted. Note: This function normally does not returns. It will either boot the OS or reset the system if memory has been "corrupted" by loading a boot sector and passing control to it.\r
79964ac8 1256**/\r
1257typedef\r
1258EFI_STATUS\r
69686d56 1259(EFIAPI *EFI_LEGACY_BIOS_BOOT)(\r
050b79eb 1260 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1261 IN BBS_BBS_DEVICE_PATH *BootOption,\r
1262 IN UINT32 LoadOptionsSize,\r
1263 IN VOID *LoadOptions\r
79964ac8 1264 );\r
1265\r
1266/**\r
ef1ac015 1267 This function takes the Leds input parameter and sets/resets the BDA accordingly. \r
1268 Leds is also passed to Compatibility16 code, in case any special processing is required. \r
5259c97d 1269 This function is normally called from EFI Setup drivers that handle user-selectable\r
ef1ac015 1270 keyboard options such as boot with NUM LOCK on/off. This function does not\r
1271 touch the keyboard or keyboard LEDs but only the BDA.\r
79964ac8 1272\r
050b79eb 1273 @param[in] This Protocol instance pointer.\r
1274 @param[in] Leds Status of current Scroll, Num & Cap lock LEDS\r
1275 - Bit 0 is Scroll Lock 0 = Not locked\r
1276 - Bit 1 is Num Lock\r
1277 - Bit 2 is Caps Lock\r
79964ac8 1278\r
050b79eb 1279 @retval EFI_SUCCESS The BDA was updated successfully.\r
79964ac8 1280\r
1281**/\r
1282typedef\r
1283EFI_STATUS\r
69686d56 1284(EFIAPI *EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS)(\r
050b79eb 1285 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1286 IN UINT8 Leds\r
79964ac8 1287 );\r
1288\r
1289/**\r
1290 Retrieve legacy BBS info and assign boot priority.\r
1291\r
050b79eb 1292 @param[in] This Protocol instance pointer.\r
1293 @param[out] HddCount Number of HDD_INFO structures\r
1294 @param[out] HddInfo Onboard IDE controller information\r
1295 @param[out] BbsCount Number of BBS_TABLE structures\r
1296 @param[in,out] BbsTable Point to List of BBS_TABLE\r
79964ac8 1297\r
050b79eb 1298 @retval EFI_SUCCESS Tables returned\r
79964ac8 1299\r
1300**/\r
1301typedef\r
1302EFI_STATUS\r
69686d56 1303(EFIAPI *EFI_LEGACY_BIOS_GET_BBS_INFO)(\r
050b79eb 1304 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1305 OUT UINT16 *HddCount,\r
1306 OUT HDD_INFO **HddInfo,\r
1307 OUT UINT16 *BbsCount,\r
1308 IN OUT BBS_TABLE **BbsTable\r
79964ac8 1309 );\r
1310\r
1311/**\r
1312 Assign drive number to legacy HDD drives prior to booting an EFI\r
1313 aware OS so the OS can access drives without an EFI driver.\r
1314\r
050b79eb 1315 @param[in] This Protocol instance pointer.\r
1316 @param[out] BbsCount Number of BBS_TABLE structures\r
1317 @param[out] BbsTable List BBS entries\r
79964ac8 1318\r
050b79eb 1319 @retval EFI_SUCCESS Drive numbers assigned\r
79964ac8 1320\r
1321**/\r
1322typedef\r
1323EFI_STATUS\r
69686d56 1324(EFIAPI *EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI)(\r
050b79eb 1325 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1326 OUT UINT16 *BbsCount,\r
1327 OUT BBS_TABLE **BbsTable\r
79964ac8 1328 );\r
1329\r
1330/**\r
1331 To boot from an unconventional device like parties and/or execute\r
1332 HDD diagnostics.\r
1333\r
050b79eb 1334 @param[in] This Protocol instance pointer.\r
1335 @param[in] Attributes How to interpret the other input parameters\r
1336 @param[in] BbsEntry The 0-based index into the BbsTable for the parent\r
79964ac8 1337 device.\r
050b79eb 1338 @param[in] BeerData Pointer to the 128 bytes of ram BEER data.\r
1339 @param[in] ServiceAreaData Pointer to the 64 bytes of raw Service Area data. The\r
79964ac8 1340 caller must provide a pointer to the specific Service\r
1341 Area and not the start all Service Areas.\r
1342\r
050b79eb 1343 @retval EFI_INVALID_PARAMETER If error. Does NOT return if no error.\r
79964ac8 1344\r
1345**/\r
1346typedef\r
1347EFI_STATUS\r
69686d56 1348(EFIAPI *EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE)(\r
050b79eb 1349 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1350 IN UDC_ATTRIBUTES Attributes,\r
1351 IN UINTN BbsEntry,\r
1352 IN VOID *BeerData,\r
1353 IN VOID *ServiceAreaData\r
79964ac8 1354 );\r
1355\r
1356/**\r
1357 Shadow all legacy16 OPROMs that haven't been shadowed.\r
1358 Warning: Use this with caution. This routine disconnects all EFI\r
1359 drivers. If used externally then caller must re-connect EFI\r
1360 drivers.\r
050b79eb 1361 \r
1362 @param[in] This Protocol instance pointer.\r
1363 \r
1364 @retval EFI_SUCCESS OPROMs shadowed\r
79964ac8 1365\r
1366**/\r
1367typedef\r
1368EFI_STATUS\r
69686d56 1369(EFIAPI *EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS)(\r
050b79eb 1370 IN EFI_LEGACY_BIOS_PROTOCOL *This\r
79964ac8 1371 );\r
1372\r
1373/**\r
1374 Get a region from the LegacyBios for S3 usage.\r
1375\r
050b79eb 1376 @param[in] This Protocol instance pointer.\r
1377 @param[in] LegacyMemorySize Size of required region\r
1378 @param[in] Region Region to use.\r
1379 00 = Either 0xE0000 or 0xF0000 block\r
1380 - Bit0 = 1 0xF0000 block\r
1381 - Bit1 = 1 0xE0000 block\r
1382 @param[in] Alignment Address alignment. Bit mapped. First non-zero\r
1383 bit from right is alignment.\r
1384 @param[out] LegacyMemoryAddress Region Assigned\r
79964ac8 1385\r
1386 @retval EFI_SUCCESS Region assigned\r
ef1ac015 1387 @retval EFI_ACCESS_DENIED The function was previously invoked.\r
79964ac8 1388 @retval Other Region not assigned\r
1389\r
1390**/\r
1391typedef\r
1392EFI_STATUS\r
69686d56 1393(EFIAPI *EFI_LEGACY_BIOS_GET_LEGACY_REGION)(\r
050b79eb 1394 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1395 IN UINTN LegacyMemorySize,\r
1396 IN UINTN Region,\r
1397 IN UINTN Alignment,\r
1398 OUT VOID **LegacyMemoryAddress\r
79964ac8 1399 );\r
1400\r
1401/**\r
1402 Get a region from the LegacyBios for Tiano usage. Can only be invoked once.\r
1403\r
050b79eb 1404 @param[in] This Protocol instance pointer.\r
1405 @param[in] LegacyMemorySize Size of data to copy\r
1406 @param[in] LegacyMemoryAddress Legacy Region destination address\r
1407 Note: must be in region assigned by\r
1408 LegacyBiosGetLegacyRegion\r
1409 @param[in] LegacyMemorySourceAddress Source of the data to copy.\r
79964ac8 1410\r
1411 @retval EFI_SUCCESS Region assigned\r
1412 @retval EFI_ACCESS_DENIED Destination outside assigned region\r
1413\r
1414**/\r
1415typedef\r
1416EFI_STATUS\r
69686d56 1417(EFIAPI *EFI_LEGACY_BIOS_COPY_LEGACY_REGION)(\r
050b79eb 1418 IN EFI_LEGACY_BIOS_PROTOCOL *This,\r
1419 IN UINTN LegacyMemorySize,\r
1420 IN VOID *LegacyMemoryAddress,\r
1421 IN VOID *LegacyMemorySourceAddress\r
79964ac8 1422 );\r
1423\r
050b79eb 1424///\r
1425/// Abstracts the traditional BIOS from the rest of EFI. The LegacyBoot()\r
1426/// member function allows the BDS to support booting a traditional OS.\r
1427/// EFI thunks drivers that make EFI bindings for BIOS INT services use\r
1428/// all the other member functions.\r
1429///\r
79964ac8 1430struct _EFI_LEGACY_BIOS_PROTOCOL {\r
2bbaeb0d 1431 ///\r
1432 /// Performs traditional software INT. See the Int86() function description.\r
1433 ///\r
79964ac8 1434 EFI_LEGACY_BIOS_INT86 Int86;\r
2bbaeb0d 1435 \r
1436 ///\r
1437 /// Performs a far call into Compatibility16 or traditional OpROM code.\r
1438 ///\r
79964ac8 1439 EFI_LEGACY_BIOS_FARCALL86 FarCall86;\r
2bbaeb0d 1440 \r
1441 ///\r
1442 /// Checks if a traditional OpROM exists for this device.\r
1443 ///\r
79964ac8 1444 EFI_LEGACY_BIOS_CHECK_ROM CheckPciRom;\r
2bbaeb0d 1445 \r
1446 ///\r
1447 /// Loads a traditional OpROM in traditional OpROM address space.\r
1448 ///\r
79964ac8 1449 EFI_LEGACY_BIOS_INSTALL_ROM InstallPciRom;\r
2bbaeb0d 1450 \r
1451 ///\r
1452 /// Boots a traditional OS.\r
1453 ///\r
79964ac8 1454 EFI_LEGACY_BIOS_BOOT LegacyBoot;\r
2bbaeb0d 1455 \r
1456 ///\r
1457 /// Updates BDA to reflect the current EFI keyboard LED status.\r
1458 ///\r
79964ac8 1459 EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS UpdateKeyboardLedStatus;\r
2bbaeb0d 1460 \r
1461 ///\r
1462 /// Allows an external agent, such as BIOS Setup, to get the BBS data.\r
1463 ///\r
79964ac8 1464 EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo;\r
2bbaeb0d 1465 \r
1466 ///\r
1467 /// Causes all legacy OpROMs to be shadowed.\r
1468 ///\r
79964ac8 1469 EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS ShadowAllLegacyOproms;\r
2bbaeb0d 1470 \r
1471 ///\r
1472 /// Performs all actions prior to boot. Used when booting an EFI-aware OS\r
1473 /// rather than a legacy OS. \r
1474 ///\r
79964ac8 1475 EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI PrepareToBootEfi;\r
2bbaeb0d 1476 \r
1477 ///\r
1478 /// Allows EFI to reserve an area in the 0xE0000 or 0xF0000 block.\r
1479 ///\r
79964ac8 1480 EFI_LEGACY_BIOS_GET_LEGACY_REGION GetLegacyRegion;\r
2bbaeb0d 1481 \r
1482 ///\r
1483 /// Allows EFI to copy data to the area specified by GetLegacyRegion.\r
1484 ///\r
79964ac8 1485 EFI_LEGACY_BIOS_COPY_LEGACY_REGION CopyLegacyRegion;\r
2bbaeb0d 1486 \r
1487 ///\r
1488 /// Allows the user to boot off an unconventional device such as a PARTIES partition.\r
1489 ///\r
79964ac8 1490 EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE BootUnconventionalDevice;\r
1491};\r
1492\r
1493extern EFI_GUID gEfiLegacyBiosProtocolGuid;\r
1494\r
1495#endif\r