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