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.
6 Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow
7 well known naming conventions.
9 Thunk is the code that switches from 32-bit protected environment into the 16-bit real-mode
10 environment. Reverse thunk is the code that does the opposite.
13 Copyright (c) 2007 - 2009, Intel Corporation
14 All rights reserved. This program and the accompanying materials
15 are licensed and made available under the terms and conditions of the BSD License
16 which accompanies this distribution. The full text of the license may be found at
17 http://opensource.org/licenses/bsd-license.php
19 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
20 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 @par Revision Reference:
23 This protocol is defined in Framework for EFI Compatibility Support Module spec
28 #ifndef _EFI_LEGACY_BIOS_H_
29 #define _EFI_LEGACY_BIOS_H_
36 typedef UINT8 SERIAL_MODE
;
37 typedef UINT8 PARALLEL_MODE
;
39 #define EFI_COMPATIBILITY16_TABLE_SIGNATURE SIGNATURE_32 ('I', 'F', 'E', '$')
42 /// There is a table located within the traditional BIOS in either the 0xF000:xxxx or 0xE000:xxxx
43 /// physical address range. It is located on a 16-byte boundary and provides the physical address of the
44 /// entry point for the Compatibility16 functions. These functions provide the platform-specific
45 /// information that is required by the generic EfiCompatibility code. The functions are invoked via
46 /// thunking by using EFI_LEGACY_BIOS_PROTOCOL.FarCall86() with the 32-bit physical
51 /// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 0 is "I," byte
52 /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.
57 /// The value required such that byte checksum of TableLength equals zero.
62 /// The length of this table.
67 /// The major EFI revision for which this table was generated.
69 UINT8 EfiMajorRevision
;
72 /// The minor EFI revision for which this table was generated.
74 UINT8 EfiMinorRevision
;
77 /// The major revision of this table.
79 UINT8 TableMajorRevision
;
82 /// The minor revision of this table.
84 UINT8 TableMinorRevision
;
87 /// Reserved for future usage.
92 /// The segment of the entry point within the traditional BIOS for Compatibility16 functions.
94 UINT16 Compatibility16CallSegment
;
97 /// The offset of the entry point within the traditional BIOS for Compatibility16 functions.
99 UINT16 Compatibility16CallOffset
;
102 /// The segment of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.
104 UINT16 PnPInstallationCheckSegment
;
107 /// The Offset of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check.
109 UINT16 PnPInstallationCheckOffset
;
112 /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform Innovation Framework for EFI
113 /// Driver Execution Environment Core Interface Specification (DXE CIS).
115 UINT32 EfiSystemTable
;
118 /// The address of an OEM-provided identifier string. The string is null terminated.
120 UINT32 OemIdStringPointer
;
123 /// The 32-bit physical address where ACPI RSD PTR is stored within the traditional
124 /// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size
125 /// reserved is the maximum for ACPI 2.0. The EfiCompatibility will fill in the ACPI
126 /// RSD PTR with either the ACPI 1.0b or 2.0 values.
128 UINT32 AcpiRsdPtrPointer
;
131 /// The OEM revision number. Usage is undefined but provided for OEM module usage.
136 /// The 32-bit physical address where INT15 E820 data is stored within the traditional
137 /// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the
138 /// data to the indicated area.
143 /// The length of the E820 data and is filled in by the EfiCompatibility code.
148 /// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.
149 /// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and
150 /// copy the data to the indicated area.
152 UINT32 IrqRoutingTablePointer
;
155 /// The length of the $PIR table and is filled in by the EfiCompatibility code.
157 UINT32 IrqRoutingTableLength
;
160 /// The 32-bit physical address where the MP table is stored in the traditional BIOS.
161 /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data to the indicated area.
166 /// The length of the MP table and is filled in by the EfiCompatibility code.
168 UINT32 MpTableLength
;
171 /// The segment of the OEM-specific INT table/code.
173 UINT16 OemIntSegment
;
176 /// The offset of the OEM-specific INT table/code.
181 /// The segment of the OEM-specific 32-bit table/code.
186 /// The offset of the OEM-specific 32-bit table/code.
191 /// The segment of the OEM-specific 16-bit table/code.
196 /// The offset of the OEM-specific 16-bit table/code.
201 /// The segment of the TPM binary passed to 16-bit CSM.
206 /// The offset of the TPM binary passed to 16-bit CSM.
211 /// A pointer to a string identifying the independent BIOS vendor.
216 /// This field is NULL for all systems not supporting PCI Express. This field is the base
217 /// value of the start of the PCI Express memory-mapped configuration registers and
218 /// must be filled in prior to EfiCompatibility code issuing the Compatibility16 function
219 /// Compatibility16InitializeYourself().
220 /// Compatibility16InitializeYourself() is defined in Compatability16
223 UINT32 PciExpressBase
;
226 /// Maximum PCI bus number assigned.
229 } EFI_COMPATIBILITY16_TABLE
;
232 /// Functions provided by the CSM binary which communicate between the EfiCompatibility
233 /// and Compatability16 code.
235 /// Inconsistent with specification here:
236 /// The member's name started with "Compatibility16" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version]
237 /// has been changed to "Legacy16" since keeping backward compatible.
241 /// Causes the Compatibility16 code to do any internal initialization required.
243 /// AX = Compatibility16InitializeYourself
244 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_INIT_TABLE
246 /// AX = Return Status codes
248 Legacy16InitializeYourself
= 0x0000,
251 /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.
253 /// AX = Compatibility16UpdateBbs
254 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE
256 /// AX = Returned status codes
258 Legacy16UpdateBbs
= 0x0001,
261 /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16
262 /// code is read/write.
264 /// AX = Compatibility16PrepareToBoot
265 /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure
267 /// AX = Returned status codes
269 Legacy16PrepareToBoot
= 0x0002,
272 /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only.
274 /// AX = Compatibility16Boot
276 /// AX = Returned status codes
278 Legacy16Boot
= 0x0003,
281 /// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is
282 /// stored in CMOS and is the priority number of the last attempted boot device.
284 /// AX = Compatibility16RetrieveLastBootDevice
286 /// AX = Returned status codes
287 /// BX = Priority number of the boot device.
289 Legacy16RetrieveLastBootDevice
= 0x0004,
292 /// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM.
294 /// AX = Compatibility16DispatchOprom
295 /// ES:BX = Pointer to EFI_DISPATCH_OPROM_TABLE
297 /// AX = Returned status codes
298 /// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.
300 Legacy16DispatchOprom
= 0x0005,
303 /// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address
306 /// AX = Compatibility16GetTableAddress
307 /// BX = Allocation region
308 /// 00 = Allocate from either 0xE0000 or 0xF0000 64 KB blocks.
309 /// Bit 0 = 1 Allocate from 0xF0000 64 KB block
310 /// Bit 1 = 1 Allocate from 0xE0000 64 KB block
311 /// CX = Requested length in bytes.
312 /// DX = Required address alignment. Bit mapped. First non-zero bit from the right is the alignment.
314 /// AX = Returned status codes
315 /// DS:BX = Address of the region
317 Legacy16GetTableAddress
= 0x0006,
320 /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.
322 /// AX = Compatibility16SetKeyboardLeds
324 /// Bit 0 Scroll Lock 0 = Off
328 /// AX = Returned status codes
330 Legacy16SetKeyboardLeds
= 0x0007,
333 /// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that
334 /// do not have an OpROM associated with them. An example is SATA.
336 /// AX = Compatibility16InstallPciHandler
337 /// ES:BX = Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER structure
339 /// AX = Returned status codes
341 Legacy16InstallPciHandler
= 0x0008
342 } EFI_COMPATIBILITY_FUNCTIONS
;
346 /// EFI_DISPATCH_OPROM_TABLE
349 UINT16 PnPInstallationCheckSegment
; ///< Pointer to the PnpInstallationCheck data structure.
350 UINT16 PnPInstallationCheckOffset
; ///< Pointer to the PnpInstallationCheck data structure.
351 UINT16 OpromSegment
; ///< The segment where the OpROM was placed. Offset is assumed to be 3.
352 UINT8 PciBus
; ///< The PCI bus.
353 UINT8 PciDeviceFunction
; ///< The PCI device * 0x08 | PCI function.
354 UINT8 NumberBbsEntries
; ///< The number of valid BBS table entries upon entry and exit. The IBV code may
355 ///< increase this number, if BBS-compliant devices also hook INTs in order to force the
356 ///< OpROM BIOS Setup to be executed.
357 VOID
*BbsTablePointer
; ///< Pointer to the BBS table.
358 UINT16 RuntimeSegment
; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this
359 ///< means that the relocation of this run time code is not supported.
360 ///< Inconsistent with specification here:
361 ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version]
362 ///< has been changed to "RuntimeSegment" since keeping backward compatible.
364 } EFI_DISPATCH_OPROM_TABLE
;
367 /// EFI_TO_COMPATIBILITY16_INIT_TABLE
371 /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.
373 UINT32 BiosLessThan1MB
;
376 /// Starting address of the high memory block.
381 /// Length of high memory block.
383 UINT32 HiPmmMemorySizeInBytes
;
386 /// The segment of the reverse thunk call code.
388 UINT16 ReverseThunkCallSegment
;
391 /// The offset of the reverse thunk call code.
393 UINT16 ReverseThunkCallOffset
;
396 /// The number of E820 entries copied to the Compatibility16 BIOS.
398 UINT32 NumberE820Entries
;
401 /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.
403 UINT32 OsMemoryAbove1Mb
;
406 /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.
411 /// The size of the thunk code.
413 UINT32 ThunkSizeInBytes
;
416 /// Starting address of memory under 1 MB.
421 /// Length of low Memory block.
423 UINT32 LowPmmMemorySizeInBytes
;
424 } EFI_TO_COMPATIBILITY16_INIT_TABLE
;
427 /// DEVICE_PRODUCER_SERIAL
430 UINT16 Address
; ///< I/O address assigned to the serial port
431 UINT8 Irq
; ///< IRQ assigned to the serial port.
432 SERIAL_MODE Mode
; ///< Mode of serial port. Values are defined below.
433 } DEVICE_PRODUCER_SERIAL
;
436 /// DEVICE_PRODUCER_SERIAL's modes
438 #define DEVICE_SERIAL_MODE_NORMAL 0x00
439 #define DEVICE_SERIAL_MODE_IRDA 0x01
440 #define DEVICE_SERIAL_MODE_ASK_IR 0x02
441 #define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
442 #define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
446 /// DEVICE_PRODUCER_PARALLEL
449 UINT16 Address
; ///< I/O address assigned to the parallel port
450 UINT8 Irq
; ///< IRQ assigned to the parallel port.
451 UINT8 Dma
; ///< DMA assigned to the parallel port.
452 PARALLEL_MODE Mode
; ///< Mode of the parallel port. Values are defined below.
453 } DEVICE_PRODUCER_PARALLEL
;
456 /// DEVICE_PRODUCER_PARALLEL's modes
458 #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
459 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
460 #define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
461 #define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
465 /// DEVICE_PRODUCER_FLOPPY
468 UINT16 Address
; ///< I/O address assigned to the floppy
469 UINT8 Irq
; ///< IRQ assigned to the floppy.
470 UINT8 Dma
; ///< DMA assigned to the floppy.
471 UINT8 NumberOfFloppy
; ///< Number of floppies in the system.
472 } DEVICE_PRODUCER_FLOPPY
;
475 /// LEGACY_DEVICE_FLAGS
478 UINT32 A20Kybd
: 1; ///< A20 controller by keyboard controller.
479 UINT32 A20Port90
: 1; ///< A20 controlled by port 0x92.
480 UINT32 Reserved
: 30; ///< Reserved for future usage.
481 } LEGACY_DEVICE_FLAGS
;
484 /// DEVICE_PRODUCER_DATA_HEADER
487 DEVICE_PRODUCER_SERIAL Serial
[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below.
488 DEVICE_PRODUCER_PARALLEL Parallel
[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below.
489 DEVICE_PRODUCER_FLOPPY Floppy
; ///< Data for floppy. Type DEVICE_PRODUCER_FLOPPY is defined below.
490 UINT8 MousePresent
; ///< Flag to indicate if mouse is present.
491 LEGACY_DEVICE_FLAGS Flags
; ///< Miscellaneous Boolean state information passed to CSM.
492 } DEVICE_PRODUCER_DATA_HEADER
;
498 UINT16 Raw
[256]; ///< Raw data from the IDE IdentifyDrive command.
506 /// Status of IDE device. Values are defined below. There is one HDD_INFO structure
507 /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index
513 /// PCI bus of IDE controller.
518 /// PCI device of IDE controller.
523 /// PCI function of IDE controller.
528 /// Command ports base address.
530 UINT16 CommandBaseAddress
;
533 /// Control ports base address.
535 UINT16 ControlBaseAddress
;
538 /// Bus master address
540 UINT16 BusMasterAddress
;
545 /// Data that identifies the drive data, one per possible attached drive
547 ATAPI_IDENTIFY IdentifyDrive
[2];
551 /// HDD_INFO status bits
553 #define HDD_PRIMARY 0x01
554 #define HDD_SECONDARY 0x02
555 #define HDD_MASTER_ATAPI_CDROM 0x04
556 #define HDD_SLAVE_ATAPI_CDROM 0x08
557 #define HDD_MASTER_IDE 0x20
558 #define HDD_SLAVE_IDE 0x40
559 #define HDD_MASTER_ATAPI_ZIPDISK 0x10
560 #define HDD_SLAVE_ATAPI_ZIPDISK 0x80
566 UINT16 OldPosition
: 4; ///< Prior priority.
567 UINT16 Reserved1
: 4; ///< Reserved for future use.
568 UINT16 Enabled
: 1; ///< If 0, ignore this entry.
569 UINT16 Failed
: 1; ///< 0 = Not known if boot failure occurred.
570 ///< 1 = Boot attempted failed.
573 /// State of media present.
574 /// 00 = No bootable media is present in the device.
575 /// 01 = Unknown if a bootable media present.
576 /// 10 = Media is present and appears bootable.
579 UINT16 MediaPresent
: 2;
580 UINT16 Reserved2
: 4; ///< Reserved for future use.
584 /// BBS_TABLE, device type values & boot priority values
588 /// The boot priority for this boot device. Values are defined below.
593 /// The PCI bus for this boot device.
598 /// The PCI device for this boot device.
603 /// The PCI function for the boot device.
608 /// The PCI class for this boot device.
613 /// The PCI Subclass for this boot device.
618 /// Segment:offset address of an ASCIIZ description string describing the manufacturer.
620 UINT16 MfgStringOffset
;
623 /// Segment:offset address of an ASCIIZ description string describing the manufacturer.
625 UINT16 MfgStringSegment
;
628 /// BBS device type. BBS device types are defined below.
633 /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.
635 BBS_STATUS_FLAGS StatusFlags
;
638 /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
641 UINT16 BootHandlerOffset
;
644 /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
647 UINT16 BootHandlerSegment
;
650 /// Segment:offset address of an ASCIIZ description string describing this device.
652 UINT16 DescStringOffset
;
655 /// Segment:offset address of an ASCIIZ description string describing this device.
657 UINT16 DescStringSegment
;
662 UINT32 InitPerReserved
;
665 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
666 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
667 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
669 UINT32 AdditionalIrq13Handler
;
672 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
673 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
674 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
676 UINT32 AdditionalIrq18Handler
;
679 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
680 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
681 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
683 UINT32 AdditionalIrq19Handler
;
686 /// The use of these fields is IBV dependent. They can be used to flag that an OpROM
687 /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
688 /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
690 UINT32 AdditionalIrq40Handler
;
691 UINT8 AssignedDriveNumber
;
692 UINT32 AdditionalIrq41Handler
;
693 UINT32 AdditionalIrq46Handler
;
699 /// BBS device type values
701 #define BBS_FLOPPY 0x01
702 #define BBS_HARDDISK 0x02
703 #define BBS_CDROM 0x03
704 #define BBS_PCMCIA 0x04
706 #define BBS_EMBED_NETWORK 0x06
707 #define BBS_BEV_DEVICE 0x80
708 #define BBS_UNKNOWN 0xff
712 /// BBS boot priority values
714 #define BBS_DO_NOT_BOOT_FROM 0xFFFC
715 #define BBS_LOWEST_PRIORITY 0xFFFD
716 #define BBS_UNPRIORITIZED_ENTRY 0xFFFE
717 #define BBS_IGNORE_ENTRY 0xFFFF
725 /// Access mechanism used to generate the soft SMI. Defined types are below. The other
726 /// values are reserved for future usage.
731 /// Size of "port" in bits. Defined values are below.
733 UINT16 PortGranularity
: 3;
736 /// Size of data in bits. Defined values are below.
738 UINT16 DataGranularity
: 3;
741 /// Reserved for future use.
747 /// SMM_ATTRIBUTES type values
749 #define STANDARD_IO 0x00
750 #define STANDARD_MEMORY 0x01
754 /// SMM_ATTRIBUTES port size constants
756 #define PORT_SIZE_8 0x00
757 #define PORT_SIZE_16 0x01
758 #define PORT_SIZE_32 0x02
759 #define PORT_SIZE_64 0x03
763 /// SMM_ATTRIBUTES data size constants
765 #define DATA_SIZE_8 0x00
766 #define DATA_SIZE_16 0x01
767 #define DATA_SIZE_32 0x02
768 #define DATA_SIZE_64 0x03
772 /// SMM_FUNCTION & relating constants
775 UINT16 Function
: 15;
780 /// SMM_FUNCTION Function constants
782 #define INT15_D042 0x0000
783 #define GET_USB_BOOT_INFO 0x0001
784 #define DMI_PNP_50_57 0x0002
788 /// SMM_FUNCTION Owner constants
790 #define STANDARD_OWNER 0x0
791 #define OEM_OWNER 0x1
795 /// This structure assumes both port and data sizes are 1. SmmAttribute must be
796 /// properly to reflect that assumption.
800 /// Describes the access mechanism, SmmPort, and SmmData sizes. Type
801 /// SMM_ATTRIBUTES is defined below.
803 SMM_ATTRIBUTES SmmAttributes
;
806 /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.
808 SMM_FUNCTION SmmFunction
;
811 /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes
816 /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes
825 UINT16 NumSmmEntries
; ///< Number of entries represented by SmmEntry.
826 SMM_ENTRY SmmEntry
; ///< One entry per function. Type SMM_ENTRY is defined below.
834 /// This bit set indicates that the ServiceAreaData is valid.
836 UINT8 DirectoryServiceValidity
: 1;
839 /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if
840 /// DirectoryServiceValidity is 0.
842 UINT8 RabcaUsedFlag
: 1;
845 /// This bit set indicates to execute hard disk diagnostics.
847 UINT8 ExecuteHddDiagnosticsFlag
: 1;
850 /// Reserved for future use. Set to 0.
860 /// This field contains the bit-mapped attributes of the PARTIES information. Type
861 /// UDC_ATTRIBUTES is defined below.
863 UDC_ATTRIBUTES Attributes
;
866 /// This field contains the zero-based device on which the selected
867 /// ServiceDataArea is present. It is 0 for master and 1 for the slave device.
872 /// This field contains the zero-based index into the BbsTable for the parent device.
873 /// This index allows the user to reference the parent device information such as PCI
874 /// bus, device function.
876 UINT8 BbsTableEntryNumberForParentDevice
;
879 /// This field contains the zero-based index into the BbsTable for the boot entry.
881 UINT8 BbsTableEntryNumberForBoot
;
884 /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.
886 UINT8 BbsTableEntryNumberForHddDiag
;
889 /// The raw Beer data.
894 /// The raw data of selected service area.
896 UINT8 ServiceAreaData
[64];
899 #define EFI_TO_LEGACY_MAJOR_VERSION 0x02
900 #define EFI_TO_LEGACY_MINOR_VERSION 0x00
901 #define MAX_IDE_CONTROLLER 8
904 /// EFI_TO_COMPATIBILITY16_BOOT_TABLE
907 UINT16 MajorVersion
; ///< The EfiCompatibility major version number.
908 UINT16 MinorVersion
; ///< The EfiCompatibility minor version number.
909 UINT32 AcpiTable
; ///< Location of the RSDT ACPI table. < 4G range
910 UINT32 SmbiosTable
; ///< Location of the SMBIOS table in EFI memory. < 4G range
911 UINT32 SmbiosTableLength
;
915 DEVICE_PRODUCER_DATA_HEADER SioData
; ///< Standard traditional device information.
916 UINT16 DevicePathType
; ///< The default boot type.
917 UINT16 PciIrqMask
; ///< Mask of which IRQs have been assigned to PCI.
918 UINT32 NumberE820Entries
; ///< Number of E820 entries. The number can change from the
919 ///< Compatibility16InitializeYourself() function.
921 // Controller & Drive Identify[2] per controller information
923 HDD_INFO HddInfo
[MAX_IDE_CONTROLLER
]; ///< Hard disk drive information, including raw Identify Drive data.
924 UINT32 NumberBbsEntries
; ///< Number of entries in the BBS table
925 UINT32 BbsTable
; ///< Pointer to the BBS table. Type BBS_TABLE is defined below.
926 UINT32 SmmTable
; ///< Pointer to the SMM table. Type SMM_TABLE is defined below.
927 UINT32 OsMemoryAbove1Mb
; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can
928 ///< differ from the value in EFI_TO_COMPATIBILITY16_INIT_TABLE as more
929 ///< memory may have been discovered.
930 UINT32 UnconventionalDeviceTable
; ///< Information to boot off an unconventional device like a PARTIES partition. Type
931 ///< UD_TABLE is defined below.
932 } EFI_TO_COMPATIBILITY16_BOOT_TABLE
;
935 /// EFI_LEGACY_INSTALL_PCI_HANDLER
938 UINT8 PciBus
; ///< The PCI bus of the device.
939 UINT8 PciDeviceFun
; ///< The PCI device in bits 7:3 and function in bits 2:0.
940 UINT8 PciSegment
; ///< The PCI segment of the device.
941 UINT8 PciClass
; ///< The PCI class code of the device.
942 UINT8 PciSubclass
; ///< The PCI subclass code of the device.
943 UINT8 PciInterface
; ///< The PCI interface code of the device.
947 UINT8 PrimaryIrq
; ///< The primary device IRQ.
948 UINT8 PrimaryReserved
; ///< Reserved.
949 UINT16 PrimaryControl
; ///< The primary device control I/O base.
950 UINT16 PrimaryBase
; ///< The primary device I/O base.
951 UINT16 PrimaryBusMaster
; ///< The primary device bus master I/O base.
955 UINT8 SecondaryIrq
; ///< The secondary device IRQ.
956 UINT8 SecondaryReserved
; ///< Reserved.
957 UINT16 SecondaryControl
; ///< The secondary device control I/O base.
958 UINT16 SecondaryBase
; ///< The secondary device I/O base.
959 UINT16 SecondaryBusMaster
; ///< The secondary device bus master I/O base.
960 } EFI_LEGACY_INSTALL_PCI_HANDLER
;
963 // Restore default pack value
967 #define EFI_LEGACY_BIOS_PROTOCOL_GUID \
969 0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d } \
972 typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL
;
975 /// Flags returned by CheckPciRom()
978 #define ROM_FOUND 0x01
979 #define VALID_LEGACY_ROM 0x02
980 #define ROM_WITH_CONFIG 0x04 ///< Not defined in the Framework CSM Specification
983 /// The following macros do not appear in the Framework CSM Specification and
984 /// are kept for backward compatibility only. They convert 32-bit address (_Adr)
985 /// to Segment:Offset 16-bit form.
988 #define EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000)
989 #define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff)
992 #define CARRY_FLAG 0x01
1014 UINT32 Reserved5
:14;
1027 EFI_EFLAGS_REG EFlags
;
1075 EFI_FLAGS_REG Flags
;
1076 UINT16 ReservedFlags
;
1104 /// EFI_IA32_REGISTER_SET
1110 } EFI_IA32_REGISTER_SET
;
1113 Thunk to 16-bit real mode and execute a software interrupt with a vector
1114 of BiosInt. Regs will contain the 16-bit register context on entry and
1117 @param[in] This Protocol instance pointer.
1118 @param[in] BiosInt Processor interrupt vector to invoke
1119 @param[in,out] Reg Register contexted passed into (and returned) from thunk to
1122 @retval TRUE Thunk completed with no BIOS errors in the target code. See Regs for status.
1123 @retval FALSE There was a BIOS error in the target code.
1127 (EFIAPI
*EFI_LEGACY_BIOS_INT86
)(
1128 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1130 IN OUT EFI_IA32_REGISTER_SET
*Regs
1134 Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the
1135 16-bit register context on entry and exit. Arguments can be passed on
1138 @param[in] This Protocol instance pointer.
1139 @param[in] Segment Segemnt of 16-bit mode call
1140 @param[in] Offset Offset of 16-bit mdoe call
1141 @param[in] Reg Register contexted passed into (and returned) from thunk to
1143 @param[in] Stack Caller allocated stack used to pass arguments
1144 @param[in] StackSize Size of Stack in bytes
1146 @retval FALSE Thunk completed with no BIOS errors in the target code. See Regs for status. @retval TRUE There was a BIOS error in the target code.
1150 (EFIAPI
*EFI_LEGACY_BIOS_FARCALL86
)(
1151 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1154 IN EFI_IA32_REGISTER_SET
*Regs
,
1160 Test to see if a legacy PCI ROM exists for this device. Optionally return
1161 the Legacy ROM instance for this PCI device.
1163 @param[in] This Protocol instance pointer.
1164 @param[in] PciHandle The PCI PC-AT OPROM from this devices ROM BAR will be loaded
1165 @param[out] RomImage Return the legacy PCI ROM for this device
1166 @param[out] RomSize Size of ROM Image
1167 @param[out] Flags Indicates if ROM found and if PC-AT. Multiple bits can be set as follows:
1170 - 02 = ROM is a valid legacy ROM
1172 @retval EFI_SUCCESS Legacy Option ROM availible for this device
1173 @retval EFI_UNSUPPORTED Legacy Option ROM not supported.
1178 (EFIAPI
*EFI_LEGACY_BIOS_CHECK_ROM
)(
1179 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1180 IN EFI_HANDLE PciHandle
,
1181 OUT VOID
**RomImage
, OPTIONAL
1182 OUT UINTN
*RomSize
, OPTIONAL
1187 Load a legacy PC-AT OPROM on the PciHandle device. Return information
1188 about how many disks were added by the OPROM and the shadow address and
1189 size. DiskStart & DiskEnd are INT 13h drive letters. Thus 0x80 is C:
1191 @param[in] This Protocol instance pointer.
1192 @param[in] PciHandle The PCI PC-AT OPROM from this devices ROM BAR will be loaded.
1193 This value is NULL if RomImage is non-NULL. This is the normal
1195 @param[in] RomImage A PCI PC-AT ROM image. This argument is non-NULL if there is
1196 no hardware associated with the ROM and thus no PciHandle,
1197 otherwise is must be NULL.
1198 Example is PXE base code.
1199 @param[out] Flags The type of ROM discovered. Multiple bits can be set, as follows:
1202 - 02 = ROM is a valid legacy ROM.
1203 @param[out] DiskStart Disk number of first device hooked by the ROM. If DiskStart
1204 is the same as DiskEnd no disked were hooked.
1205 @param[out] DiskEnd disk number of the last device hooked by the ROM.
1206 @param[out] RomShadowAddress Shadow address of PC-AT ROM
1207 @param[out] RomShadowSize Size of RomShadowAddress in bytes
1209 @retval EFI_SUCCESS Thunk completed, see Regs for status.
1210 @retval EFI_INVALID_PARAMETER PciHandle not found
1215 (EFIAPI
*EFI_LEGACY_BIOS_INSTALL_ROM
)(
1216 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1217 IN EFI_HANDLE PciHandle
,
1220 OUT UINT8
*DiskStart
, OPTIONAL
1221 OUT UINT8
*DiskEnd
, OPTIONAL
1222 OUT VOID
**RomShadowAddress
, OPTIONAL
1223 OUT UINT32
*ShadowedRomSize OPTIONAL
1227 This function attempts to traditionally boot the specified BootOption. If the EFI context has
1228 been compromised, this function will not return. This procedure is not used for loading an EFI-aware
1229 OS off a traditional device. The following actions occur:
1230 - Get EFI SMBIOS data structures, convert them to a traditional format, and copy to
1232 - Get a pointer to ACPI data structures and copy the Compatibility16 RSD PTR to F0000 block.
1233 - Find the traditional SMI handler from a firmware volume and register the traditional SMI
1234 handler with the EFI SMI handler.
1235 - Build onboard IDE information and pass this information to the Compatibility16 code.
1236 - Make sure all PCI Interrupt Line registers are programmed to match 8259.
1237 - Reconfigure SIO devices from EFI mode (polled) into traditional mode (interrupt driven).
1238 - Shadow all PCI ROMs.
1239 - Set up BDA and EBDA standard areas before the legacy boot.
1240 - Construct the Compatibility16 boot memory map and pass it to the Compatibility16 code.
1241 - Invoke the Compatibility16 table function Compatibility16PrepareToBoot(). This
1242 invocation causes a thunk into the Compatibility16 code, which sets all appropriate internal
1243 data structures. The boot device list is a parameter.
1244 - Invoke the Compatibility16 Table function Compatibility16Boot(). This invocation
1245 causes a thunk into the Compatibility16 code, which does an INT19.
1246 - If the Compatibility16Boot() function returns, then the boot failed in a graceful
1247 manner--meaning that the EFI code is still valid. An ungraceful boot failure causes a reset because the state
1248 of EFI code is unknown.
1250 @param[in] This Protocol instance pointer.
1251 @param[in] BootOption EFI Device Path from BootXXXX variable.
1252 @param[in] LoadOptionSize Size of LoadOption in size.
1253 @param[in] LoadOption LoadOption from BootXXXX variable
1255 @retval EFI_DEVICE_ERROR Failed to boot from any boot device and memory is uncorrupted. Note: This function normally does not returns. It will either boot the OS or reset the system if memory has been "corrupted" by loading a boot sector and passing control to it.
1259 (EFIAPI
*EFI_LEGACY_BIOS_BOOT
)(
1260 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1261 IN BBS_BBS_DEVICE_PATH
*BootOption
,
1262 IN UINT32 LoadOptionsSize
,
1263 IN VOID
*LoadOptions
1267 This function takes the Leds input parameter and sets/resets the BDA accordingly.
1268 Leds is also passed to Compatibility16 code, in case any special processing is required.
1269 This function is normally called from EFI Setup drivers that handle user-selectable
1270 keyboard options such as boot with NUM LOCK on/off. This function does not
1271 touch the keyboard or keyboard LEDs but only the BDA.
1273 @param[in] This Protocol instance pointer.
1274 @param[in] Leds Status of current Scroll, Num & Cap lock LEDS
1275 - Bit 0 is Scroll Lock 0 = Not locked
1277 - Bit 2 is Caps Lock
1279 @retval EFI_SUCCESS The BDA was updated successfully.
1284 (EFIAPI
*EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS
)(
1285 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1290 Retrieve legacy BBS info and assign boot priority.
1292 @param[in] This Protocol instance pointer.
1293 @param[out] HddCount Number of HDD_INFO structures
1294 @param[out] HddInfo Onboard IDE controller information
1295 @param[out] BbsCount Number of BBS_TABLE structures
1296 @param[in,out] BbsTable Point to List of BBS_TABLE
1298 @retval EFI_SUCCESS Tables returned
1303 (EFIAPI
*EFI_LEGACY_BIOS_GET_BBS_INFO
)(
1304 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1305 OUT UINT16
*HddCount
,
1306 OUT HDD_INFO
**HddInfo
,
1307 OUT UINT16
*BbsCount
,
1308 IN OUT BBS_TABLE
**BbsTable
1312 Assign drive number to legacy HDD drives prior to booting an EFI
1313 aware OS so the OS can access drives without an EFI driver.
1315 @param[in] This Protocol instance pointer.
1316 @param[out] BbsCount Number of BBS_TABLE structures
1317 @param[out] BbsTable List BBS entries
1319 @retval EFI_SUCCESS Drive numbers assigned
1324 (EFIAPI
*EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI
)(
1325 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1326 OUT UINT16
*BbsCount
,
1327 OUT BBS_TABLE
**BbsTable
1331 To boot from an unconventional device like parties and/or execute
1334 @param[in] This Protocol instance pointer.
1335 @param[in] Attributes How to interpret the other input parameters
1336 @param[in] BbsEntry The 0-based index into the BbsTable for the parent
1338 @param[in] BeerData Pointer to the 128 bytes of ram BEER data.
1339 @param[in] ServiceAreaData Pointer to the 64 bytes of raw Service Area data. The
1340 caller must provide a pointer to the specific Service
1341 Area and not the start all Service Areas.
1343 @retval EFI_INVALID_PARAMETER If error. Does NOT return if no error.
1348 (EFIAPI
*EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE
)(
1349 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1350 IN UDC_ATTRIBUTES Attributes
,
1353 IN VOID
*ServiceAreaData
1357 Shadow all legacy16 OPROMs that haven't been shadowed.
1358 Warning: Use this with caution. This routine disconnects all EFI
1359 drivers. If used externally then caller must re-connect EFI
1362 @param[in] This Protocol instance pointer.
1364 @retval EFI_SUCCESS OPROMs shadowed
1369 (EFIAPI
*EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS
)(
1370 IN EFI_LEGACY_BIOS_PROTOCOL
*This
1374 Get a region from the LegacyBios for S3 usage.
1376 @param[in] This Protocol instance pointer.
1377 @param[in] LegacyMemorySize Size of required region
1378 @param[in] Region Region to use.
1379 00 = Either 0xE0000 or 0xF0000 block
1380 - Bit0 = 1 0xF0000 block
1381 - Bit1 = 1 0xE0000 block
1382 @param[in] Alignment Address alignment. Bit mapped. First non-zero
1383 bit from right is alignment.
1384 @param[out] LegacyMemoryAddress Region Assigned
1386 @retval EFI_SUCCESS Region assigned
1387 @retval EFI_ACCESS_DENIED The function was previously invoked.
1388 @retval Other Region not assigned
1393 (EFIAPI
*EFI_LEGACY_BIOS_GET_LEGACY_REGION
)(
1394 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1395 IN UINTN LegacyMemorySize
,
1398 OUT VOID
**LegacyMemoryAddress
1402 Get a region from the LegacyBios for Tiano usage. Can only be invoked once.
1404 @param[in] This Protocol instance pointer.
1405 @param[in] LegacyMemorySize Size of data to copy
1406 @param[in] LegacyMemoryAddress Legacy Region destination address
1407 Note: must be in region assigned by
1408 LegacyBiosGetLegacyRegion
1409 @param[in] LegacyMemorySourceAddress Source of the data to copy.
1411 @retval EFI_SUCCESS Region assigned
1412 @retval EFI_ACCESS_DENIED Destination outside assigned region
1417 (EFIAPI
*EFI_LEGACY_BIOS_COPY_LEGACY_REGION
)(
1418 IN EFI_LEGACY_BIOS_PROTOCOL
*This
,
1419 IN UINTN LegacyMemorySize
,
1420 IN VOID
*LegacyMemoryAddress
,
1421 IN VOID
*LegacyMemorySourceAddress
1425 /// Abstracts the traditional BIOS from the rest of EFI. The LegacyBoot()
1426 /// member function allows the BDS to support booting a traditional OS.
1427 /// EFI thunks drivers that make EFI bindings for BIOS INT services use
1428 /// all the other member functions.
1430 struct _EFI_LEGACY_BIOS_PROTOCOL
{
1432 /// Performs traditional software INT. See the Int86() function description.
1434 EFI_LEGACY_BIOS_INT86 Int86
;
1437 /// Performs a far call into Compatibility16 or traditional OpROM code.
1439 EFI_LEGACY_BIOS_FARCALL86 FarCall86
;
1442 /// Checks if a traditional OpROM exists for this device.
1444 EFI_LEGACY_BIOS_CHECK_ROM CheckPciRom
;
1447 /// Loads a traditional OpROM in traditional OpROM address space.
1449 EFI_LEGACY_BIOS_INSTALL_ROM InstallPciRom
;
1452 /// Boots a traditional OS.
1454 EFI_LEGACY_BIOS_BOOT LegacyBoot
;
1457 /// Updates BDA to reflect the current EFI keyboard LED status.
1459 EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS UpdateKeyboardLedStatus
;
1462 /// Allows an external agent, such as BIOS Setup, to get the BBS data.
1464 EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo
;
1467 /// Causes all legacy OpROMs to be shadowed.
1469 EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS ShadowAllLegacyOproms
;
1472 /// Performs all actions prior to boot. Used when booting an EFI-aware OS
1473 /// rather than a legacy OS.
1475 EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI PrepareToBootEfi
;
1478 /// Allows EFI to reserve an area in the 0xE0000 or 0xF0000 block.
1480 EFI_LEGACY_BIOS_GET_LEGACY_REGION GetLegacyRegion
;
1483 /// Allows EFI to copy data to the area specified by GetLegacyRegion.
1485 EFI_LEGACY_BIOS_COPY_LEGACY_REGION CopyLegacyRegion
;
1488 /// Allows the user to boot off an unconventional device such as a PARTIES partition.
1490 EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE BootUnconventionalDevice
;
1493 extern EFI_GUID gEfiLegacyBiosProtocolGuid
;