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