BaseTools/CommonLib: Consume MdePkg and MdeModulePkg

BaseTools has been duplicating and adapting code that is defined in
MdePkg and MdeModulePkg. This leads to desync issues where the same
symbols may be backed by different functions with slightly different
semantics and also fixes that apply only to BaseTools or only to MdePkg
and MdeModulePkg.

To address these issues, update BaseTools/Source/C to utilize the code
from MdePkg and MdeModulePkg.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
This commit is contained in:
Marvin Häuser 2023-03-08 15:57:01 +01:00 committed by Mikhail Krichanov
parent 1a49c0297c
commit 9163cd4925
53 changed files with 1049 additions and 8311 deletions

View File

@ -16,6 +16,7 @@ Source/C/VfrCompile/VfrSyntax.cpp
Source/C/VfrCompile/VfrTokens.h
Source/C/bin/
Source/C/libs/
Source/C/obj/
Bin/Win32
Lib
BaseToolsBuild/

View File

@ -4,12 +4,14 @@
# Copyright (c) 2022, Mikhail Krichanov. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
EDK2_PATH = ..\..
!INCLUDE ..\Source\C\Makefiles\ms.common
APP = ImageTool
OC_USER = ..\..\OpenCorePkg
UDK_PATH = ..\..
UDK_PATH = $(EDK2_PATH)
UDK_ARCH = $(HOST_ARCH)
OUT_DIR = .\Windows

View File

@ -4,12 +4,14 @@
# Copyright (c) 2022, Mikhail Krichanov. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
EDK2_PATH = ..\..
!INCLUDE ..\Source\C\Makefiles\ms.common
APP = MicroTool
OC_USER = ..\..\OpenCorePkg
UDK_PATH = ..\..
UDK_PATH = $(EDK2_PATH)
UDK_ARCH = $(HOST_ARCH)
OUT_DIR = .\Windows

View File

