X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkPkg%2FInclude%2FProtocol%2FLegacyBios.h;h=36761da39740271d833abacfa23e9a323bc9b94c;hb=aa7fc1c11c3d57d82842dbede50d064639671a98;hp=b8b3621852bc2530c0d4eb2274e9294c63f9277f;hpb=050b79ebb0bef44779009c46b15b68b60e8012d1;p=mirror_edk2.git diff --git a/IntelFrameworkPkg/Include/Protocol/LegacyBios.h b/IntelFrameworkPkg/Include/Protocol/LegacyBios.h index b8b3621852..36761da397 100644 --- a/IntelFrameworkPkg/Include/Protocol/LegacyBios.h +++ b/IntelFrameworkPkg/Include/Protocol/LegacyBios.h @@ -6,25 +6,15 @@ Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow well known naming conventions. - Thunk - A thunk is a transition from one processor mode to another. A Thunk - is a transition from native EFI mode to 16-bit mode. A reverse thunk - would be a transition from 16-bit mode to native EFI mode. + 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. - You most likely should not use this protocol! Find the EFI way to solve the - problem to make your code portable - - Copyright (c) 2007 - 2009, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent @par Revision Reference: This protocol is defined in Framework for EFI Compatibility Support Module spec - Version 0.97. + Version 0.98. **/ @@ -32,7 +22,7 @@ #define _EFI_LEGACY_BIOS_H_ /// -/// +/// /// #pragma pack(1) @@ -55,73 +45,75 @@ typedef struct { /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32. /// UINT32 Signature; - + /// /// The value required such that byte checksum of TableLength equals zero. /// UINT8 TableChecksum; - + /// /// The length of this table. /// UINT8 TableLength; - + /// /// The major EFI revision for which this table was generated. - /// + /// UINT8 EfiMajorRevision; - + /// /// The minor EFI revision for which this table was generated. /// UINT8 EfiMinorRevision; - + /// /// The major revision of this table. /// UINT8 TableMajorRevision; - + /// /// The minor revision of this table. /// UINT8 TableMinorRevision; - + /// /// Reserved for future usage. /// UINT16 Reserved; - + /// /// The segment of the entry point within the traditional BIOS for Compatibility16 functions. /// UINT16 Compatibility16CallSegment; - + /// /// The offset of the entry point within the traditional BIOS for Compatibility16 functions. /// UINT16 Compatibility16CallOffset; - + /// - /// The segment of the entry point within the traditional BIOS for EfiCompatibility to invoke the PnP installation check. + /// The segment of the entry point within the traditional BIOS for EfiCompatibility + /// to invoke the PnP installation check. /// UINT16 PnPInstallationCheckSegment; - + /// - /// The Offset 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. /// UINT16 PnPInstallationCheckOffset; - + /// - /// 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). + /// 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). /// - UINT32 EfiSystemTable; - + UINT32 EfiSystemTable; + /// /// The address of an OEM-provided identifier string. The string is null terminated. /// UINT32 OemIdStringPointer; - + /// /// 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 @@ -129,92 +121,93 @@ typedef struct { /// RSD PTR with either the ACPI 1.0b or 2.0 values. /// UINT32 AcpiRsdPtrPointer; - + /// /// The OEM revision number. Usage is undefined but provided for OEM module usage. /// UINT16 OemRevision; - + /// /// 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. /// UINT32 E820Pointer; - + /// /// The length of the E820 data and is filled in by the EfiCompatibility code. /// UINT32 E820Length; - + /// /// 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. /// UINT32 IrqRoutingTablePointer; - + /// /// The length of the $PIR table and is filled in by the EfiCompatibility code. /// UINT32 IrqRoutingTableLength; - + /// /// 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 EfiCompatibility code will fill in the MpTablePtr value and copy the data + /// to the indicated area. /// UINT32 MpTablePtr; - + /// /// The length of the MP table and is filled in by the EfiCompatibility code. /// UINT32 MpTableLength; - + /// /// The segment of the OEM-specific INT table/code. - /// + /// UINT16 OemIntSegment; - + /// /// The offset of the OEM-specific INT table/code. /// UINT16 OemIntOffset; - + /// /// The segment of the OEM-specific 32-bit table/code. /// UINT16 Oem32Segment; - + /// /// The offset of the OEM-specific 32-bit table/code. /// UINT16 Oem32Offset; - + /// /// The segment of the OEM-specific 16-bit table/code. /// UINT16 Oem16Segment; - + /// /// The offset of the OEM-specific 16-bit table/code. /// UINT16 Oem16Offset; - + /// /// The segment of the TPM binary passed to 16-bit CSM. /// UINT16 TpmSegment; - + /// /// The offset of the TPM binary passed to 16-bit CSM. /// UINT16 TpmOffset; - + /// /// A pointer to a string identifying the independent BIOS vendor. /// UINT32 IbvPointer; - + /// /// 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 @@ -224,19 +217,45 @@ typedef struct { /// Functions. /// UINT32 PciExpressBase; - + /// /// Maximum PCI bus number assigned. /// UINT8 LastPciBus; + + /// + /// Start Address of Upper Memory Area (UMA) to be set as Read/Write. If + /// UmaAddress is a valid address in the shadow RAM, it also indicates that the region + /// from 0xC0000 to (UmaAddress - 1) can be used for Option ROM. + /// + UINT32 UmaAddress; + + /// + /// Upper Memory Area size in bytes to be set as Read/Write. If zero, no UMA region + /// will be set as Read/Write (i.e. all Shadow RAM is set as Read-Only). + /// + UINT32 UmaSize; + + /// + /// Start Address of high memory that can be used for permanent allocation. If zero, + /// high memory is not available for permanent allocation. + /// + UINT32 HiPermanentMemoryAddress; + + /// + /// Size of high memory that can be used for permanent allocation in bytes. If zero, + /// high memory is not available for permanent allocation. + /// + UINT32 HiPermanentMemorySize; } EFI_COMPATIBILITY16_TABLE; /// -/// Functions provided by the CSM binary which communicate between the EfiCompatibility +/// Functions provided by the CSM binary which communicate between the EfiCompatibility /// and Compatability16 code. /// -/// Inconsistent with specification here: -/// The member's name started with "Compatibility16" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version] +/// 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 { @@ -249,7 +268,7 @@ typedef enum { /// AX = Return Status codes /// Legacy16InitializeYourself = 0x0000, - + /// /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence. /// Input: @@ -259,18 +278,18 @@ typedef enum { /// AX = Returned status codes /// Legacy16UpdateBbs = 0x0001, - + /// /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16 /// code is read/write. /// Input: /// AX = Compatibility16PrepareToBoot - /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure + /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure /// Return: /// AX = Returned status codes /// Legacy16PrepareToBoot = 0x0002, - + /// /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only. /// Input: @@ -279,7 +298,7 @@ typedef enum { /// 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. @@ -290,7 +309,7 @@ typedef enum { /// 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: @@ -301,7 +320,7 @@ typedef enum { /// 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. @@ -318,7 +337,7 @@ typedef enum { /// DS:BX = Address of the region /// Legacy16GetTableAddress = 0x0006, - + /// /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state. /// Input: @@ -331,7 +350,7 @@ typedef enum { /// 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. @@ -349,19 +368,19 @@ typedef enum { /// EFI_DISPATCH_OPROM_TABLE /// typedef struct { - UINT16 PnPInstallationCheckSegment; ///< Pointer to the PnpInstallationCheck data structure. - UINT16 PnPInstallationCheckOffset; ///< Pointer to the PnpInstallationCheck data structure. + UINT16 PnPInstallationCheckSegment; ///< A pointer to the PnpInstallationCheck data structure. + UINT16 PnPInstallationCheckOffset; ///< A pointer to the PnpInstallationCheck data structure. UINT16 OpromSegment; ///< The segment where the OpROM was placed. Offset is assumed to be 3. UINT8 PciBus; ///< The PCI bus. UINT8 PciDeviceFunction; ///< The PCI device * 0x08 | PCI function. 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. - VOID *BbsTablePointer; ///< Pointer to the BBS table. + UINT32 BbsTablePointer; ///< A pointer to the BBS table. 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] + ///< 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_DISPATCH_OPROM_TABLE; @@ -374,69 +393,69 @@ typedef struct { /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF. /// UINT32 BiosLessThan1MB; - + /// - /// Starting address of the high memory block. + /// The starting address of the high memory block. /// UINT32 HiPmmMemory; - + /// - /// Length of high memory block. + /// The length of high memory block. /// UINT32 HiPmmMemorySizeInBytes; - + /// /// The segment of the reverse thunk call code. /// UINT16 ReverseThunkCallSegment; - + /// /// The offset of the reverse thunk call code. /// UINT16 ReverseThunkCallOffset; - + /// /// The number of E820 entries copied to the Compatibility16 BIOS. /// UINT32 NumberE820Entries; - + /// /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory. /// UINT32 OsMemoryAbove1Mb; - + /// /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM. /// UINT32 ThunkStart; - + /// /// The size of the thunk code. /// UINT32 ThunkSizeInBytes; - + /// /// Starting address of memory under 1 MB. /// UINT32 LowPmmMemory; - + /// - /// Length of low Memory block. + /// The length of low Memory block. /// UINT32 LowPmmMemorySizeInBytes; } EFI_TO_COMPATIBILITY16_INIT_TABLE; /// -/// DEVICE_PRODUCER_SERIAL +/// DEVICE_PRODUCER_SERIAL. /// typedef struct { - UINT16 Address; ///< I/O address assigned to the serial port + UINT16 Address; ///< I/O address assigned to the serial port. UINT8 Irq; ///< IRQ assigned to the serial port. SERIAL_MODE Mode; ///< Mode of serial port. Values are defined below. } DEVICE_PRODUCER_SERIAL; /// -/// DEVICE_PRODUCER_SERIAL's modes +/// DEVICE_PRODUCER_SERIAL's modes. ///@{ #define DEVICE_SERIAL_MODE_NORMAL 0x00 #define DEVICE_SERIAL_MODE_IRDA 0x01 @@ -446,17 +465,17 @@ typedef struct { ///@) /// -/// DEVICE_PRODUCER_PARALLEL +/// DEVICE_PRODUCER_PARALLEL. /// typedef struct { - UINT16 Address; ///< I/O address assigned to the parallel port + UINT16 Address; ///< I/O address assigned to the parallel port. UINT8 Irq; ///< IRQ assigned to the parallel port. UINT8 Dma; ///< DMA assigned to the parallel port. PARALLEL_MODE Mode; ///< Mode of the parallel port. Values are defined below. } DEVICE_PRODUCER_PARALLEL; /// -/// DEVICE_PRODUCER_PARALLEL's modes +/// DEVICE_PRODUCER_PARALLEL's modes. ///@{ #define DEVICE_PARALLEL_MODE_MODE_OUTPUT_ONLY 0x00 #define DEVICE_PARALLEL_MODE_MODE_BIDIRECTIONAL 0x01 @@ -468,7 +487,7 @@ typedef struct { /// DEVICE_PRODUCER_FLOPPY /// typedef struct { - UINT16 Address; ///< I/O address assigned to the floppy + UINT16 Address; ///< I/O address assigned to the floppy. UINT8 Irq; ///< IRQ assigned to the floppy. UINT8 Dma; ///< DMA assigned to the floppy. UINT8 NumberOfFloppy; ///< Number of floppies in the system. @@ -510,42 +529,42 @@ typedef struct { /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index /// 1 is slave. /// - UINT16 Status; - + UINT16 Status; + /// /// PCI bus of IDE controller. /// UINT32 Bus; - + /// /// PCI device of IDE controller. /// UINT32 Device; - + /// /// PCI function of IDE controller. /// UINT32 Function; - + /// /// Command ports base address. /// UINT16 CommandBaseAddress; - + /// /// Control ports base address. /// UINT16 ControlBaseAddress; - + /// - /// Bus master address + /// Bus master address. /// UINT16 BusMasterAddress; - + UINT8 HddIrq; - + /// - /// Data that identifies the drive data, one per possible attached drive + /// Data that identifies the drive data; one per possible attached drive. /// ATAPI_IDENTIFY IdentifyDrive[2]; } HDD_INFO; @@ -563,7 +582,7 @@ typedef struct { #define HDD_SLAVE_ATAPI_ZIPDISK 0x80 /// -/// BBS_STATUS_FLAGS +/// BBS_STATUS_FLAGS;\. /// typedef struct { UINT16 OldPosition : 4; ///< Prior priority. @@ -571,7 +590,7 @@ typedef struct { UINT16 Enabled : 1; ///< If 0, ignore this entry. UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred. ///< 1 = Boot attempted failed. - + /// /// State of media present. /// 00 = No bootable media is present in the device. @@ -584,71 +603,71 @@ typedef struct { } BBS_STATUS_FLAGS; /// -/// BBS_TABLE, device type values & boot priority values +/// BBS_TABLE, device type values & boot priority values. /// typedef struct { /// /// The boot priority for this boot device. Values are defined below. /// UINT16 BootPriority; - + /// /// The PCI bus for this boot device. /// UINT32 Bus; - + /// /// The PCI device for this boot device. /// UINT32 Device; - + /// /// The PCI function for the boot device. /// UINT32 Function; - + /// /// The PCI class for this boot device. /// UINT8 Class; - + /// /// The PCI Subclass for this boot device. /// UINT8 SubClass; - + /// /// Segment:offset address of an ASCIIZ description string describing the manufacturer. /// UINT16 MfgStringOffset; - + /// /// Segment:offset address of an ASCIIZ description string describing the manufacturer. - /// + /// UINT16 MfgStringSegment; - + /// /// BBS device type. BBS device types are defined below. /// UINT16 DeviceType; - + /// /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below. /// BBS_STATUS_FLAGS StatusFlags; - + /// /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for /// BCV devices. /// UINT16 BootHandlerOffset; - + /// /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for /// BCV devices. - /// + /// UINT16 BootHandlerSegment; - + /// /// Segment:offset address of an ASCIIZ description string describing this device. /// @@ -658,38 +677,38 @@ typedef struct { /// Segment:offset address of an ASCIIZ description string describing this device. /// UINT16 DescStringSegment; - + /// /// Reserved. /// UINT32 InitPerReserved; - + /// /// 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 /// UINT32 AdditionalIrq13Handler; - + /// /// 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 - /// + /// UINT32 AdditionalIrq18Handler; - + /// /// 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 - /// + /// UINT32 AdditionalIrq19Handler; - + /// /// 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 - /// + /// UINT32 AdditionalIrq40Handler; UINT8 AssignedDriveNumber; UINT32 AdditionalIrq41Handler; @@ -729,17 +748,17 @@ typedef struct { /// values are reserved for future usage. /// UINT16 Type : 3; - + /// - /// Size of "port" in bits. Defined values are below. + /// The size of "port" in bits. Defined values are below. /// UINT16 PortGranularity : 3; - + /// - /// Size of data in bits. Defined values are below. + /// The size of data in bits. Defined values are below. /// UINT16 DataGranularity : 3; - + /// /// Reserved for future use. /// @@ -747,14 +766,14 @@ typedef struct { } SMM_ATTRIBUTES; /// -/// SMM_ATTRIBUTES type values +/// SMM_ATTRIBUTES type values. ///@{ #define STANDARD_IO 0x00 #define STANDARD_MEMORY 0x01 ///@} /// -/// SMM_ATTRIBUTES port size constants +/// SMM_ATTRIBUTES port size constants. ///@{ #define PORT_SIZE_8 0x00 #define PORT_SIZE_16 0x01 @@ -763,7 +782,7 @@ typedef struct { ///@} /// -/// SMM_ATTRIBUTES data size constants +/// SMM_ATTRIBUTES data size constants. ///@{ #define DATA_SIZE_8 0x00 #define DATA_SIZE_16 0x01 @@ -772,7 +791,7 @@ typedef struct { ///@} /// -/// SMM_FUNCTION & relating constants +/// SMM_FUNCTION & relating constants. /// typedef struct { UINT16 Function : 15; @@ -780,7 +799,7 @@ typedef struct { } SMM_FUNCTION; /// -/// SMM_FUNCTION Function constants +/// SMM_FUNCTION Function constants. ///@{ #define INT15_D042 0x0000 #define GET_USB_BOOT_INFO 0x0001 @@ -788,7 +807,7 @@ typedef struct { ///@} /// -/// SMM_FUNCTION Owner constants +/// SMM_FUNCTION Owner constants. ///@{ #define STANDARD_OWNER 0x0 #define OEM_OWNER 0x1 @@ -804,19 +823,19 @@ typedef struct { /// SMM_ATTRIBUTES is defined below. /// SMM_ATTRIBUTES SmmAttributes; - + /// /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below. /// SMM_FUNCTION SmmFunction; - + /// - /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes + /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes. /// UINT8 SmmPort; - + /// - /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes + /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes. /// UINT8 SmmData; } SMM_ENTRY; @@ -837,18 +856,18 @@ typedef struct { /// This bit set indicates that the ServiceAreaData is valid. /// UINT8 DirectoryServiceValidity : 1; - + /// /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if /// DirectoryServiceValidity is 0. /// UINT8 RabcaUsedFlag : 1; - + /// /// This bit set indicates to execute hard disk diagnostics. /// UINT8 ExecuteHddDiagnosticsFlag : 1; - + /// /// Reserved for future use. Set to 0. /// @@ -864,35 +883,35 @@ typedef struct { /// UDC_ATTRIBUTES is defined below. /// UDC_ATTRIBUTES Attributes; - + /// /// 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. + /// ServiceDataArea is present. It is 0 for master and 1 for the slave device. /// UINT8 DeviceNumber; - + /// /// 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. /// UINT8 BbsTableEntryNumberForParentDevice; - + /// /// This field contains the zero-based index into the BbsTable for the boot entry. /// UINT8 BbsTableEntryNumberForBoot; - + /// /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry. /// UINT8 BbsTableEntryNumberForHddDiag; - + /// /// The raw Beer data. /// UINT8 BeerData[128]; - + /// /// The raw data of selected service area. /// @@ -909,8 +928,8 @@ typedef struct { typedef struct { UINT16 MajorVersion; ///< The EfiCompatibility major version number. UINT16 MinorVersion; ///< The EfiCompatibility minor version number. - UINT32 AcpiTable; ///< Location of the RSDT ACPI table. < 4G range - UINT32 SmbiosTable; ///< Location of the SMBIOS table in EFI memory. < 4G range + UINT32 AcpiTable; ///< The location of the RSDT ACPI table. < 4G range. + UINT32 SmbiosTable; ///< The location of the SMBIOS table in EFI memory. < 4G range. UINT32 SmbiosTableLength; // // Legacy SIO state @@ -925,8 +944,8 @@ typedef struct { // HDD_INFO HddInfo[MAX_IDE_CONTROLLER]; ///< Hard disk drive information, including raw Identify Drive data. UINT32 NumberBbsEntries; ///< Number of entries in the BBS table - UINT32 BbsTable; ///< Pointer to the BBS table. Type BBS_TABLE is defined below. - UINT32 SmmTable; ///< Pointer to the SMM table. Type SMM_TABLE is defined below. + UINT32 BbsTable; ///< A pointer to the BBS table. Type BBS_TABLE is defined below. + UINT32 SmmTable; ///< A pointer to the SMM table. Type SMM_TABLE is defined below. 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. @@ -975,22 +994,22 @@ typedef struct { typedef struct _EFI_LEGACY_BIOS_PROTOCOL EFI_LEGACY_BIOS_PROTOCOL; /// -/// Flags returned by CheckPciRom() +/// Flags returned by CheckPciRom(). /// #define NO_ROM 0x00 #define ROM_FOUND 0x01 #define VALID_LEGACY_ROM 0x02 -#define ROM_WITH_CONFIG 0x04 ///> Not defined in the Framework CSM Specification +#define ROM_WITH_CONFIG 0x04 ///< Not defined in the Framework CSM Specification. /// -/// The following macros do not appear in the Framework CSM Specification and -/// are kept for backward compatibility only. They convert 32-bit address (_Adr) +/// 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 EFI_SEGMENT(_Adr) (UINT16) ((UINT16) (((UINTN) (_Adr)) >> 4) & 0xf000) #define EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xffff) -/// @} +///@} #define CARRY_FLAG 0x01 @@ -1117,15 +1136,13 @@ typedef union { of BiosInt. Regs will contain the 16-bit register context on entry and exit. - @param[in] This Protocol instance pointer. - @param[in] BiosInt Processor interrupt vector to invoke + @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 FALSE Thunk completed, and there were no BIOS errors in the target code. - See Regs for status. - @retval TRUE There was a BIOS erro in the target code. + 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 BOOLEAN @@ -1140,18 +1157,15 @@ BOOLEAN 16-bit register context on entry and exit. Arguments can be passed on the Stack argument - @param[in] This Protocol instance pointer. - @param[in] Segment Segemnt of 16-bit mode call - @param[in] Offset Offset of 16-bit mdoe call + @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 Caller allocated stack used to pass arguments - @param[in] StackSize Size of Stack in bytes - - @retval FALSE Thunk completed, and there were no BIOS errors in the target code. - See Regs for status. - @retval TRUE There was a BIOS erro in the target code. + 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 BOOLEAN @@ -1168,17 +1182,17 @@ BOOLEAN 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 Protocol instance pointer. + @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 Size of ROM Image + @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 + - 00 = No ROM. + - 01 = ROM Found. + - 02 = ROM is a valid legacy ROM. - @retval EFI_SUCCESS Legacy Option ROM availible for this device - @retval EFI_UNSUPPORTED Legacy Option ROM not supported. + @retval EFI_SUCCESS The Legacy Option ROM available for this device + @retval EFI_UNSUPPORTED The Legacy Option ROM is not supported. **/ typedef @@ -1196,7 +1210,7 @@ EFI_STATUS 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 Protocol instance pointer. + @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. @@ -1208,11 +1222,11 @@ EFI_STATUS - 00 = No ROM. - 01 = ROM found. - 02 = ROM is a valid legacy ROM. - @param[out] DiskStart Disk number of first device hooked by the ROM. If DiskStart + @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 + @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 @@ -1233,7 +1247,7 @@ EFI_STATUS /** 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 EFIaware + 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. @@ -1252,19 +1266,15 @@ EFI_STATUS - 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—i.e., EFI code is still valid. An ungraceful boot failure causes a reset because the state + 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 Protocol instance pointer. - @param[in] BootOption EFI Device Path from BootXXXX variable. - @param[in] LoadOptionSize Size of LoadOption in size. - @param[in] LoadOption LoadOption from BootXXXX variable - - @retval EFI_DEVICE_ERROR Failed to boot from any boot device and memory is uncorrupted. - Note: This function normally never 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. + @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 EFI_STATUS @@ -1276,17 +1286,17 @@ EFI_STATUS ); /** - This function takes the Leds input parameter and sets/resets the BDA accordingly. - 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 userselectable + This function takes the Leds input parameter and sets/resets the BDA accordingly. + 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 keyboard options such as boot with NUM LOCK on/off. This function does not touch the keyboard or keyboard LEDs but only the BDA. - @param[in] This Protocol instance pointer. - @param[in] Leds 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 + @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. @@ -1301,13 +1311,13 @@ EFI_STATUS /** Retrieve legacy BBS info and assign boot priority. - @param[in] This Protocol instance pointer. - @param[out] HddCount Number of HDD_INFO structures - @param[out] HddInfo Onboard IDE controller information - @param[out] BbsCount Number of BBS_TABLE structures - @param[in,out] BbsTable Point to List of BBS_TABLE + @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 returned + @retval EFI_SUCCESS Tables were returned. **/ typedef @@ -1324,11 +1334,11 @@ EFI_STATUS 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 Protocol instance pointer. - @param[out] BbsCount Number of BBS_TABLE structures - @param[out] BbsTable List BBS entries + @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 + @retval EFI_SUCCESS Drive numbers assigned. **/ typedef @@ -1343,12 +1353,12 @@ EFI_STATUS To boot from an unconventional device like parties and/or execute HDD diagnostics. - @param[in] This Protocol instance pointer. - @param[in] Attributes How to interpret the other input parameters + @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 Pointer to the 128 bytes of ram BEER data. - @param[in] ServiceAreaData Pointer to the 64 bytes of raw Service Area data. The + @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. @@ -1368,12 +1378,12 @@ EFI_STATUS /** Shadow all legacy16 OPROMs that haven't been shadowed. Warning: Use this with caution. This routine disconnects all EFI - drivers. If used externally then caller must re-connect EFI + drivers. If used externally, then the caller must re-connect EFI drivers. - - @param[in] This Protocol instance pointer. - - @retval EFI_SUCCESS OPROMs shadowed + + @param[in] This The protocol instance pointer. + + @retval EFI_SUCCESS OPROMs were shadowed. **/ typedef @@ -1385,19 +1395,19 @@ EFI_STATUS /** Get a region from the LegacyBios for S3 usage. - @param[in] This Protocol instance pointer. - @param[in] LegacyMemorySize Size of required region - @param[in] Region Region to use. - 00 = Either 0xE0000 or 0xF0000 block - - Bit0 = 1 0xF0000 block - - Bit1 = 1 0xE0000 block - @param[in] Alignment Address alignment. Bit mapped. First non-zero + @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 Region Assigned + @param[out] LegacyMemoryAddress The Region Assigned - @retval EFI_SUCCESS Region assigned + @retval EFI_SUCCESS The Region was assigned. @retval EFI_ACCESS_DENIED The function was previously invoked. - @retval Other Region not assigned + @retval Other The Region was not assigned. **/ typedef @@ -1413,15 +1423,15 @@ EFI_STATUS /** Get a region from the LegacyBios for Tiano usage. Can only be invoked once. - @param[in] This Protocol instance pointer. - @param[in] LegacyMemorySize Size of data to copy - @param[in] LegacyMemoryAddress Legacy Region destination address + @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 Source of the data to copy. + LegacyBiosGetLegacyRegion. + @param[in] LegacyMemorySourceAddress The source of the data to copy. - @retval EFI_SUCCESS Region assigned - @retval EFI_ACCESS_DENIED Destination outside assigned region + @retval EFI_SUCCESS The Region assigned. + @retval EFI_ACCESS_DENIED Destination was outside an assigned region. **/ typedef @@ -1444,64 +1454,100 @@ struct _EFI_LEGACY_BIOS_PROTOCOL { /// Performs traditional software INT. See the Int86() function description. /// EFI_LEGACY_BIOS_INT86 Int86; - + /// /// Performs a far call into Compatibility16 or traditional OpROM code. /// EFI_LEGACY_BIOS_FARCALL86 FarCall86; - + /// /// Checks if a traditional OpROM exists for this device. /// EFI_LEGACY_BIOS_CHECK_ROM CheckPciRom; - + /// /// Loads a traditional OpROM in traditional OpROM address space. /// EFI_LEGACY_BIOS_INSTALL_ROM InstallPciRom; - + /// /// Boots a traditional OS. /// EFI_LEGACY_BIOS_BOOT LegacyBoot; - + /// /// Updates BDA to reflect the current EFI keyboard LED status. /// EFI_LEGACY_BIOS_UPDATE_KEYBOARD_LED_STATUS UpdateKeyboardLedStatus; - + /// /// Allows an external agent, such as BIOS Setup, to get the BBS data. /// EFI_LEGACY_BIOS_GET_BBS_INFO GetBbsInfo; - + /// /// Causes all legacy OpROMs to be shadowed. /// EFI_LEGACY_BIOS_SHADOW_ALL_LEGACY_OPROMS ShadowAllLegacyOproms; - + /// /// Performs all actions prior to boot. Used when booting an EFI-aware OS - /// rather than a legacy OS. + /// rather than a legacy OS. /// EFI_LEGACY_BIOS_PREPARE_TO_BOOT_EFI PrepareToBootEfi; - + /// /// Allows EFI to reserve an area in the 0xE0000 or 0xF0000 block. /// EFI_LEGACY_BIOS_GET_LEGACY_REGION GetLegacyRegion; - + /// /// Allows EFI to copy data to the area specified by GetLegacyRegion. /// EFI_LEGACY_BIOS_COPY_LEGACY_REGION CopyLegacyRegion; - + /// /// Allows the user to boot off an unconventional device such as a PARTIES partition. /// EFI_LEGACY_BIOS_BOOT_UNCONVENTIONAL_DEVICE BootUnconventionalDevice; }; +// +// Legacy BIOS needs to access memory in page 0 (0-4095), which is disabled if +// NULL pointer detection feature is enabled. Following macro can be used to +// enable/disable page 0 before/after accessing it. +// +#define ACCESS_PAGE0_CODE(statements) \ + do { \ + EFI_STATUS Status_; \ + EFI_GCD_MEMORY_SPACE_DESCRIPTOR Desc_; \ + \ + Desc_.Attributes = 0; \ + Status_ = gDS->GetMemorySpaceDescriptor (0, &Desc_); \ + ASSERT_EFI_ERROR (Status_); \ + if ((Desc_.Attributes & EFI_MEMORY_RP) != 0) { \ + Status_ = gDS->SetMemorySpaceAttributes ( \ + 0, \ + EFI_PAGES_TO_SIZE(1), \ + Desc_.Attributes & ~(UINT64)EFI_MEMORY_RP \ + ); \ + ASSERT_EFI_ERROR (Status_); \ + } \ + \ + { \ + statements; \ + } \ + \ + if ((Desc_.Attributes & EFI_MEMORY_RP) != 0) { \ + Status_ = gDS->SetMemorySpaceAttributes ( \ + 0, \ + EFI_PAGES_TO_SIZE(1), \ + Desc_.Attributes \ + ); \ + ASSERT_EFI_ERROR (Status_); \ + } \ + } while (FALSE) + extern EFI_GUID gEfiLegacyBiosProtocolGuid; #endif