LegacyBios.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
The EFI Legacy BIOS Protocol is used to abstract legacy Option ROM usage
under EFI and Legacy OS boot. This file also includes all the related
COMPATIBILIY16 structures and defintions.
Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow
well known naming conventions.
Thunk is the code that switches from 32-bit protected environment into the 16-bit real-mode
environment. Reverse thunk is the code that does the opposite.
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@par Revision Reference:
This protocol is defined in Framework for EFI Compatibility Support Module spec
Version 0.97.
**/
#ifndef _EFI_LEGACY_BIOS_H_
#define _EFI_LEGACY_BIOS_H_
///
///
///
#pragma pack(1)
typedef UINT8 SERIAL_MODE;
typedef UINT8 PARALLEL_MODE;
///
/// There is a table located within the traditional BIOS in either the 0xF000:xxxx or 0xE000:xxxx
/// physical address range. It is located on a 16-byte boundary and provides the physical address of the
/// entry point for the Compatibility16 functions. These functions provide the platform-specific
/// information that is required by the generic EfiCompatibility code. The functions are invoked via
/// thunking by using EFI_LEGACY_BIOS_PROTOCOL.FarCall86() with the 32-bit physical
/// entry point.
///
typedef struct {
///
/// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 0 is "I," byte
/// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32.
///
///
/// The value required such that byte checksum of TableLength equals zero.
///
///
/// The length of this table.
///
///
/// The major EFI revision for which this table was generated.
///
///
/// The minor EFI revision for which this table was generated.
///
///
/// The major revision of this table.
///
///
/// The minor revision of this table.
///
///
/// Reserved for future usage.
///
///
/// The segment of the entry point within the traditional BIOS for Compatibility16 functions.
///
///
/// The offset of the entry point within the traditional BIOS for Compatibility16 functions.
///
///
/// The segment of the entry point within the traditional BIOS for EfiCompatibility
/// to invoke the PnP installation check.
///
///
/// The Offset of the entry point within the traditional BIOS for EfiCompatibility
/// to invoke the PnP installation check.
///
///
/// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform
///Innovation Framework for EFI Driver Execution Environment Core Interface Specification (DXE CIS).
///
///
/// The address of an OEM-provided identifier string. The string is null terminated.
///
///
/// The 32-bit physical address where ACPI RSD PTR is stored within the traditional
/// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size
/// reserved is the maximum for ACPI 2.0. The EfiCompatibility will fill in the ACPI
/// RSD PTR with either the ACPI 1.0b or 2.0 values.
///
///
/// The OEM revision number. Usage is undefined but provided for OEM module usage.
///
///
/// The 32-bit physical address where INT15 E820 data is stored within the traditional
/// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the
/// data to the indicated area.
///
///
/// The length of the E820 data and is filled in by the EfiCompatibility code.
///
///
/// The 32-bit physical address where the $PIR table is stored in the traditional BIOS.
/// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and
/// copy the data to the indicated area.
///
///
/// The length of the $PIR table and is filled in by the EfiCompatibility code.
///
///
/// The 32-bit physical address where the MP table is stored in the traditional BIOS.
/// The EfiCompatibility code will fill in the MpTablePtr value and copy the data
/// to the indicated area.
///
///
/// The length of the MP table and is filled in by the EfiCompatibility code.
///
///
///
///
///
///
///
///
///
///
///
///
///
///
/// The segment of the TPM binary passed to 16-bit CSM.
///
///
/// The offset of the TPM binary passed to 16-bit CSM.
///
///
/// A pointer to a string identifying the independent BIOS vendor.
///
///
/// This field is NULL for all systems not supporting PCI Express. This field is the base
/// value of the start of the PCI Express memory-mapped configuration registers and
/// must be filled in prior to EfiCompatibility code issuing the Compatibility16 function
/// Compatibility16InitializeYourself().
/// Compatibility16InitializeYourself() is defined in Compatability16
/// Functions.
///
///
/// Maximum PCI bus number assigned.
///
///
/// Functions provided by the CSM binary which communicate between the EfiCompatibility
/// and Compatability16 code.
///
/// Inconsistent with the specification here:
/// The member's name started with "Compatibility16" [defined in Intel Framework
/// Compatibility Support Module Specification / 0.97 version]
/// has been changed to "Legacy16" since keeping backward compatible.
///
typedef enum {
///
/// Causes the Compatibility16 code to do any internal initialization required.
/// Input:
/// AX = Compatibility16InitializeYourself
/// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_INIT_TABLE
/// Return:
/// AX = Return Status codes
///
Legacy16InitializeYourself = 0x0000,
///
/// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence.
/// Input:
/// AX = Compatibility16UpdateBbs
/// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE
/// Return:
/// AX = Returned status codes
///
Legacy16UpdateBbs = 0x0001,
///
/// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16
/// Input:
/// AX = Compatibility16PrepareToBoot
/// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure
/// Return:
/// AX = Returned status codes
///
Legacy16PrepareToBoot = 0x0002,
///
/// Input:
/// AX = Compatibility16Boot
/// Output:
/// AX = Returned status codes
///
Legacy16Boot = 0x0003,
///
/// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is
/// stored in CMOS and is the priority number of the last attempted boot device.
/// Input:
/// AX = Compatibility16RetrieveLastBootDevice
/// Output:
/// AX = Returned status codes
/// BX = Priority number of the boot device.
///
Legacy16RetrieveLastBootDevice = 0x0004,
///
/// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM.
/// Input:
/// AX = Compatibility16DispatchOprom
/// ES:BX = Pointer to EFI_DISPATCH_OPROM_TABLE
/// Output:
/// AX = Returned status codes
/// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant.
///
Legacy16DispatchOprom = 0x0005,
///
/// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address
/// of that region.
/// Input:
/// AX = Compatibility16GetTableAddress
/// BX = Allocation region
/// 00 = Allocate from either 0xE0000 or 0xF0000 64 KB blocks.
/// Bit 0 = 1 Allocate from 0xF0000 64 KB block
/// Bit 1 = 1 Allocate from 0xE0000 64 KB block
/// CX = Requested length in bytes.
/// DX = Required address alignment. Bit mapped. First non-zero bit from the right is the alignment.
/// Output:
/// AX = Returned status codes
/// DS:BX = Address of the region
///
Legacy16GetTableAddress = 0x0006,
///
/// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state.
/// Input:
/// AX = Compatibility16SetKeyboardLeds
/// CL = LED status.
/// Bit 0 Scroll Lock 0 = Off
/// Bit 1 NumLock
/// Bit 2 Caps Lock
/// Output:
/// AX = Returned status codes
///
Legacy16SetKeyboardLeds = 0x0007,
///
/// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that
/// do not have an OpROM associated with them. An example is SATA.
/// Input:
/// AX = Compatibility16InstallPciHandler
/// ES:BX = Pointer to EFI_LEGACY_INSTALL_PCI_HANDLER structure
/// Output:
/// AX = Returned status codes
///
Legacy16InstallPciHandler = 0x0008
///
/// EFI_DISPATCH_OPROM_TABLE
///
typedef struct {
UINT8 NumberBbsEntries; ///< The number of valid BBS table entries upon entry and exit. The IBV code may
///< increase this number, if BBS-compliant devices also hook INTs in order to force the
///< OpROM BIOS Setup to be executed.
UINT16 RuntimeSegment; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this
///< means that the relocation of this run time code is not supported.
///< Inconsistent with specification here:
///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version]
///< has been changed to "RuntimeSegment" since keeping backward compatible.
///
/// EFI_TO_COMPATIBILITY16_INIT_TABLE
///
typedef struct {
///
/// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF.
///
///
/// The starting address of the high memory block.
///
///
/// The length of high memory block.
///
///
/// The segment of the reverse thunk call code.
///
///
/// The offset of the reverse thunk call code.
///
///
/// The number of E820 entries copied to the Compatibility16 BIOS.
///
///
/// The amount of usable memory above 1 MB, e.g., E820 type 1 memory.
///
///
/// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM.
///
///
/// The size of the thunk code.
///
///
/// Starting address of memory under 1 MB.
///
///
/// The length of low Memory block.
///
///
/// DEVICE_PRODUCER_SERIAL.
///
typedef struct {
///
/// DEVICE_PRODUCER_SERIAL's modes.
///@{
#define DEVICE_SERIAL_MODE_NORMAL 0x00
#define DEVICE_SERIAL_MODE_IRDA 0x01
#define DEVICE_SERIAL_MODE_ASK_IR 0x02
#define DEVICE_SERIAL_MODE_DUPLEX_HALF 0x00
#define DEVICE_SERIAL_MODE_DUPLEX_FULL 0x10
///@)
///
/// DEVICE_PRODUCER_PARALLEL.
///
typedef struct {
///
/// DEVICE_PRODUCER_PARALLEL's modes.
///@{
#define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00
#define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01
#define DEVICE_PARALLEL_MODE_MODE_EPP 0x02
#define DEVICE_PARALLEL_MODE_MODE_ECP 0x03
///@}
///
/// DEVICE_PRODUCER_FLOPPY
///
typedef struct {
///
/// LEGACY_DEVICE_FLAGS
///
typedef struct {
///
/// DEVICE_PRODUCER_DATA_HEADER
///
typedef struct {
DEVICE_PRODUCER_SERIAL Serial[4]; ///< Data for serial port x. Type DEVICE_PRODUCER_SERIAL is defined below.
DEVICE_PRODUCER_PARALLEL Parallel[3]; ///< Data for parallel port x. Type DEVICE_PRODUCER_PARALLEL is defined below.
///
/// ATAPI_IDENTIFY
///
typedef struct {
///
/// HDD_INFO
///
typedef struct {
///
/// Status of IDE device. Values are defined below. There is one HDD_INFO structure
/// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index
/// 1 is slave.
///
///
/// PCI bus of IDE controller.
///
///
/// PCI device of IDE controller.
///
///
/// PCI function of IDE controller.
///
///
/// Command ports base address.
///
///
/// Control ports base address.
///
///
/// Bus master address.
///
///
/// Data that identifies the drive data; one per possible attached drive.
///
} HDD_INFO;
///
/// HDD_INFO status bits
///
#define HDD_PRIMARY 0x01
#define HDD_SECONDARY 0x02
#define HDD_MASTER_ATAPI_CDROM 0x04
#define HDD_SLAVE_ATAPI_CDROM 0x08
#define HDD_MASTER_IDE 0x20
#define HDD_SLAVE_IDE 0x40
#define HDD_MASTER_ATAPI_ZIPDISK 0x10
#define HDD_SLAVE_ATAPI_ZIPDISK 0x80
///
/// BBS_STATUS_FLAGS;\.
///
typedef struct {
///< 1 = Boot attempted failed.
///
/// State of media present.
/// 00 = No bootable media is present in the device.
/// 01 = Unknown if a bootable media present.
/// 10 = Media is present and appears bootable.
/// 11 = Reserved.
///
///
/// BBS_TABLE, device type values & boot priority values.
///
typedef struct {
///
/// The boot priority for this boot device. Values are defined below.
///
///
/// The PCI bus for this boot device.
///
///
/// The PCI device for this boot device.
///
///
/// The PCI function for the boot device.
///
///
/// The PCI class for this boot device.
///
///
/// The PCI Subclass for this boot device.
///
///
/// Segment:offset address of an ASCIIZ description string describing the manufacturer.
///
///
/// Segment:offset address of an ASCIIZ description string describing the manufacturer.
///
///
/// BBS device type. BBS device types are defined below.
///
///
/// Status of this boot device. Type BBS_STATUS_FLAGS is defined below.
///
///
/// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
/// BCV devices.
///
///
/// Segment:Offset address of boot loader for IPL devices or install INT13 handler for
/// BCV devices.
///
///
/// Segment:offset address of an ASCIIZ description string describing this device.
///
///
/// Segment:offset address of an ASCIIZ description string describing this device.
///
///
/// Reserved.
///
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
///
/// The use of these fields is IBV dependent. They can be used to flag that an OpROM
/// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI
/// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup
///
} BBS_TABLE;
///
/// BBS device type values
///@{
#define BBS_FLOPPY 0x01
#define BBS_HARDDISK 0x02
#define BBS_CDROM 0x03
#define BBS_PCMCIA 0x04
#define BBS_USB 0x05
#define BBS_EMBED_NETWORK 0x06
#define BBS_BEV_DEVICE 0x80
#define BBS_UNKNOWN 0xff
///@}
///
/// BBS boot priority values
///@{
#define BBS_DO_NOT_BOOT_FROM 0xFFFC
#define BBS_LOWEST_PRIORITY 0xFFFD
#define BBS_UNPRIORITIZED_ENTRY 0xFFFE
#define BBS_IGNORE_ENTRY 0xFFFF
///@}
///
/// SMM_ATTRIBUTES
///
typedef struct {
///
/// Access mechanism used to generate the soft SMI. Defined types are below. The other
/// values are reserved for future usage.
///
///
/// The size of "port" in bits. Defined values are below.
///
///
/// The size of data in bits. Defined values are below.
///
///
/// Reserved for future use.
///
///
/// SMM_ATTRIBUTES type values.
///@{
#define STANDARD_IO 0x00
#define STANDARD_MEMORY 0x01
///@}
///
/// SMM_ATTRIBUTES port size constants.
///@{
#define PORT_SIZE_8 0x00
#define PORT_SIZE_16 0x01
#define PORT_SIZE_32 0x02
#define PORT_SIZE_64 0x03
///@}
///
/// SMM_ATTRIBUTES data size constants.
///@{
#define DATA_SIZE_8 0x00
#define DATA_SIZE_16 0x01
#define DATA_SIZE_32 0x02
#define DATA_SIZE_64 0x03
///@}
///
/// SMM_FUNCTION & relating constants.
///
typedef struct {
} SMM_FUNCTION;
///
/// SMM_FUNCTION Function constants.
///@{
#define INT15_D042 0x0000
#define GET_USB_BOOT_INFO 0x0001
#define DMI_PNP_50_57 0x0002
///@}
///
/// SMM_FUNCTION Owner constants.
///@{
#define STANDARD_OWNER 0x0
#define OEM_OWNER 0x1
///@}
///
/// This structure assumes both port and data sizes are 1. SmmAttribute must be
/// properly to reflect that assumption.
///
typedef struct {
///
/// Describes the access mechanism, SmmPort, and SmmData sizes. Type
/// SMM_ATTRIBUTES is defined below.
///
///
/// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below.
///
///
/// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes.
///
///
/// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes.
///
} SMM_ENTRY;
///
/// SMM_TABLE
///
typedef struct {
} SMM_TABLE;
///
/// UDC_ATTRIBUTES
///
typedef struct {
///
/// This bit set indicates that the ServiceAreaData is valid.
///
///
/// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if
/// DirectoryServiceValidity is 0.
///
///
/// This bit set indicates to execute hard disk diagnostics.
///
///
/// Reserved for future use. Set to 0.
///
///
/// UD_TABLE
///
typedef struct {
///
/// This field contains the bit-mapped attributes of the PARTIES information. Type
/// UDC_ATTRIBUTES is defined below.
///
///
/// This field contains the zero-based device on which the selected
/// ServiceDataArea is present. It is 0 for master and 1 for the slave device.
///
///
/// This field contains the zero-based index into the BbsTable for the parent device.
/// This index allows the user to reference the parent device information such as PCI
/// bus, device function.
///
///
/// This field contains the zero-based index into the BbsTable for the boot entry.
///
///
/// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry.
///
///
/// The raw Beer data.
///
///
/// The raw data of selected service area.
///
} UD_TABLE;
#define EFI_TO_LEGACY_MAJOR_VERSION 0x02
#define EFI_TO_LEGACY_MINOR_VERSION 0x00
#define MAX_IDE_CONTROLLER 8
///
/// EFI_TO_COMPATIBILITY16_BOOT_TABLE
///
typedef struct {
//
// Legacy SIO state
//
///< Compatibility16InitializeYourself() function.
//
// Controller & Drive Identify[2] per controller information
//
HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data.
UINT32 OsMemoryAbove1Mb; ///< The amount of usable memory above 1 MB, i.e. E820 type 1 memory. This value can
///< differ from the value in EFI_TO_COMPATIBILITY16_INIT_TABLE as more
///< memory may have been discovered.
UINT32 UnconventionalDeviceTable; ///< Information to boot off an unconventional device like a PARTIES partition. Type
///< UD_TABLE is defined below.
///
/// EFI_LEGACY_INSTALL_PCI_HANDLER
///
typedef struct {
//
// Primary section
//
//
// Secondary Section
//
//
// Restore default pack value
//
#pragma pack()
#define EFI_LEGACY_BIOS_PROTOCOL_GUID \
{ \
0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d } \
}
typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL;
///
/// Flags returned by CheckPciRom().
///
#define NO_ROM 0x00
#define ROM_FOUND 0x01
#define VALID_LEGACY_ROM 0x02
///
/// The following macros do not appear in the Framework CSM Specification and
/// are kept for backward compatibility only. They convert 32-bit address (_Adr)
/// to Segment:Offset 16-bit form.
///
///@{
///@}
#define CARRY_FLAG 0x01
///
/// EFI_EFLAGS_REG
///
typedef struct {
///
/// EFI_DWORD_REGS
///
typedef struct {
///
/// EFI_FLAGS_REG
///
typedef struct {
///
/// EFI_WORD_REGS
///
typedef struct {
///
/// EFI_BYTE_REGS
///
typedef struct {
///
/// EFI_IA32_REGISTER_SET
///
typedef union {
/**
Thunk to 16-bit real mode and execute a software interrupt with a vector
of BiosInt. Regs will contain the 16-bit register context on entry and
exit.
@param[in] This The protocol instance pointer.
@param[in] BiosInt The processor interrupt vector to invoke.
@param[in,out] Reg Register contexted passed into (and returned) from thunk to
16-bit mode.
@retval TRUE Thunk completed with no BIOS errors in the target code. See Regs for status.
@retval FALSE There was a BIOS error in the target code.
**/
typedef
);
/**
Thunk to 16-bit real mode and call Segment:Offset. Regs will contain the
16-bit register context on entry and exit. Arguments can be passed on
the Stack argument
@param[in] This The protocol instance pointer.
@param[in] Segment The segemnt of 16-bit mode call.
@param[in] Offset The offset of 16-bit mdoe call.
@param[in] Reg Register contexted passed into (and returned) from thunk to
16-bit mode.
@param[in] Stack The caller allocated stack used to pass arguments.
@param[in] StackSize The size of Stack in bytes.
@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.
**/
typedef
);
/**
Test to see if a legacy PCI ROM exists for this device. Optionally return
the Legacy ROM instance for this PCI device.
@param[in] This The protocol instance pointer.
@param[in] PciHandle The PCI PC-AT OPROM from this devices ROM BAR will be loaded
@param[out] RomImage Return the legacy PCI ROM for this device.
@param[out] RomSize The size of ROM Image.
@param[out] Flags Indicates if ROM found and if PC-AT. Multiple bits can be set as follows:
- 00 = No ROM.
- 01 = ROM Found.
- 02 = ROM is a valid legacy ROM.
@retval EFI_SUCCESS The Legacy Option ROM availible for this device
@retval EFI_UNSUPPORTED The Legacy Option ROM is not supported.
**/
typedef
);
/**
Load a legacy PC-AT OPROM on the PciHandle device. Return information
about how many disks were added by the OPROM and the shadow address and
size. DiskStart & DiskEnd are INT 13h drive letters. Thus 0x80 is C:
@param[in] This The protocol instance pointer.
@param[in] PciHandle The PCI PC-AT OPROM from this devices ROM BAR will be loaded.
This value is NULL if RomImage is non-NULL. This is the normal
case.
@param[in] RomImage A PCI PC-AT ROM image. This argument is non-NULL if there is
no hardware associated with the ROM and thus no PciHandle,
otherwise is must be NULL.
Example is PXE base code.
@param[out] Flags The type of ROM discovered. Multiple bits can be set, as follows:
- 00 = No ROM.
- 01 = ROM found.
- 02 = ROM is a valid legacy ROM.
@param[out] DiskStart The disk number of first device hooked by the ROM. If DiskStart
is the same as DiskEnd no disked were hooked.
@param[out] DiskEnd disk number of the last device hooked by the ROM.
@param[out] RomShadowAddress Shadow address of PC-AT ROM.
@param[out] RomShadowSize Size of RomShadowAddress in bytes.
@retval EFI_SUCCESS Thunk completed, see Regs for status.
@retval EFI_INVALID_PARAMETER PciHandle not found
**/
typedef
);
/**
This function attempts to traditionally boot the specified BootOption. If the EFI context has
been compromised, this function will not return. This procedure is not used for loading an EFI-aware
OS off a traditional device. The following actions occur:
- Get EFI SMBIOS data structures, convert them to a traditional format, and copy to
Compatibility16.
- Get a pointer to ACPI data structures and copy the Compatibility16 RSD PTR to F0000 block.
- Find the traditional SMI handler from a firmware volume and register the traditional SMI
handler with the EFI SMI handler.
- Build onboard IDE information and pass this information to the Compatibility16 code.
- Make sure all PCI Interrupt Line registers are programmed to match 8259.
- Reconfigure SIO devices from EFI mode (polled) into traditional mode (interrupt driven).
- Shadow all PCI ROMs.
- Set up BDA and EBDA standard areas before the legacy boot.
- Construct the Compatibility16 boot memory map and pass it to the Compatibility16 code.
- Invoke the Compatibility16 table function Compatibility16PrepareToBoot(). This
invocation causes a thunk into the Compatibility16 code, which sets all appropriate internal
data structures. The boot device list is a parameter.
- Invoke the Compatibility16 Table function Compatibility16Boot(). This invocation
causes a thunk into the Compatibility16 code, which does an INT19.
- If the Compatibility16Boot() function returns, then the boot failed in a graceful
manner--meaning that the EFI code is still valid. An ungraceful boot failure causes a reset because the state
of EFI code is unknown.
@param[in] This The protocol instance pointer.
@param[in] BootOption The EFI Device Path from BootXXXX variable.
@param[in] LoadOptionSize The size of LoadOption in size.
@param[in] LoadOption LThe oadOption from BootXXXX variable.
@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.
**/
typedef
);
/**
Leds is also passed to Compatibility16 code, in case any special processing is required.
This function is normally called from EFI Setup drivers that handle user-selectable
touch the keyboard or keyboard LEDs but only the BDA.
@param[in] This The protocol instance pointer.
@param[in] Leds The status of current Scroll, Num & Cap lock LEDS:
- Bit 0 is Scroll Lock 0 = Not locked.
- Bit 1 is Num Lock.
- Bit 2 is Caps Lock.
@retval EFI_SUCCESS The BDA was updated successfully.
**/
typedef
);
/**
Retrieve legacy BBS info and assign boot priority.
@param[in] This The protocol instance pointer.
@param[out] HddCount The number of HDD_INFO structures.
@param[out] HddInfo Onboard IDE controller information.
@param[out] BbsCount The number of BBS_TABLE structures.
@param[in,out] BbsTable Points to List of BBS_TABLE.
@retval EFI_SUCCESS Tables were returned.
**/
typedef
);
/**
Assign drive number to legacy HDD drives prior to booting an EFI
aware OS so the OS can access drives without an EFI driver.
@param[in] This The protocol instance pointer.
@param[out] BbsCount The number of BBS_TABLE structures
@param[out] BbsTable List of BBS entries
@retval EFI_SUCCESS Drive numbers assigned.
**/
typedef
);
/**
HDD diagnostics.
@param[in] This The protocol instance pointer.
@param[in] Attributes How to interpret the other input parameters.
@param[in] BbsEntry The 0-based index into the BbsTable for the parent
device.
@param[in] BeerData A pointer to the 128 bytes of ram BEER data.
@param[in] ServiceAreaData A pointer to the 64 bytes of raw Service Area data. The
caller must provide a pointer to the specific Service
Area and not the start all Service Areas.
@retval EFI_INVALID_PARAMETER If error. Does NOT return if no error.
**/
typedef
);
/**
Shadow all legacy16 OPROMs that haven't been shadowed.
Warning: Use this with caution. This routine disconnects all EFI
drivers. If used externally, then the caller must re-connect EFI
drivers.
@param[in] This The protocol instance pointer.
@retval EFI_SUCCESS OPROMs were shadowed.
**/
typedef
);
/**
Get a region from the LegacyBios for S3 usage.
@param[in] This The protocol instance pointer.
@param[in] LegacyMemorySize The size of required region.
@param[in] Region The region to use.
00 = Either 0xE0000 or 0xF0000 block.
- Bit0 = 1 0xF0000 block.
- Bit1 = 1 0xE0000 block.
@param[in] Alignment Address alignment. Bit mapped. The first non-zero
bit from right is alignment.
@param[out] LegacyMemoryAddress The Region Assigned
@retval EFI_SUCCESS The Region was assigned.
@retval EFI_ACCESS_DENIED The function was previously invoked.
@retval Other The Region was not assigned.
**/
typedef
);
/**
Get a region from the LegacyBios for Tiano usage. Can only be invoked once.
@param[in] This The protocol instance pointer.
@param[in] LegacyMemorySize The size of data to copy.
@param[in] LegacyMemoryAddress The Legacy Region destination address.
Note: must be in region assigned by
LegacyBiosGetLegacyRegion.
@param[in] LegacyMemorySourceAddress The source of the data to copy.
@retval EFI_SUCCESS The Region assigned.
@retval EFI_ACCESS_DENIED Destination was outside an assigned region.
**/
typedef
);
///
/// Abstracts the traditional BIOS from the rest of EFI. The LegacyBoot()
/// member function allows the BDS to support booting a traditional OS.
/// EFI thunks drivers that make EFI bindings for BIOS INT services use
/// all the other member functions.
///
struct _EFI_LEGACY_BIOS_PROTOCOL {
///
/// Performs traditional software INT. See the Int86() function description.
///
///
/// Performs a far call into Compatibility16 or traditional OpROM code.
///
///
/// Checks if a traditional OpROM exists for this device.
///
///
/// Loads a traditional OpROM in traditional OpROM address space.
///
///
/// Boots a traditional OS.
///
///
/// Updates BDA to reflect the current EFI keyboard LED status.
///
///
/// Allows an external agent, such as BIOS Setup, to get the BBS data.
///
///
/// Causes all legacy OpROMs to be shadowed.
///
///
/// Performs all actions prior to boot. Used when booting an EFI-aware OS
/// rather than a legacy OS.
///
///
/// Allows EFI to reserve an area in the 0xE0000 or 0xF0000 block.
///
///
/// Allows EFI to copy data to the area specified by GetLegacyRegion.
///
///
/// Allows the user to boot off an unconventional device such as a PARTIES partition.
///
};
extern EFI_GUID gEfiLegacyBiosProtocolGuid;
#endif