@ -0,0 +1,19 @@
/** @file
AutoGen definitions for edk2 package code consumption in BaseTools.
Copyright (c) 2023, Marvin Häuser. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Common/AutoGen.h>
GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = EFI_CALLER_ID_GUID;
GLOBAL_REMOVE_IF_UNREFERENCED GUID gEdkiiDscPlatformGuid = EDKII_DSC_PLATFORM_GUID;
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gEfiCallerBaseName = "BaseTools";
// Definition of SkuId Array
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 _gPcd_SkuId_Array[] = {0x0};

View File

@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Common/UefiBaseTypes.h>
#include <CommonLib.h>
#include <IndustryStandard/PeImage.h>
#include <Common/PeImageEx.h>
#include "PeCoffLib.h"
typedef union {

View File

@ -62,12 +62,12 @@ CommonLibBinderCompareMem (
}
BOOLEAN
CommonLibBinderCompareGuid (
CommonLibBinderBtCompareGuid (
IN EFI_GUID *Guid1,
IN EFI_GUID *Guid2
)
{
return CompareGuid (Guid1, Guid2) ? FALSE : TRUE;
return BtCompareGuid (Guid1, Guid2) ? FALSE : TRUE;
}

View File

@ -52,7 +52,7 @@ CommonLibBinderCompareMem (
);
BOOLEAN
CommonLibBinderCompareGuid (
CommonLibBinderBtCompareGuid (
IN EFI_GUID *Guid1,
IN EFI_GUID *Guid2
);

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <limits.h>
#endif
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
#ifdef PATH_MAX
@ -41,8 +46,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define IS_SLASH(a) ((a) == L'/')
#define IS_NULL(a) ((a) == L'\0')
#define ASSERT(x) assert(x)
#ifdef __cplusplus
extern "C" {
#endif
@ -50,38 +53,8 @@ extern "C" {
//
// Function declarations
//
VOID
PeiZeroMem (
IN VOID *Buffer,
IN UINTN Size
)
;
VOID
PeiCopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
)
;
VOID
ZeroMem (
IN VOID *Buffer,
IN UINTN Size
)
;
VOID
CopyMem (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
)
;
INTN
CompareGuid (
BtCompareGuid (
IN EFI_GUID *Guid1,
IN EFI_GUID *Guid2
)
@ -95,26 +68,6 @@ GetFileImage (
)
;
/*++
Routine Description:
This function opens a file and writes OutputFileImage into the file.
Arguments:
OutputFileName The name of the file to write.
OutputFileImage A pointer to the memory buffer.
BytesToWrite The size of the memory buffer.
Returns:
EFI_SUCCESS The function completed successfully.
EFI_INVALID_PARAMETER One of the input parameters was invalid.
EFI_ABORTED An error occurred.
EFI_OUT_OF_RESOURCES No resource to complete operations.
**/
EFI_STATUS
PutFileImage (
IN CHAR8 *OutputFileName,
@ -123,29 +76,17 @@ PutFileImage (
)
;
UINT8
CalculateChecksum8 (
IN UINT8 *Buffer,
IN UINTN Size
)
;
UINT8
CalculateSum8 (
IN UINT8 *Buffer,
IN UINTN Size
)
;
#define CalculateChecksum8 CalculateCheckSum8
UINT16
CalculateChecksum16 (
BtCalculateChecksum16 (
IN UINT16 *Buffer,
IN UINTN Size
)
;
UINT16
CalculateSum16 (
BtCalculateSum16 (
IN UINT16 *Buffer,
IN UINTN Size
)
@ -172,231 +113,6 @@ LongFilePath (
IN CHAR8 *FileName
);
UINTN
StrLen (
CONST CHAR16 *String
);
VOID *
AllocateCopyPool (
UINTN AllocationSize,
CONST VOID *Buffer
);
INTN
StrnCmp (
CONST CHAR16 *FirstString,
CONST CHAR16 *SecondString,
UINTN Length
);
RETURN_STATUS
StrToGuid (
CONST CHAR16 *String,
EFI_GUID *Guid
);
RETURN_STATUS
StrHexToBytes (
CONST CHAR16 *String,
UINTN Length,
UINT8 *Buffer,
UINTN MaxBufferSize
);
UINTN
InternalHexCharToUintn (
CHAR16 Char
);
VOID *
InternalAllocateCopyPool (
UINTN AllocationSize,
CONST VOID *Buffer
);
BOOLEAN
InternalIsDecimalDigitCharacter (
CHAR16 Char
);
UINT32
SwapBytes32 (
UINT32 Value
);
UINT16
SwapBytes16 (
UINT16 Value
);
EFI_GUID *
CopyGuid (
EFI_GUID *DestinationGuid,
CONST EFI_GUID *SourceGuid
);
UINT64
WriteUnaligned64 (
UINT64 *Buffer,
UINT64 Value
);
UINT64
ReadUnaligned64 (
CONST UINT64 *Buffer
);
UINTN
StrSize (
CONST CHAR16 *String
);
UINT64
StrHexToUint64 (
CONST CHAR16 *String
);
UINT64
StrDecimalToUint64 (
CONST CHAR16 *String
);
RETURN_STATUS
StrHexToUint64S (
CONST CHAR16 *String,
CHAR16 **EndPointer,
UINT64 *Data
);
RETURN_STATUS
StrDecimalToUint64S (
CONST CHAR16 *String,
CHAR16 **EndPointer, OPTIONAL
UINT64 *Data
);
VOID *
ReallocatePool (
UINTN OldSize,
UINTN NewSize,
VOID *OldBuffer OPTIONAL
);
VOID *
InternalReallocatePool (
UINTN OldSize,
UINTN NewSize,
VOID *OldBuffer OPTIONAL
);
VOID *
InternalAllocateZeroPool (
UINTN AllocationSize
) ;
VOID *
InternalAllocatePool (
UINTN AllocationSize
);
UINTN
StrnLenS (
CONST CHAR16 *String,
UINTN MaxSize
);
CHAR16
InternalCharToUpper (
CHAR16 Char
);
INTN
StrCmp (
CONST CHAR16 *FirstString,
CONST CHAR16 *SecondString
);
UINT64
SwapBytes64 (
UINT64 Value
);
UINT64
InternalMathSwapBytes64 (
UINT64 Operand
);
RETURN_STATUS
StrToIpv4Address (
CONST CHAR16 *String,
CHAR16 **EndPointer,
EFI_IPv4_ADDRESS *Address,
UINT8 *PrefixLength
);
RETURN_STATUS
StrToIpv6Address (
CONST CHAR16 *String,
CHAR16 **EndPointer,
EFI_IPv6_ADDRESS *Address,
UINT8 *PrefixLength
);
RETURN_STATUS
StrCpyS (
CHAR16 *Destination,
UINTN DestMax,
CONST CHAR16 *Source
);
RETURN_STATUS
UnicodeStrToAsciiStrS (
CONST CHAR16 *Source,
CHAR8 *Destination,
UINTN DestMax
);
VOID *
AllocatePool (
UINTN AllocationSize
);
UINT16
WriteUnaligned16 (
UINT16 *Buffer,
UINT16 Value
);
UINT16
ReadUnaligned16 (
CONST UINT16 *Buffer
);
VOID *
AllocateZeroPool (
UINTN AllocationSize
);
BOOLEAN
InternalIsHexaDecimalDigitCharacter (
CHAR16 Char
);
BOOLEAN
InternalSafeStringIsOverlap (
IN VOID *Base1,
IN UINTN Size1,
IN VOID *Base2,
IN UINTN Size2
);
BOOLEAN
InternalSafeStringNoStrOverlap (
IN CHAR16 *Str1,
IN UINTN Size1,
IN CHAR16 *Str2,
IN UINTN Size2
);
BOOLEAN
IsHexStr (

View File

@ -1,5 +1,5 @@
/** @file
CalculateCrc32 routine.
BtCalculateCrc32 routine.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -7,299 +7,41 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <stdlib.h>
#include <Common/BaseTypes.h>
#include <Library/BaseLib.h>
#include "Crc32.h"
UINT32 mCrcTable[256] = {
0x00000000,
0x77073096,
0xEE0E612C,
0x990951BA,
0x076DC419,
0x706AF48F,
0xE963A535,
0x9E6495A3,
0x0EDB8832,
0x79DCB8A4,
0xE0D5E91E,
0x97D2D988,
0x09B64C2B,
0x7EB17CBD,
0xE7B82D07,
0x90BF1D91,
0x1DB71064,
0x6AB020F2,
0xF3B97148,
0x84BE41DE,
0x1ADAD47D,
0x6DDDE4EB,
0xF4D4B551,
0x83D385C7,
0x136C9856,
0x646BA8C0,
0xFD62F97A,
0x8A65C9EC,
0x14015C4F,
0x63066CD9,
0xFA0F3D63,
0x8D080DF5,
0x3B6E20C8,
0x4C69105E,
0xD56041E4,
0xA2677172,
0x3C03E4D1,
0x4B04D447,
0xD20D85FD,
0xA50AB56B,
0x35B5A8FA,
0x42B2986C,
0xDBBBC9D6,
0xACBCF940,
0x32D86CE3,
0x45DF5C75,
0xDCD60DCF,
0xABD13D59,
0x26D930AC,
0x51DE003A,
0xC8D75180,
0xBFD06116,
0x21B4F4B5,
0x56B3C423,
0xCFBA9599,
0xB8BDA50F,
0x2802B89E,
0x5F058808,
0xC60CD9B2,
0xB10BE924,
0x2F6F7C87,
0x58684C11,
0xC1611DAB,
0xB6662D3D,
0x76DC4190,
0x01DB7106,
0x98D220BC,
0xEFD5102A,
0x71B18589,
0x06B6B51F,
0x9FBFE4A5,
0xE8B8D433,
0x7807C9A2,
0x0F00F934,
0x9609A88E,
0xE10E9818,
0x7F6A0DBB,
0x086D3D2D,
0x91646C97,
0xE6635C01,
0x6B6B51F4,
0x1C6C6162,
0x856530D8,
0xF262004E,
0x6C0695ED,
0x1B01A57B,
0x8208F4C1,
0xF50FC457,
0x65B0D9C6,
0x12B7E950,
0x8BBEB8EA,
0xFCB9887C,
0x62DD1DDF,
0x15DA2D49,
0x8CD37CF3,
0xFBD44C65,
0x4DB26158,
0x3AB551CE,
0xA3BC0074,
0xD4BB30E2,
0x4ADFA541,
0x3DD895D7,
0xA4D1C46D,
0xD3D6F4FB,
0x4369E96A,
0x346ED9FC,
0xAD678846,
0xDA60B8D0,
0x44042D73,
0x33031DE5,
0xAA0A4C5F,
0xDD0D7CC9,
0x5005713C,
0x270241AA,
0xBE0B1010,
0xC90C2086,
0x5768B525,
0x206F85B3,
0xB966D409,
0xCE61E49F,
0x5EDEF90E,
0x29D9C998,
0xB0D09822,
0xC7D7A8B4,
0x59B33D17,
0x2EB40D81,
0xB7BD5C3B,
0xC0BA6CAD,
0xEDB88320,
0x9ABFB3B6,
0x03B6E20C,
0x74B1D29A,
0xEAD54739,
0x9DD277AF,
0x04DB2615,
0x73DC1683,
0xE3630B12,
0x94643B84,
0x0D6D6A3E,
0x7A6A5AA8,
0xE40ECF0B,
0x9309FF9D,
0x0A00AE27,
0x7D079EB1,
0xF00F9344,
0x8708A3D2,
0x1E01F268,
0x6906C2FE,
0xF762575D,
0x806567CB,
0x196C3671,
0x6E6B06E7,
0xFED41B76,
0x89D32BE0,
0x10DA7A5A,
0x67DD4ACC,
0xF9B9DF6F,
0x8EBEEFF9,
0x17B7BE43,
0x60B08ED5,
0xD6D6A3E8,
0xA1D1937E,
0x38D8C2C4,
0x4FDFF252,
0xD1BB67F1,
0xA6BC5767,
0x3FB506DD,
0x48B2364B,
0xD80D2BDA,
0xAF0A1B4C,
0x36034AF6,
0x41047A60,
0xDF60EFC3,
0xA867DF55,
0x316E8EEF,
0x4669BE79,
0xCB61B38C,
0xBC66831A,
0x256FD2A0,
0x5268E236,
0xCC0C7795,
0xBB0B4703,
0x220216B9,
0x5505262F,
0xC5BA3BBE,
0xB2BD0B28,
0x2BB45A92,
0x5CB36A04,
0xC2D7FFA7,
0xB5D0CF31,
0x2CD99E8B,
0x5BDEAE1D,
0x9B64C2B0,
0xEC63F226,
0x756AA39C,
0x026D930A,
0x9C0906A9,
0xEB0E363F,
0x72076785,
0x05005713,
0x95BF4A82,
0xE2B87A14,
0x7BB12BAE,
0x0CB61B38,
0x92D28E9B,
0xE5D5BE0D,
0x7CDCEFB7,
0x0BDBDF21,
0x86D3D2D4,
0xF1D4E242,
0x68DDB3F8,
0x1FDA836E,
0x81BE16CD,
0xF6B9265B,
0x6FB077E1,
0x18B74777,
0x88085AE6,
0xFF0F6A70,
0x66063BCA,
0x11010B5C,
0x8F659EFF,
0xF862AE69,
0x616BFFD3,
0x166CCF45,
0xA00AE278,
0xD70DD2EE,
0x4E048354,
0x3903B3C2,
0xA7672661,
0xD06016F7,
0x4969474D,
0x3E6E77DB,
0xAED16A4A,
0xD9D65ADC,
0x40DF0B66,
0x37D83BF0,
0xA9BCAE53,
0xDEBB9EC5,
0x47B2CF7F,
0x30B5FFE9,
0xBDBDF21C,
0xCABAC28A,
0x53B39330,
0x24B4A3A6,
0xBAD03605,
0xCDD70693,
0x54DE5729,
0x23D967BF,
0xB3667A2E,
0xC4614AB8,
0x5D681B02,
0x2A6F2B94,
0xB40BBE37,
0xC30C8EA1,
0x5A05DF1B,
0x2D02EF8D
};
/**
The CalculateCrc32 routine.
@param Data The buffer containing the data to be processed
@param DataSize The size of data to be processed
@param CrcOut A pointer to the caller allocated UINT32 that on
contains the CRC32 checksum of Data
@retval EFI_SUCCESS Calculation is successful.
@retval EFI_INVALID_PARAMETER Data / CrcOut = NULL, or DataSize = 0
**/
EFI_STATUS
CalculateCrc32 (
BtCalculateCrc32 (
IN UINT8 *Data,
IN UINTN DataSize,
IN OUT UINT32 *CrcOut
)
{
UINT32 Crc;
UINTN Index;
UINT8 *Ptr;
/*++
Routine Description:
The BtCalculateCrc32 routine.
Arguments:
Data - The buffer containing the data to be processed
DataSize - The size of data to be processed
CrcOut - A pointer to the caller allocated UINT32 that on
contains the CRC32 checksum of Data
Returns:
EFI_SUCCESS - Calculation is successful.
EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
--*/
{
if ((DataSize == 0) || (Data == NULL) || (CrcOut == NULL)) {
return EFI_INVALID_PARAMETER;
}
Crc = 0xffffffff;
for (Index = 0, Ptr = Data; Index < DataSize; Index++, Ptr++) {
Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];
}
*CrcOut = Crc ^ 0xffffffff;
*CrcOut = CalculateCrc32 (Data, DataSize);
return EFI_SUCCESS;
}

View File

@ -1,5 +1,5 @@
/** @file
Header file for CalculateCrc32 routine
Header file for BtCalculateCrc32 routine
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@ -23,11 +23,30 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
@retval EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
**/
EFI_STATUS
CalculateCrc32 (
BtCalculateCrc32 (
IN UINT8 *Data,
IN UINTN DataSize,
IN OUT UINT32 *CrcOut
)
/*++
Routine Description:
The BtCalculateCrc32 routine.
Arguments:
Data - The buffer containing the data to be processed
DataSize - The size of data to be processed
CrcOut - A pointer to the caller allocated UINT32 that on
contains the CRC32 checksum of Data
Returns:
EFI_SUCCESS - Calculation is successful.
EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
--*/
;
#endif

View File

@ -0,0 +1,356 @@
/** @file
BaseTools Debug Library that sends messages to the standard output.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2023, Marvin Häuser. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Common/AutoGen.h>
#include <stdio.h>
#include <Library/DebugLib.h>
#include <Library/PrintLib.h>
#include <Library/PcdLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
//
// Define the maximum debug and assert message length that this library supports
//
#define MAX_DEBUG_MESSAGE_LENGTH 0x100
//
// VA_LIST can not initialize to NULL for all compiler, so we use this to
// indicate a null VA_LIST
//
VA_LIST mVaListNull;
/**
Prints a debug message to the debug output device if the specified error level is enabled.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
GetDebugPrintErrorLevel (), then print the message specified by Format and the
associated variable argument list to the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
@param ... A variable argument list whose contents are accessed
based on the format string specified by Format.
**/
VOID
EFIAPI
DebugPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
...
)
{
VA_LIST Marker;
VA_START (Marker, Format);
DebugVPrint (ErrorLevel, Format, Marker);
VA_END (Marker);
}
/**
Prints a debug message to the debug output device if the specified
error level is enabled base on Null-terminated format string and a
VA_LIST argument list or a BASE_LIST argument list.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
GetDebugPrintErrorLevel (), then print the message specified by Format and
the associated variable argument list to the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
@param VaListMarker VA_LIST marker for the variable argument list.
@param BaseListMarker BASE_LIST marker for the variable argument list.
**/
VOID
DebugPrintMarker (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN VA_LIST VaListMarker,
IN BASE_LIST BaseListMarker
)
{
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
//
// If Format is NULL, then ASSERT().
//
ASSERT (Format != NULL);
//
// Check driver debug mask value and global mask
//
if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
return;
}
//
// Convert the DEBUG() message to a Unicode String
//
if (BaseListMarker == NULL) {
AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
} else {
AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
}
//
// Send the print string to the Console Output device
//
printf("%s", Buffer);
}
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
GetDebugPrintErrorLevel (), then print the message specified by Format and
the associated variable argument list to the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
@param VaListMarker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
DebugVPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN VA_LIST VaListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
}
/**
Prints a debug message to the debug output device if the specified
error level is enabled.
This function use BASE_LIST which would provide a more compatible
service than VA_LIST.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
GetDebugPrintErrorLevel (), then print the message specified by Format and
the associated variable argument list to the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
@param BaseListMarker BASE_LIST marker for the variable argument list.
**/
VOID
EFIAPI
DebugBPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN BASE_LIST BaseListMarker
)
{
DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
}
/**
Prints an assert message containing a filename, line number, and description.
This may be followed by a breakpoint or a dead loop.
Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
CpuDeadLoop() is called. If neither of these bits are set, then this function
returns immediately after the message is printed to the debug output device.
DebugAssert() must actively prevent recursion. If DebugAssert() is called while
processing another DebugAssert(), then DebugAssert() must return immediately.
If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
@param FileName The pointer to the name of the source file that generated
the assert condition.
@param LineNumber The line number in the source file that generated the
assert condition
@param Description The pointer to the description of the assert condition.
**/
VOID
EFIAPI
DebugAssert (
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
)
{
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
//
// Generate the ASSERT() message in Unicode format
//
AsciiSPrint (
Buffer,
sizeof (Buffer),
"ASSERT [%a] %a(%d): %a\n",
gEfiCallerBaseName,
FileName,
LineNumber,
Description
);
//
// Send the print string to the Console Output device
//
printf ("%s", Buffer);
//
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
//
if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint ();
} else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
/**
Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
This function fills Length bytes of Buffer with the value specified by
PcdDebugClearMemoryValue, and returns Buffer.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue.
@param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
@return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue.
**/
VOID *
EFIAPI
DebugClearMemory (
OUT VOID *Buffer,
IN UINTN Length
)
{
//
// If Buffer is NULL, then ASSERT().
//
ASSERT (Buffer != NULL);
//
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer
//
return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
/**
Returns TRUE if ASSERT() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugAssertEnabled (
VOID
)
{
return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
}
/**
Returns TRUE if DEBUG() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugPrintEnabled (
VOID
)
{
return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
}
/**
Returns TRUE if DEBUG_CODE() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugCodeEnabled (
VOID
)
{
return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
}
/**
Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugClearMemoryEnabled (
VOID
)
{
return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
@retval TRUE Current ErrorLevel is supported.
@retval FALSE Current ErrorLevel is not supported.
**/
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
IN CONST UINTN ErrorLevel
)
{
return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}

View File

@ -62,7 +62,7 @@ FvBufGetSecFileLen (
STATIC
UINT16
FvBufCalculateChecksum16 (
FvBufBtCalculateChecksum16 (
IN UINT16 *Buffer,
IN UINTN Size
);
@ -181,7 +181,7 @@ FvBufRemoveFile (
return Status;
}
if (CommonLibBinderCompareGuid (Name, &NextFile->Name)) {
if (CommonLibBinderBtCompareGuid (Name, &NextFile->Name)) {
continue;
}
else {
@ -265,7 +265,7 @@ FvBufChecksumHeader (
FvHeader->Checksum = 0;
FvHeader->Checksum =
FvBufCalculateChecksum16 (
FvBufBtCalculateChecksum16 (
(UINT16*) FvHeader,
FvHeader->HeaderLength / sizeof (UINT16)
);
@ -919,7 +919,7 @@ FvBufFindFileByName (
return Status;
}
if (CommonLibBinderCompareGuid (Name, &NextFile->Name)) {
if (CommonLibBinderBtCompareGuid (Name, &NextFile->Name)) {
if (File != NULL) {
*File = NextFile;
}
@ -1429,7 +1429,7 @@ FvBufUnifyBlockSizes (
**/
STATIC
UINT16
FvBufCalculateSum16 (
FvBufBtCalculateSum16 (
IN UINT16 *Buffer,
IN UINTN Size
)
@ -1459,12 +1459,12 @@ FvBufCalculateSum16 (
**/
STATIC
UINT16
FvBufCalculateChecksum16 (
FvBufBtCalculateChecksum16 (
IN UINT16 *Buffer,
IN UINTN Size
)
{
return (UINT16)(0x10000 - FvBufCalculateSum16 (Buffer, Size));
return (UINT16)(0x10000 - FvBufBtCalculateSum16 (Buffer, Size));
}
/**

View File

@ -246,7 +246,7 @@ GetFileByName (
// Loop as long as we have a valid file
//
while (CurrentFile) {
if (!CompareGuid (&CurrentFile->Name, FileName)) {
if (!BtCompareGuid (&CurrentFile->Name, FileName)) {
*File = CurrentFile;
return EFI_SUCCESS;
}
@ -543,7 +543,7 @@ VerifyFv (
//
// Verify header checksum
//
Checksum = CalculateSum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
Checksum = BtCalculateSum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
if (Checksum != 0) {
Error (NULL, 0, 0006, "invalid FV header checksum", NULL);

View File

@ -30,4 +30,66 @@ OBJECTS = \
StringFuncs.o \
TianoCompress.o
OBJECTS += AutoGen.o DebugLib.o
OBJECTS += \
$(EDK2_OBJPATH)/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.o
OBJECTS += \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/ARShiftU64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/BitField.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/CheckSum.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/DivS64x64Remainder.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/DivU64x32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/DivU64x32Remainder.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/DivU64x64Remainder.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/FilePaths.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/GetPowerOfTwo32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/GetPowerOfTwo64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/HighBitSet32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/HighBitSet64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/LinkedList.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/LowBitSet32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/LRotU32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/LRotU64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/LShiftU64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/Math64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/ModU64x32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/MultS64x64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/MultU64x32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/MultU64x64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/QuickSort.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/RRotU32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/RRotU64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/RShiftU64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/SafeString.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/SafeString.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/String.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/SwapBytes16.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/SwapBytes32.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/SwapBytes64.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseLib/Unaligned.o
OBJECTS += \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/CompareMemWrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/CopyMem.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/CopyMemWrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/IsZeroBufferWrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/MemLibGeneric.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/MemLibGuid.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/ScanMem8Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/ScanMem16Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/ScanMem32Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/ScanMem64Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/SetMem.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/SetMem16Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/SetMem32Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/SetMem64Wrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/SetMemWrapper.o \
$(EDK2_OBJPATH)/MdePkg/Library/BaseMemoryLib/ZeroMemWrapper.o
OBJECTS += \
$(EDK2_OBJPATH)/MdePkg/Library/BasePrintLib/PrintLib.o \
$(EDK2_OBJPATH)/MdePkg/Library/BasePrintLib/PrintLibInternal.o
include $(MAKEROOT)/Makefiles/lib.makefile

View File

@ -30,6 +30,67 @@ OBJECTS = \
StringFuncs.obj \
TianoCompress.obj
OBJECTS = $(OBJECTS) AutoGen.obj DebugLib.obj
OBJECTS = $(OBJECTS) \
$(EDK2_OBJPATH)\MdePkg\Library\BaseDebugPrintErrorLevelLib\BaseDebugPrintErrorLevelLib.obj
OBJECTS = $(OBJECTS) \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\ARShiftU64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\BitField.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\CheckSum.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\DivS64x64Remainder.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\DivU64x32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\DivU64x32Remainder.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\DivU64x64Remainder.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\FilePaths.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\GetPowerOfTwo32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\GetPowerOfTwo64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\HighBitSet32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\HighBitSet64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\LinkedList.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\LowBitSet32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\LRotU32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\LRotU64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\LShiftU64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\Math64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\ModU64x32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\MultS64x64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\MultU64x32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\MultU64x64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\QuickSort.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\RRotU32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\RRotU64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\RShiftU64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\SafeString.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\String.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\SwapBytes16.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\SwapBytes32.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\SwapBytes64.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\Unaligned.obj
OBJECTS = $(OBJECTS) \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\CompareMemWrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\CopyMem.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\CopyMemWrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\IsZeroBufferWrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\MemLibGeneric.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\MemLibGuid.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\ScanMem8Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\ScanMem16Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\ScanMem32Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\ScanMem64Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\SetMem.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\SetMem16Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\SetMem32Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\SetMem64Wrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\SetMemWrapper.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\ZeroMemWrapper.obj
OBJECTS = $(OBJECTS) \
$(EDK2_OBJPATH)\MdePkg\Library\BasePrintLib\PrintLib.obj \
$(EDK2_OBJPATH)\MdePkg\Library\BasePrintLib\PrintLibInternal.obj
!INCLUDE ..\Makefiles\ms.lib

View File

@ -168,7 +168,7 @@ LookupGuidedSectionToolPath (
}
for ( ; GuidTool != NULL; GuidTool = GuidTool->Next) {
if (CompareGuid (&(GuidTool->Guid), SectionGuid) == 0) {
if (BtCompareGuid (&(GuidTool->Guid), SectionGuid) == 0) {
return CloneString (GuidTool->Path);
}
}

View File

@ -10,19 +10,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
--*/
#include <Common/UefiBaseTypes.h>
#include <IndustryStandard/PeImage.h>
#include <Common/PeImageEx.h>
#include "PeCoffLib.h"
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
Value |= (((UINT64)((*(Address) >> InstPos) & (((UINT64)1 << Size) - 1))) << ValPos)
#define INS_IMM64(Value, Address, Size, InstPos, ValPos) \
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
#define IMM64_IMM7B_INST_WORD_X 3
#define IMM64_IMM7B_SIZE_X 7
#define IMM64_IMM7B_INST_WORD_POS_X 4
@ -166,6 +158,7 @@ PeCoffLoaderRelocateRiscVImage (
**/
UINT16
EFIAPI
ThumbMovtImmediateAddress (
IN UINT16 *Instruction
)
@ -196,6 +189,7 @@ ThumbMovtImmediateAddress (
@param Address New address to patch into the instruction
**/
VOID
EFIAPI
ThumbMovtImmediatePatch (
IN OUT UINT16 *Instruction,
IN UINT16 Address

View File

@ -10,7 +10,14 @@ APPNAME = DevicePath
LIBS = $(LIB_PATH)\Common.lib
OBJECTS = DevicePath.obj UefiDevicePathLib.obj DevicePathFromText.obj DevicePathUtilities.obj
OBJECTS = DevicePath.obj
OBJECTS = $(OBJECTS) \
$(EDK2_OBJPATH)\MdePkg\Library\UefiDevicePathLib\DevicePathFromText.obj \
$(EDK2_OBJPATH)\MdePkg\Library\UefiDevicePathLib\DevicePathToText.obj \
$(EDK2_OBJPATH)\MdePkg\Library\UefiDevicePathLib\DevicePathUtilities.obj \
$(EDK2_OBJPATH)\MdePkg\Library\UefiDevicePathLib\DevicePathUtilitiesBase.obj \
$(EDK2_OBJPATH)\MdePkg\Library\UefiDevicePathLib\UefiDevicePathLib.obj
#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib

View File

@ -24,6 +24,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
#include <Protocol/DebugPort.h>
#define EFI_UART_DEVICE_PATH_GUID DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL
#define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
#define MAX_DEVICE_PATH_NODE_COUNT 1024
#define SIZE_64KB 0x00010000
@ -436,4 +441,111 @@ ConvertTextToDevicePath (
CONST CHAR16 *TextDevicePath
);
VOID
SetDevicePathEndNode (
VOID *Node
);
BOOLEAN
IsDevicePathValid (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
UINTN MaxSize
);
UINT8
DevicePathType (
CONST VOID *Node
);
UINT8
DevicePathSubType (
CONST VOID *Node
);
UINTN
DevicePathNodeLength (
CONST VOID *Node
);
EFI_DEVICE_PATH_PROTOCOL *
NextDevicePathNode (
CONST VOID *Node
);
BOOLEAN
IsDevicePathEndType (
CONST VOID *Node
);
BOOLEAN
IsDevicePathEnd (
CONST VOID *Node
);
BOOLEAN
IsDevicePathEndInstance (
CONST VOID *Node
);
UINT16
SetDevicePathNodeLength (
VOID *Node,
UINTN Length
);
VOID
SetDevicePathEndNode (
VOID *Node
);
UINTN
UefiDevicePathLibGetDevicePathSize (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibDuplicateDevicePath (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibAppendDevicePath (
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibAppendDevicePathNode (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibAppendDevicePathInstance (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibGetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
UINTN *Size
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibCreateDeviceNode (
UINT8 NodeType,
UINT8 NodeSubType,
UINT16 NodeLength
);
BOOLEAN
UefiDevicePathLibIsDevicePathMultiInstance (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
#endif

View File

@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <stdlib.h>
#include <Common/UefiBaseTypes.h>
#include <IndustryStandard/PeImage.h> // for PE32 structure definitions
#include <Common/PeImageEx.h> // for PE32 structure definitions
#include <IndustryStandard/Pci22.h> // for option ROM header structures
#include <IndustryStandard/Pci30.h>

View File

@ -304,7 +304,7 @@ Returns:
// Calculate Crc32 value
//
if (FileAction == CRC32_ENCODE) {
Status = CalculateCrc32 (FileBuffer, FileSize, &Crc32Value);
Status = BtCalculateCrc32 (FileBuffer, FileSize, &Crc32Value);
if (Status != EFI_SUCCESS) {
Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
goto Finish;
@ -324,7 +324,7 @@ Returns:
Error (NULL, 0, 3000, "Invalid", "Input file is invalid!");
goto Finish;
}
Status = CalculateCrc32 (FileBuffer + sizeof (UINT32), FileSize - sizeof (UINT32), &Crc32Value);
Status = BtCalculateCrc32 (FileBuffer + sizeof (UINT32), FileSize - sizeof (UINT32), &Crc32Value);
if (Status != EFI_SUCCESS) {
Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
goto Finish;

View File

@ -6,6 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "WinNtInclude.h"
#ifndef __GNUC__
#include <windows.h>
#include <io.h>
@ -23,7 +25,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Common/UefiBaseTypes.h>
#include <Common/PiFirmwareFile.h>
#include <IndustryStandard/PeImage.h>
#include <Common/PeImageEx.h>
#include <Guid/FfsSectionAlignmentPadding.h>
#include "CommonLib.h"
@ -469,6 +471,7 @@ Returns:
}
EFI_STATUS
EFIAPI
FfsRebaseImageRead (
IN VOID *FileHandle,
IN UINTN FileOffset,
@ -895,7 +898,7 @@ Returns:
goto Finish;
}
if (CompareGuid (&FileGuid, &mZeroGuid) == 0) {
if (BtCompareGuid (&FileGuid, &mZeroGuid) == 0) {
Error (NULL, 0, 1001, "Missing option", "fileguid");
goto Finish;
}

View File

@ -1047,7 +1047,7 @@ Returns:
Status = GetSectionByType (FfsFile, EFI_SECTION_FREEFORM_SUBTYPE_GUID, 1,
&PadSection);
if (EFI_ERROR (Status) ||
CompareGuid (&PadSection.FreeformSubtypeSection->SubTypeGuid,
BtCompareGuid (&PadSection.FreeformSubtypeSection->SubTypeGuid,
&mEfiFfsSectionAlignmentPaddingGuid) != 0) {
return FALSE;
}
@ -1254,7 +1254,7 @@ Returns:
// Verify the input file is the duplicated file in this Fv image
//
for (Index1 = 0; Index1 < Index; Index1 ++) {
if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {
if (BtCompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {
Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %uth file have the same file GUID.", (unsigned) Index1 + 1, (unsigned) Index + 1);
PrintGuid ((EFI_GUID *) FileBuffer);
free (FileBuffer);
@ -2679,8 +2679,8 @@ Returns:
mFvDataInfo.FvNameGuid.Data4[7]);
}
if (CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0 ||
CompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem3Guid) == 0) {
if (BtCompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0 ||
BtCompareGuid (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem3Guid) == 0) {
mFvDataInfo.IsPiFvImage = TRUE;
}
@ -2821,7 +2821,7 @@ Returns:
//
FvHeader->HeaderLength = (UINT16) (((UINTN) &(FvHeader->BlockMap[Index + 1])) - (UINTN) FvImage);
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
//
// If there is no FFS file, generate one empty FV
@ -2901,7 +2901,7 @@ Returns:
// Fv Extension header change update Fv Header Check sum
//
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
}
//
@ -2967,7 +2967,7 @@ Returns:
// Update Checksum for FvHeader
//
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
}
if (mRiscV) {
@ -2983,7 +2983,7 @@ Returns:
// Update Checksum for FvHeader
//
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
}
if (mLoongArch) {
@ -2996,7 +2996,7 @@ Returns:
// Update Checksum for FvHeader
//
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
}
//
@ -3009,16 +3009,16 @@ Returns:
// Update Checksum for FvHeader
//
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
}
//
// If there are large FFS in FV, the file system GUID should set to system 3 GUID.
//
if (mIsLargeFfs && CompareGuid (&FvHeader->FileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0) {
if (mIsLargeFfs && BtCompareGuid (&FvHeader->FileSystemGuid, &mEfiFirmwareFileSystem2Guid) == 0) {
memcpy (&FvHeader->FileSystemGuid, &mEfiFirmwareFileSystem3Guid, sizeof (EFI_GUID));
FvHeader->Checksum = 0;
FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
FvHeader->Checksum = BtCalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
}
WriteFile:
@ -3341,6 +3341,7 @@ Returns:
}
EFI_STATUS
EFIAPI
FfsRebaseImageRead (
IN VOID *FileHandle,
IN UINTN FileOffset,
@ -4414,7 +4415,7 @@ Returns:
//
// Set Default Capsule Guid value
//
if (CompareGuid (&mCapDataInfo.CapGuid, &mZeroGuid) == 0) {
if (BtCompareGuid (&mCapDataInfo.CapGuid, &mZeroGuid) == 0) {
memcpy (&mCapDataInfo.CapGuid, &mDefaultCapsuleGuid, sizeof (EFI_GUID));
}
//

View File

@ -20,8 +20,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Common/PiFirmwareFile.h>
#include <Common/PiFirmwareVolume.h>
#include <Guid/PiFirmwareFileSystem.h>
#include <IndustryStandard/PeImage.h>
#include <Guid/FirmwareFileSystem2.h>
#include <Guid/FirmwareFileSystem3.h>
#include <Common/PeImageEx.h>
#include "CommonLib.h"
#include "ParseInf.h"

View File

@ -5,6 +5,8 @@ Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "WinNtInclude.h"
#ifndef __GNUC__
#include <windows.h>
#include <io.h>
@ -19,8 +21,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Common/UefiBaseTypes.h>
#include <Common/PiFirmwareFile.h>
#include <Protocol/GuidedSectionExtraction.h>
#include <IndustryStandard/PeImage.h>
#include <Common/GuidedSectionExtractionEx.h>
#include <Common/PeImageEx.h>
#include "CommonLib.h"
#include "Compress.h"
@ -870,7 +872,7 @@ Returns:
);
if (Status == EFI_BUFFER_TOO_SMALL) {
if (CompareGuid (VendorGuid, &mZeroGuid) == 0) {
if (BtCompareGuid (VendorGuid, &mZeroGuid) == 0) {
Offset = sizeof (CRC32_SECTION_HEADER);
if (InputLength + Offset >= MAX_SECTION_SIZE) {
Offset = sizeof (CRC32_SECTION_HEADER2);
@ -927,12 +929,12 @@ Returns:
//
// Now data is in FileBuffer + Offset
//
if (CompareGuid (VendorGuid, &mZeroGuid) == 0) {
if (BtCompareGuid (VendorGuid, &mZeroGuid) == 0) {
//
// Default Guid section is CRC32.
//
Crc32Checksum = 0;
CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
BtCalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
if (TotalLength >= MAX_SECTION_SIZE) {
Crc32GuidSect2 = (CRC32_SECTION_HEADER2 *) FileBuffer;
@ -1142,6 +1144,7 @@ Returns:
}
EFI_STATUS
EFIAPI
FfsRebaseImageRead (
IN VOID *FileHandle,
IN UINTN FileOffset,
@ -1750,14 +1753,14 @@ Returns:
//
if ((SectType != EFI_SECTION_GUID_DEFINED) && (SectType != EFI_SECTION_FREEFORM_SUBTYPE_GUID) &&
(SectionName != NULL) &&
(CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
(BtCompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
fprintf (stdout, "Warning: the input guid value is not required for this section type %s\n", SectionName);
}
//
// Check whether there is GUID for the SubtypeGuid section
//
if ((SectType == EFI_SECTION_FREEFORM_SUBTYPE_GUID) && (CompareGuid (&VendorGuid, &mZeroGuid) == 0)) {
if ((SectType == EFI_SECTION_FREEFORM_SUBTYPE_GUID) && (BtCompareGuid (&VendorGuid, &mZeroGuid) == 0)) {
Error (NULL, 0, 1001, "Missing options", "GUID");
goto Finish;
}
@ -1811,7 +1814,7 @@ Returns:
break;
case EFI_SECTION_GUID_DEFINED:
if (InputFileAlign != NULL && (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
if (InputFileAlign != NULL && (BtCompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
//
// Only process alignment for the default known CRC32 guided section.
// For the unknown guided section, the alignment is processed when the dummy all section (EFI_SECTION_ALL) is generated.

View File

@ -0,0 +1,94 @@
/** @file
AutoGen definitions for edk2 package code consumption in BaseTools.
Copyright (c) 2023, Marvin Häuser. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _BT_AUTOGENH
#define _BT_AUTOGENH
#ifdef __cplusplus
extern "C" {
#endif
#include <Base.h>
#include <Library/PcdLib.h>
extern GUID gEfiCallerIdGuid;
extern GUID gEdkiiDscPlatformGuid;
extern CHAR8 *gEfiCallerBaseName;
#define EFI_CALLER_ID_GUID \
{0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
#define EDKII_DSC_PLATFORM_GUID \
{0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
// Definition of SkuId Array
extern UINT64 _gPcd_SkuId_Array[];
// Definition of PCDs used in this module
#define _PCD_TOKEN_PcdMaximumAsciiStringLength 0U
#define _PCD_SIZE_PcdMaximumAsciiStringLength 4
#define _PCD_GET_MODE_SIZE_PcdMaximumAsciiStringLength _PCD_SIZE_PcdMaximumAsciiStringLength
#define _PCD_VALUE_PcdMaximumAsciiStringLength 0U
#define _PCD_GET_MODE_32_PcdMaximumAsciiStringLength _PCD_VALUE_PcdMaximumAsciiStringLength
//#define _PCD_SET_MODE_32_PcdMaximumAsciiStringLength ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdMaximumUnicodeStringLength 0U
#define _PCD_SIZE_PcdMaximumUnicodeStringLength 4
#define _PCD_GET_MODE_SIZE_PcdMaximumUnicodeStringLength _PCD_SIZE_PcdMaximumUnicodeStringLength
#define _PCD_VALUE_PcdMaximumUnicodeStringLength 0U
#define _PCD_GET_MODE_32_PcdMaximumUnicodeStringLength _PCD_VALUE_PcdMaximumUnicodeStringLength
//#define _PCD_SET_MODE_32_PcdMaximumUnicodeStringLength ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdMaximumLinkedListLength 0U
#define _PCD_SIZE_PcdMaximumLinkedListLength 4
#define _PCD_GET_MODE_SIZE_PcdMaximumLinkedListLength _PCD_SIZE_PcdMaximumLinkedListLength
#define _PCD_VALUE_PcdMaximumLinkedListLength 0U
#define _PCD_GET_MODE_32_PcdMaximumLinkedListLength _PCD_VALUE_PcdMaximumLinkedListLength
//#define _PCD_SET_MODE_32_PcdMaximumLinkedListLength ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdVerifyNodeInList 0U
#define _PCD_SIZE_PcdVerifyNodeInList 1
#define _PCD_GET_MODE_SIZE_PcdVerifyNodeInList _PCD_SIZE_PcdVerifyNodeInList
#define _PCD_VALUE_PcdVerifyNodeInList 1U
#define _PCD_GET_MODE_BOOL_PcdVerifyNodeInList _PCD_VALUE_PcdVerifyNodeInList
//#define _PCD_SET_MODE_BOOL_PcdVerifyNodeInList ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdFixedDebugPrintErrorLevel 0U
#define _PCD_SIZE_PcdFixedDebugPrintErrorLevel 4
#define _PCD_GET_MODE_SIZE_PcdFixedDebugPrintErrorLevel _PCD_SIZE_PcdFixedDebugPrintErrorLevel
#define _PCD_VALUE_PcdFixedDebugPrintErrorLevel 0xFFFFFFFFU
#define _PCD_GET_MODE_32_PcdFixedDebugPrintErrorLevel _PCD_VALUE_PcdFixedDebugPrintErrorLevel
//#define _PCD_SET_MODE_32_PcdFixedDebugPrintErrorLevel ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdDebugPropertyMask 0U
#define _PCD_SIZE_PcdDebugPropertyMask 1
#define _PCD_GET_MODE_SIZE_PcdDebugPropertyMask _PCD_SIZE_PcdDebugPropertyMask
#define _PCD_VALUE_PcdDebugPropertyMask 0xFFU
#define _PCD_GET_MODE_8_PcdDebugPropertyMask _PCD_VALUE_PcdDebugPropertyMask
//#define _PCD_SET_MODE_8_PcdDebugPropertyMask ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdDebugClearMemoryValue 0U
#define _PCD_SIZE_PcdDebugClearMemoryValue 1
#define _PCD_GET_MODE_SIZE_PcdDebugClearMemoryValue _PCD_SIZE_PcdDebugClearMemoryValue
#define _PCD_VALUE_PcdDebugClearMemoryValue 0xAFU
#define _PCD_GET_MODE_8_PcdDebugClearMemoryValue _PCD_VALUE_PcdDebugClearMemoryValue
//#define _PCD_SET_MODE_8_PcdDebugClearMemoryValue ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdDebugPrintErrorLevel 0U
#define _PCD_SIZE_PcdDebugPrintErrorLevel 4
#define _PCD_GET_MODE_SIZE_PcdDebugPrintErrorLevel _PCD_SIZE_PcdDebugPrintErrorLevel
#define _PCD_VALUE_PcdDebugPrintErrorLevel 0x8000004F
#define _PCD_GET_MODE_32_PcdDebugPrintErrorLevel _PCD_VALUE_PcdDebugPrintErrorLevel
//#define _PCD_SET_MODE_32_PcdDebugPrintErrorLevel ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#ifdef __cplusplus
}
#endif
#endif

View File

@ -8,303 +8,37 @@
**/
#ifndef __BASE_TYPES_H__
#define __BASE_TYPES_H__
#ifndef __BT_BASE_TYPES_H__
#define __BT_BASE_TYPES_H__
//
// Include processor specific binding
// To be able to safely include Windows headers, we need to include
// WinNtInclude.h first.
//
#include <ProcessorBind.h>
#include "WinNtInclude.h"
#include <stdarg.h>
#include <stdint.h>
//
// Modifiers to abstract standard types to aid in debug of problems
// Base.h is a C header and must be linked against as such.
// Without this, MSVC may fail to link against _ReturnAddress.
//
#define CONST const
#define STATIC static
#define VOID void
//
// Modifiers for Data Types used to self document code.
// This concept is borrowed for UEFI specification.
//
#ifndef IN
//
// Some other environments use this construct, so #ifndef to prevent
// multiple definition.
//
#define IN
#define OUT
#define OPTIONAL
#ifdef __cplusplus
extern "C" {
#endif
//
// Constants. They may exist in other build structures, so #ifndef them.
// These macros may have been declared previously by C standard libraries.
//
#ifndef TRUE
//
// BugBug: UEFI specification claims 1 and 0. We are concerned about the
// compiler portability so we did it this way.
//
#define TRUE ((BOOLEAN)(1==1))
#undef NULL
#undef FALSE
#undef TRUE
#include <Base.h>
#ifdef __cplusplus
}
#endif
#ifndef FALSE
#define FALSE ((BOOLEAN)(0==1))
#endif
#ifndef NULL
#define NULL ((VOID *) 0)
#endif
#define PACKED
//
// Support for variable length argument lists using the ANSI standard.
//
// Since we are using the ANSI standard we used the standard naming and
// did not follow the coding convention
//
// VA_LIST - typedef for argument list.
// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
// VA_END (VA_LIST Marker) - Clear Marker
// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from
// the ... list. You must know the size and pass it in this macro.
//
// example:
//
// UINTN
// ExampleVarArg (
// IN UINTN NumberOfArgs,
// ...
// )
// {
// VA_LIST Marker;
// UINTN Index;
// UINTN Result;
//
// //
// // Initialize the Marker
// //
// VA_START (Marker, NumberOfArgs);
// for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) {
// //
// // The ... list is a series of UINTN values, so average them up.
// //
// Result += VA_ARG (Marker, UINTN);
// }
//
// VA_END (Marker);
// return Result
// }
//
#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
//
// Also support coding convention rules for var arg macros
//
#ifndef VA_START
// typedef CHAR8 *VA_LIST;
// #define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
// #define VA_ARG(ap, t) (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
// #define VA_END(ap) (ap = (VA_LIST) 0)
// Use the native arguments for tools.
#define VA_START va_start
#define VA_ARG va_arg
#define VA_END va_end
#define VA_LIST va_list
#endif
#ifndef GUID_DEFINED
#define GUID_DEFINED
///
/// 128 bit buffer containing a unique identifier value.
/// Unless otherwise specified, aligned on a 64 bit boundary.
///
typedef struct {
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];
} GUID;
#endif
///
/// 4-byte buffer. An IPv4 internet protocol address.
///
typedef struct {
UINT8 Addr[4];
} IPv4_ADDRESS;
///
/// 16-byte buffer. An IPv6 internet protocol address.
///
typedef struct {
UINT8 Addr[16];
} IPv6_ADDRESS;
//
// Macro that returns the byte offset of a field in a data structure.
//
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
///
/// _CR - returns a pointer to the structure
/// from one of its elements.
///
#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
///
/// ALIGN_POINTER - aligns a pointer to the lowest boundary
///
#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
///
/// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor
///
#define ALIGN_VARIABLE(Value, Adjustment) \
Adjustment = 0U; \
if ((UINTN) (Value) % sizeof (UINTN)) { \
(Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \
} \
(Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
//
// Return the maximum of two operands.
// This macro returns the maximum of two operand specified by a and b.
// Both a and b must be the same numerical types, signed or unsigned.
//
#define MAX(a, b) \
(((a) > (b)) ? (a) : (b))
//
// Return the minimum of two operands.
// This macro returns the minimal of two operand specified by a and b.
// Both a and b must be the same numerical types, signed or unsigned.
//
#define MIN(a, b) \
(((a) < (b)) ? (a) : (b))
//
// EFI Error Codes common to all execution phases
//
typedef UINTN RETURN_STATUS;
///
/// Set the upper bit to indicate EFI Error.
///
#define ENCODE_ERROR(a) ((RETURN_STATUS)(MAX_BIT | (a)))
#define ENCODE_WARNING(a) ((RETURN_STATUS)(a))
#define RETURN_ERROR(a) (((INTN)(RETURN_STATUS)(a)) < 0)
#define RETURN_SUCCESS 0
#define RETURN_LOAD_ERROR ENCODE_ERROR (1)
#define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)
#define RETURN_UNSUPPORTED ENCODE_ERROR (3)
#define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)
#define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)
#define RETURN_NOT_READY ENCODE_ERROR (6)
#define RETURN_DEVICE_ERROR ENCODE_ERROR (7)
#define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)
#define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)
#define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)
#define RETURN_VOLUME_FULL ENCODE_ERROR (11)
#define RETURN_NO_MEDIA ENCODE_ERROR (12)
#define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)
#define RETURN_NOT_FOUND ENCODE_ERROR (14)
#define RETURN_ACCESS_DENIED ENCODE_ERROR (15)
#define RETURN_NO_RESPONSE ENCODE_ERROR (16)
#define RETURN_NO_MAPPING ENCODE_ERROR (17)
#define RETURN_TIMEOUT ENCODE_ERROR (18)
#define RETURN_NOT_STARTED ENCODE_ERROR (19)
#define RETURN_ALREADY_STARTED ENCODE_ERROR (20)
#define RETURN_ABORTED ENCODE_ERROR (21)
#define RETURN_ICMP_ERROR ENCODE_ERROR (22)
#define RETURN_TFTP_ERROR ENCODE_ERROR (23)
#define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)
#define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)
#define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)
#define RETURN_CRC_ERROR ENCODE_ERROR (27)
#define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
#define RETURN_END_OF_FILE ENCODE_ERROR (31)
#define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
#define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
#define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)
#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
typedef UINT64 PHYSICAL_ADDRESS;
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
#define BIT32 0x0000000100000000ULL
#define BIT33 0x0000000200000000ULL
#define BIT34 0x0000000400000000ULL
#define BIT35 0x0000000800000000ULL
#define BIT36 0x0000001000000000ULL
#define BIT37 0x0000002000000000ULL
#define BIT38 0x0000004000000000ULL
#define BIT39 0x0000008000000000ULL
#define BIT40 0x0000010000000000ULL
#define BIT41 0x0000020000000000ULL
#define BIT42 0x0000040000000000ULL
#define BIT43 0x0000080000000000ULL
#define BIT44 0x0000100000000000ULL
#define BIT45 0x0000200000000000ULL
#define BIT46 0x0000400000000000ULL
#define BIT47 0x0000800000000000ULL
#define BIT48 0x0001000000000000ULL
#define BIT49 0x0002000000000000ULL
#define BIT50 0x0004000000000000ULL
#define BIT51 0x0008000000000000ULL
#define BIT52 0x0010000000000000ULL
#define BIT53 0x0020000000000000ULL
#define BIT54 0x0040000000000000ULL
#define BIT55 0x0080000000000000ULL
#define BIT56 0x0100000000000000ULL
#define BIT57 0x0200000000000000ULL
#define BIT58 0x0400000000000000ULL
#define BIT59 0x0800000000000000ULL
#define BIT60 0x1000000000000000ULL
#define BIT61 0x2000000000000000ULL
#define BIT62 0x4000000000000000ULL
#define BIT63 0x8000000000000000ULL
#endif

View File

@ -0,0 +1,36 @@
/** @file
This file declares GUIDed section extraction protocol.
This interface provides a means of decoding a GUID defined encapsulation
section. There may be multiple different GUIDs associated with the GUIDed
section extraction protocol. That is, all instances of the GUIDed section
extraction protocol must have the same interface structure.
@par Revision Reference: PI
Version 1.00.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __BT_EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
#define __BT_EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
#include <Protocol/GuidedSectionExtraction.h>
#include <Guid/Crc32GuidedSectionExtraction.h>
//
// Protocol GUID definition. Each GUIDed section extraction protocol has the
// same interface but with different GUID. All the GUIDs is defined here.
// May add multiple GUIDs here.
//
#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID
//
// may add other GUID here
//
#define gEfiCrc32GuidedSectionExtractionProtocolGuid gEfiCrc32GuidedSectionExtractionGuid
#endif

View File

@ -7,227 +7,10 @@
**/
#ifndef _MDEMODULE_HII_H
#define _MDEMODULE_HII_H
#ifndef _BT_MDEMODULE_HII_H
#define _BT_MDEMODULE_HII_H
#define NARROW_CHAR 0xFFF0
#define WIDE_CHAR 0xFFF1
#define NON_BREAKING_CHAR 0xFFF2
///
/// State defined for password statemachine .
///
#define BROWSER_STATE_VALIDATE_PASSWORD 0
#define BROWSER_STATE_SET_PASSWORD 1
///
/// GUIDed opcodes defined for EDKII implementation.
///
#define EFI_IFR_TIANO_GUID \
{ 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce} }
#pragma pack(1)
///
/// EDKII implementation extension opcodes, new extension can be added here later.
///
#define EFI_IFR_EXTEND_OP_LABEL 0x0
#define EFI_IFR_EXTEND_OP_BANNER 0x1
#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
#define EFI_IFR_EXTEND_OP_CLASS 0x3
#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
///
/// Label opcode.
///
typedef struct _EFI_IFR_GUID_LABEL {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_TIANO_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_LABEL.
///
UINT8 ExtendOpCode;
///
/// Label Number.
///
UINT16 Number;
} EFI_IFR_GUID_LABEL;
#define EFI_IFR_BANNER_ALIGN_LEFT 0
#define EFI_IFR_BANNER_ALIGN_CENTER 1
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
///
/// Banner opcode.
///
typedef struct _EFI_IFR_GUID_BANNER {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_TIANO_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_BANNER
///
UINT8 ExtendOpCode;
EFI_STRING_ID Title; ///< The string token for the banner title.
UINT16 LineNumber; ///< 1-based line number.
UINT8 Alignment; ///< left, center, or right-aligned.
} EFI_IFR_GUID_BANNER;
///
/// Timeout opcode.
///
typedef struct _EFI_IFR_GUID_TIMEOUT {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_TIANO_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_TIMEOUT.
///
UINT8 ExtendOpCode;
UINT16 TimeOut; ///< TimeOut Value.
} EFI_IFR_GUID_TIMEOUT;
#define EFI_NON_DEVICE_CLASS 0x00
#define EFI_DISK_DEVICE_CLASS 0x01
#define EFI_VIDEO_DEVICE_CLASS 0x02
#define EFI_NETWORK_DEVICE_CLASS 0x04
#define EFI_INPUT_DEVICE_CLASS 0x08
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
#define EFI_OTHER_DEVICE_CLASS 0x20
///
/// Device Class opcode.
///
typedef struct _EFI_IFR_GUID_CLASS {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_TIANO_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_CLASS.
///
UINT8 ExtendOpCode;
UINT16 Class; ///< Device Class from the above.
} EFI_IFR_GUID_CLASS;
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
#define EFI_FRONT_PAGE_SUBCLASS 0x02
#define EFI_SINGLE_USE_SUBCLASS 0x03
///
/// SubClass opcode
///
typedef struct _EFI_IFR_GUID_SUBCLASS {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_TIANO_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_SUBCLASS.
///
UINT8 ExtendOpCode;
UINT16 SubClass; ///< Sub Class type from the above.
} EFI_IFR_GUID_SUBCLASS;
///
/// GUIDed opcodes support for framework vfr.
///
#define EFI_IFR_FRAMEWORK_GUID \
{ 0x31ca5d1a, 0xd511, 0x4931, { 0xb7, 0x82, 0xae, 0x6b, 0x2b, 0x17, 0x8c, 0xd7 } }
///
/// Two extended opcodes are added, and new extensions can be added here later.
/// One is for framework OneOf question Option Key value;
/// another is for framework vareqval.
///
#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0
#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1
///
/// Store the framework vfr option key value.
///
typedef struct _EFI_IFR_GUID_OPTIONKEY {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_FRAMEWORK_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_OPTIONKEY.
///
UINT8 ExtendOpCode;
///
/// OneOf Questiond ID binded by OneOf Option.
///
EFI_QUESTION_ID QuestionId;
///
/// The OneOf Option Value.
///
EFI_IFR_TYPE_VALUE OptionValue;
///
/// The Framework OneOf Option Key Value.
///
UINT16 KeyValue;
} EFI_IFR_GUID_OPTIONKEY;
///
/// Store the framework vfr vareqval name number.
///
typedef struct _EFI_IFR_GUID_VAREQNAME {
EFI_IFR_OP_HEADER Header;
///
/// EFI_IFR_FRAMEWORK_GUID.
///
EFI_GUID Guid;
///
/// EFI_IFR_EXTEND_OP_VAREQNAME.
///
UINT8 ExtendOpCode;
///
/// Question ID of the Numeric Opcode created.
///
EFI_QUESTION_ID QuestionId;
///
/// For vareqval (0x100), NameId is 0x100.
/// This value will convert to a Unicode String following this rule;
/// sprintf(StringBuffer, "%d", NameId) .
/// The Unicode String will be used as a EFI Variable Name.
///
UINT16 NameId;
} EFI_IFR_GUID_VAREQNAME;
///
/// EDKII implementation extension GUID, used to indicate there are bit fields in the varstore.
///
#define EDKII_IFR_BIT_VARSTORE_GUID \
{ 0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60 ,0xA7, 0x1D}}
///
/// EDKII implementation extension flags, used to indicate the display style and bit width for bit filed storage.
/// Two high bits for display style and the low six bits for bit width.
///
#define EDKII_IFR_DISPLAY_BIT 0xC0
#define EDKII_IFR_DISPLAY_INT_DEC_BIT 0x00
#define EDKII_IFR_DISPLAY_UINT_DEC_BIT 0x40
#define EDKII_IFR_DISPLAY_UINT_HEX_BIT 0x80
#define EDKII_IFR_NUMERIC_SIZE_BIT 0x3F
#pragma pack()
extern EFI_GUID gEfiIfrTianoGuid;
extern EFI_GUID gEfiIfrFrameworkGuid;
extern EFI_GUID gEdkiiIfrBitVarStoreGuid;
#include <Guid/MdeModuleHii.h>
#endif

View File

@ -0,0 +1,59 @@
/** @file
EFI image format for PE32+. Please note some data structures are different
for IA-32 and Itanium-based images, look for UINTN and the #ifdef EFI_IA64
@bug Fix text - doc as defined in MSFT EFI specification.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __BT_PE_IMAGE_H__
#define __BT_PE_IMAGE_H__
#include <IndustryStandard/PeImage.h>
//
// PE32+ Machine type for EFI images
//
#define IMAGE_FILE_MACHINE_ARM 0x01c0
#define IMAGE_FILE_MACHINE_ARMT IMAGE_FILE_MACHINE_ARMTHUMB_MIXED
//
// Support old names for backward compatible
//
#define EFI_IMAGE_MACHINE_ARMT EFI_IMAGE_MACHINE_ARMTHUMB_MIXED
#define EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 // Supports addresses > 2-GB
//
// Based export types.
//
#define EFI_IMAGE_EXPORT_ORDINAL_BASE 1
#define EFI_IMAGE_EXPORT_ADDR_SIZE 4
#define EFI_IMAGE_EXPORT_ORDINAL_SIZE 2
//
// .pdata entries for X64
//
typedef struct {
UINT32 FunctionStartAddress;
UINT32 FunctionEndAddress;
UINT32 UnwindInfoAddress;
} RUNTIME_FUNCTION;
typedef struct {
UINT8 Version:3;
UINT8 Flags:5;
UINT8 SizeOfProlog;
UINT8 CountOfUnwindCodes;
UINT8 FrameRegister:4;
UINT8 FrameRegisterOffset:4;
} UNWIND_INFO;
#endif

View File

@ -10,308 +10,24 @@
**/
#ifndef __PI_FIRMWARE_FILE_H__
#define __PI_FIRMWARE_FILE_H__
#ifndef __BT_PI_FIRMWARE_FILE_H__
#define __BT_PI_FIRMWARE_FILE_H__
#pragma pack(1)
//
// Used to verify the integrity of the file.
//
typedef union {
struct {
UINT8 Header;
UINT8 File;
} Checksum;
UINT16 Checksum16;
} EFI_FFS_INTEGRITY_CHECK;
#include <Uefi/UefiMultiPhase.h>
#include <Pi/PiMultiPhase.h>
typedef UINT8 EFI_FV_FILETYPE;
typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
typedef UINT8 EFI_FFS_FILE_STATE;
#define MAX_FFS_SIZE 0x1000000
#define MAX_SECTION_SIZE 0x1000000
//
// File Types Definitions
//
#define EFI_FV_FILETYPE_ALL 0x00
#define EFI_FV_FILETYPE_RAW 0x01
#define EFI_FV_FILETYPE_FREEFORM 0x02
#define EFI_FV_FILETYPE_SECURITY_CORE 0x03
#define EFI_FV_FILETYPE_PEI_CORE 0x04
#define EFI_FV_FILETYPE_DXE_CORE 0x05
#define EFI_FV_FILETYPE_PEIM 0x06
#define EFI_FV_FILETYPE_DRIVER 0x07
#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER 0x08
#define EFI_FV_FILETYPE_APPLICATION 0x09
#define EFI_FV_FILETYPE_SMM 0x0A
#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
#define EFI_FV_FILETYPE_COMBINED_SMM_DXE 0x0C
#define EFI_FV_FILETYPE_SMM_CORE 0x0D
#define EFI_FV_FILETYPE_MM_STANDALONE 0x0E
#define EFI_FV_FILETYPE_MM_CORE_STANDALONE 0x0F
#define EFI_FV_FILETYPE_OEM_MIN 0xc0
#define EFI_FV_FILETYPE_OEM_MAX 0xdf
#define EFI_FV_FILETYPE_DEBUG_MIN 0xe0
#define EFI_FV_FILETYPE_DEBUG_MAX 0xef
#define EFI_FV_FILETYPE_FFS_MIN 0xf0
#define EFI_FV_FILETYPE_FFS_MAX 0xff
#define EFI_FV_FILETYPE_FFS_PAD 0xf0
//
// FFS File Attributes.
//
#define FFS_ATTRIB_LARGE_FILE 0x01
#define FFS_ATTRIB_DATA_ALIGNMENT2 0x02
#define FFS_ATTRIB_FIXED 0x04
#define FFS_ATTRIB_DATA_ALIGNMENT 0x38
#define FFS_ATTRIB_CHECKSUM 0x40
//
// FFS_FIXED_CHECKSUM is the checksum value used when the
// FFS_ATTRIB_CHECKSUM attribute bit is clear
//
#define FFS_FIXED_CHECKSUM 0xAA
//
// FFS File State Bits.
//
#define EFI_FILE_HEADER_CONSTRUCTION 0x01
#define EFI_FILE_HEADER_VALID 0x02
#define EFI_FILE_DATA_VALID 0x04
#define EFI_FILE_MARKED_FOR_UPDATE 0x08
#define EFI_FILE_DELETED 0x10
#define EFI_FILE_HEADER_INVALID 0x20
#define EFI_FILE_ALL_STATE_BITS (EFI_FILE_HEADER_CONSTRUCTION | \
EFI_FILE_HEADER_VALID | \
EFI_FILE_DATA_VALID | \
EFI_FILE_MARKED_FOR_UPDATE | \
EFI_FILE_DELETED | \
EFI_FILE_HEADER_INVALID \
)
//
// Each file begins with the header that describe the
// contents and state of the files.
//
typedef struct {
EFI_GUID Name;
EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
EFI_FV_FILETYPE Type;
EFI_FFS_FILE_ATTRIBUTES Attributes;
UINT8 Size[3];
EFI_FFS_FILE_STATE State;
} EFI_FFS_FILE_HEADER;
typedef struct {
EFI_GUID Name;
EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
EFI_FV_FILETYPE Type;
EFI_FFS_FILE_ATTRIBUTES Attributes;
UINT8 Size[3];
EFI_FFS_FILE_STATE State;
UINT64 ExtendedSize;
} EFI_FFS_FILE_HEADER2;
#define MAX_FFS_SIZE 0x1000000
typedef UINT8 EFI_SECTION_TYPE;
//
// Pseudo type. It is
// used as a wild card when retrieving sections. The section
// type EFI_SECTION_ALL matches all section types.
//
#define EFI_SECTION_ALL 0x00
//
// Encapsulation section Type values
//
#define EFI_SECTION_COMPRESSION 0x01
#define EFI_SECTION_GUID_DEFINED 0x02
//
// Leaf section Type values
//
#define EFI_SECTION_PE32 0x10
#define EFI_SECTION_PIC 0x11
#define EFI_SECTION_TE 0x12
#define EFI_SECTION_DXE_DEPEX 0x13
#define EFI_SECTION_VERSION 0x14
#define EFI_SECTION_USER_INTERFACE 0x15
#define EFI_SECTION_COMPATIBILITY16 0x16
#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
#define EFI_SECTION_RAW 0x19
#define EFI_SECTION_PEI_DEPEX 0x1B
#define EFI_SECTION_SMM_DEPEX 0x1C
typedef struct {
UINT8 Size[3];
EFI_SECTION_TYPE Type;
} EFI_COMMON_SECTION_HEADER;
typedef struct {
UINT8 Size[3];
EFI_SECTION_TYPE Type;
UINT32 ExtendedSize;
} EFI_COMMON_SECTION_HEADER2;
#define MAX_SECTION_SIZE 0x1000000
//
// Leaf section type that contains an
// IA-32 16-bit executable image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;
#define FFS_ATTRIB_DATA_ALIGNMENT2 FFS_ATTRIB_DATA_ALIGNMENT_2
//
// CompressionType of EFI_COMPRESSION_SECTION.
//
#define EFI_NOT_COMPRESSED 0x00
#define EFI_STANDARD_COMPRESSION 0x01
#define TIANO_COMPRESS 0x02
//
// An encapsulation section type in which the
// section data is compressed.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
UINT32 UncompressedLength;
UINT8 CompressionType;
} EFI_COMPRESSION_SECTION;
typedef struct {
EFI_COMMON_SECTION_HEADER2 CommonHeader;
UINT32 UncompressedLength;
UINT8 CompressionType;
} EFI_COMPRESSION_SECTION2;
//
// Leaf section which could be used to determine the dispatch order of DXEs.
//
typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2;
//
// Leaf section witch contains a PI FV.
//
typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;
//
// Leaf section which contains a single GUID.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
EFI_GUID SubTypeGuid;
} EFI_FREEFORM_SUBTYPE_GUID_SECTION;
typedef struct {
EFI_COMMON_SECTION_HEADER2 CommonHeader;
EFI_GUID SubTypeGuid;
} EFI_FREEFORM_SUBTYPE_GUID_SECTION2;
//
// Attributes of EFI_GUID_DEFINED_SECTION
//
#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED 0x01
#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID 0x02
//
// Leaf section which is encapsulation defined by specific GUID
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
EFI_GUID SectionDefinitionGuid;
UINT16 DataOffset;
UINT16 Attributes;
} EFI_GUID_DEFINED_SECTION;
typedef struct {
EFI_COMMON_SECTION_HEADER2 CommonHeader;
EFI_GUID SectionDefinitionGuid;
UINT16 DataOffset;
UINT16 Attributes;
} EFI_GUID_DEFINED_SECTION2;
//
// Leaf section which contains PE32+ image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2;
//
// Leaf section which contains PIC image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2;
//
// Leaf section which used to determine the dispatch order of PEIMs.
//
typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2;
//
// Leaf section which constains the position-independent-code image.
//
typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2;
//
// Leaf section which contains an array of zero or more bytes.
//
typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2;
//
// Leaf section which contains a unicode string that
// is human readable file name.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
//
// Array of unicode string.
//
CHAR16 FileNameString[1];
} EFI_USER_INTERFACE_SECTION;
typedef struct {
EFI_COMMON_SECTION_HEADER2 CommonHeader;
//
// Array of unicode string.
//
CHAR16 FileNameString[1];
} EFI_USER_INTERFACE_SECTION2;
//
// Leaf section which contains a numeric build number and
// an optional unicode string that represent the file revision.
//
typedef struct {
EFI_COMMON_SECTION_HEADER CommonHeader;
UINT16 BuildNumber;
CHAR16 VersionString[1];
} EFI_VERSION_SECTION;
typedef struct {
EFI_COMMON_SECTION_HEADER2 CommonHeader;
UINT16 BuildNumber;
CHAR16 VersionString[1];
} EFI_VERSION_SECTION2;
//
// The argument passed as the SectionHeaderPtr parameter to the SECTION_SIZE()
// function-like macro below must not have side effects: SectionHeaderPtr is
// evaluated multiple times.
//
#define SECTION_SIZE(SectionHeaderPtr) ((UINT32) ( \
(((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[0] ) | \
(((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[1] << 8) | \
(((EFI_COMMON_SECTION_HEADER *) (SectionHeaderPtr))->Size[2] << 16)))
#pragma pack()
typedef union {
EFI_COMMON_SECTION_HEADER *CommonHeader;

View File

@ -10,148 +10,9 @@
**/
#ifndef __PI_FIRMWAREVOLUME_H__
#define __PI_FIRMWAREVOLUME_H__
#ifndef __BT_PI_FIRMWAREVOLUME_H__
#define __BT_PI_FIRMWAREVOLUME_H__
//
// EFI_FV_FILE_ATTRIBUTES
//
typedef UINT32 EFI_FV_FILE_ATTRIBUTES;
//
// Value of EFI_FV_FILE_ATTRIBUTES.
//
#define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F
#define EFI_FV_FILE_ATTRIB_FIXED 0x00000100
#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED 0x00000200
typedef UINT32 EFI_FVB_ATTRIBUTES_2;
//
// Attributes bit definitions
//
#define EFI_FVB2_READ_DISABLED_CAP 0x00000001
#define EFI_FVB2_READ_ENABLED_CAP 0x00000002
#define EFI_FVB2_READ_STATUS 0x00000004
#define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
#define EFI_FVB2_WRITE_ENABLED_CAP 0x00000010
#define EFI_FVB2_WRITE_STATUS 0x00000020
#define EFI_FVB2_LOCK_CAP 0x00000040
#define EFI_FVB2_LOCK_STATUS 0x00000080
#define EFI_FVB2_STICKY_WRITE 0x00000200
#define EFI_FVB2_MEMORY_MAPPED 0x00000400
#define EFI_FVB2_ERASE_POLARITY 0x00000800
#define EFI_FVB2_READ_LOCK_CAP 0x00001000
#define EFI_FVB2_READ_LOCK_STATUS 0x00002000
#define EFI_FVB2_WRITE_LOCK_CAP 0x00004000
#define EFI_FVB2_WRITE_LOCK_STATUS 0x00008000
#define EFI_FVB2_ALIGNMENT 0x001F0000
#define EFI_FVB2_WEAK_ALIGNMENT 0x80000000
#define EFI_FVB2_ALIGNMENT_1 0x00000000
#define EFI_FVB2_ALIGNMENT_2 0x00010000
#define EFI_FVB2_ALIGNMENT_4 0x00020000
#define EFI_FVB2_ALIGNMENT_8 0x00030000
#define EFI_FVB2_ALIGNMENT_16 0x00040000
#define EFI_FVB2_ALIGNMENT_32 0x00050000
#define EFI_FVB2_ALIGNMENT_64 0x00060000
#define EFI_FVB2_ALIGNMENT_128 0x00070000
#define EFI_FVB2_ALIGNMENT_256 0x00080000
#define EFI_FVB2_ALIGNMENT_512 0x00090000
#define EFI_FVB2_ALIGNMENT_1K 0x000A0000
#define EFI_FVB2_ALIGNMENT_2K 0x000B0000
#define EFI_FVB2_ALIGNMENT_4K 0x000C0000
#define EFI_FVB2_ALIGNMENT_8K 0x000D0000
#define EFI_FVB2_ALIGNMENT_16K 0x000E0000
#define EFI_FVB2_ALIGNMENT_32K 0x000F0000
#define EFI_FVB2_ALIGNMENT_64K 0x00100000
#define EFI_FVB2_ALIGNMENT_128K 0x00110000
#define EFI_FVB2_ALIGNMENT_256K 0x00120000
#define EFI_FVB2_ALIGNMENT_512K 0x00130000
#define EFI_FVB2_ALIGNMENT_1M 0x00140000
#define EFI_FVB2_ALIGNMENT_2M 0x00150000
#define EFI_FVB2_ALIGNMENT_4M 0x00160000
#define EFI_FVB2_ALIGNMENT_8M 0x00170000
#define EFI_FVB2_ALIGNMENT_16M 0x00180000
#define EFI_FVB2_ALIGNMENT_32M 0x00190000
#define EFI_FVB2_ALIGNMENT_64M 0x001A0000
#define EFI_FVB2_ALIGNMENT_128M 0x001B0000
#define EFI_FVB2_ALIGNMENT_256M 0x001C0000
#define EFI_FVB2_ALIGNMENT_512M 0x001D0000
#define EFI_FVB2_ALIGNMENT_1G 0x001E0000
#define EFI_FVB2_ALIGNMENT_2G 0x001F0000
typedef struct {
UINT32 NumBlocks;
UINT32 Length;
} EFI_FV_BLOCK_MAP_ENTRY;
//
// Describes the features and layout of the firmware volume.
//
typedef struct {
UINT8 ZeroVector[16];
EFI_GUID FileSystemGuid;
UINT64 FvLength;
UINT32 Signature;
EFI_FVB_ATTRIBUTES_2 Attributes;
UINT16 HeaderLength;
UINT16 Checksum;
UINT16 ExtHeaderOffset;
UINT8 Reserved[1];
UINT8 Revision;
EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
} EFI_FIRMWARE_VOLUME_HEADER;
#define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
///
/// Firmware Volume Header Revision definition
///
#define EFI_FVH_REVISION 0x02
//
// Extension header pointed by ExtHeaderOffset of volume header.
//
typedef struct {
EFI_GUID FvName;
UINT32 ExtHeaderSize;
} EFI_FIRMWARE_VOLUME_EXT_HEADER;
typedef struct {
UINT16 ExtEntrySize;
UINT16 ExtEntryType;
} EFI_FIRMWARE_VOLUME_EXT_ENTRY;
#define EFI_FV_EXT_TYPE_OEM_TYPE 0x01
typedef struct {
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
UINT32 TypeMask;
//
// Array of GUIDs.
// Each GUID represents an OEM file type.
//
// EFI_GUID Types[1];
//
} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
#define EFI_FV_EXT_TYPE_GUID_TYPE 0x0002
typedef struct {
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
EFI_GUID FormatType;
//
// An array of bytes of length Length.
//
// UINT8 Data[1];
//
} EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE;
#define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03
typedef struct {
EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
UINT32 UsedSize;
} EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE;
#include <Common/PiFirmwareFile.h>
#endif

View File

@ -7,162 +7,10 @@
**/
#ifndef __UEFI_BASETYPE_H__
#define __UEFI_BASETYPE_H__
#ifndef __BT_UEFI_BASETYPE_H__
#define __BT_UEFI_BASETYPE_H__
#include <Common/BaseTypes.h>
//
// Basical data type definitions introduced in UEFI.
//
typedef struct {
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
UINT8 Data4[8];
} EFI_GUID;
typedef RETURN_STATUS EFI_STATUS;
typedef VOID *EFI_HANDLE;
typedef VOID *EFI_EVENT;
typedef UINTN EFI_TPL;
typedef UINT64 EFI_LBA;
typedef UINT16 STRING_REF;
typedef UINT64 EFI_PHYSICAL_ADDRESS;
typedef UINT64 EFI_VIRTUAL_ADDRESS;
//
// EFI Time Abstraction:
// Year: 2000 - 20XX
// Month: 1 - 12
// Day: 1 - 31
// Hour: 0 - 23
// Minute: 0 - 59
// Second: 0 - 59
// Nanosecond: 0 - 999,999,999
// TimeZone: -1440 to 1440 or 2047
//
typedef struct {
UINT16 Year;
UINT8 Month;
UINT8 Day;
UINT8 Hour;
UINT8 Minute;
UINT8 Second;
UINT8 Pad1;
UINT32 Nanosecond;
INT16 TimeZone;
UINT8 Daylight;
UINT8 Pad2;
} EFI_TIME;
//
// Networking Definitions
//
typedef struct {
UINT8 Addr[4];
} EFI_IPv4_ADDRESS;
typedef struct {
UINT8 Addr[16];
} EFI_IPv6_ADDRESS;
typedef struct {
UINT8 Addr[32];
} EFI_MAC_ADDRESS;
typedef union {
UINT32 Addr[4];
EFI_IPv4_ADDRESS v4;
EFI_IPv6_ADDRESS v6;
} EFI_IP_ADDRESS;
//
// Enumeration of EFI_STATUS.
//
#define EFI_SUCCESS RETURN_SUCCESS
#define EFI_LOAD_ERROR RETURN_LOAD_ERROR
#define EFI_INVALID_PARAMETER RETURN_INVALID_PARAMETER
#define EFI_UNSUPPORTED RETURN_UNSUPPORTED
#define EFI_BAD_BUFFER_SIZE RETURN_BAD_BUFFER_SIZE
#define EFI_BUFFER_TOO_SMALL RETURN_BUFFER_TOO_SMALL
#define EFI_NOT_READY RETURN_NOT_READY
#define EFI_DEVICE_ERROR RETURN_DEVICE_ERROR
#define EFI_WRITE_PROTECTED RETURN_WRITE_PROTECTED
#define EFI_OUT_OF_RESOURCES RETURN_OUT_OF_RESOURCES
#define EFI_VOLUME_CORRUPTED RETURN_VOLUME_CORRUPTED
#define EFI_VOLUME_FULL RETURN_VOLUME_FULL
#define EFI_NO_MEDIA RETURN_NO_MEDIA
#define EFI_MEDIA_CHANGED RETURN_MEDIA_CHANGED
#define EFI_NOT_FOUND RETURN_NOT_FOUND
#define EFI_ACCESS_DENIED RETURN_ACCESS_DENIED
#define EFI_NO_RESPONSE RETURN_NO_RESPONSE
#define EFI_NO_MAPPING RETURN_NO_MAPPING
#define EFI_TIMEOUT RETURN_TIMEOUT
#define EFI_NOT_STARTED RETURN_NOT_STARTED
#define EFI_ALREADY_STARTED RETURN_ALREADY_STARTED
#define EFI_ABORTED RETURN_ABORTED
#define EFI_ICMP_ERROR RETURN_ICMP_ERROR
#define EFI_TFTP_ERROR RETURN_TFTP_ERROR
#define EFI_PROTOCOL_ERROR RETURN_PROTOCOL_ERROR
#define EFI_INCOMPATIBLE_VERSION RETURN_INCOMPATIBLE_VERSION
#define EFI_SECURITY_VIOLATION RETURN_SECURITY_VIOLATION
#define EFI_CRC_ERROR RETURN_CRC_ERROR
#define EFI_END_OF_MEDIA RETURN_END_OF_MEDIA
#define EFI_END_OF_FILE RETURN_END_OF_FILE
#define EFI_WARN_UNKNOWN_GLYPH RETURN_WARN_UNKNOWN_GLYPH
#define EFI_WARN_DELETE_FAILURE RETURN_WARN_DELETE_FAILURE
#define EFI_WARN_WRITE_FAILURE RETURN_WARN_WRITE_FAILURE
#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
#define NULL_HANDLE ((VOID *) 0)
//
// Define macro to encode the status code.
//
#define EFIERR(_a) ENCODE_ERROR(_a)
#define EFI_ERROR(A) RETURN_ERROR(A)
//
// Define macros to build data structure signatures from characters.
//
#define SIGNATURE_16(A, B) ((A) | (B << 8))
#define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
(SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
//
// Returns the byte offset to a field within a structure
//
#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
//
// The EFI memory allocation functions work in units of EFI_PAGEs that are
// 4K. This should in no way be confused with the page size of the processor.
// An EFI_PAGE is just the quanta of memory in EFI.
//
#define EFI_PAGE_SIZE 0x1000
#define EFI_PAGE_MASK 0xFFF
#define EFI_PAGE_SHIFT 12
#define EFI_SIZE_TO_PAGES(a) (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))
#define EFI_PAGES_TO_SIZE(a) ( (a) << EFI_PAGE_SHIFT)
#define EFI_MAX_BIT MAX_BIT
#include <Uefi/UefiBaseType.h>
#endif

View File

@ -9,18 +9,10 @@
**/
#ifndef _EFI_CAPSULE_H_
#define _EFI_CAPSULE_H_
#ifndef _BT_EFI_CAPSULE_H_
#define _BT_EFI_CAPSULE_H_
typedef struct {
EFI_GUID CapsuleGuid;
UINT32 HeaderSize;
UINT32 Flags;
UINT32 CapsuleImageSize;
} EFI_CAPSULE_HEADER;
#include <Common/UefiBaseTypes.h>
#include <Uefi/UefiSpec.h>
#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
#endif // #ifndef _EFI_CAPSULE_H_
#endif // #ifndef _EFI_CAPSULE_H_

View File

@ -1,226 +0,0 @@
/** @file
This includes some definitions introduced in UEFI that will be used in both PEI
and DXE phases.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __UEFI_MULTIPHASE_H__
#define __UEFI_MULTIPHASE_H__
//
// Enumeration of memory types introduced in UEFI.
//
typedef enum {
EfiReservedMemoryType,
EfiLoaderCode,
EfiLoaderData,
EfiBootServicesCode,
EfiBootServicesData,
EfiRuntimeServicesCode,
EfiRuntimeServicesData,
EfiConventionalMemory,
EfiUnusableMemory,
EfiACPIReclaimMemory,
EfiACPIMemoryNVS,
EfiMemoryMappedIO,
EfiMemoryMappedIOPortSpace,
EfiPalCode,
EfiPersistentMemory,
EfiMaxMemoryType
} EFI_MEMORY_TYPE;
//
// Data structure that precedes all of the standard EFI table types.
//
typedef struct {
UINT64 Signature;
UINT32 Revision;
UINT32 HeaderSize;
UINT32 CRC32;
UINT32 Reserved;
} EFI_TABLE_HEADER;
//
// Attributes of variable.
//
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
//
// This attribute is identified by the mnemonic 'HR'
// elsewhere in this specification.
//
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
//
// _WIN_CERTIFICATE.wCertificateType
//
#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
/**
The WIN_CERTIFICATE structure is part of the PE/COFF
specification and has the following definition:
@param dwLength The length of the entire certificate,
including the length of the header, in
bytes.
@param wRevision The revision level of the WIN_CERTIFICATE
structure. The current revision level is
0x0200.
@param wCertificateType The certificate type. See
WIN_CERT_TYPE_xxx for the UEFI
certificate types. The UEFI
specification reserves the range of
certificate type values from 0x0EF0
to 0x0EFF.
@param bCertificate The actual certificate. The format of
the certificate depends on
wCertificateType. The format of the UEFI
certificates is defined below.
**/
typedef struct _WIN_CERTIFICATE {
UINT32 dwLength;
UINT16 wRevision;
UINT16 wCertificateType;
//UINT8 bCertificate[ANYSIZE_ARRAY];
} WIN_CERTIFICATE;
//
// WIN_CERTIFICATE_UEFI_GUID.CertType
//
#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
{0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
//
// WIN_CERTIFICATE_UEFI_GUID.CertData
//
typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
EFI_GUID HashType;
UINT8 PublicKey[256];
UINT8 Signature[256];
} EFI_CERT_BLOCK_RSA_2048_SHA256;
/**
@param Hdr This is the standard WIN_CERTIFICATE header, where
wCertificateType is set to
WIN_CERT_TYPE_EFI_GUID.
@param CertType This is the unique id which determines the
format of the CertData. In this case, the
value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.
@param CertData This is the certificate data. The format of
the data is determined by the CertType. In
this case the value is
EFI_CERT_BLOCK_RSA_2048_SHA256.
@param Information The WIN_CERTIFICATE_UEFI_GUID certificate
type allows new types of certificates to
be developed for driver authentication
without requiring a new certificate type.
The CertType defines the format of the
CertData, which length is defined by the
size of the certificate less the fixed
size of the WIN_CERTIFICATE_UEFI_GUID
structure.
**/
typedef struct _WIN_CERTIFICATE_UEFI_GUID {
WIN_CERTIFICATE Hdr;
EFI_GUID CertType;
UINT8 CertData[1];
} WIN_CERTIFICATE_UEFI_GUID;
/**
Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
signature.
The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
WIN_CERTIFICATE and encapsulate the information needed to
implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
specified in RFC2437.
@param Hdr This is the standard WIN_CERTIFICATE header, where
wCertificateType is set to
WIN_CERT_TYPE_UEFI_PKCS1_15.
@param HashAlgorithm This is the hashing algorithm which was
performed on the UEFI executable when
creating the digital signature. It is
one of the enumerated values pre-defined
in Section 26.4.1. See
EFI_HASH_ALGORITHM_x.
@param Signature This is the actual digital signature. The
size of the signature is the same size as
the key (1024-bit key is 128 bytes) and can
be determined by subtracting the length of
the other parts of this header from the
total length of the certificate as found in
Hdr.dwLength.
**/
typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
WIN_CERTIFICATE Hdr;
EFI_GUID HashAlgorithm;
// UINT8 Signature[ANYSIZE_ARRAY];
} WIN_CERTIFICATE_EFI_PKCS1_15;
/**
AuthInfo is a WIN_CERTIFICATE using the wCertificateType
WIN_CERTIFICATE_UEFI_GUID and the CertType
EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
authenticated access, then the Data buffer should begin with an
authentication descriptor prior to the data payload and DataSize
should reflect the data.and descriptor size. The caller
shall digest the Monotonic Count value and the associated data
for the variable update using the SHA-256 1-way hash algorithm.
The ensuing the 32-byte digest will be signed using the private
key associated w/ the public/private 2048-bit RSA key-pair. The
WIN_CERTIFICATE shall be used to describe the signature of the
Variable data *Data. In addition, the signature will also
include the MonotonicCount value to guard against replay attacks
@param MonotonicCount Included in the signature of
AuthInfo.Used to ensure freshness/no
replay. Incremented during each
"Write" access.
@param AuthInfo Provides the authorization for the variable
access. It is a signature across the
variable data and the Monotonic Count
value. Caller uses Private key that is
associated with a public key that has been
provisioned via the key exchange.
**/
typedef struct {
UINT64 MonotonicCount;
WIN_CERTIFICATE_UEFI_GUID AuthInfo;
} EFI_VARIABLE_AUTHENTICATION;
#endif

View File

@ -1,44 +0,0 @@
/**@file
Header file for EFI Variable Services.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __VARIABLE_FORMAT_H__
#define __VARIABLE_FORMAT_H__
#define VARIABLE_DATA 0x55AA
//
// Variable Store Header flags
//
#define VARIABLE_STORE_FORMATTED 0x5a
#define VARIABLE_STORE_HEALTHY 0xfe
#pragma pack(1)
typedef struct {
EFI_GUID Signature;
UINT32 Size;
UINT8 Format;
UINT8 State;
UINT16 Reserved;
UINT32 Reserved1;
} VARIABLE_STORE_HEADER;
typedef struct {
UINT16 StartId;
UINT8 State;
UINT8 Reserved;
UINT32 Attributes;
UINT32 NameSize;
UINT32 DataSize;
EFI_GUID VendorGuid;
} VARIABLE_HEADER;
#pragma pack()
#endif // _EFI_VARIABLE_H_

View File

@ -1,35 +0,0 @@
/** @file
Defines data structure that is the headers found at the runtime
updatable firmware volumes, such as the FileSystemGuid of the
working block, the header structure of the variable block, FTW
working block, or event log block.
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __EFI_WORKING_BLOCK_HEADER_H__
#define __EFI_WORKING_BLOCK_HEADER_H__
//
// EFI Fault tolerant working block header
// The header is immediately followed by the write queue.
//
typedef struct {
EFI_GUID Signature;
UINT32 Crc;
UINT8 WorkingBlockValid : 1;
UINT8 WorkingBlockInvalid : 1;
#define WORKING_BLOCK_VALID 0x1
#define WORKING_BLOCK_INVALID 0x2
UINT8 Reserved : 6;
UINT8 Reserved3[3];
UINT64 WriteQueueSize;
//
// UINT8 WriteQueue[WriteQueueSize];
//
} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER;
#endif

View File

@ -1,52 +0,0 @@
/** @file
Terminal Device Path Vendor Guid.
@par Revision Reference:
GUIDs defined in UEFI 2.0 spec.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __PC_ANSI_H__
#define __PC_ANSI_H__
#define EFI_PC_ANSI_GUID \
{ \
0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
#define EFI_VT_100_GUID \
{ \
0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
}
#define EFI_VT_100_PLUS_GUID \
{ \
0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } \
}
#define EFI_VT_UTF8_GUID \
{ \
0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
}
#define EFI_UART_DEVICE_PATH_GUID \
{ \
0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
}
#define EFI_SAS_DEVICE_PATH_GUID \
{ \
0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
}
extern EFI_GUID gEfiPcAnsiGuid;
extern EFI_GUID gEfiVT100Guid;
extern EFI_GUID gEfiVT100PlusGuid;
extern EFI_GUID gEfiVTUTF8Guid;
extern EFI_GUID gEfiUartDevicePathGuid;
extern EFI_GUID gEfiSasDevicePathGuid;
#endif

View File

@ -1,39 +0,0 @@
/** @file
Guid used to define the Firmware File System. See PI spec volume 3 for more
details.
@par Revision Reference:
Guids defined in PI Spec Volume 3
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __FIRMWARE_FILE_SYSTEM2_GUID_H__
#define __FIRMWARE_FILE_SYSTEM2_GUID_H__
//
// GUIDs defined by the PI specification.
//
#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \
{ \
0x8c8ce578, 0x8a3d, 0x4f1c, {0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } \
}
#define EFI_FIRMWARE_FILE_SYSTEM3_GUID \
{ \
0x5473c07a, 0x3dcb, 0x4dca, {0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a } \
}
#define EFI_FFS_VOLUME_TOP_FILE_GUID \
{ \
0x1BA0062E, 0xC779, 0x4582, {0x85, 0x66, 0x33, 0x6A, 0xE8, 0xF7, 0x8F, 0x09 } \
}
extern EFI_GUID gEfiFirmwareFileSystem2Guid;
extern EFI_GUID gEfiFirmwareFileSystem3Guid;
extern EFI_GUID gEfiFirmwareVolumeTopFileGuid;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,288 +0,0 @@
/** @file
EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.
Use to create and manipulate device paths and device nodes.
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __DEVICE_PATH_UTILITIES_H__
#define __DEVICE_PATH_UTILITIES_H__
///
/// Device Path Utilities protocol
///
#define EFI_DEVICE_PATH_UTILITIES_GUID \
{ \
0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \
}
/**
Returns the size of the device path, in bytes.
@param DevicePath Points to the start of the EFI device path.
@return Size Size of the specified device path, in bytes, including the end-of-path tag.
@retval 0 DevicePath is NULL
**/
typedef
UINTN
( *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Create a duplicate of the specified path.
@param DevicePath Points to the source EFI device path.
@retval Pointer A pointer to the duplicate device path.
@retval NULL insufficient memory or DevicePath is NULL
**/
typedef
EFI_DEVICE_PATH_PROTOCOL*
( *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Create a new path by appending the second device path to the first.
If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.
If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.
If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.
@param Src1 Points to the first device path.
@param Src2 Points to the second device path.
@retval Pointer A pointer to the newly created device path.
@retval NULL Memory could not be allocated
**/
typedef
EFI_DEVICE_PATH_PROTOCOL*
( *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(
CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
CONST EFI_DEVICE_PATH_PROTOCOL *Src2
);
/**
Creates a new path by appending the device node to the device path.
If DeviceNode is NULL then a copy of DevicePath is returned.
If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.
If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.
@param DevicePath Points to the device path.
@param DeviceNode Points to the device node.
@retval Pointer A pointer to the allocated device node.
@retval NULL There was insufficient memory.
**/
typedef
EFI_DEVICE_PATH_PROTOCOL*
( *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
);
/**
Creates a new path by appending the specified device path instance to the specified device path.
@param DevicePath Points to the device path. If NULL, then ignored.
@param DevicePathInstance Points to the device path instance.
@retval Pointer A pointer to the newly created device path
@retval NULL Memory could not be allocated or DevicePathInstance is NULL.
**/
typedef
EFI_DEVICE_PATH_PROTOCOL*
( *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
);
/**
Creates a copy of the current device path instance and returns a pointer to the next device path
instance.
@param DevicePathInstance On input, this holds the pointer to the current device path
instance. On output, this holds the pointer to the next
device path instance or NULL if there are no more device
path instances in the device path.
@param DevicePathInstanceSize On output, this holds the size of the device path instance,
in bytes or zero, if DevicePathInstance is NULL.
If NULL, then the instance size is not output.
@retval Pointer A pointer to the copy of the current device path instance.
@retval NULL DevicePathInstance was NULL on entry or there was insufficient memory.
**/
typedef
EFI_DEVICE_PATH_PROTOCOL*
( *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(
EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
UINTN *DevicePathInstanceSize
);
/**
Creates a device node
@param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for
the new device node.
@param NodeSubType NodeSubType is the device node sub-type
EFI_DEVICE_PATH.SubType) for the new device node.
@param NodeLength NodeLength is the length of the device node
(EFI_DEVICE_PATH.Length) for the new device node.
@retval Pointer A pointer to the newly created device node.
@retval NULL NodeLength is less than
the size of the header or there was insufficient memory.
**/
typedef
EFI_DEVICE_PATH_PROTOCOL*
( *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(
UINT8 NodeType,
UINT8 NodeSubType,
UINT16 NodeLength
);
/**
Returns whether a device path is multi-instance.
@param DevicePath Points to the device path. If NULL, then ignored.
@retval TRUE The device path has more than one instance
@retval FALSE The device path is empty or contains only a single instance.
**/
typedef
BOOLEAN
( *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
///
/// This protocol is used to creates and manipulates device paths and device nodes.
///
typedef struct {
EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;
EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;
EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;
EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;
EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;
EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;
EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;
EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;
} EFI_DEVICE_PATH_UTILITIES_PROTOCOL;
extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;
VOID
SetDevicePathEndNode (
VOID *Node
);
BOOLEAN
IsDevicePathValid (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
UINTN MaxSize
);
UINT8
DevicePathType (
CONST VOID *Node
);
UINT8
DevicePathSubType (
CONST VOID *Node
);
UINTN
DevicePathNodeLength (
CONST VOID *Node
);
EFI_DEVICE_PATH_PROTOCOL *
NextDevicePathNode (
CONST VOID *Node
);
BOOLEAN
IsDevicePathEndType (
CONST VOID *Node
);
BOOLEAN
IsDevicePathEnd (
CONST VOID *Node
);
BOOLEAN
IsDevicePathEndInstance (
CONST VOID *Node
);
UINT16
SetDevicePathNodeLength (
VOID *Node,
UINTN Length
);
VOID
SetDevicePathEndNode (
VOID *Node
);
UINTN
UefiDevicePathLibGetDevicePathSize (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibDuplicateDevicePath (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibAppendDevicePath (
CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibAppendDevicePathNode (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibAppendDevicePathInstance (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibGetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL **DevicePath,
UINTN *Size
);
EFI_DEVICE_PATH_PROTOCOL *
UefiDevicePathLibCreateDeviceNode (
UINT8 NodeType,
UINT8 NodeSubType,
UINT16 NodeLength
);
BOOLEAN
UefiDevicePathLibIsDevicePathMultiInstance (
CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
#endif

View File

@ -1,187 +0,0 @@
/** @file
Graphics Output Protocol from the UEFI 2.0 specification.
Abstraction of a very simple graphics device.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __GRAPHICS_OUTPUT_H__
#define __GRAPHICS_OUTPUT_H__
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
{ \
0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
}
typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
typedef struct {
UINT32 RedMask;
UINT32 GreenMask;
UINT32 BlueMask;
UINT32 ReservedMask;
} EFI_PIXEL_BITMASK;
typedef enum {
PixelRedGreenBlueReserved8BitPerColor,
PixelBlueGreenRedReserved8BitPerColor,
PixelBitMask,
PixelBltOnly,
PixelFormatMax
} EFI_GRAPHICS_PIXEL_FORMAT;
typedef struct {
UINT32 Version;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
EFI_PIXEL_BITMASK PixelInformation;
UINT32 PixelsPerScanLine;
} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
/**
Return the current video mode information.
@param This Protocol instance pointer.
@param ModeNumber The mode number to return information on.
@param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
@param Info A pointer to callee allocated buffer that returns information about ModeNumber.
@retval EFI_SUCCESS Mode information returned.
@retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
@retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
@retval EFI_INVALID_PARAMETER One of the input args was NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber,
OUT UINTN *SizeOfInfo,
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
)
;
/**
Return the current video mode information.
@param This Protocol instance pointer.
@param ModeNumber The mode number to be set.
@retval EFI_SUCCESS Graphics mode was changed.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
@retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber
)
;
typedef struct {
UINT8 Blue;
UINT8 Green;
UINT8 Red;
UINT8 Reserved;
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
typedef union {
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
UINT32 Raw;
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
typedef enum {
EfiBltVideoFill,
EfiBltVideoToBltBuffer,
EfiBltBufferToVideo,
EfiBltVideoToVideo,
EfiGraphicsOutputBltOperationMax
} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
/**
The following table defines actions for BltOperations:
<B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
directly to every pixel of the video display rectangle
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
Only one pixel will be used from the BltBuffer. Delta is NOT used.
<B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
the BltBuffer rectangle (DestinationX, DestinationY )
(DestinationX + Width, DestinationY + Height). If DestinationX or
DestinationY is not zero then Delta must be set to the length in bytes
of a row in the BltBuffer.
<B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
video display rectangle (DestinationX, DestinationY)
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
not zero then Delta must be set to the length in bytes of a row in the
BltBuffer.
<B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
(SourceX + Width, SourceY + Height) .to the video display rectangle
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
The BltBuffer and Delta are not used in this mode.
@param This Protocol instance pointer.
@param BltBuffer Buffer containing data to blit into video buffer. This
buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
@param BltOperation Operation to perform on BlitBuffer and video memory
@param SourceX X coordinate of source for the BltBuffer.
@param SourceY Y coordinate of source for the BltBuffer.
@param DestinationX X coordinate of destination for the BltBuffer.
@param DestinationY Y coordinate of destination for the BltBuffer.
@param Width Width of rectangle in BltBuffer in pixels.
@param Height Height of rectangle in BltBuffer in pixels.
@param Delta OPTIONAL
@retval EFI_SUCCESS The Blt operation completed.
@retval EFI_INVALID_PARAMETER BltOperation is not valid.
@retval EFI_DEVICE_ERROR A hardware error occurred writing to the video buffer.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
);
typedef struct {
UINT32 MaxMode;
UINT32 Mode;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
UINTN SizeOfInfo;
EFI_PHYSICAL_ADDRESS FrameBufferBase;
UINTN FrameBufferSize;
} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
};
extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
#endif

View File

@ -1,145 +0,0 @@
/** @file
This file declares GUIDed section extraction protocol.
This interface provides a means of decoding a GUID defined encapsulation
section. There may be multiple different GUIDs associated with the GUIDed
section extraction protocol. That is, all instances of the GUIDed section
extraction protocol must have the same interface structure.
@par Revision Reference: PI
Version 1.00.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
#define __EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__
//
// Forward reference for pure ANSI compatibility
typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL;
/**
The ExtractSection() function processes the input section and
allocates a buffer from the pool in which it returns the section
contents. If the section being extracted contains
authentication information (the section's
GuidedSectionHeader.Attributes field has the
EFI_GUIDED_SECTION_AUTH_STATUS_VALID bit set), the values
returned in AuthenticationStatus must reflect the results of
the authentication operation. Depending on the algorithm and
size of the encapsulated data, the time that is required to do
a full authentication may be prohibitively long for some
classes of systems. To indicate this, use
EFI_SECURITY_POLICY_PROTOCOL_GUID, which may be published by
the security policy driver (see the Platform Initialization
Driver Execution Environment Core Interface Specification for
more details and the GUID definition). If the
EFI_SECURITY_POLICY_PROTOCOL_GUID exists in the handle
database, then, if possible, full authentication should be
skipped and the section contents simply returned in the
OutputBuffer. In this case, the
EFI_AUTH_STATUS_PLATFORM_OVERRIDE bit AuthenticationStatus
must be set on return. ExtractSection() is callable only from
TPL_NOTIFY and below. Behavior of ExtractSection() at any
EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
defined in RaiseTPL() in the UEFI 2.0 specification.
@param This Indicates the
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
@param InputSection Buffer containing the input GUIDed section
to be processed. OutputBuffer OutputBuffer
is allocated from boot services pool
memory and contains the new section
stream. The caller is responsible for
freeing this buffer.
@param OutputSize A pointer to a caller-allocated UINTN in
which the size of OutputBuffer allocation
is stored. If the function returns
anything other than EFI_SUCCESS, the value
of OutputSize is undefined.
@param AuthenticationStatus A pointer to a caller-allocated
UINT32 that indicates the
authentication status of the
output buffer. If the input
section's
GuidedSectionHeader.Attributes
field has the
EFI_GUIDED_SECTION_AUTH_STATUS_VAL
bit as clear, AuthenticationStatus
must return zero. Both local bits
(19:16) and aggregate bits (3:0)
in AuthenticationStatus are
returned by ExtractSection().
These bits reflect the status of
the extraction operation. The bit
pattern in both regions must be
the same, as the local and
aggregate authentication statuses
have equivalent meaning at this
level. If the function returns
anything other than EFI_SUCCESS,
the value of AuthenticationStatus
is undefined.
@retval EFI_SUCCESS The InputSection was successfully
processed and the section contents were
returned.
@retval EFI_OUT_OF_RESOURCES The system has insufficient
resources to process the
request.
@retval EFI_INVALID_PARAMETER The GUID in InputSection does
not match this instance of the
GUIDed Section Extraction
Protocol.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_EXTRACT_GUIDED_SECTION)(
IN CONST EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,
IN CONST VOID *InputSection,
OUT VOID **OutputBuffer,
OUT UINTN *OutputSize,
OUT UINT32 *AuthenticationStatus
);
/**
Takes the GUIDed section as input and produces the section
stream data. See the ExtractSection() function description.
**/
struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL {
EFI_EXTRACT_GUIDED_SECTION ExtractSection;
};
//
// Protocol GUID definition. Each GUIDed section extraction protocol has the
// same interface but with different GUID. All the GUIDs is defined here.
// May add multiple GUIDs here.
//
#define EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID \
{ \
0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } \
}
//
// may add other GUID here
//
extern EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid;
#endif

View File

@ -1,944 +0,0 @@
/** @file
This file defines the Human Interface Infrastructure protocol which will
be used by resources which want to publish IFR/Font/String data and have it
collected by the Configuration engine.
@par Revision Reference:
This protocol is defined in HII spec 0.92.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _FRAMEWORK_HII_H_
#define _FRAMEWORK_HII_H_
//#include <PiDxe.h>
//
// To get EFI_GRAPHICS_OUTPUT_BLT_PIXEL,
// is defined in MdePkg/Protocol/GraphicsOutput.h
//
#include <Protocol/GraphicsOutput.h>
#define EFI_HII_PROTOCOL_GUID \
{ \
0xd7ad636e, 0xb997, 0x459b, {0xbf, 0x3f, 0x88, 0x46, 0x89, 0x79, 0x80, 0xe1} \
}
// BugBug:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// If UGA goes away we need to put this some place. I'm not sure where?
//
//typedef struct {
// UINT8 Blue;
// UINT8 Green;
// UINT8 Red;
// UINT8 Reserved;
//} EFI_UGA_PIXEL;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
typedef struct _EFI_HII_PROTOCOL EFI_HII_PROTOCOL;
//
// Global definition
//
#define NARROW_CHAR 0xFFF0
#define WIDE_CHAR 0xFFF1
#define NON_BREAKING_CHAR 0xFFF2
#define GLYPH_WIDTH 8
#define GLYPH_HEIGHT 19
#define EFI_HII_FONT 1
#define EFI_HII_STRING 2
#define EFI_HII_IFR 3
#define EFI_HII_KEYBOARD 4
#define EFI_HII_HANDLES 5
#define EFI_HII_VARIABLE 6
#define EFI_HII_DEVICE_PATH 7
// References to string tokens must use this macro to enable scanning for
// token usages.
//
#define STRING_TOKEN(t) t
//
// The following types are currently defined:
// EFI_FROM_ID has been defined in UEFI spec.
//
typedef UINT16 EFI_FORM_LABEL;
#pragma pack(1)
typedef struct {
UINT32 Length;
UINT16 Type;
} EFI_HII_PACK_HEADER;
//
// A form list consists of a large variety of structure
// possibilities so to represent the binary blob of data
// associated with a package of forms, we will assume a
// pointer to a self-describing data buffer.
//
typedef struct {
EFI_HII_PACK_HEADER Header;
} EFI_HII_IFR_PACK;
typedef struct {
EFI_HII_PACK_HEADER Header; // Must be filled in
EFI_HANDLE ImageHandle; // Must be filled in
EFI_HANDLE DeviceHandle; // Optional
EFI_HANDLE ControllerHandle; // Optional
EFI_HANDLE CallbackHandle; // Optional
EFI_HANDLE COBExportHandle; // Optional
} EFI_HII_HANDLE_PACK;
//
// ********************************************************
// EFI_VARIABLE_CONTENTS
// ********************************************************
//
typedef struct {
EFI_HII_PACK_HEADER Header;
EFI_GUID VariableGuid;
UINT32 VariableNameLength;
UINT16 VariableId;
//
// CHAR16 VariableName[]; //Null-terminated
//
} EFI_HII_VARIABLE_PACK;
//
// ********************************************************
// EFI_DEVICE_PATH_PACK
// ********************************************************
//
typedef struct {
EFI_HII_PACK_HEADER Header;
//
// EFI_DEVICE_PATH DevicePath[];
//
} EFI_HII_DEVICE_PATH_PACK;
//
// ********************************************************
// EFI_HII_DATA_TABLE
// ********************************************************
//
typedef struct {
EFI_HII_HANDLE HiiHandle;
EFI_GUID PackageGuid;
UINT32 DataTableSize;
UINT32 IfrDataOffset;
UINT32 StringDataOffset;
UINT32 VariableDataOffset;
UINT32 DevicePathOffset;
UINT32 NumberOfVariableData;
UINT32 NumberOfLanguages;
//
// EFI_HII_DEVICE_PATH_PACK DevicePath[];
// EFI_HII_VARIABLE_PACK VariableData[];
// EFI_HII_IFR_PACK IfrData;
// EFI_HII_STRING_PACK StringData[];
//
} EFI_HII_DATA_TABLE;
//
// ********************************************************
// EFI_HII_EXPORT_TABLE
// ********************************************************
//
typedef struct {
UINT32 NumberOfHiiDataTables;
EFI_GUID Revision;
//
// EFI_HII_DATA_TABLE HiiDataTable[];
//
} EFI_HII_EXPORT_TABLE;
typedef struct {
BOOLEAN FormSetUpdate; // If TRUE, next variable is significant
EFI_PHYSICAL_ADDRESS FormCallbackHandle; // If not 0, will update Formset with this info
BOOLEAN FormUpdate; // If TRUE, next variable is significant
UINT16 FormValue; // specify which form is to be updated if FormUpdate value is TRUE.
STRING_REF FormTitle; // If not 0, will update Form with this info
UINT16 DataCount; // The number of Data entries in this structure
UINT8 *Data; // An array of 1+ op-codes, specified by DataCount
} EFI_HII_UPDATE_DATA;
//
// String attributes
//
#define LANG_RIGHT_TO_LEFT 0x00000001
//
// A string package is used to localize strings to a particular
// language. The package is associated with a particular driver
// or set of drivers. Tools are used to associate tokens with
// string references in forms and in programs. These tokens are
// language agnostic. When paired with a language pack (directly
// or indirectly), the string token resolves into an actual
// UNICODE string. The NumStringPointers determines how many
// StringPointers (offset values) there are as well as the total
// number of Strings that are defined.
//
typedef struct {
EFI_HII_PACK_HEADER Header;
RELOFST LanguageNameString;
RELOFST PrintableLanguageName;
UINT32 NumStringPointers;
UINT32 Attributes;
//
// RELOFST StringPointers[];
// EFI_STRING Strings[];
//
} EFI_HII_STRING_PACK;
//
// Glyph Attributes
//
#define EFI_GLYPH_NON_SPACING 1
#define EFI_GLYPH_WIDE 2
typedef struct {
CHAR16 UnicodeWeight;
UINT8 Attributes;
UINT8 GlyphCol1[GLYPH_HEIGHT];
} EFI_NARROW_GLYPH;
typedef struct {
CHAR16 UnicodeWeight;
UINT8 Attributes;
UINT8 GlyphCol1[GLYPH_HEIGHT];
UINT8 GlyphCol2[GLYPH_HEIGHT];
UINT8 Pad[3];
} EFI_WIDE_GLYPH;
//
// A font list consists of a font header followed by a series
// of glyph structures. Note that fonts are not language specific.
//
typedef struct {
EFI_HII_PACK_HEADER Header;
UINT16 NumberOfNarrowGlyphs;
UINT16 NumberOfWideGlyphs;
} EFI_HII_FONT_PACK;
//
// The IfrData in the EFI_HII_IFR_PACK structure definition
// is variable length, and not really part of the header. To
// simplify from code the size of the header, define an
// identical structure that does not include the IfrData field.
// Then use sizeof() this new structure to determine the
// actual size of the header.
//
typedef struct {
EFI_HII_PACK_HEADER Header;
} EFI_HII_IFR_PACK_HEADER;
//
// pedef EFI_HII_PACK_HEADER EFI_HII_IFR_PACK_HEADER;
//
typedef enum {
EfiKeyLCtrl,
EfiKeyA0,
EfiKeyLAlt,
EfiKeySpaceBar,
EfiKeyA2,
EfiKeyA3,
EfiKeyA4,
EfiKeyRCtrl,
EfiKeyLeftArrow,
EfiKeyDownArrow,
EfiKeyRightArrow,
EfiKeyZero,
EfiKeyPeriod,
EfiKeyEnter,
EfiKeyLShift,
EfiKeyB0,
EfiKeyB1,
EfiKeyB2,
EfiKeyB3,
EfiKeyB4,
EfiKeyB5,
EfiKeyB6,
EfiKeyB7,
EfiKeyB8,
EfiKeyB9,
EfiKeyB10,
EfiKeyRshift,
EfiKeyUpArrow,
EfiKeyOne,
EfiKeyTwo,
EfiKeyThree,
EfiKeyCapsLock,
EfiKeyC1,
EfiKeyC2,
EfiKeyC3,
EfiKeyC4,
EfiKeyC5,
EfiKeyC6,
EfiKeyC7,
EfiKeyC8,
EfiKeyC9,
EfiKeyC10,
EfiKeyC11,
EfiKeyC12,
EfiKeyFour,
EfiKeyFive,
EfiKeySix,
EfiKeyPlus,
EfiKeyTab,
EfiKeyD1,
EfiKeyD2,
EfiKeyD3,
EfiKeyD4,
EfiKeyD5,
EfiKeyD6,
EfiKeyD7,
EfiKeyD8,
EfiKeyD9,
EfiKeyD10,
EfiKeyD11,
EfiKeyD12,
EfiKeyD13,
EfiKeyDel,
EfiKeyEnd,
EfiKeyPgDn,
EfiKeySeven,
EfiKeyEight,
EfiKeyNine,
EfiKeyE0,
EfiKeyE1,
EfiKeyE2,
EfiKeyE3,
EfiKeyE4,
EfiKeyE5,
EfiKeyE6,
EfiKeyE7,
EfiKeyE8,
EfiKeyE9,
EfiKeyE10,
EfiKeyE11,
EfiKeyE12,
EfiKeyBackSpace,
EfiKeyIns,
EfiKeyHome,
EfiKeyPgUp,
EfiKeyNLck,
EfiKeySlash,
EfiKeyAsterisk,
EfiKeyMinus,
EfiKeyEsc,
EfiKeyF1,
EfiKeyF2,
EfiKeyF3,
EfiKeyF4,
EfiKeyF5,
EfiKeyF6,
EfiKeyF7,
EfiKeyF8,
EfiKeyF9,
EfiKeyF10,
EfiKeyF11,
EfiKeyF12,
EfiKeyPrint,
EfiKeySLck,
EfiKeyPause
} EFI_KEY;
typedef struct {
EFI_KEY Key;
CHAR16 Unicode;
CHAR16 ShiftedUnicode;
CHAR16 AltGrUnicode;
CHAR16 ShiftedAltGrUnicode;
UINT16 Modifier;
} EFI_KEY_DESCRIPTOR;
//
// This structure allows a sparse set of keys to be redefined
// or a complete redefinition of the keyboard layout. Most
// keyboards have a lot of commonality in their layouts, therefore
// only defining those keys that need to change from the default
// minimizes the passed in information.
//
// Additionally, when an update occurs, the active keyboard layout
// will be switched to the newly updated keyboard layout. This
// allows for situations that when a keyboard layout driver is
// loaded as part of system initialization, the system will default
// the keyboard behavior to the new layout.
//
// Each call to update the keyboard mapping should contain the
// complete set of key descriptors to be updated, since every
// call to the HII which contains an EFI_HII_KEYBOARD_PACK will
// wipe the previous set of overrides. A call to
//
typedef struct {
EFI_HII_PACK_HEADER Header;
EFI_KEY_DESCRIPTOR *Descriptor;
UINT8 DescriptorCount;
} EFI_HII_KEYBOARD_PACK;
//
// The EFI_HII_PACKAGES can contain different types of packages just
// after the structure as inline data.
//
typedef struct {
UINTN NumberOfPackages;
EFI_GUID *GuidId;
//
// EFI_HII_HANDLE_PACK *HandlePack; // Only one pack.
// EFI_HII_IFR_PACK *IfrPack; // Only one pack.
// EFI_HII_FONT_PACK *FontPack[]; // Multiple packs ok
// EFI_HII_STRING_PACK *StringPack[]; // Multiple packs ok
// EFI_HII_KEYBOARD_PACK *KeyboardPack[]; // Multiple packs ok
//
} EFI_HII_PACKAGES;
typedef struct _EFI_HII_VARIABLE_PACK_LIST {
struct _EFI_HII_VARIABLE_PACK_LIST *NextVariablePack;
EFI_HII_VARIABLE_PACK *VariablePack;
} EFI_HII_VARIABLE_PACK_LIST;
#pragma pack()
/**
Registers the various packs that are passed in via the Packages parameter.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Packages A pointer to an EFI_HII_PACKAGES package instance.
@param Handle A pointer to the EFI_HII_HANDLE instance.
@retval EFI_SUCCESS Data was extracted from Packages, the database
was updated with the data, and Handle returned successfully.
@retval EFI_INVALID_PARAMETER The content of Packages was invalid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_NEW_PACK) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_PACKAGES *Packages,
OUT EFI_HII_HANDLE *Handle
);
/**
Removes a package from the HII database.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The handle that was registered to the data that is requested
for removal.
@retval EFI_SUCCESS The data associated with the Handle was removed
from the HII database.
@retval EFI_INVALID_PARAMETER The Handle was not valid.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_REMOVE_PACK) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle
);
/**
Determines the handles that are currently active in the database.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param HandleBufferLength On input, a pointer to the length of the handle
buffer. On output, the length of the handle buffer that is required
for the handles found.
@param Handle An array of EFI_HII_HANDLE instances returned.
@retval EFI_SUCCESS Handle was updated successfully.
@retval EFI_BUFFER_TOO_SMALL The HandleBufferLength parameter indicates
that Handle is too small to support the number of handles.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_FIND_HANDLES) (
IN EFI_HII_PROTOCOL *This,
IN OUT UINT16 *HandleBufferLength,
OUT EFI_HII_HANDLE *Handle
);
/**
Exports the contents of the database into a buffer.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle An EFI_HII_HANDLE that corresponds to the desired
handle to export. If the value is 0, the entire database will be exported.
In either case, the data will be exported in a format described by the
structure definition of EFI_HII_EXPORT_TABLE.
@param BufferSize
On input, a pointer to the length of the buffer. On output, the length
of the buffer that is required for the export data.
@param Buffer A pointer to a buffer that will contain the results of the export function.
@retval EFI_SUCCESS The buffer was successfully filled with BufferSize amount of data.
@retval EFI_BUFFER_TOO_SMALL The value in BufferSize was too small to contain the export data.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_EXPORT) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
/**
Remove any new strings that were added after the initial string export
for this handle.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The handle on which the string resides.
@retval EFI_SUCCESS Remove strings from the handle successfully.
@retval EFI_INVALID_PARAMETER The Handle was unknown.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_RESET_STRINGS) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle
);
/**
Tests if all of the characters in a string have corresponding font characters.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param StringToTest A pointer to a Unicode string.
@param FirstMissing A pointer to an index into the string. On input,
the index of the first character in the StringToTest to examine. On exit,
the index of the first character encountered for which a glyph is unavailable.
If all glyphs in the string are available, the index is the index of the
terminator of the string.
@param GlyphBufferSize A pointer to a value. On output, if the function
returns EFI_SUCCESS, it contains the amount of memory that is required to
store the string's glyph equivalent.
@retval EFI_SUCCESS All glyphs are available. Note that an empty string
always returns this value.
@retval EFI_NOT_FOUND A glyph was not found for a character.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_TEST_STRING) (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *StringToTest,
IN OUT UINT32 *FirstMissing,
OUT UINT32 *GlyphBufferSize
);
/**
Translates a Unicode character into the corresponding font glyph.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Source A pointer to a Unicode string.
@param Index On input, the offset into the string from which to fetch
the character.On successful completion, the index is updated to the first
character past the character(s) making up the just extracted glyph.
@param GlyphBuffer Pointer to an array where the glyphs corresponding
to the characters in the source may be stored. GlyphBuffer is assumed
to be wide enough to accept a wide glyph character.
@param BitWidth If EFI_SUCCESS was returned, the UINT16 pointed to by
this value is filled with the length of the glyph in pixels. It is unchanged
if the call was unsuccessful.
@param InternalStatus The cell pointed to by this parameter must be
initialized to zero prior to invoking the call the first time for any string.
@retval EFI_SUCCESS It worked.
@retval EFI_NOT_FOUND A glyph for a character was not found.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_GLYPH) (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Source,
IN OUT UINT16 *Index,
OUT UINT8 **GlyphBuffer,
OUT UINT16 *BitWidth,
IN OUT UINT32 *InternalStatus
);
/**
Translates a glyph into the format required for input to the Universal
Graphics Adapter (UGA) Block Transfer (BLT) routines.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param GlyphBuffer A pointer to the buffer that contains glyph data.
@param Foreground The foreground setting requested to be used for the
generated BltBuffer data.
@param Background The background setting requested to be used for the
generated BltBuffer data.
@param Count The entry in the BltBuffer upon which to act.
@param Width The width in bits of the glyph being converted.
@param Height The height in bits of the glyph being converted
@param BltBuffer A pointer to the buffer that contains the data that is
ready to be used by the UGA BLT routines.
@retval EFI_SUCCESS It worked.
@retval EFI_NOT_FOUND A glyph for a character was not found.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GLYPH_TO_BLT) (
IN EFI_HII_PROTOCOL *This,
IN UINT8 *GlyphBuffer,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
IN UINTN Count,
IN UINTN Width,
IN UINTN Height,
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
);
/**
Allows a new string to be added to an already existing string package.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Pointer to a NULL-terminated string containing a single ISO 639-2
language identifier, indicating the language in which the string is translated.
@param Handle The handle of the language pack to which the string is to be added.
@param Reference The identifier of the string to be added. If the reference
value is zero, then the string will be assigned a new identifier on that
handle for the language specified. Otherwise, the string will be updated
with the NewString Value.
@param NewString The string to be added.
@retval EFI_SUCCESS The string was effectively registered.
@retval EFI_INVALID_PARAMETER The Handle was unknown.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_NEW_STRING) (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Language,
IN EFI_HII_HANDLE Handle,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
);
/**
Allows a program to determine the primary languages that are supported
on a given handle.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The handle on which the strings reside.
@param LanguageString A string allocated by GetPrimaryLanguages() that
contains a list of all primary languages registered on the handle.
@retval EFI_SUCCESS LanguageString was correctly returned.
@retval EFI_INVALID_PARAMETER The Handle was unknown.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_PRI_LANGUAGES) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
OUT EFI_STRING *LanguageString
);
/**
Allows a program to determine which secondary languages are supported
on a given handle for a given primary language.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The handle on which the strings reside.
@param PrimaryLanguage Pointer to a NULL-terminated string containing a single
ISO 639-2 language identifier, indicating the primary language.
@param LanguageString A string allocated by GetSecondaryLanguages()
containing a list of all secondary languages registered on the handle.
@retval EFI_SUCCESS LanguageString was correctly returned.
@retval EFI_INVALID_PARAMETER The Handle was unknown.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_SEC_LANGUAGES) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN CHAR16 *PrimaryLanguage,
OUT EFI_STRING *LanguageString
);
/**
Extracts a string from a package already registered with the EFI HII database.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The handle on which the string resides.
@param Token The string token assigned to the string.
@param Raw If TRUE, the string is returned unedited in the internal
storage format described above. If false, the string returned is edited
by replacing <cr> with <space> and by removing special characters such
as the <wide> prefix.
@param LanguageString Pointer to a NULL-terminated string containing a
single ISO 639-2 language identifier, indicating the language to print.
If the LanguageString is empty (starts with a NULL), the default system
language will be used to determine the language.
@param BufferLength Length of the StringBuffer.
@param StringBuffer The buffer designed to receive the characters in the string.
@retval EFI_SUCCESS StringBuffer is filled with a NULL-terminated string.
@retval EFI_INVALID_PARAMETER The handle or string token is unknown.
@retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough to
allow the entire string to be stored.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_STRING) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN BOOLEAN Raw,
IN CHAR16 *LanguageString,
IN OUT UINTN *BufferLength,
OUT EFI_STRING StringBuffer
);
/**
Allows a program to extract a part of a string of not more than a given width.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The handle on which the string resides.
@param Token The string token assigned to the string.
@param Index On input, the offset into the string where the line is to start.
On output, the index is updated to point to beyond the last character returned
in the call.
@param LineWidth The maximum width of the line in units of narrow glyphs.
@param LanguageString Pointer to a NULL-terminated string containing a
single ISO 639-2 language identifier, indicating the language to print.
@param BufferLength Pointer to the length of the StringBuffer.
@param StringBuffer The buffer designed to receive the characters in the string.
@retval EFI_SUCCESS StringBuffer filled with characters that will fit on the line.
@retval EFI_NOT_FOUND The font glyph for at least one of the characters in
the string is not in the font database.
@retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough
to allow the entire string to be stored.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_LINE) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN OUT UINT16 *Index,
IN UINT16 LineWidth,
IN CHAR16 *LanguageString,
IN OUT UINT16 *BufferLength,
OUT EFI_STRING StringBuffer
);
/**
Allows a program to extract a form or form package that has previously
been registered with the HII database.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle Handle on which the form resides.
@param FormId The ID of the form to return. If the ID is zero,
the entire form package is returned.
@param BufferLength On input, the length of the Buffer. On output,
the length of the returned buffer,
@param Buffer The buffer designed to receive the form(s).
@retval EFI_SUCCESS Buffer filled with the requested forms. BufferLength
was updated.
@retval EFI_INVALID_PARAMETER The handle is unknown.
@retval EFI_NOT_FOUND A form on the requested handle cannot be found with
the requested FormId.
@retval EFI_BUFFER_TOO_SMALL The buffer provided was not large enough
to allow the form to be stored.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_FORMS) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN EFI_FORM_ID FormId,
IN OUT UINTN *BufferLength,
OUT UINT8 *Buffer
);
/**
Extracts the defaults that are associated with a given handle in the HII database.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle The HII handle from which will have default data retrieved.
@param DefaultMask The mask used to specify some type of default override when extracting
the default image data.
@param VariablePackList A indirect pointer to the first entry of a link list with
type EFI_HII_VARIABLE_PACK_LIST.
@retval EFI_SUCCESS The VariablePackList was populated with the appropriate
default setting data.
@retval EFI_NOT_FOUND The IFR does not have any explicit or default map(s).
@retval EFI_INVALID_PARAMETER The HII database entry associated with Handle
contain invalid data.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_DEFAULT_IMAGE) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN UINTN DefaultMask,
OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
);
/**
Allows the caller to update a form or form package that has previously been
registered with the EFI HII database.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param Handle Handle of the package where the form to be updated resides.
@param Label The label inside the form package where the update is to take place.
@param AddData If TRUE, adding data at a given Label; otherwise,
if FALSE, removing data at a given Label.
@param Data The buffer containing the new tags to insert after the Label
@retval EFI_SUCCESS The form was updated with the new tags.
@retval EFI_INVALID_PARAMETER The buffer for the buffer length does not
contain an integral number of tags.
@retval EFI_NOT_FOUND The Handle, Label, or FormId was not found.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_UPDATE_FORM) (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_HANDLE Handle,
IN EFI_FORM_LABEL Label,
IN BOOLEAN AddData,
IN EFI_HII_UPDATE_DATA *Data
);
/**
Retrieves the current keyboard layout.
@param This A pointer to the EFI_HII_PROTOCOL instance.
@param DescriptorCount A pointer to the number of Descriptor entries being
described in the keyboard layout being retrieved.
@param Descriptor A pointer to a buffer containing an array of EFI_KEY_DESCRIPTOR
entries. Each entry will reflect the definition of a specific physical key.
@retval EFI_SUCCESS The keyboard layout was retrieved successfully.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (
IN EFI_HII_PROTOCOL *This,
OUT UINT16 *DescriptorCount,
OUT EFI_KEY_DESCRIPTOR *Descriptor
);
/**
@par Protocol Description:
The HII Protocol manages the HII database, which is a repository for data
having to do with fonts, strings, forms, keyboards, and other future human
interface items.
@param NewPack
Extracts the various packs from a package list.
@param RemovePack
Removes a package from the HII database.
@param FindHandles
Determines the handles that are currently active in the database.
@param ExportDatabase
Export the entire contents of the database to a buffer.
@param TestString
Tests if all of the characters in a string have corresponding font characters.
@param GetGlyph
Translates a Unicode character into the corresponding font glyph.
@param GlyphToBlt
Converts a glyph value into a format that is ready for a UGA BLT command.
@param NewString
Allows a new string to be added to an already existing string package.
@param GetPrimaryLanguages
Allows a program to determine the primary languages that are supported
on a given handle.
@param GetSecondaryLanguages
Allows a program to determine which secondary languages are supported
on a given handle for a given primary language.
@param GetString
Extracts a string from a package that is already registered with the
EFI HII database.
@param ResetString
Remove any new strings that were added after the initial string export
for this handle.
@param GetLine
Allows a program to extract a part of a string of not more than a given width.
@param GetForms
Allows a program to extract a form or form package that has been previously registered.
@param GetDefaultImage
Allows a program to extract the nonvolatile image that represents the default storage image.
@param UpdateForm
Allows a program to update a previously registered form.
@param GetKeyboardLayout
Allows a program to extract the current keyboard layout.
**/
struct _EFI_HII_PROTOCOL {
EFI_HII_NEW_PACK NewPack;
EFI_HII_REMOVE_PACK RemovePack;
EFI_HII_FIND_HANDLES FindHandles;
EFI_HII_EXPORT ExportDatabase;
EFI_HII_TEST_STRING TestString;
EFI_HII_GET_GLYPH GetGlyph;
EFI_HII_GLYPH_TO_BLT GlyphToBlt;
EFI_HII_NEW_STRING NewString;
EFI_HII_GET_PRI_LANGUAGES GetPrimaryLanguages;
EFI_HII_GET_SEC_LANGUAGES GetSecondaryLanguages;
EFI_HII_GET_STRING GetString;
EFI_HII_RESET_STRINGS ResetStrings;
EFI_HII_GET_LINE GetLine;
EFI_HII_GET_FORMS GetForms;
EFI_HII_GET_DEFAULT_IMAGE GetDefaultImage;
EFI_HII_UPDATE_FORM UpdateForm;
EFI_HII_GET_KEYBOARD_LAYOUT GetKeyboardLayout;
};
extern EFI_GUID gEfiHiiProtocolGuid;
#endif

View File

@ -1,161 +0,0 @@
/** @file
UGA Draw protocol from the EFI 1.1 specification.
Abstraction of a very simple graphics device.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __UGA_DRAW_H__
#define __UGA_DRAW_H__
#define EFI_UGA_DRAW_PROTOCOL_GUID \
{ \
0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
}
typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
/**
Return the current video mode information.
@param This Protocol instance pointer.
@param HorizontalResolution Current video horizontal resolution in pixels
@param VerticalResolution Current video vertical resolution in pixels
@param ColorDepth Current video color depth in bits per pixel
@param RefreshRate Current video refresh rate in Hz.
@retval EFI_SUCCESS Mode information returned.
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
@retval EFI_INVALID_PARAMETER One of the input args was NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) (
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
OUT UINT32 *VerticalResolution,
OUT UINT32 *ColorDepth,
OUT UINT32 *RefreshRate
)
;
/**
Return the current video mode information.
@param This Protocol instance pointer.
@param HorizontalResolution Current video horizontal resolution in pixels
@param VerticalResolution Current video vertical resolution in pixels
@param ColorDepth Current video color depth in bits per pixel
@param RefreshRate Current video refresh rate in Hz.
@retval EFI_SUCCESS Mode information returned.
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) (
IN EFI_UGA_DRAW_PROTOCOL *This,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
)
;
typedef struct {
UINT8 Blue;
UINT8 Green;
UINT8 Red;
UINT8 Reserved;
} EFI_UGA_PIXEL;
typedef union {
EFI_UGA_PIXEL Pixel;
UINT32 Raw;
} EFI_UGA_PIXEL_UNION;
typedef enum {
EfiUgaVideoFill,
EfiUgaVideoToBltBuffer,
EfiUgaBltBufferToVideo,
EfiUgaVideoToVideo,
EfiUgaBltMax
} EFI_UGA_BLT_OPERATION;
/**
Type specifying a pointer to a function to perform an UGA Blt operation.
The following table defines actions for BltOperations:
<B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
directly to every pixel of the video display rectangle
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
Only one pixel will be used from the BltBuffer. Delta is NOT used.
<B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
(SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
the BltBuffer rectangle (DestinationX, DestinationY )
(DestinationX + Width, DestinationY + Height). If DestinationX or
DestinationY is not zero then Delta must be set to the length in bytes
of a row in the BltBuffer.
<B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle
(SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
video display rectangle (DestinationX, DestinationY)
(DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
not zero then Delta must be set to the length in bytes of a row in the
BltBuffer.
<B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
(SourceX + Width, SourceY + Height) .to the video display rectangle
(DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
The BltBuffer and Delta are not used in this mode.
@param[in] This - Protocol instance pointer.
@param[in] BltBuffer - Buffer containing data to blit into video buffer. This
buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
@param[in] BltOperation - Operation to perform on BlitBuffer and video memory
@param[in] SourceX - X coordinate of source for the BltBuffer.
@param[in] SourceY - Y coordinate of source for the BltBuffer.
@param[in] DestinationX - X coordinate of destination for the BltBuffer.
@param[in] DestinationY - Y coordinate of destination for the BltBuffer.
@param[in] Width - Width of rectangle in BltBuffer in pixels.
@param[in] Height - Height of rectangle in BltBuffer in pixels.
@param[in] Delta - OPTIONAL
@retval EFI_SUCCESS - The Blt operation completed.
@retval EFI_INVALID_PARAMETER - BltOperation is not valid.
@retval EFI_DEVICE_ERROR - A hardware error occurred writing to the video buffer.
--*/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) (
IN EFI_UGA_DRAW_PROTOCOL * This,
IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL
IN EFI_UGA_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
);
struct _EFI_UGA_DRAW_PROTOCOL {
EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode;
EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode;
EFI_UGA_DRAW_PROTOCOL_BLT Blt;
};
extern EFI_GUID gEfiUgaDrawProtocolGuid;
#endif

View File

@ -12,6 +12,8 @@
#define _CRT_SECURE_NO_WARNINGS
#include "WinNtInclude.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -17,6 +17,10 @@ install: $(MAKEROOT)/libs-$(HOST_ARCH) $(LIBRARY)
$(LIBRARY): $(OBJECTS)
$(AR) crs $@ $^
$(EDK2_OBJPATH)/%.o : $(EDK2_PATH)/%.c
@mkdir -p $(@D)
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(EDK2_INCLUDE) $< -o $@
%.o : %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
@ -26,5 +30,6 @@ $(LIBRARY): $(OBJECTS)
.PHONY: clean
clean:
@rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
@rm -rf $(EDK2_OBJPATH)
-include $(DEPFILES)

View File

@ -9,6 +9,7 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
EDK2_PATH ?= $(MAKEROOT)/../../..
EDK2_OBJPATH ?= $(MAKEROOT)/obj/edk2
ifndef HOST_ARCH
#
@ -84,7 +85,11 @@ $(error Bad HOST_ARCH)
endif
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
INCLUDE += -I $(EDK2_PATH)/MdePkg/Include
INCLUDE += -I $(EDK2_PATH)/MdePkg/Include/ -I $(EDK2_PATH)/MdeModulePkg/Include/
EDK2_INCLUDE = -include $(MAKEROOT)/Include/Common/AutoGen.h
CPPFLAGS = $(INCLUDE)
# keep EXTRA_OPTFLAGS last
@ -114,6 +119,12 @@ else
LDFLAGS =
CXXFLAGS = -Wno-unused-result
endif
CPPFLAGS += -fshort-wchar -flto -DUSING_LTO
ifeq ($(HOST_ARCH), X64)
CPPFLAGS += "-DEFIAPI=__attribute__((ms_abi))"
endif
ifeq ($(HOST_ARCH), IA32)
#
# Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults

View File

@ -34,6 +34,7 @@ EDK_TOOLS_PATH = $(EDK_TOOLS_PATH::\\=:\)
SOURCE_PATH = $(BASE_TOOLS_PATH)\Source\C
BIN_PATH = $(BASE_TOOLS_PATH)\Bin
LIB_PATH = $(BASE_TOOLS_PATH)\Lib
EDK2_OBJPATH = ..\obj\edk2
SYS_BIN_PATH=$(EDK_TOOLS_PATH)\Bin
SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
@ -42,6 +43,7 @@ SYS_LIB_PATH=$(EDK_TOOLS_PATH)\Lib
ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\Ia32
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
EDK2_OBJPATH = ..\obj\Win32\edk2
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
@ -49,6 +51,7 @@ SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\Include\X64
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
EDK2_OBJPATH = ..\obj\Win64\edk2
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
@ -66,5 +69,9 @@ LINKER = $(LD)
INC = $(INC) -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common
INC = $(INC) -I $(EDK2_PATH)\MdePkg\Include
INC = $(INC) -I $(EDK2_PATH)\MdePkg\Include -I $(EDK2_PATH)\MdeModulePkg\Include
EDK2_INC = $(INC) /FI..\Include\Common\AutoGen.h
CFLAGS = $(CFLAGS) /nologo /Z7 /c /O2 /MT /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Z7 /c /O2 /MT /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE

View File

@ -7,6 +7,26 @@
#DEPFILES = $(OBJECTS:%.o=%.d)
{$(EDK2_PATH)\MdePkg\Library\BaseDebugPrintErrorLevelLib\}.c{$(EDK2_OBJPATH)\MdePkg\Library\BaseDebugPrintErrorLevelLib\}.obj :
-@if not exist $(@D)\ mkdir $(@D)
$(CC) -c $(CFLAGS) $(EDK2_INC) $< -Fo$@
{$(EDK2_PATH)\MdePkg\Library\BaseLib\}.c{$(EDK2_OBJPATH)\MdePkg\Library\BaseLib\}.obj :
-@if not exist $(@D)\ mkdir $(@D)
$(CC) -c $(CFLAGS) $(EDK2_INC) $< -Fo$@
{$(EDK2_PATH)\MdePkg\Library\BaseMemoryLib\}.c{$(EDK2_OBJPATH)\MdePkg\Library\BaseMemoryLib\}.obj :
-@if not exist $(@D)\ mkdir $(@D)
$(CC) -c $(CFLAGS) $(EDK2_INC) $< -Fo$@
{$(EDK2_PATH)\MdePkg\Library\BasePrintLib\}.c{$(EDK2_OBJPATH)\MdePkg\Library\BasePrintLib\}.obj :
-@if not exist $(@D)\ mkdir $(@D)
$(CC) -c $(CFLAGS) $(EDK2_INC) $< -Fo$@
{$(EDK2_PATH)\MdePkg\Library\UefiDevicePathLib\}.c{$(EDK2_OBJPATH)\MdePkg\Library\UefiDevicePathLib\}.obj :
-@if not exist $(@D)\ mkdir $(@D)
$(CC) -c $(CFLAGS) $(EDK2_INC) $< -Fo$@
.c.obj :
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@

View File

@ -23,9 +23,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Common/UefiCapsule.h>
#include <Common/PiFirmwareFile.h>
#include <Common/PiFirmwareVolume.h>
#include <Guid/PiFirmwareFileSystem.h>
#include <IndustryStandard/PeImage.h>
#include <Protocol/GuidedSectionExtraction.h>
#include <Guid/FirmwareFileSystem2.h>
#include <Common/PeImageEx.h>
#include <Common/GuidedSectionExtractionEx.h>
#include "Compress.h"
#include "Decompress.h"
@ -1395,7 +1395,7 @@ Returns:
break;
}
if (!CompareGuid (
if (!BtCompareGuid (
&FileHeader->Name,
&gPeiAprioriFileNameGuid
))
@ -1404,7 +1404,7 @@ Returns:
printf("PEI APRIORI FILE:\n");
return PrintAprioriFile (FileHeader);
}
if (!CompareGuid (
if (!BtCompareGuid (
&FileHeader->Name,
&gAprioriGuid
))
@ -1418,6 +1418,7 @@ Returns:
}
EFI_STATUS
EFIAPI
RebaseImageRead (
IN VOID *FileHandle,
IN UINTN FileOffset,
@ -2082,7 +2083,7 @@ Returns:
);
free (ExtractionTool);
if (!CompareGuid (
if (!BtCompareGuid (
EfiGuid,
&gEfiCrc32GuidedSectionExtractionProtocolGuid
)
@ -2128,7 +2129,7 @@ Returns:
//
// Check for CRC32 sections which we can handle internally if needed.
//
} else if (!CompareGuid (
} else if (!BtCompareGuid (
EfiGuid,
&gEfiCrc32GuidedSectionExtractionProtocolGuid
)