diff --git a/BaseTools/.gitignore b/BaseTools/.gitignore index 08a53639bd..3f28c9038d 100644 --- a/BaseTools/.gitignore +++ b/BaseTools/.gitignore @@ -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 Bin/Win64 Lib diff --git a/BaseTools/ImageTool/Makefile b/BaseTools/ImageTool/Makefile index 76e9479d96..fe1e197b5a 100644 --- a/BaseTools/ImageTool/Makefile +++ b/BaseTools/ImageTool/Makefile @@ -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 diff --git a/BaseTools/MicroTool/Makefile b/BaseTools/MicroTool/Makefile index 8df029aff8..44d23ca0de 100644 --- a/BaseTools/MicroTool/Makefile +++ b/BaseTools/MicroTool/Makefile @@ -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 diff --git a/BaseTools/Source/C/Common/AutoGen.c b/BaseTools/Source/C/Common/AutoGen.c new file mode 100644 index 0000000000..8c88f6c177 --- /dev/null +++ b/BaseTools/Source/C/Common/AutoGen.c @@ -0,0 +1,19 @@ +/** @file + AutoGen definitions for edk2 package code consumption in BaseTools. + + Copyright (c) 2023, Marvin Häuser. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +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}; + diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c index 038bb054e5..c38180af69 100644 --- a/BaseTools/Source/C/Common/BasePeCoff.c +++ b/BaseTools/Source/C/Common/BasePeCoff.c @@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -#include +#include #include "PeCoffLib.h" typedef union { diff --git a/BaseTools/Source/C/Common/BinderFuncs.c b/BaseTools/Source/C/Common/BinderFuncs.c index de835287e9..6d81cb8d30 100644 --- a/BaseTools/Source/C/Common/BinderFuncs.c +++ b/BaseTools/Source/C/Common/BinderFuncs.c @@ -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; } diff --git a/BaseTools/Source/C/Common/BinderFuncs.h b/BaseTools/Source/C/Common/BinderFuncs.h index ceaa9cd318..1774ff08b1 100644 --- a/BaseTools/Source/C/Common/BinderFuncs.h +++ b/BaseTools/Source/C/Common/BinderFuncs.h @@ -52,7 +52,7 @@ CommonLibBinderCompareMem ( ); BOOLEAN -CommonLibBinderCompareGuid ( +CommonLibBinderBtCompareGuid ( IN EFI_GUID *Guid1, IN EFI_GUID *Guid2 ); diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index b2cde6d481..ded1cbb5c3 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -18,77 +18,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "CommonLib.h" #include "EfiUtilityMsgs.h" -#define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status) \ - do { \ - ASSERT (Expression); \ - if (!(Expression)) { \ - return Status; \ - } \ - } while (FALSE) - -/** - Set Buffer to zero for Size bytes. - - @param Buffer Memory to set. - @param Size Number of bytes to set -**/ -VOID -PeiZeroMem ( - IN VOID *Buffer, - IN UINTN Size - ) -{ - INT8 *Ptr; - - Ptr = Buffer; - while (Size--) { - *(Ptr++) = 0; - } -} - -/** - Copy Length bytes from Source to Destination. - - @param Destination Target of copy - @param Source Place to copy from - @param Length Number of bytes to copy -**/ -VOID -PeiCopyMem ( - IN VOID *Destination, - IN VOID *Source, - IN UINTN Length - ) -{ - CHAR8 *Destination8; - CHAR8 *Source8; - - Destination8 = Destination; - Source8 = Source; - while (Length--) { - *(Destination8++) = *(Source8++); - } -} - -VOID -ZeroMem ( - IN VOID *Buffer, - IN UINTN Size - ) -{ - PeiZeroMem (Buffer, Size); -} - -VOID -CopyMem ( - IN VOID *Destination, - IN VOID *Source, - IN UINTN Length - ) -{ - PeiCopyMem (Destination, Source, Length); -} - /** Compares to GUIDs @@ -99,27 +28,12 @@ CopyMem ( @retval != 0 if Guid1 != Guid2 **/ INTN -CompareGuid ( +BtCompareGuid ( IN EFI_GUID *Guid1, IN EFI_GUID *Guid2 ) { - INT32 *g1; - INT32 *g2; - INT32 r; - - // - // Compare 32 bits at a time - // - g1 = (INT32 *) Guid1; - g2 = (INT32 *) Guid2; - - r = g1[0] - g2[0]; - r |= g1[1] - g2[1]; - r |= g1[2] - g2[2]; - r |= g1[3] - g2[3]; - - return r; + return !CompareGuid (Guid1, Guid2); } /** @@ -273,67 +187,13 @@ PutFileImage ( return EFI_SUCCESS; } -/** - This function calculates the value needed for a valid UINT8 checksum - - @param Buffer Pointer to buffer containing byte data of component. - @param Size Size of the buffer - - @return The 8 bit checksum value needed. -**/ -UINT8 -CalculateChecksum8 ( - IN UINT8 *Buffer, - IN UINTN Size - ) -{ - return (UINT8) (0x100 - CalculateSum8 (Buffer, Size)); -} - -/** - This function calculates the UINT8 sum for the requested region. - - @param Buffer Pointer to buffer containing byte data of component. - @param Size Size of the buffer - - @return The 8 bit checksum value needed. -**/ -UINT8 -CalculateSum8 ( - IN UINT8 *Buffer, - IN UINTN Size - ) -{ - UINTN Index; - UINT8 Sum; - - Sum = 0; - - // - // Perform the byte sum for buffer - // - for (Index = 0; Index < Size; Index++) { - Sum = (UINT8) (Sum + Buffer[Index]); - } - - return Sum; -} - -/** - This function calculates the value needed for a valid UINT16 checksum - - @param Buffer Pointer to buffer containing byte data of component. - @param Size Size of the buffer - - @return The 16 bit checksum value needed. -**/ UINT16 -CalculateChecksum16 ( +BtCalculateChecksum16 ( IN UINT16 *Buffer, IN UINTN Size ) { - return (UINT16) (0x10000 - CalculateSum16 (Buffer, Size)); + return CalculateCheckSum16 (Buffer, Size * sizeof (UINT16)); } /** @@ -345,24 +205,12 @@ CalculateChecksum16 ( @return The 16 bit checksum **/ UINT16 -CalculateSum16 ( +BtCalculateSum16 ( IN UINT16 *Buffer, IN UINTN Size ) { - UINTN Index; - UINT16 Sum; - - Sum = 0; - - // - // Perform the word sum for buffer - // - for (Index = 0; Index < Size; Index++) { - Sum = (UINT16) (Sum + Buffer[Index]); - } - - return (UINT16) Sum; + return CalculateSum16 (Buffer, Size * sizeof (UINT16)); } /** @@ -634,45 +482,6 @@ LongFilePath ( #endif } -CHAR16 -InternalCharToUpper ( - CHAR16 Char - ) -{ - if (Char >= L'a' && Char <= L'z') { - return (CHAR16) (Char - (L'a' - L'A')); - } - - return Char; -} - -UINTN -StrnLenS ( - CONST CHAR16 *String, - UINTN MaxSize - ) -{ - UINTN Length; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero. - // - if ((String == NULL) || (MaxSize == 0)) { - return 0; - } - - Length = 0; - while (String[Length] != 0) { - if (Length >= MaxSize - 1) { - return MaxSize; - } - Length++; - } - return Length; -} - VOID * InternalAllocatePool ( @@ -705,6 +514,7 @@ InternalReallocatePool ( } VOID * +EFIAPI ReallocatePool ( UINTN OldSize, UINTN NewSize, @@ -714,413 +524,6 @@ ReallocatePool ( return InternalReallocatePool (OldSize, NewSize, OldBuffer); } -/** - Returns the length of a Null-terminated Unicode string. - - This function returns the number of Unicode characters in the Null-terminated - Unicode string specified by String. - - If String is NULL, then ASSERT(). - If String is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - @param String A pointer to a Null-terminated Unicode string. - - @return The length of String. - -**/ -UINTN -StrLen ( - CONST CHAR16 *String - ) -{ - UINTN Length; - - ASSERT (String != NULL); - ASSERT (((UINTN) String & BIT0) == 0); - - for (Length = 0; *String != L'\0'; String++, Length++) { - // - // If PcdMaximumUnicodeStringLength is not zero, - // length should not more than PcdMaximumUnicodeStringLength - // - } - return Length; -} - -BOOLEAN -InternalSafeStringIsOverlap ( - IN VOID *Base1, - IN UINTN Size1, - IN VOID *Base2, - IN UINTN Size2 - ) -{ - if ((((UINTN)Base1 >= (UINTN)Base2) && ((UINTN)Base1 < (UINTN)Base2 + Size2)) || - (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1))) { - return TRUE; - } - return FALSE; -} - -BOOLEAN -InternalSafeStringNoStrOverlap ( - IN CHAR16 *Str1, - IN UINTN Size1, - IN CHAR16 *Str2, - IN UINTN Size2 - ) -{ - return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof(CHAR16), Str2, Size2 * sizeof(CHAR16)); -} - -/** - Convert a Null-terminated Unicode decimal string to a value of type UINT64. - - This function outputs a value of type UINT64 by interpreting the contents of - the Unicode string specified by String as a decimal number. The format of the - input Unicode string String is: - - [spaces] [decimal digits]. - - The valid decimal digit character is in the range [0-9]. The function will - ignore the pad space, which includes spaces or tab characters, before - [decimal digits]. The running zero in the beginning of [decimal digits] will - be ignored. Then, the function stops at the first character that is a not a - valid decimal character or a Null-terminator, whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid decimal digits in the above format, then 0 is stored - at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINT64, then - MAX_UINT64 is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - decimal digits right after the optional pad spaces, the value of String is - stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINT64. - -**/ -RETURN_STATUS -StrDecimalToUint64S ( - CONST CHAR16 *String, - CHAR16 **EndPointer, OPTIONAL - UINT64 *Data - ) -{ - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - *Data = 0; - - while (InternalIsDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINT64, then MAX_UINT64 is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > ((MAX_UINT64 - (*String - L'0'))/10)) { - *Data = MAX_UINT64; - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = (*Data) * 10 + (*String - L'0'); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode hexadecimal string to a value of type - UINT64. - - This function outputs a value of type UINT64 by interpreting the contents of - the Unicode string specified by String as a hexadecimal number. The format of - the input Unicode string String is: - - [spaces][zeros][x][hexadecimal digits]. - - The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F]. - The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. - If "x" appears in the input string, it must be prefixed with at least one 0. - The function will ignore the pad space, which includes spaces or tab - characters, before [zeros], [x] or [hexadecimal digit]. The running zero - before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts - after [x] or the first valid hexadecimal digit. Then, the function stops at - the first character that is a not a valid hexadecimal character or NULL, - whichever one comes first. - - If String is NULL, then ASSERT(). - If Data is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the - Null-terminator, then ASSERT(). - - If String has no valid hexadecimal digits in the above format, then 0 is - stored at the location pointed to by Data. - If the number represented by String exceeds the range defined by UINT64, then - MAX_UINT64 is stored at the location pointed to by Data. - - If EndPointer is not NULL, a pointer to the character that stopped the scan - is stored at the location pointed to by EndPointer. If String has no valid - hexadecimal digits right after the optional pad spaces, the value of String - is stored at the location pointed to by EndPointer. - - @param String Pointer to a Null-terminated Unicode string. - @param EndPointer Pointer to character that stops scan. - @param Data Pointer to the converted value. - - @retval RETURN_SUCCESS Value is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If PcdMaximumUnicodeStringLength is not - zero, and String contains more than - PcdMaximumUnicodeStringLength Unicode - characters, not including the - Null-terminator. - @retval RETURN_UNSUPPORTED If the number represented by String exceeds - the range defined by UINT64. - -**/ -RETURN_STATUS -StrHexToUint64S ( - CONST CHAR16 *String, - CHAR16 **EndPointer, OPTIONAL - UINT64 *Data - ) -{ - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. Neither String nor Data shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Data != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. The length of String shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((StrnLenS (String, RSIZE_MAX + 1) <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - - // - // Ignore the pad spaces (space or tab) - // - while ((*String == L' ') || (*String == L'\t')) { - String++; - } - - // - // Ignore leading Zeros after the spaces - // - while (*String == L'0') { - String++; - } - - if (InternalCharToUpper (*String) == L'X') { - if (*(String - 1) != L'0') { - *Data = 0; - return RETURN_SUCCESS; - } - // - // Skip the 'X' - // - String++; - } - - *Data = 0; - - while (InternalIsHexaDecimalDigitCharacter (*String)) { - // - // If the number represented by String overflows according to the range - // defined by UINT64, then MAX_UINT64 is stored in *Data and - // RETURN_UNSUPPORTED is returned. - // - if (*Data > ((MAX_UINT64 - InternalHexCharToUintn (*String))>>4)) { - *Data = MAX_UINT64; - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_UNSUPPORTED; - } - - *Data = ((*Data) << 4) + InternalHexCharToUintn (*String); - String++; - } - - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) String; - } - return RETURN_SUCCESS; -} - -UINT64 -StrDecimalToUint64 ( - CONST CHAR16 *String - ) -{ - UINT64 Result; - - StrDecimalToUint64S (String, (CHAR16 **) NULL, &Result); - return Result; -} - - -UINT64 -StrHexToUint64 ( - CONST CHAR16 *String - ) -{ - UINT64 Result; - - StrHexToUint64S (String, (CHAR16 **) NULL, &Result); - return Result; -} - -UINTN -StrSize ( - CONST CHAR16 *String - ) -{ - return (StrLen (String) + 1) * sizeof (*String); -} - - -UINT64 -ReadUnaligned64 ( - CONST UINT64 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer; -} - -UINT64 -WriteUnaligned64 ( - UINT64 *Buffer, - UINT64 Value - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer = Value; -} - - -EFI_GUID * -CopyGuid ( - EFI_GUID *DestinationGuid, - CONST EFI_GUID *SourceGuid - ) -{ - WriteUnaligned64 ( - (UINT64*)DestinationGuid, - ReadUnaligned64 ((CONST UINT64*)SourceGuid) - ); - WriteUnaligned64 ( - (UINT64*)DestinationGuid + 1, - ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1) - ); - return DestinationGuid; -} - -UINT16 -SwapBytes16 ( - UINT16 Value - ) -{ - return (UINT16) ((Value<< 8) | (Value>> 8)); -} - - -UINT32 -SwapBytes32 ( - UINT32 Value - ) -{ - UINT32 LowerBytes; - UINT32 HigherBytes; - - LowerBytes = (UINT32) SwapBytes16 ((UINT16) Value); - HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16)); - return (LowerBytes << 16 | HigherBytes); -} - -BOOLEAN -InternalIsDecimalDigitCharacter ( - CHAR16 Char - ) -{ - return (BOOLEAN) (Char >= L'0' && Char <= L'9'); -} - VOID * InternalAllocateCopyPool ( UINTN AllocationSize, @@ -1138,323 +541,8 @@ InternalAllocateCopyPool ( return Memory; } -BOOLEAN -InternalIsHexaDecimalDigitCharacter ( - CHAR16 Char - ) -{ - - return (BOOLEAN) (InternalIsDecimalDigitCharacter (Char) || - (Char >= L'A' && Char <= L'F') || - (Char >= L'a' && Char <= L'f')); -} - -UINTN -InternalHexCharToUintn ( - CHAR16 Char - ) -{ - if (InternalIsDecimalDigitCharacter (Char)) { - return Char - L'0'; - } - - return (10 + InternalCharToUpper (Char) - L'A'); -} - - -/** - Convert a Null-terminated Unicode hexadecimal string to a byte array. - - This function outputs a byte array by interpreting the contents of - the Unicode string specified by String in hexadecimal format. The format of - the input Unicode string String is: - - [XX]* - - X is a hexadecimal digit character in the range [0-9], [a-f] and [A-F]. - The function decodes every two hexadecimal digit characters as one byte. The - decoding stops after Length of characters and outputs Buffer containing - (Length / 2) bytes. - - If String is not aligned in a 16-bit boundary, then ASSERT(). - - If String is NULL, then ASSERT(). - - If Buffer is NULL, then ASSERT(). - - If Length is not multiple of 2, then ASSERT(). - - If PcdMaximumUnicodeStringLength is not zero and Length is greater than - PcdMaximumUnicodeStringLength, then ASSERT(). - - If MaxBufferSize is less than (Length / 2), then ASSERT(). - - @param String Pointer to a Null-terminated Unicode string. - @param Length The number of Unicode characters to decode. - @param Buffer Pointer to the converted bytes array. - @param MaxBufferSize The maximum size of Buffer. - - @retval RETURN_SUCCESS Buffer is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - If Length is not multiple of 2. - If PcdMaximumUnicodeStringLength is not zero, - and Length is greater than - PcdMaximumUnicodeStringLength. - @retval RETURN_UNSUPPORTED If Length of characters from String contain - a character that is not valid hexadecimal - digit characters, or a Null-terminator. - @retval RETURN_BUFFER_TOO_SMALL If MaxBufferSize is less than (Length / 2). -**/ -RETURN_STATUS -StrHexToBytes ( - CONST CHAR16 *String, - UINTN Length, - UINT8 *Buffer, - UINTN MaxBufferSize - ) -{ - UINTN Index; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Buffer shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Buffer != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. Length shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((Length <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. Length shall not be odd. - // - SAFE_STRING_CONSTRAINT_CHECK (((Length & BIT0) == 0), RETURN_INVALID_PARAMETER); - - // - // 4. MaxBufferSize shall equal to or greater than Length / 2. - // - SAFE_STRING_CONSTRAINT_CHECK ((MaxBufferSize >= Length / 2), RETURN_BUFFER_TOO_SMALL); - - // - // 5. String shall not contains invalid hexadecimal digits. - // - for (Index = 0; Index < Length; Index++) { - if (!InternalIsHexaDecimalDigitCharacter (String[Index])) { - break; - } - } - if (Index != Length) { - return RETURN_UNSUPPORTED; - } - - // - // Convert the hex string to bytes. - // - for(Index = 0; Index < Length; Index++) { - - // - // For even characters, write the upper nibble for each buffer byte, - // and for even characters, the lower nibble. - // - if ((Index & BIT0) == 0) { - Buffer[Index / 2] = (UINT8) InternalHexCharToUintn (String[Index]) << 4; - } else { - Buffer[Index / 2] |= (UINT8) InternalHexCharToUintn (String[Index]); - } - } - return RETURN_SUCCESS; -} - -/** - Convert a Null-terminated Unicode GUID string to a value of type - EFI_GUID. - - This function outputs a GUID value by interpreting the contents of - the Unicode string specified by String. The format of the input - Unicode string String consists of 36 characters, as follows: - - aabbccdd-eeff-gghh-iijj-kkllmmnnoopp - - The pairs aa - pp are two characters in the range [0-9], [a-f] and - [A-F], with each pair representing a single byte hexadecimal value. - - The mapping between String and the EFI_GUID structure is as follows: - aa Data1[24:31] - bb Data1[16:23] - cc Data1[8:15] - dd Data1[0:7] - ee Data2[8:15] - ff Data2[0:7] - gg Data3[8:15] - hh Data3[0:7] - ii Data4[0:7] - jj Data4[8:15] - kk Data4[16:23] - ll Data4[24:31] - mm Data4[32:39] - nn Data4[40:47] - oo Data4[48:55] - pp Data4[56:63] - - If String is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - If String is not aligned in a 16-bit boundary, then ASSERT(). - - @param String Pointer to a Null-terminated Unicode string. - @param Guid Pointer to the converted GUID. - - @retval RETURN_SUCCESS Guid is translated from String. - @retval RETURN_INVALID_PARAMETER If String is NULL. - If Data is NULL. - @retval RETURN_UNSUPPORTED If String is not as the above format. - -**/ -RETURN_STATUS -StrToGuid ( - CONST CHAR16 *String, - EFI_GUID *Guid - ) -{ - RETURN_STATUS Status; - EFI_GUID LocalGuid; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Guid shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Guid != NULL), RETURN_INVALID_PARAMETER); - - // - // Get aabbccdd in big-endian. - // - Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1)); - if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != L'-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1); - String += 2 * sizeof (LocalGuid.Data1) + 1; - - // - // Get eeff in big-endian. - // - Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2)); - if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != L'-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2); - String += 2 * sizeof (LocalGuid.Data2) + 1; - - // - // Get gghh in big-endian. - // - Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3)); - if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != L'-') { - return RETURN_UNSUPPORTED; - } - // - // Convert big-endian to little-endian. - // - LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3); - String += 2 * sizeof (LocalGuid.Data3) + 1; - - // - // Get iijj. - // - Status = StrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2); - if (RETURN_ERROR (Status) || String[2 * 2] != L'-') { - return RETURN_UNSUPPORTED; - } - String += 2 * 2 + 1; - - // - // Get kkllmmnnoopp. - // - Status = StrHexToBytes (String, 2 * 6, &LocalGuid.Data4[2], 6); - if (RETURN_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - - CopyGuid (Guid, &LocalGuid); - return RETURN_SUCCESS; -} - -/** - Compares up to a specified length the contents of two Null-terminated Unicode strings, - and returns the difference between the first mismatched Unicode characters. - - This function compares the Null-terminated Unicode string FirstString to the - Null-terminated Unicode string SecondString. At most, Length Unicode - characters will be compared. If Length is 0, then 0 is returned. If - FirstString is identical to SecondString, then 0 is returned. Otherwise, the - value returned is the first mismatched Unicode character in SecondString - subtracted from the first mismatched Unicode character in FirstString. - - If Length > 0 and FirstString is NULL, then ASSERT(). - If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT(). - If Length > 0 and SecondString is NULL, then ASSERT(). - If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and Length is greater than - PcdMaximumUnicodeStringLength, then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than - PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, - then ASSERT(). - - @param FirstString A pointer to a Null-terminated Unicode string. - @param SecondString A pointer to a Null-terminated Unicode string. - @param Length The maximum number of Unicode characters to compare. - - @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. - -**/ -INTN -StrnCmp ( - CONST CHAR16 *FirstString, - CONST CHAR16 *SecondString, - UINTN Length - ) -{ - if (Length == 0) { - return 0; - } - - // - // ASSERT both strings are less long than PcdMaximumUnicodeStringLength. - // Length tests are performed inside StrLen(). - // - ASSERT (StrSize (FirstString) != 0); - ASSERT (StrSize (SecondString) != 0); - - while ((*FirstString != L'\0') && - (*SecondString != L'\0') && - (*FirstString == *SecondString) && - (Length > 1)) { - FirstString++; - SecondString++; - Length--; - } - - return *FirstString - *SecondString; -} - VOID * +EFIAPI AllocateCopyPool ( UINTN AllocationSize, CONST VOID *Buffer @@ -1463,437 +551,8 @@ AllocateCopyPool ( return InternalAllocateCopyPool (AllocationSize, Buffer); } -INTN -StrCmp ( - CONST CHAR16 *FirstString, - CONST CHAR16 *SecondString - ) -{ - // - // ASSERT both strings are less long than PcdMaximumUnicodeStringLength - // - ASSERT (StrSize (FirstString) != 0); - ASSERT (StrSize (SecondString) != 0); - - while ((*FirstString != L'\0') && (*FirstString == *SecondString)) { - FirstString++; - SecondString++; - } - return *FirstString - *SecondString; -} - -UINT64 -SwapBytes64 ( - UINT64 Value - ) -{ - return InternalMathSwapBytes64 (Value); -} - -UINT64 -InternalMathSwapBytes64 ( - UINT64 Operand - ) -{ - UINT64 LowerBytes; - UINT64 HigherBytes; - - LowerBytes = (UINT64) SwapBytes32 ((UINT32) Operand); - HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32)); - - return (LowerBytes << 32 | HigherBytes); -} - -RETURN_STATUS -StrToIpv4Address ( - CONST CHAR16 *String, - CHAR16 **EndPointer, - EFI_IPv4_ADDRESS *Address, - UINT8 *PrefixLength - ) -{ - RETURN_STATUS Status; - UINTN AddressIndex; - UINT64 Uint64; - EFI_IPv4_ADDRESS LocalAddress; - UINT8 LocalPrefixLength; - CHAR16 *Pointer; - - LocalPrefixLength = MAX_UINT8; - LocalAddress.Addr[0] = 0; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Guid shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER); - - for (Pointer = (CHAR16 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) { - if (!InternalIsDecimalDigitCharacter (*Pointer)) { - // - // D or P contains invalid characters. - // - break; - } - - // - // Get D or P. - // - Status = StrDecimalToUint64S ((CONST CHAR16 *) Pointer, &Pointer, &Uint64); - if (RETURN_ERROR (Status)) { - return RETURN_UNSUPPORTED; - } - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // It's P. - // - if (Uint64 > 32) { - return RETURN_UNSUPPORTED; - } - LocalPrefixLength = (UINT8) Uint64; - } else { - // - // It's D. - // - if (Uint64 > MAX_UINT8) { - return RETURN_UNSUPPORTED; - } - LocalAddress.Addr[AddressIndex] = (UINT8) Uint64; - AddressIndex++; - } - - // - // Check the '.' or '/', depending on the AddressIndex. - // - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - if (*Pointer == L'/') { - // - // '/P' is in the String. - // Skip "/" and get P in next loop. - // - Pointer++; - } else { - // - // '/P' is not in the String. - // - break; - } - } else if (AddressIndex < ARRAY_SIZE (Address->Addr)) { - if (*Pointer == L'.') { - // - // D should be followed by '.' - // - Pointer++; - } else { - return RETURN_UNSUPPORTED; - } - } - } - - if (AddressIndex < ARRAY_SIZE (Address->Addr)) { - return RETURN_UNSUPPORTED; - } - - memcpy (Address, &LocalAddress, sizeof (*Address)); - if (PrefixLength != NULL) { - *PrefixLength = LocalPrefixLength; - } - if (EndPointer != NULL) { - *EndPointer = Pointer; - } - - return RETURN_SUCCESS; -} - -RETURN_STATUS -StrToIpv6Address ( - CONST CHAR16 *String, - CHAR16 **EndPointer, - EFI_IPv6_ADDRESS *Address, - UINT8 *PrefixLength - ) -{ - RETURN_STATUS Status; - UINTN AddressIndex; - UINT64 Uint64; - EFI_IPv6_ADDRESS LocalAddress; - UINT8 LocalPrefixLength; - CONST CHAR16 *Pointer; - CHAR16 *End; - UINTN CompressStart; - BOOLEAN ExpectPrefix; - - LocalPrefixLength = MAX_UINT8; - CompressStart = ARRAY_SIZE (Address->Addr); - ExpectPrefix = FALSE; - - ASSERT (((UINTN) String & BIT0) == 0); - - // - // 1. None of String or Guid shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER); - - for (Pointer = String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) { - if (!InternalIsHexaDecimalDigitCharacter (*Pointer)) { - if (*Pointer != L':') { - // - // ":" or "/" should be followed by digit characters. - // - return RETURN_UNSUPPORTED; - } - - // - // Meet second ":" after previous ":" or "/" - // or meet first ":" in the beginning of String. - // - if (ExpectPrefix) { - // - // ":" shall not be after "/" - // - return RETURN_UNSUPPORTED; - } - - if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // "::" can only appear once. - // "::" can only appear when address is not full length. - // - return RETURN_UNSUPPORTED; - } else { - // - // Remember the start of zero compressing. - // - CompressStart = AddressIndex; - Pointer++; - - if (CompressStart == 0) { - if (*Pointer != L':') { - // - // Single ":" shall not be in the beginning of String. - // - return RETURN_UNSUPPORTED; - } - Pointer++; - } - } - } - - if (!InternalIsHexaDecimalDigitCharacter (*Pointer)) { - if (*Pointer == L'/') { - // - // Might be optional "/P" after "::". - // - if (CompressStart != AddressIndex) { - return RETURN_UNSUPPORTED; - } - } else { - break; - } - } else { - if (!ExpectPrefix) { - // - // Get X. - // - Status = StrHexToUint64S (Pointer, &End, &Uint64); - if (RETURN_ERROR (Status) || End - Pointer > 4) { - // - // Number of hexadecimal digit characters is no more than 4. - // - return RETURN_UNSUPPORTED; - } - Pointer = End; - // - // Uint64 won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4. - // - ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr)); - LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uint64 >> 8); - LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uint64; - AddressIndex += 2; - } else { - // - // Get P, then exit the loop. - // - Status = StrDecimalToUint64S (Pointer, &End, &Uint64); - if (RETURN_ERROR (Status) || End == Pointer || Uint64 > 128) { - // - // Prefix length should not exceed 128. - // - return RETURN_UNSUPPORTED; - } - LocalPrefixLength = (UINT8) Uint64; - Pointer = End; - break; - } - } - - // - // Skip ':' or "/" - // - if (*Pointer == L'/') { - ExpectPrefix = TRUE; - } else if (*Pointer == L':') { - if (AddressIndex == ARRAY_SIZE (Address->Addr)) { - // - // Meet additional ":" after all 8 16-bit address - // - break; - } - } else { - // - // Meet other character that is not "/" or ":" after all 8 16-bit address - // - break; - } - Pointer++; - } - - if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) || - (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr)) - ) { - // - // Full length of address shall not have compressing zeros. - // Non-full length of address shall have compressing zeros. - // - return RETURN_UNSUPPORTED; - } - memcpy (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart); - if (AddressIndex > CompressStart) { - memset (&Address->Addr[CompressStart], 0, ARRAY_SIZE (Address->Addr) - AddressIndex); - memcpy ( - &Address->Addr[CompressStart + ARRAY_SIZE (Address->Addr) - AddressIndex], - &LocalAddress.Addr[CompressStart], - AddressIndex - CompressStart - ); - } - - if (PrefixLength != NULL) { - *PrefixLength = LocalPrefixLength; - } - if (EndPointer != NULL) { - *EndPointer = (CHAR16 *) Pointer; - } - - return RETURN_SUCCESS; -} - - -RETURN_STATUS -UnicodeStrToAsciiStrS ( - CONST CHAR16 *Source, - CHAR8 *Destination, - UINTN DestMax - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than ASCII_RSIZE_MAX or RSIZE_MAX. - // - if (ASCII_RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. DestMax shall be greater than StrnLenS (Source, DestMax). - // - SourceLen = StrnLenS (Source, DestMax); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 5. Copying shall not take place between objects that overlap. - // - SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED); - - // - // convert string - // - while (*Source != '\0') { - // - // If any Unicode characters in Source contain - // non-zero value in the upper 8 bits, then ASSERT(). - // - ASSERT (*Source < 0x100); - *(Destination++) = (CHAR8) *(Source++); - } - *Destination = '\0'; - - return RETURN_SUCCESS; -} - -RETURN_STATUS -StrCpyS ( - CHAR16 *Destination, - UINTN DestMax, - CONST CHAR16 *Source - ) -{ - UINTN SourceLen; - - ASSERT (((UINTN) Destination & BIT0) == 0); - ASSERT (((UINTN) Source & BIT0) == 0); - - // - // 1. Neither Destination nor Source shall be a null pointer. - // - SAFE_STRING_CONSTRAINT_CHECK ((Destination != NULL), RETURN_INVALID_PARAMETER); - SAFE_STRING_CONSTRAINT_CHECK ((Source != NULL), RETURN_INVALID_PARAMETER); - - // - // 2. DestMax shall not be greater than RSIZE_MAX. - // - if (RSIZE_MAX != 0) { - SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER); - } - - // - // 3. DestMax shall not equal zero. - // - SAFE_STRING_CONSTRAINT_CHECK ((DestMax != 0), RETURN_INVALID_PARAMETER); - - // - // 4. DestMax shall be greater than StrnLenS(Source, DestMax). - // - SourceLen = StrnLenS (Source, DestMax); - SAFE_STRING_CONSTRAINT_CHECK ((DestMax > SourceLen), RETURN_BUFFER_TOO_SMALL); - - // - // 5. Copying shall not take place between objects that overlap. - // - SAFE_STRING_CONSTRAINT_CHECK (InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1), RETURN_ACCESS_DENIED); - - // - // The StrCpyS function copies the string pointed to by Source (including the terminating - // null character) into the array pointed to by Destination. - // - while (*Source != 0) { - *(Destination++) = *(Source++); - } - *Destination = 0; - - return RETURN_SUCCESS; -} - VOID * +EFIAPI AllocateZeroPool ( UINTN AllocationSize ) @@ -1909,6 +568,7 @@ AllocateZeroPool ( } VOID * +EFIAPI AllocatePool ( UINTN AllocationSize ) @@ -1916,26 +576,6 @@ AllocatePool ( return InternalAllocatePool (AllocationSize); } -UINT16 -WriteUnaligned16 ( - UINT16 *Buffer, - UINT16 Value - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer = Value; -} - -UINT16 -ReadUnaligned16 ( - CONST UINT16 *Buffer - ) -{ - ASSERT (Buffer != NULL); - - return *Buffer; -} /** Return whether the integer string is a hex string. @@ -2088,3 +728,21 @@ SplitStr ( *List = Str; return ReturnStr; } + +VOID +EFIAPI +CpuBreakpoint ( + VOID + ) +{ + abort (); +} + +VOID +EFIAPI +CpuDeadLoop ( + VOID + ) +{ + abort (); +} diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h index a841029c2a..923f936e4f 100644 --- a/BaseTools/Source/C/Common/CommonLib.h +++ b/BaseTools/Source/C/Common/CommonLib.h @@ -16,6 +16,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #endif +#include +#include +#include +#include + #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 ( diff --git a/BaseTools/Source/C/Common/Crc32.c b/BaseTools/Source/C/Common/Crc32.c index 00cae94898..7c79e4d7de 100644 --- a/BaseTools/Source/C/Common/Crc32.c +++ b/BaseTools/Source/C/Common/Crc32.c @@ -1,5 +1,5 @@ /** @file -CalculateCrc32 routine. +BtCalculateCrc32 routine. Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -7,299 +7,41 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include +#include +#include #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; } diff --git a/BaseTools/Source/C/Common/Crc32.h b/BaseTools/Source/C/Common/Crc32.h index 3f6b5b35fc..b57717f397 100644 --- a/BaseTools/Source/C/Common/Crc32.h +++ b/BaseTools/Source/C/Common/Crc32.h @@ -1,5 +1,5 @@ /** @file -Header file for CalculateCrc32 routine +Header file for BtCalculateCrc32 routine Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
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 diff --git a/BaseTools/Source/C/Common/DebugLib.c b/BaseTools/Source/C/Common/DebugLib.c new file mode 100644 index 0000000000..e385dec19e --- /dev/null +++ b/BaseTools/Source/C/Common/DebugLib.c @@ -0,0 +1,356 @@ +/** @file + BaseTools Debug Library that sends messages to the standard output. + + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2023, Marvin Häuser. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include + +#include +#include +#include +#include +#include +#include + +// +// 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 (): \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 string of "(NULL) Filename" is printed. + If Description is NULL, then a 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); +} diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c index 40e068c303..7e530200ac 100644 --- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c +++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c @@ -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)); } /** diff --git a/BaseTools/Source/C/Common/FvLib.c b/BaseTools/Source/C/Common/FvLib.c index 37631f470f..9bd415b64b 100644 --- a/BaseTools/Source/C/Common/FvLib.c +++ b/BaseTools/Source/C/Common/FvLib.c @@ -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); diff --git a/BaseTools/Source/C/Common/GNUmakefile b/BaseTools/Source/C/Common/GNUmakefile index b3eef7460f..17e166d62e 100644 --- a/BaseTools/Source/C/Common/GNUmakefile +++ b/BaseTools/Source/C/Common/GNUmakefile @@ -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 diff --git a/BaseTools/Source/C/Common/Makefile b/BaseTools/Source/C/Common/Makefile index ec61e45c81..c2abbca39b 100644 --- a/BaseTools/Source/C/Common/Makefile +++ b/BaseTools/Source/C/Common/Makefile @@ -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 diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c index e1e9a97e7b..e7709828f8 100644 --- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c +++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c @@ -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); } } diff --git a/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/BaseTools/Source/C/Common/PeCoffLoaderEx.c index 181192035e..088e470d17 100644 --- a/BaseTools/Source/C/Common/PeCoffLoaderEx.c +++ b/BaseTools/Source/C/Common/PeCoffLoaderEx.c @@ -10,19 +10,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent --*/ #include -#include +#include #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 diff --git a/BaseTools/Source/C/DevicePath/Makefile b/BaseTools/Source/C/DevicePath/Makefile index 177a96dfb6..9ee776db07 100644 --- a/BaseTools/Source/C/DevicePath/Makefile +++ b/BaseTools/Source/C/DevicePath/Makefile @@ -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 diff --git a/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h b/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h index 1c171c8085..30d8854c99 100644 --- a/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h +++ b/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h @@ -24,6 +24,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "CommonLib.h" #include "EfiUtilityMsgs.h" + +#include +#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 diff --git a/BaseTools/Source/C/EfiRom/EfiRom.h b/BaseTools/Source/C/EfiRom/EfiRom.h index dfb4c32077..f05198713e 100644 --- a/BaseTools/Source/C/EfiRom/EfiRom.h +++ b/BaseTools/Source/C/EfiRom/EfiRom.h @@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -#include // for PE32 structure definitions +#include // for PE32 structure definitions #include // for option ROM header structures #include diff --git a/BaseTools/Source/C/GenCrc32/GenCrc32.c b/BaseTools/Source/C/GenCrc32/GenCrc32.c index 8c2056e369..877b83a53d 100644 --- a/BaseTools/Source/C/GenCrc32/GenCrc32.c +++ b/BaseTools/Source/C/GenCrc32/GenCrc32.c @@ -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; diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index 4c2e93e6f4..3776fb92ed 100644 --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -6,6 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ +#include "WinNtInclude.h" + #ifndef __GNUC__ #define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include @@ -25,7 +27,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -#include +#include #include #include "CommonLib.h" @@ -471,6 +473,7 @@ Returns: } EFI_STATUS +EFIAPI FfsRebaseImageRead ( IN VOID *FileHandle, IN UINTN FileOffset, @@ -897,7 +900,7 @@ Returns: goto Finish; } - if (CompareGuid (&FileGuid, &mZeroGuid) == 0) { + if (BtCompareGuid (&FileGuid, &mZeroGuid) == 0) { Error (NULL, 0, 1001, "Missing option", "fileguid"); goto Finish; } diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c index 4c9eaa7dae..1f4651c819 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -1056,7 +1056,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; } @@ -1263,7 +1263,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); @@ -2688,8 +2688,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; } @@ -2830,7 +2830,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 @@ -2910,7 +2910,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)); } // @@ -2976,7 +2976,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) { @@ -2992,7 +2992,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) { @@ -3005,7 +3005,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)); } // @@ -3018,16 +3018,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: @@ -3350,6 +3350,7 @@ Returns: } EFI_STATUS +EFIAPI FfsRebaseImageRead ( IN VOID *FileHandle, IN UINTN FileOffset, @@ -4423,7 +4424,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)); } // diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.h b/BaseTools/Source/C/GenFv/GenFvInternalLib.h index bf476f2c08..7bace6ad36 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.h +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.h @@ -20,8 +20,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -#include -#include +#include +#include +#include #include "CommonLib.h" #include "ParseInf.h" diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index 62fd0c0a95..9d7321515b 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -5,6 +5,8 @@ Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ +#include "WinNtInclude.h" + #ifndef __GNUC__ #define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include @@ -21,8 +23,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -#include -#include +#include +#include #include "CommonLib.h" #include "Compress.h" @@ -872,7 +874,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); @@ -929,12 +931,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; @@ -1144,6 +1146,7 @@ Returns: } EFI_STATUS +EFIAPI FfsRebaseImageRead ( IN VOID *FileHandle, IN UINTN FileOffset, @@ -1752,14 +1755,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; } @@ -1813,7 +1816,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. diff --git a/BaseTools/Source/C/Include/Common/AutoGen.h b/BaseTools/Source/C/Include/Common/AutoGen.h new file mode 100644 index 0000000000..8136bd1e2a --- /dev/null +++ b/BaseTools/Source/C/Include/Common/AutoGen.h @@ -0,0 +1,94 @@ +/** @file + AutoGen definitions for edk2 package code consumption in BaseTools. + + Copyright (c) 2023, Marvin Häuser. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BT_AUTOGENH +#define _BT_AUTOGENH + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +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 diff --git a/BaseTools/Source/C/Include/Common/BaseTypes.h b/BaseTools/Source/C/Include/Common/BaseTypes.h index 5093a2f1f9..f81449c91b 100644 --- a/BaseTools/Source/C/Include/Common/BaseTypes.h +++ b/BaseTools/Source/C/Include/Common/BaseTypes.h @@ -10,303 +10,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 +#include "WinNtInclude.h" + #include +#include // -// 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 + +#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) (((RETURN_STATUS)(a)) >= MAX_BIT) - -#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 diff --git a/BaseTools/Source/C/Include/Common/GuidedSectionExtractionEx.h b/BaseTools/Source/C/Include/Common/GuidedSectionExtractionEx.h new file mode 100644 index 0000000000..3a9f505190 --- /dev/null +++ b/BaseTools/Source/C/Include/Common/GuidedSectionExtractionEx.h @@ -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.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BT_EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__ +#define __BT_EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL_H__ + +#include +#include + +// +// 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 \ No newline at end of file diff --git a/BaseTools/Source/C/Include/Common/MdeModuleHii.h b/BaseTools/Source/C/Include/Common/MdeModuleHii.h index d4944efe45..60697b9422 100644 --- a/BaseTools/Source/C/Include/Common/MdeModuleHii.h +++ b/BaseTools/Source/C/Include/Common/MdeModuleHii.h @@ -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 #endif diff --git a/BaseTools/Source/C/Include/Common/PeImageEx.h b/BaseTools/Source/C/Include/Common/PeImageEx.h new file mode 100644 index 0000000000..3e4e129778 --- /dev/null +++ b/BaseTools/Source/C/Include/Common/PeImageEx.h @@ -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.
+ Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.
+ Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BT_PE_IMAGE_H__ +#define __BT_PE_IMAGE_H__ + +#include + +// +// 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 diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h index 56874374ca..a3d1c76956 100644 --- a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h +++ b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h @@ -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 +#include -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; diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h b/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h index 35afbdf00a..f0d28dae30 100644 --- a/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h +++ b/BaseTools/Source/C/Include/Common/PiFirmwareVolume.h @@ -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 #endif diff --git a/BaseTools/Source/C/Include/Common/UefiBaseTypes.h b/BaseTools/Source/C/Include/Common/UefiBaseTypes.h index acf179af23..a47549cc9b 100644 --- a/BaseTools/Source/C/Include/Common/UefiBaseTypes.h +++ b/BaseTools/Source/C/Include/Common/UefiBaseTypes.h @@ -7,162 +7,10 @@ **/ -#ifndef __UEFI_BASETYPE_H__ -#define __UEFI_BASETYPE_H__ +#ifndef __BT_UEFI_BASETYPE_H__ +#define __BT_UEFI_BASETYPE_H__ #include - -// -// 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 #endif diff --git a/BaseTools/Source/C/Include/Common/UefiCapsule.h b/BaseTools/Source/C/Include/Common/UefiCapsule.h index ecfe3a0a7a..01beb6b84f 100644 --- a/BaseTools/Source/C/Include/Common/UefiCapsule.h +++ b/BaseTools/Source/C/Include/Common/UefiCapsule.h @@ -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 +#include -#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_ diff --git a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h index cb009ed68e..76b8f8254a 100644 --- a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h +++ b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h @@ -13,1678 +13,13 @@ **/ -#ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__ -#define __UEFI_INTERNAL_FORMREPRESENTATION_H__ +#ifndef __BT_UEFI_INTERNAL_FORMREPRESENTATION_H__ +#define __BT_UEFI_INTERNAL_FORMREPRESENTATION_H__ -#define EFI_HII_PLATFORM_SETUP_FORMSET_GUID \ - { 0x93039971, 0x8545, 0x4b04, { 0xb4, 0x5e, 0x32, 0xeb, 0x83, 0x26, 0x4, 0xe } } +#include +#include -// -// The following types are currently defined: -// -typedef UINT32 RELOFST; - -typedef VOID* EFI_HII_HANDLE; -typedef CHAR16* EFI_STRING; -typedef UINT16 EFI_IMAGE_ID; -typedef UINT16 EFI_QUESTION_ID; -typedef UINT16 EFI_STRING_ID; -typedef UINT16 EFI_FORM_ID; -typedef UINT16 EFI_VARSTORE_ID; -typedef UINT16 EFI_DEFAULT_ID; -typedef UINT32 EFI_HII_FONT_STYLE; - - - -#pragma pack(1) - - -// -// HII package list -// -typedef struct { - EFI_GUID PackageListGuid; - UINT32 PackageLength; -} EFI_HII_PACKAGE_LIST_HEADER; - -/** - - Each package starts with a header, as defined above, which - indicates the size and type of the package. When added to a - pointer pointing to the start of the header, Length points at - the next package. The package lists form a package list when - concatenated together and terminated with an - EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The - type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII - packages, whose contents are determined by the Guid. The range - of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN - through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system - firmware implementers. - - @param Length The size of the package in bytes. - - @param Type The package type. See EFI_HII_PACKAGE_TYPE_x, - below. - - @param Data The package data, the format of which is - determined by Type. - -**/ -typedef struct { - UINT32 Length:24; - UINT32 Type:8; - // UINT8 Data[...]; -} EFI_HII_PACKAGE_HEADER; - -// -// EFI_HII_PACKAGE_TYPE_x. -// -#define EFI_HII_PACKAGE_TYPE_ALL 0x00 -#define EFI_HII_PACKAGE_TYPE_GUID 0x01 -#define EFI_HII_PACKAGE_FORM 0x02 -#define EFI_HII_PACKAGE_KEYBOARD_LAYOUT 0x03 -#define EFI_HII_PACKAGE_STRINGS 0x04 -#define EFI_HII_PACKAGE_FONTS 0x05 -#define EFI_HII_PACKAGE_IMAGES 0x06 -#define EFI_HII_PACKAGE_SIMPLE_FONTS 0x07 -#define EFI_HII_PACKAGE_DEVICE_PATH 0x08 -#define EFI_HII_PACKAGE_END 0xDF -#define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN 0xE0 -#define EFI_HII_PACKAGE_TYPE_SYSTEM_END 0xFF - -// -// Simplified Font Package -// - -#define EFI_GLYPH_HEIGHT 19 -#define EFI_GLYPH_WIDTH 8 -// -// Contents of EFI_NARROW_GLYPH.Attributes -// -#define EFI_GLYPH_NON_SPACING 0x01 -#define EFI_GLYPH_WIDE 0x02 - -typedef struct { - CHAR16 UnicodeWeight; - UINT8 Attributes; - UINT8 GlyphCol1[EFI_GLYPH_HEIGHT]; -} EFI_NARROW_GLYPH; - -typedef struct { - CHAR16 UnicodeWeight; - UINT8 Attributes; - UINT8 GlyphCol1[EFI_GLYPH_HEIGHT]; - UINT8 GlyphCol2[EFI_GLYPH_HEIGHT]; - UINT8 Pad[3]; -} EFI_WIDE_GLYPH; - - -typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR { - EFI_HII_PACKAGE_HEADER Header; - UINT16 NumberOfNarrowGlyphs; - UINT16 NumberOfWideGlyphs; - // EFI_NARROW_GLYPH NarrowGlyphs[]; - // EFI_WIDE_GLYPH WideGlyphs[]; -} EFI_HII_SIMPLE_FONT_PACKAGE_HDR; - -// -// Font Package -// - -#define EFI_HII_FONT_STYLE_BOLD 0x00000001 -#define EFI_HII_FONT_STYLE_ITALIC 0x00000002 -#define EFI_HII_FONT_STYLE_EMBOSS 0x00010000 -#define EFI_HII_FONT_STYLE_OUTLINE 0x00020000 -#define EFI_HII_FONT_STYLE_SHADOW 0x00040000 -#define EFI_HII_FONT_STYLE_UNDERLINE 0x00080000 -#define EFI_HII_FONT_STYLE_DBL_UNDER 0x00100000 - -typedef struct _EFI_HII_GLYPH_INFO { - UINT16 Width; - UINT16 Height; - INT16 OffsetX; - INT16 OffsetY; - INT16 AdvanceX; -} EFI_HII_GLYPH_INFO; - -typedef struct _EFI_HII_FONT_PACKAGE_HDR { - EFI_HII_PACKAGE_HEADER Header; - UINT32 HdrSize; - UINT32 GlyphBlockOffset; - EFI_HII_GLYPH_INFO Cell; - EFI_HII_FONT_STYLE FontStyle; - CHAR16 FontFamily[1]; -} EFI_HII_FONT_PACKAGE_HDR; - -#define EFI_HII_GIBT_END 0x00 -#define EFI_HII_GIBT_GLYPH 0x10 -#define EFI_HII_GIBT_GLYPHS 0x11 -#define EFI_HII_GIBT_GLYPH_DEFAULT 0x12 -#define EFI_HII_GIBT_GLYPHS_DEFAULT 0x13 -#define EFI_HII_GIBT_GLYPH_VARIABILITY 0x14 -#define EFI_HII_GIBT_DUPLICATE 0x20 -#define EFI_HII_GIBT_SKIP2 0x21 -#define EFI_HII_GIBT_SKIP1 0x22 -#define EFI_HII_GIBT_DEFAULTS 0x23 -#define EFI_HII_GIBT_EXT1 0x30 -#define EFI_HII_GIBT_EXT2 0x31 -#define EFI_HII_GIBT_EXT4 0x32 - -typedef struct _EFI_HII_GLYPH_BLOCK { - UINT8 BlockType; -} EFI_HII_GLYPH_BLOCK; - -typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - EFI_HII_GLYPH_INFO Cell; -} EFI_HII_GIBT_DEFAULTS_BLOCK; - -typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - CHAR16 CharValue; -} EFI_HII_GIBT_DUPLICATE_BLOCK; - -typedef struct _EFI_GLYPH_GIBT_END_BLOCK { - EFI_HII_GLYPH_BLOCK Header; -} EFI_GLYPH_GIBT_END_BLOCK; - -typedef struct _EFI_HII_GIBT_EXT1_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT8 BlockType2; - UINT8 Length; -} EFI_HII_GIBT_EXT1_BLOCK; - -typedef struct _EFI_HII_GIBT_EXT2_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT8 BlockType2; - UINT16 Length; -} EFI_HII_GIBT_EXT2_BLOCK; - -typedef struct _EFI_HII_GIBT_EXT4_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT8 BlockType2; - UINT32 Length; -} EFI_HII_GIBT_EXT4_BLOCK; - -typedef struct _EFI_HII_GIBT_GLYPH_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - EFI_HII_GLYPH_INFO Cell; - UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height -} EFI_HII_GIBT_GLYPH_BLOCK; - -typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - EFI_HII_GLYPH_INFO Cell; - UINT16 Count; - UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height -} EFI_HII_GIBT_GLYPHS_BLOCK; - -typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Global.Cell.Width+7)/8)*Global.Cell.Height -} EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK; - -typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT16 Count; - UINT8 BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Global.Cell.Width+7)/8)*Global.Cell.Height -} EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK; - -typedef struct _EFI_HII_GIBT_VARIABILITY_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - EFI_HII_GLYPH_INFO Cell; - UINT8 GlyphPackInBits; - UINT8 BitmapData [1]; -} EFI_HII_GIBT_VARIABILITY_BLOCK; - -typedef struct _EFI_HII_GIBT_SKIP1_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT8 SkipCount; -} EFI_HII_GIBT_SKIP1_BLOCK; - -typedef struct _EFI_HII_GIBT_SKIP2_BLOCK { - EFI_HII_GLYPH_BLOCK Header; - UINT16 SkipCount; -} EFI_HII_GIBT_SKIP2_BLOCK; - -// -// Device Path Package -// -typedef struct _EFI_HII_DEVICE_PATH_PACKAGE { - EFI_HII_PACKAGE_HEADER Header; - // EFI_DEVICE_PATH_PROTOCOL DevicePath[]; -} EFI_HII_DEVICE_PATH_PACKAGE; - -// -// GUID Package -// -typedef struct _EFI_HII_GUID_PACKAGE_HDR { - EFI_HII_PACKAGE_HEADER Header; - EFI_GUID Guid; - // Data per GUID definition may follow -} EFI_HII_GUID_PACKAGE_HDR; - -// -// String Package -// - -#define UEFI_CONFIG_LANG "x-UEFI" -#define UEFI_CONFIG_LANG2 "x-i-UEFI" - -typedef struct _EFI_HII_STRING_PACKAGE_HDR { - EFI_HII_PACKAGE_HEADER Header; - UINT32 HdrSize; - UINT32 StringInfoOffset; - CHAR16 LanguageWindow[16]; - EFI_STRING_ID LanguageName; - CHAR8 Language[1]; -} EFI_HII_STRING_PACKAGE_HDR; - -typedef struct { - UINT8 BlockType; -} EFI_HII_STRING_BLOCK; - -#define EFI_HII_SIBT_END 0x00 -#define EFI_HII_SIBT_STRING_SCSU 0x10 -#define EFI_HII_SIBT_STRING_SCSU_FONT 0x11 -#define EFI_HII_SIBT_STRINGS_SCSU 0x12 -#define EFI_HII_SIBT_STRINGS_SCSU_FONT 0x13 -#define EFI_HII_SIBT_STRING_UCS2 0x14 -#define EFI_HII_SIBT_STRING_UCS2_FONT 0x15 -#define EFI_HII_SIBT_STRINGS_UCS2 0x16 -#define EFI_HII_SIBT_STRINGS_UCS2_FONT 0x17 -#define EFI_HII_SIBT_DUPLICATE 0x20 -#define EFI_HII_SIBT_SKIP2 0x21 -#define EFI_HII_SIBT_SKIP1 0x22 -#define EFI_HII_SIBT_EXT1 0x30 -#define EFI_HII_SIBT_EXT2 0x31 -#define EFI_HII_SIBT_EXT4 0x32 -#define EFI_HII_SIBT_FONT 0x40 - -typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK { - EFI_HII_STRING_BLOCK Header; - EFI_STRING_ID StringId; -} EFI_HII_SIBT_DUPLICATE_BLOCK; - -typedef struct _EFI_HII_SIBT_END_BLOCK { - EFI_HII_STRING_BLOCK Header; -} EFI_HII_SIBT_END_BLOCK; - -typedef struct _EFI_HII_SIBT_EXT1_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 BlockType2; - UINT8 Length; -} EFI_HII_SIBT_EXT1_BLOCK; - -typedef struct _EFI_HII_SIBT_EXT2_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 BlockType2; - UINT16 Length; -} EFI_HII_SIBT_EXT2_BLOCK; - -typedef struct _EFI_HII_SIBT_EXT4_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 BlockType2; - UINT32 Length; -} EFI_HII_SIBT_EXT4_BLOCK; - -typedef struct _EFI_HII_SIBT_FONT_BLOCK { - EFI_HII_SIBT_EXT2_BLOCK Header; - UINT8 FontId; - UINT16 FontSize; - EFI_HII_FONT_STYLE FontStyle; - CHAR16 FontName[1]; -} EFI_HII_SIBT_FONT_BLOCK; - -typedef struct _EFI_HII_SIBT_SKIP1_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 SkipCount; -} EFI_HII_SIBT_SKIP1_BLOCK; - -typedef struct _EFI_HII_SIBT_SKIP2_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT16 SkipCount; -} EFI_HII_SIBT_SKIP2_BLOCK; - -typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 StringText[1]; -} EFI_HII_SIBT_STRING_SCSU_BLOCK; - -typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 FontIdentifier; - UINT8 StringText[1]; -} EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK; - -typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT16 StringCount; - UINT8 StringText[1]; -} EFI_HII_SIBT_STRINGS_SCSU_BLOCK; - -typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 FontIdentifier; - UINT16 StringCount; - UINT8 StringText[1]; -} EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK; - -typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK { - EFI_HII_STRING_BLOCK Header; - CHAR16 StringText[1]; -} EFI_HII_SIBT_STRING_UCS2_BLOCK; - -typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 FontIdentifier; - CHAR16 StringText[1]; -} EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK; - -typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT16 StringCount; - CHAR16 StringText[1]; -} EFI_HII_SIBT_STRINGS_UCS2_BLOCK; - -typedef struct _EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK { - EFI_HII_STRING_BLOCK Header; - UINT8 FontIdentifier; - UINT16 StringCount; - CHAR16 StringText[1]; -} EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK; - -// -// Image Packages -// - -typedef struct _EFI_HII_IMAGE_PACKAGE_HDR { - EFI_HII_PACKAGE_HEADER Header; - UINT32 ImageInfoOffset; - UINT32 PaletteInfoOffset; -} EFI_HII_IMAGE_PACKAGE_HDR; - -typedef struct _EFI_HII_IMAGE_BLOCK { - UINT8 BlockType; -} EFI_HII_IMAGE_BLOCK; - -#define EFI_HII_IIBT_END 0x00 -#define EFI_HII_IIBT_IMAGE_1BIT 0x10 -#define EFI_HII_IIBT_IMAGE_1BIT_TRANS 0x11 -#define EFI_HII_IIBT_IMAGE_4BIT 0x12 -#define EFI_HII_IIBT_IMAGE_4BIT_TRANS 0x13 -#define EFI_HII_IIBT_IMAGE_8BIT 0x14 -#define EFI_HII_IIBT_IMAGE_8BIT_TRANS 0x15 -#define EFI_HII_IIBT_IMAGE_24BIT 0x16 -#define EFI_HII_IIBT_IMAGE_24BIT_TRANS 0x17 -#define EFI_HII_IIBT_IMAGE_JPEG 0x18 -#define EFI_HII_IIBT_IMAGE_PNG 0x19 -#define EFI_HII_IIBT_DUPLICATE 0x20 -#define EFI_HII_IIBT_SKIP2 0x21 -#define EFI_HII_IIBT_SKIP1 0x22 -#define EFI_HII_IIBT_EXT1 0x30 -#define EFI_HII_IIBT_EXT2 0x31 -#define EFI_HII_IIBT_EXT4 0x32 - -typedef struct _EFI_HII_IIBT_END_BLOCK { - EFI_HII_IMAGE_BLOCK Header; -} EFI_HII_IIBT_END_BLOCK; - -typedef struct _EFI_HII_IIBT_EXT1_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 BlockType2; - UINT8 Length; -} EFI_HII_IIBT_EXT1_BLOCK; - -typedef struct _EFI_HII_IIBT_EXT2_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 BlockType2; - UINT16 Length; -} EFI_HII_IIBT_EXT2_BLOCK; - -typedef struct _EFI_HII_IIBT_EXT4_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 BlockType2; - UINT32 Length; -} EFI_HII_IIBT_EXT4_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE { - UINT16 Width; - UINT16 Height; - UINT8 Data[1]; -} EFI_HII_IIBT_IMAGE_1BIT_BASE; - -typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 PaletteIndex; - EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_1BIT_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 PaletteIndex; - EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK; - -typedef struct _EFI_HII_RGB_PIXEL { - UINT8 b; - UINT8 g; - UINT8 r; -} EFI_HII_RGB_PIXEL; - -typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE { - UINT16 Width; - UINT16 Height; - EFI_HII_RGB_PIXEL Bitmap[1]; -} EFI_HII_IIBT_IMAGE_24BIT_BASE; - -typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_24BIT_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE { - UINT16 Width; - UINT16 Height; - UINT8 Data[1]; -} EFI_HII_IIBT_IMAGE_4BIT_BASE; - -typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 PaletteIndex; - EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_4BIT_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 PaletteIndex; - EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE { - UINT16 Width; - UINT16 Height; - UINT8 Data[1]; -} EFI_HII_IIBT_IMAGE_8BIT_BASE; - -typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 PaletteIndex; - EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_8BIT_BLOCK; - -typedef struct _EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 PaletteIndex; - EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap; -} EFI_HII_IIBT_IMAGE_8BIT_TRAN_BLOCK; - -typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - EFI_IMAGE_ID ImageId; -} EFI_HII_IIBT_DUPLICATE_BLOCK; - -typedef struct _EFI_HII_IIBT_JPEG_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT32 Size; - UINT8 Data[1]; -} EFI_HII_IIBT_JPEG_BLOCK; - -typedef struct _EFI_HII_IIBT_PNG_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT32 Size; - UINT8 Data[1]; -} EFI_HII_IIBT_PNG_BLOCK; - -typedef struct _EFI_HII_IIBT_SKIP1_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT8 SkipCount; -} EFI_HII_IIBT_SKIP1_BLOCK; - -typedef struct _EFI_HII_IIBT_SKIP2_BLOCK { - EFI_HII_IMAGE_BLOCK Header; - UINT16 SkipCount; -} EFI_HII_IIBT_SKIP2_BLOCK; - -typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER { - UINT16 PaletteCount; -} EFI_HII_IMAGE_PALETTE_INFO_HEADER; - -typedef struct _EFI_HII_IMAGE_PALETTE_INFO { - UINT16 PaletteSize; - EFI_HII_RGB_PIXEL PaletteValue[1]; -} EFI_HII_IMAGE_PALETTE_INFO; - -// -// Forms Package -// - -typedef struct _EFI_HII_FORM_PACKAGE { - EFI_HII_PACKAGE_HEADER Header; - // EFI_IFR_OP_HEADER OpCodeHeader; - // More op-codes follow -} EFI_HII_FORM_PACKAGE; - -typedef struct { - UINT8 Hour; - UINT8 Minute; - UINT8 Second; -} EFI_HII_TIME; - -typedef struct { - UINT16 Year; - UINT8 Month; - UINT8 Day; -} EFI_HII_DATE; - -typedef struct { - EFI_QUESTION_ID QuestionId; - EFI_FORM_ID FormId; - EFI_GUID FormSetGuid; - EFI_STRING_ID DevicePath; -} EFI_HII_REF; - -typedef union { - UINT8 u8; - UINT16 u16; - UINT32 u32; - UINT64 u64; - BOOLEAN b; - EFI_HII_TIME time; - EFI_HII_DATE date; - EFI_STRING_ID string; - EFI_HII_REF ref; -} EFI_IFR_TYPE_VALUE; - -#define EFI_IFR_FORM_OP 0x01 -#define EFI_IFR_SUBTITLE_OP 0x02 -#define EFI_IFR_TEXT_OP 0x03 -#define EFI_IFR_IMAGE_OP 0x04 -#define EFI_IFR_ONE_OF_OP 0x05 -#define EFI_IFR_CHECKBOX_OP 0x06 -#define EFI_IFR_NUMERIC_OP 0x07 -#define EFI_IFR_PASSWORD_OP 0x08 -#define EFI_IFR_ONE_OF_OPTION_OP 0x09 -#define EFI_IFR_SUPPRESS_IF_OP 0x0A -#define EFI_IFR_LOCKED_OP 0x0B -#define EFI_IFR_ACTION_OP 0x0C -#define EFI_IFR_RESET_BUTTON_OP 0x0D -#define EFI_IFR_FORM_SET_OP 0x0E -#define EFI_IFR_REF_OP 0x0F -#define EFI_IFR_NO_SUBMIT_IF_OP 0x10 -#define EFI_IFR_INCONSISTENT_IF_OP 0x11 -#define EFI_IFR_EQ_ID_VAL_OP 0x12 -#define EFI_IFR_EQ_ID_ID_OP 0x13 -#define EFI_IFR_EQ_ID_VAL_LIST_OP 0x14 -#define EFI_IFR_AND_OP 0x15 -#define EFI_IFR_OR_OP 0x16 -#define EFI_IFR_NOT_OP 0x17 -#define EFI_IFR_RULE_OP 0x18 -#define EFI_IFR_GRAY_OUT_IF_OP 0x19 -#define EFI_IFR_DATE_OP 0x1A -#define EFI_IFR_TIME_OP 0x1B -#define EFI_IFR_STRING_OP 0x1C -#define EFI_IFR_REFRESH_OP 0x1D -#define EFI_IFR_DISABLE_IF_OP 0x1E -#define EFI_IFR_TO_LOWER_OP 0x20 -#define EFI_IFR_TO_UPPER_OP 0x21 -#define EFI_IFR_MAP_OP 0x22 -#define EFI_IFR_ORDERED_LIST_OP 0x23 -#define EFI_IFR_VARSTORE_OP 0x24 -#define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25 -#define EFI_IFR_VARSTORE_EFI_OP 0x26 -#define EFI_IFR_VARSTORE_DEVICE_OP 0x27 -#define EFI_IFR_VERSION_OP 0x28 -#define EFI_IFR_END_OP 0x29 -#define EFI_IFR_MATCH_OP 0x2A -#define EFI_IFR_GET_OP 0x2B -#define EFI_IFR_SET_OP 0x2C -#define EFI_IFR_READ_OP 0x2D -#define EFI_IFR_WRITE_OP 0x2E -#define EFI_IFR_EQUAL_OP 0x2F -#define EFI_IFR_NOT_EQUAL_OP 0x30 -#define EFI_IFR_GREATER_THAN_OP 0x31 -#define EFI_IFR_GREATER_EQUAL_OP 0x32 -#define EFI_IFR_LESS_THAN_OP 0x33 -#define EFI_IFR_LESS_EQUAL_OP 0x34 -#define EFI_IFR_BITWISE_AND_OP 0x35 -#define EFI_IFR_BITWISE_OR_OP 0x36 -#define EFI_IFR_BITWISE_NOT_OP 0x37 -#define EFI_IFR_SHIFT_LEFT_OP 0x38 -#define EFI_IFR_SHIFT_RIGHT_OP 0x39 -#define EFI_IFR_ADD_OP 0x3A -#define EFI_IFR_SUBTRACT_OP 0x3B -#define EFI_IFR_MULTIPLY_OP 0x3C -#define EFI_IFR_DIVIDE_OP 0x3D -#define EFI_IFR_MODULO_OP 0x3E -#define EFI_IFR_RULE_REF_OP 0x3F -#define EFI_IFR_QUESTION_REF1_OP 0x40 -#define EFI_IFR_QUESTION_REF2_OP 0x41 -#define EFI_IFR_UINT8_OP 0x42 -#define EFI_IFR_UINT16_OP 0x43 -#define EFI_IFR_UINT32_OP 0x44 -#define EFI_IFR_UINT64_OP 0x45 -#define EFI_IFR_TRUE_OP 0x46 -#define EFI_IFR_FALSE_OP 0x47 -#define EFI_IFR_TO_UINT_OP 0x48 -#define EFI_IFR_TO_STRING_OP 0x49 -#define EFI_IFR_TO_BOOLEAN_OP 0x4A -#define EFI_IFR_MID_OP 0x4B -#define EFI_IFR_FIND_OP 0x4C -#define EFI_IFR_TOKEN_OP 0x4D -#define EFI_IFR_STRING_REF1_OP 0x4E -#define EFI_IFR_STRING_REF2_OP 0x4F -#define EFI_IFR_CONDITIONAL_OP 0x50 -#define EFI_IFR_QUESTION_REF3_OP 0x51 -#define EFI_IFR_ZERO_OP 0x52 -#define EFI_IFR_ONE_OP 0x53 -#define EFI_IFR_ONES_OP 0x54 -#define EFI_IFR_UNDEFINED_OP 0x55 -#define EFI_IFR_LENGTH_OP 0x56 -#define EFI_IFR_DUP_OP 0x57 -#define EFI_IFR_THIS_OP 0x58 -#define EFI_IFR_SPAN_OP 0x59 -#define EFI_IFR_VALUE_OP 0x5A -#define EFI_IFR_DEFAULT_OP 0x5B -#define EFI_IFR_DEFAULTSTORE_OP 0x5C -#define EFI_IFR_FORM_MAP_OP 0x5D -#define EFI_IFR_CATENATE_OP 0x5E -#define EFI_IFR_GUID_OP 0x5F -#define EFI_IFR_SECURITY_OP 0x60 -#define EFI_IFR_MODAL_TAG_OP 0x61 -#define EFI_IFR_REFRESH_ID_OP 0x62 -#define EFI_IFR_WARNING_IF_OP 0x63 -#define EFI_IFR_MATCH2_OP 0x64 - - -typedef struct _EFI_IFR_OP_HEADER { - UINT8 OpCode; - UINT8 Length:7; - UINT8 Scope:1; -} EFI_IFR_OP_HEADER; - -typedef struct _EFI_IFR_STATEMENT_HEADER { - EFI_STRING_ID Prompt; - EFI_STRING_ID Help; -} EFI_IFR_STATEMENT_HEADER; - -typedef struct _EFI_IFR_QUESTION_HEADER { - EFI_IFR_STATEMENT_HEADER Header; - EFI_QUESTION_ID QuestionId; - EFI_VARSTORE_ID VarStoreId; - union { - EFI_STRING_ID VarName; - UINT16 VarOffset; - } VarStoreInfo; - UINT8 Flags; -} EFI_IFR_QUESTION_HEADER; - -#define EFI_IFR_FLAG_READ_ONLY 0x01 -#define EFI_IFR_FLAG_CALLBACK 0x04 -#define EFI_IFR_FLAG_RESET_REQUIRED 0x10 -#define EFI_IFR_FLAG_REST_STYLE 0x20 -#define EFI_IFR_FLAG_RECONNECT_REQUIRED 0x40 -#define EFI_IFR_FLAG_OPTIONS_ONLY 0x80 - -typedef struct _EFI_IFR_DEFAULTSTORE { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID DefaultName; - UINT16 DefaultId; -} EFI_IFR_DEFAULTSTORE; - -#define EFI_HII_DEFAULT_CLASS_STANDARD 0x0000 -#define EFI_HII_DEFAULT_CLASS_MANUFACTURING 0x0001 -#define EFI_HII_DEFAULT_CLASS_SAFE 0x0002 -#define EFI_HII_DEFAULT_CLASS_PLATFORM_BEGIN 0x4000 -#define EFI_HII_DEFAULT_CLASS_PLATFORM_END 0x7fff -#define EFI_HII_DEFAULT_CLASS_HARDWARE_BEGIN 0x8000 -#define EFI_HII_DEFAULT_CLASS_HARDWARE_END 0xbfff -#define EFI_HII_DEFAULT_CLASS_FIRMWARE_BEGIN 0xc000 -#define EFI_HII_DEFAULT_CLASS_FIRMWARE_END 0xffff - -typedef struct _EFI_IFR_VARSTORE { - EFI_IFR_OP_HEADER Header; - EFI_GUID Guid; - EFI_VARSTORE_ID VarStoreId; - UINT16 Size; - UINT8 Name[1]; -} EFI_IFR_VARSTORE; - -typedef struct _EFI_IFR_VARSTORE_EFI { - EFI_IFR_OP_HEADER Header; - EFI_VARSTORE_ID VarStoreId; - EFI_GUID Guid; - UINT32 Attributes; - UINT16 Size; - UINT8 Name[1]; -} EFI_IFR_VARSTORE_EFI; - -typedef struct _EFI_IFR_VARSTORE_NAME_VALUE { - EFI_IFR_OP_HEADER Header; - EFI_VARSTORE_ID VarStoreId; - EFI_GUID Guid; -} EFI_IFR_VARSTORE_NAME_VALUE; - -typedef struct _EFI_IFR_FORM_SET { - EFI_IFR_OP_HEADER Header; - EFI_GUID Guid; - EFI_STRING_ID FormSetTitle; - EFI_STRING_ID Help; - UINT8 Flags; - // EFI_GUID ClassGuid[]; -} EFI_IFR_FORM_SET; - -typedef struct _EFI_IFR_END { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_END; - -typedef struct _EFI_IFR_FORM { - EFI_IFR_OP_HEADER Header; - UINT16 FormId; - EFI_STRING_ID FormTitle; -} EFI_IFR_FORM; - -typedef struct _EFI_IFR_IMAGE { - EFI_IFR_OP_HEADER Header; - EFI_IMAGE_ID Id; -} EFI_IFR_IMAGE; - -typedef struct _EFI_IFR_MODAL_TAG { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_MODAL_TAG; - -typedef struct _EFI_IFR_LOCKED { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_LOCKED; - -typedef struct _EFI_IFR_RULE { - EFI_IFR_OP_HEADER Header; - UINT8 RuleId; -} EFI_IFR_RULE; - -typedef struct _EFI_IFR_DEFAULT { - EFI_IFR_OP_HEADER Header; - UINT16 DefaultId; - UINT8 Type; - EFI_IFR_TYPE_VALUE Value; -} EFI_IFR_DEFAULT; - -typedef struct _EFI_IFR_DEFAULT_2 { - EFI_IFR_OP_HEADER Header; - UINT16 DefaultId; - UINT8 Type; -} EFI_IFR_DEFAULT_2; - -typedef struct _EFI_IFR_VALUE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_VALUE; - -typedef struct _EFI_IFR_SUBTITLE { - EFI_IFR_OP_HEADER Header; - EFI_IFR_STATEMENT_HEADER Statement; - UINT8 Flags; -} EFI_IFR_SUBTITLE; - -#define EFI_IFR_FLAGS_HORIZONTAL 0x01 - -typedef struct _EFI_IFR_CHECKBOX { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 Flags; -} EFI_IFR_CHECKBOX; - -#define EFI_IFR_CHECKBOX_DEFAULT 0x01 -#define EFI_IFR_CHECKBOX_DEFAULT_MFG 0x02 - -typedef struct _EFI_IFR_TEXT { - EFI_IFR_OP_HEADER Header; - EFI_IFR_STATEMENT_HEADER Statement; - EFI_STRING_ID TextTwo; -} EFI_IFR_TEXT; - -typedef struct _EFI_IFR_REF { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - EFI_FORM_ID FormId; -} EFI_IFR_REF; - -typedef struct _EFI_IFR_REF2 { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - EFI_FORM_ID FormId; - EFI_QUESTION_ID QuestionId; -} EFI_IFR_REF2; - -typedef struct _EFI_IFR_REF3 { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - EFI_FORM_ID FormId; - EFI_QUESTION_ID QuestionId; - EFI_GUID FormSetId; -} EFI_IFR_REF3; - -typedef struct _EFI_IFR_REF4 { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - EFI_FORM_ID FormId; - EFI_QUESTION_ID QuestionId; - EFI_GUID FormSetId; - EFI_STRING_ID DevicePath; -} EFI_IFR_REF4; - -typedef struct _EFI_IFR_REF5 { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; -} EFI_IFR_REF5; - -typedef struct _EFI_IFR_RESET_BUTTON { - EFI_IFR_OP_HEADER Header; - EFI_IFR_STATEMENT_HEADER Statement; - EFI_DEFAULT_ID DefaultId; -} EFI_IFR_RESET_BUTTON; - -typedef struct _EFI_IFR_ACTION { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - EFI_STRING_ID QuestionConfig; -} EFI_IFR_ACTION; - -typedef struct _EFI_IFR_ACTION_1 { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; -} EFI_IFR_ACTION_1; - -typedef struct _EFI_IFR_DATE { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 Flags; -} EFI_IFR_DATE; - -#define EFI_QF_DATE_YEAR_SUPPRESS 0x01 -#define EFI_QF_DATE_MONTH_SUPPRESS 0x02 -#define EFI_QF_DATE_DAY_SUPPRESS 0x04 - -#define EFI_QF_DATE_STORAGE 0x30 -#define QF_DATE_STORAGE_NORMAL 0x00 -#define QF_DATE_STORAGE_TIME 0x10 -#define QF_DATE_STORAGE_WAKEUP 0x20 - -typedef union { - struct { - UINT8 MinValue; - UINT8 MaxValue; - UINT8 Step; - } u8; - struct { - UINT16 MinValue; - UINT16 MaxValue; - UINT16 Step; - } u16; - struct { - UINT32 MinValue; - UINT32 MaxValue; - UINT32 Step; - } u32; - struct { - UINT64 MinValue; - UINT64 MaxValue; - UINT64 Step; - } u64; -} MINMAXSTEP_DATA; - -typedef struct _EFI_IFR_NUMERIC { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 Flags; - MINMAXSTEP_DATA data; -} EFI_IFR_NUMERIC; - -#define EFI_IFR_NUMERIC_SIZE 0x03 -#define EFI_IFR_NUMERIC_SIZE_1 0x00 -#define EFI_IFR_NUMERIC_SIZE_2 0x01 -#define EFI_IFR_NUMERIC_SIZE_4 0x02 -#define EFI_IFR_NUMERIC_SIZE_8 0x03 - -#define EFI_IFR_DISPLAY 0x30 -#define EFI_IFR_DISPLAY_INT_DEC 0x00 -#define EFI_IFR_DISPLAY_UINT_DEC 0x10 -#define EFI_IFR_DISPLAY_UINT_HEX 0x20 - -typedef struct _EFI_IFR_ONE_OF { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 Flags; - MINMAXSTEP_DATA data; -} EFI_IFR_ONE_OF; - -typedef struct _EFI_IFR_STRING { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 MinSize; - UINT8 MaxSize; - UINT8 Flags; -} EFI_IFR_STRING; - -#define EFI_IFR_STRING_MULTI_LINE 0x01 - -typedef struct _EFI_IFR_PASSWORD { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT16 MinSize; - UINT16 MaxSize; -} EFI_IFR_PASSWORD; - -typedef struct _EFI_IFR_ORDERED_LIST { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 MaxContainers; - UINT8 Flags; -} EFI_IFR_ORDERED_LIST; - -#define EFI_IFR_UNIQUE_SET 0x01 -#define EFI_IFR_NO_EMPTY_SET 0x02 - -typedef struct _EFI_IFR_TIME { - EFI_IFR_OP_HEADER Header; - EFI_IFR_QUESTION_HEADER Question; - UINT8 Flags; -} EFI_IFR_TIME; - -#define QF_TIME_HOUR_SUPPRESS 0x01 -#define QF_TIME_MINUTE_SUPPRESS 0x02 -#define QF_TIME_SECOND_SUPPRESS 0x04 - -#define QF_TIME_STORAGE 0x30 -#define QF_TIME_STORAGE_NORMAL 0x00 -#define QF_TIME_STORAGE_TIME 0x10 -#define QF_TIME_STORAGE_WAKEUP 0x20 - -typedef struct _EFI_IFR_DISABLE_IF { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_DISABLE_IF; - -typedef struct _EFI_IFR_SUPPRESS_IF { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_SUPPRESS_IF; - -typedef struct _EFI_IFR_GRAY_OUT_IF { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_GRAY_OUT_IF; - -typedef struct _EFI_IFR_INCONSISTENT_IF { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID Error; -} EFI_IFR_INCONSISTENT_IF; - -typedef struct _EFI_IFR_NO_SUBMIT_IF { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID Error; -} EFI_IFR_NO_SUBMIT_IF; - -typedef struct _EFI_IFR_WARNING_IF { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID Warning; - UINT8 TimeOut; -} EFI_IFR_WARNING_IF; - -typedef struct _EFI_IFR_REFRESH { - EFI_IFR_OP_HEADER Header; - UINT8 RefreshInterval; -} EFI_IFR_REFRESH; - -typedef struct _EFI_IFR_REFRESH_ID { - EFI_IFR_OP_HEADER Header; - EFI_GUID RefreshEventGroupId; -} EFI_IFR_REFRESH_ID; - -typedef struct _EFI_IFR_VARSTORE_DEVICE { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID DevicePath; -} EFI_IFR_VARSTORE_DEVICE; - -typedef struct _EFI_IFR_ONE_OF_OPTION { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID Option; - UINT8 Flags; - UINT8 Type; - EFI_IFR_TYPE_VALUE Value; -} EFI_IFR_ONE_OF_OPTION; - -#define EFI_IFR_TYPE_NUM_SIZE_8 0x00 -#define EFI_IFR_TYPE_NUM_SIZE_16 0x01 -#define EFI_IFR_TYPE_NUM_SIZE_32 0x02 -#define EFI_IFR_TYPE_NUM_SIZE_64 0x03 -#define EFI_IFR_TYPE_BOOLEAN 0x04 -#define EFI_IFR_TYPE_TIME 0x05 -#define EFI_IFR_TYPE_DATE 0x06 -#define EFI_IFR_TYPE_STRING 0x07 -#define EFI_IFR_TYPE_OTHER 0x08 -#define EFI_IFR_TYPE_UNDEFINED 0x09 -#define EFI_IFR_TYPE_ACTION 0x0A -#define EFI_IFR_TYPE_BUFFER 0x0B -#define EFI_IFR_TYPE_REF 0x0C - -#define EFI_IFR_OPTION_DEFAULT 0x10 -#define EFI_IFR_OPTION_DEFAULT_MFG 0x20 - -typedef struct _EFI_IFR_GUID { - EFI_IFR_OP_HEADER Header; - EFI_GUID Guid; - //Optional Data Follows -} EFI_IFR_GUID; - -typedef struct _EFI_IFR_DUP { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_DUP; - -typedef struct _EFI_IFR_EQ_ID_ID { - EFI_IFR_OP_HEADER Header; - EFI_QUESTION_ID QuestionId1; - EFI_QUESTION_ID QuestionId2; -} EFI_IFR_EQ_ID_ID; - -typedef struct _EFI_IFR_EQ_ID_VAL { - EFI_IFR_OP_HEADER Header; - EFI_QUESTION_ID QuestionId; - UINT16 Value; -} EFI_IFR_EQ_ID_VAL; - -typedef struct _EFI_IFR_EQ_ID_VAL_LIST { - EFI_IFR_OP_HEADER Header; - EFI_QUESTION_ID QuestionId; - UINT16 ListLength; - UINT16 ValueList[1]; -} EFI_IFR_EQ_ID_VAL_LIST; - -typedef struct _EFI_IFR_QUESTION_REF1 { - EFI_IFR_OP_HEADER Header; - EFI_QUESTION_ID QuestionId; -} EFI_IFR_QUESTION_REF1; - -typedef struct _EFI_IFR_UINT8 { - EFI_IFR_OP_HEADER Header; - UINT8 Value; -} EFI_IFR_UINT8; - -typedef struct _EFI_IFR_UINT16 { - EFI_IFR_OP_HEADER Header; - UINT16 Value; -} EFI_IFR_UINT16; - -typedef struct _EFI_IFR_QUESTION_REF2 { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_QUESTION_REF2; - -typedef struct _EFI_IFR_UINT32 { - EFI_IFR_OP_HEADER Header; - UINT32 Value; -} EFI_IFR_UINT32; - -typedef struct _EFI_IFR_UINT64 { - EFI_IFR_OP_HEADER Header; - UINT64 Value; -} EFI_IFR_UINT64; - -typedef struct _EFI_IFR_QUESTION_REF3 { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_QUESTION_REF3; - -typedef struct _EFI_IFR_QUESTION_REF3_2 { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID DevicePath; -} EFI_IFR_QUESTION_REF3_2; - -typedef struct _EFI_IFR_QUESTION_REF3_3 { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID DevicePath; - EFI_GUID Guid; -} EFI_IFR_QUESTION_REF3_3; - -typedef struct _EFI_IFR_RULE_REF { - EFI_IFR_OP_HEADER Header; - UINT8 RuleId; -} EFI_IFR_RULE_REF; - -typedef struct _EFI_IFR_STRING_REF1 { - EFI_IFR_OP_HEADER Header; - EFI_STRING_ID StringId; -} EFI_IFR_STRING_REF1; - -typedef struct _EFI_IFR_STRING_REF2 { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_STRING_REF2; - -typedef struct _EFI_IFR_THIS { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_THIS; - -typedef struct _EFI_IFR_TRUE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_TRUE; - -typedef struct _EFI_IFR_FALSE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_FALSE; - -typedef struct _EFI_IFR_ONE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_ONE; - -typedef struct _EFI_IFR_ONES { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_ONES; - -typedef struct _EFI_IFR_ZERO { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_ZERO; - -typedef struct _EFI_IFR_UNDEFINED { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_UNDEFINED; - -typedef struct _EFI_IFR_VERSION { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_VERSION; - -typedef struct _EFI_IFR_LENGTH { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_LENGTH; - -typedef struct _EFI_IFR_NOT { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_NOT; - -typedef struct _EFI_IFR_BITWISE_NOT { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_BITWISE_NOT; - -typedef struct _EFI_IFR_TO_BOOLEAN { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_TO_BOOLEAN; - -#define EFI_IFR_STRING_UNSIGNED_DEC 0 -#define EFI_IFR_STRING_SIGNED_DEC 1 -#define EFI_IFR_STRING_LOWERCASE_HEX 2 -#define EFI_IFR_STRING_UPPERCASE_HEX 3 - -#define EFI_IFR_STRING_ASCII 0 -#define EFI_IFR_STRING_UNICODE 8 - -typedef struct _EFI_IFR_TO_STRING { - EFI_IFR_OP_HEADER Header; - UINT8 Format; -} EFI_IFR_TO_STRING; - -typedef struct _EFI_IFR_TO_UINT { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_TO_UINT; - -typedef struct _EFI_IFR_TO_UPPER { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_TO_UPPER; - -typedef struct _EFI_IFR_TO_LOWER { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_TO_LOWER; - -typedef struct _EFI_IFR_ADD { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_ADD; - -typedef struct _EFI_IFR_AND { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_AND; - -typedef struct _EFI_IFR_BITWISE_AND { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_BITWISE_AND; - -typedef struct _EFI_IFR_BITWISE_OR { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_BITWISE_OR; - -typedef struct _EFI_IFR_CATENATE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_CATENATE; - -typedef struct _EFI_IFR_DIVIDE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_DIVIDE; - -typedef struct _EFI_IFR_EQUAL { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_EQUAL; - -typedef struct _EFI_IFR_GREATER_EQUAL { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_GREATER_EQUAL; - -typedef struct _EFI_IFR_GREATER_THAN { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_GREATER_THAN; - -typedef struct _EFI_IFR_LESS_EQUAL { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_LESS_EQUAL; - -typedef struct _EFI_IFR_LESS_THAN { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_LESS_THAN; - -typedef struct _EFI_IFR_MATCH { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_MATCH; - -typedef struct _EFI_IFR_MATCH2 { - EFI_IFR_OP_HEADER Header; - EFI_GUID SyntaxType; -} EFI_IFR_MATCH2; - -typedef struct _EFI_IFR_MULTIPLY { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_MULTIPLY; - -typedef struct _EFI_IFR_MODULO { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_MODULO; - -typedef struct _EFI_IFR_NOT_EQUAL { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_NOT_EQUAL; - -typedef struct _EFI_IFR_OR { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_OR; - -typedef struct _EFI_IFR_SHIFT_LEFT { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_SHIFT_LEFT; - -typedef struct _EFI_IFR_SHIFT_RIGHT { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_SHIFT_RIGHT; - -typedef struct _EFI_IFR_SUBTRACT { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_SUBTRACT; - -typedef struct _EFI_IFR_CONDITIONAL { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_CONDITIONAL; - -#define EFI_IFR_FF_CASE_SENSITIVE 0x00 -#define EFI_IFR_FF_CASE_INSENSITIVE 0x01 - -typedef struct _EFI_IFR_FIND { - EFI_IFR_OP_HEADER Header; - UINT8 Format; -} EFI_IFR_FIND; - -typedef struct _EFI_IFR_MID { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_MID; - -typedef struct _EFI_IFR_TOKEN { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_TOKEN; - -#define EFI_IFR_FLAGS_FIRST_MATCHING 0x00 -#define EFI_IFR_FLAGS_FIRST_NON_MATCHING 0x01 - -typedef struct _EFI_IFR_SPAN { - EFI_IFR_OP_HEADER Header; - UINT8 Flags; -} EFI_IFR_SPAN; - -typedef struct _EFI_IFR_SECURITY { - /// - /// Standard opcode header, where Header.Op = EFI_IFR_SECURITY_OP. - /// - EFI_IFR_OP_HEADER Header; - /// - /// Security permission level. - /// - EFI_GUID Permissions; -} EFI_IFR_SECURITY; - -typedef struct _EFI_IFR_FORM_MAP_METHOD { - /// - /// The string identifier which provides the human-readable name of - /// the configuration method for this standards map form. - /// - EFI_STRING_ID MethodTitle; - /// - /// Identifier which uniquely specifies the configuration methods - /// associated with this standards map form. - /// - EFI_GUID MethodIdentifier; -} EFI_IFR_FORM_MAP_METHOD; - -typedef struct _EFI_IFR_FORM_MAP { - /// - /// The sequence that defines the type of opcode as well as the length - /// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP. - /// - EFI_IFR_OP_HEADER Header; - /// - /// The unique identifier for this particular form. - /// - EFI_FORM_ID FormId; - /// - /// One or more configuration method's name and unique identifier. - /// - // EFI_IFR_FORM_MAP_METHOD Methods[]; -} EFI_IFR_FORM_MAP; - -typedef struct _EFI_IFR_SET { - /// - /// The sequence that defines the type of opcode as well as the length - /// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP. - /// - EFI_IFR_OP_HEADER Header; - /// - /// Specifies the identifier of a previously declared variable store to - /// use when storing the question's value. - /// - EFI_VARSTORE_ID VarStoreId; - union { - /// - /// A 16-bit Buffer Storage offset. - /// - EFI_STRING_ID VarName; - /// - /// A Name Value or EFI Variable name (VarName). - /// - UINT16 VarOffset; - } VarStoreInfo; - /// - /// Specifies the type used for storage. - /// - UINT8 VarStoreType; -} EFI_IFR_SET; - -typedef struct _EFI_IFR_GET { - /// - /// The sequence that defines the type of opcode as well as the length - /// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP. - /// - EFI_IFR_OP_HEADER Header; - /// - /// Specifies the identifier of a previously declared variable store to - /// use when retrieving the value. - /// - EFI_VARSTORE_ID VarStoreId; - union { - /// - /// A 16-bit Buffer Storage offset. - /// - EFI_STRING_ID VarName; - /// - /// A Name Value or EFI Variable name (VarName). - /// - UINT16 VarOffset; - } VarStoreInfo; - /// - /// Specifies the type used for storage. - /// - UINT8 VarStoreType; -} EFI_IFR_GET; - -typedef struct _EFI_IFR_READ { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_READ; - -typedef struct _EFI_IFR_WRITE { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_WRITE; - -typedef struct _EFI_IFR_MAP { - EFI_IFR_OP_HEADER Header; -} EFI_IFR_MAP; -// -// Keyboard Package -// - -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, - EfiKeyIntl0, - EfiKeyIntl1, - EfiKeyIntl2, - EfiKeyIntl3, - EfiKeyIntl4, - EfiKeyIntl5, - EfiKeyIntl6, - EfiKeyIntl7, - EfiKeyIntl8, - EfiKeyIntl9 -} EFI_KEY; - -typedef struct { - EFI_KEY Key; - CHAR16 Unicode; - CHAR16 ShiftedUnicode; - CHAR16 AltGrUnicode; - CHAR16 ShiftedAltGrUnicode; - UINT16 Modifier; - UINT16 AffectedAttribute; -} EFI_KEY_DESCRIPTOR; - -// -// A key which is affected by all the standard shift modifiers. -// Most keys would be expected to have this bit active. -// -#define EFI_AFFECTED_BY_STANDARD_SHIFT 0x0001 -// -// This key is affected by the caps lock so that if a keyboard driver -// would need to disambiguate between a key which had a "1" defined -// versus a "a" character. Having this bit turned on would tell -// the keyboard driver to use the appropriate shifted state or not. -// -#define EFI_AFFECTED_BY_CAPS_LOCK 0x0002 -// -// Similar to the case of CAPS lock, if this bit is active, the key -// is affected by the num lock being turned on. -// -#define EFI_AFFECTED_BY_NUM_LOCK 0x0004 - -typedef struct { - UINT16 LayoutLength; - EFI_GUID Guid; - UINT32 LayoutDescriptorStringOffset; - UINT8 DescriptorCount; - // EFI_KEY_DESCRIPTOR Descriptors[]; -} EFI_HII_KEYBOARD_LAYOUT; - -typedef struct { - EFI_HII_PACKAGE_HEADER Header; - UINT16 LayoutCount; - // EFI_HII_KEYBOARD_LAYOUT Layout[]; -} EFI_HII_KEYBOARD_PACKAGE_HDR; - -typedef struct { - CHAR16 Language[3]; - CHAR16 Space; - CHAR16 DescriptionString[1]; -} EFI_DESCRIPTION_STRING; - -typedef struct { - UINT16 DescriptionCount; - EFI_DESCRIPTION_STRING DescriptionString[1]; -} EFI_DESCRIPTION_STRING_BUNDLE; - -// -// Modifier values -// -#define EFI_NULL_MODIFIER 0x0000 -#define EFI_LEFT_CONTROL_MODIFIER 0x0001 -#define EFI_RIGHT_CONTROL_MODIFIER 0x0002 -#define EFI_LEFT_ALT_MODIFIER 0x0003 -#define EFI_RIGHT_ALT_MODIFIER 0x0004 -#define EFI_ALT_GR_MODIFIER 0x0005 -#define EFI_INSERT_MODIFIER 0x0006 -#define EFI_DELETE_MODIFIER 0x0007 -#define EFI_PAGE_DOWN_MODIFIER 0x0008 -#define EFI_PAGE_UP_MODIFIER 0x0009 -#define EFI_HOME_MODIFIER 0x000A -#define EFI_END_MODIFIER 0x000B -#define EFI_LEFT_SHIFT_MODIFIER 0x000C -#define EFI_RIGHT_SHIFT_MODIFIER 0x000D -#define EFI_CAPS_LOCK_MODIFIER 0x000E -#define EFI_NUM_LOCK _MODIFIER 0x000F -#define EFI_LEFT_ARROW_MODIFIER 0x0010 -#define EFI_RIGHT_ARROW_MODIFIER 0x0011 -#define EFI_DOWN_ARROW_MODIFIER 0x0012 -#define EFI_UP_ARROW_MODIFIER 0x0013 -#define EFI_NS_KEY_MODIFIER 0x0014 -#define EFI_NS_KEY_DEPENDENCY_MODIFIER 0x0015 -#define EFI_FUNCTION_KEY_ONE_MODIFIER 0x0016 -#define EFI_FUNCTION_KEY_TWO_MODIFIER 0x0017 -#define EFI_FUNCTION_KEY_THREE_MODIFIER 0x0018 -#define EFI_FUNCTION_KEY_FOUR_MODIFIER 0x0019 -#define EFI_FUNCTION_KEY_FIVE_MODIFIER 0x001A -#define EFI_FUNCTION_KEY_SIX_MODIFIER 0x001B -#define EFI_FUNCTION_KEY_SEVEN_MODIFIER 0x001C -#define EFI_FUNCTION_KEY_EIGHT_MODIFIER 0x001D -#define EFI_FUNCTION_KEY_NINE_MODIFIER 0x001E -#define EFI_FUNCTION_KEY_TEN_MODIFIER 0x001F -#define EFI_FUNCTION_KEY_ELEVEN_MODIFIER 0x0020 -#define EFI_FUNCTION_KEY_TWELVE_MODIFIER 0x0021 - -// -// Keys that have multiple control functions based on modifier -// settings are handled in the keyboard driver implementation. -// For instance PRINT_KEY might have a modifier held down and -// is still a nonprinting character, but might have an alternate -// control function like SYSREQUEST -// -#define EFI_PRINT_MODIFIER 0x0022 -#define EFI_SYS_REQUEST_MODIFIER 0x0023 -#define EFI_SCROLL_LOCK_MODIFIER 0x0024 -#define EFI_PAUSE_MODIFIER 0x0025 -#define EFI_BREAK_MODIFIER 0x0026 - -#pragma pack() - - - -// -// References to string tokens must use this macro to enable scanning for -// token usages. -// -// -// STRING_TOKEN is not defined in UEFI specification. But it is placed -// here for the easy access by C files and VFR source files. -// -#define STRING_TOKEN(t) t +#define EFI_HII_PACKAGE_FORM EFI_HII_PACKAGE_FORMS #endif diff --git a/BaseTools/Source/C/Include/Common/VariableFormat.h b/BaseTools/Source/C/Include/Common/VariableFormat.h deleted file mode 100644 index 096db88bc7..0000000000 --- a/BaseTools/Source/C/Include/Common/VariableFormat.h +++ /dev/null @@ -1,44 +0,0 @@ -/**@file - Header file for EFI Variable Services. - - Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- - 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_ diff --git a/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h b/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h deleted file mode 100644 index a1b77dd3e8..0000000000 --- a/BaseTools/Source/C/Include/Common/WorkingBlockHeader.h +++ /dev/null @@ -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.
- - 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 diff --git a/BaseTools/Source/C/Include/Guid/PcAnsi.h b/BaseTools/Source/C/Include/Guid/PcAnsi.h deleted file mode 100644 index 697cf418b9..0000000000 --- a/BaseTools/Source/C/Include/Guid/PcAnsi.h +++ /dev/null @@ -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.
- - 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 diff --git a/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h b/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h deleted file mode 100644 index 0483966beb..0000000000 --- a/BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h +++ /dev/null @@ -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.
- - 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 diff --git a/BaseTools/Source/C/Include/Protocol/DevicePath.h b/BaseTools/Source/C/Include/Protocol/DevicePath.h deleted file mode 100644 index bcad2cfead..0000000000 --- a/BaseTools/Source/C/Include/Protocol/DevicePath.h +++ /dev/null @@ -1,1404 +0,0 @@ -/** @file - The device path protocol as defined in UEFI 2.0. - - The device path represents a programmatic path to a device, - from a software point of view. The path must persist from boot to boot, so - it can not contain things like PCI bus numbers that change from boot to boot. - -Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __EFI_DEVICE_PATH_H__ -#define __EFI_DEVICE_PATH_H__ - -#include -#include -#include - -/// -/// Device Path protocol. -/// -#define EFI_DEVICE_PATH_PROTOCOL_GUID \ - { \ - 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \ - } - -/// -/// Device Path guid definition for backward-compatible with EFI1.1. -/// -#define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID - -#pragma pack(1) - -#if defined(_MSC_EXTENSIONS) -// -// Disable warning when last field of data structure is a zero sized array. -// -#pragma warning ( disable : 4200 ) -#endif - -/** - This protocol can be used on any device handle to obtain generic path/location - information concerning the physical device or logical device. If the handle does - not logically map to a physical device, the handle may not necessarily support - the device path protocol. The device path describes the location of the device - the handle is for. The size of the Device Path can be determined from the structures - that make up the Device Path. -**/ -typedef struct { - UINT8 Type; ///< 0x01 Hardware Device Path. - ///< 0x02 ACPI Device Path. - ///< 0x03 Messaging Device Path. - ///< 0x04 Media Device Path. - ///< 0x05 BIOS Boot Specification Device Path. - ///< 0x7F End of Hardware Device Path. - - UINT8 SubType; ///< Varies by Type - ///< 0xFF End Entire Device Path, or - ///< 0x01 End This Instance of a Device Path and start a new - ///< Device Path. - - UINT8 Length[2]; ///< Specific Device Path data. Type and Sub-Type define - ///< type of data. Size of data is included in Length. - -} EFI_DEVICE_PATH_PROTOCOL; - -/// -/// Device Path protocol definition for backward-compatible with EFI1.1. -/// -typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH; - -/// -/// Hardware Device Paths. -/// -#define HARDWARE_DEVICE_PATH 0x01 - -/// -/// PCI Device Path SubType. -/// -#define HW_PCI_DP 0x01 - -/// -/// PCI Device Path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// PCI Function Number. - /// - UINT8 Function; - /// - /// PCI Device Number. - /// - UINT8 Device; -} PCI_DEVICE_PATH; - -/// -/// PCCARD Device Path SubType. -/// -#define HW_PCCARD_DP 0x02 - -/// -/// PCCARD Device Path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Function Number (0 = First Function). - /// - UINT8 FunctionNumber; -} PCCARD_DEVICE_PATH; - -/// -/// Memory Mapped Device Path SubType. -/// -#define HW_MEMMAP_DP 0x03 - -/// -/// Memory Mapped Device Path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// EFI_MEMORY_TYPE - /// - UINT32 MemoryType; - /// - /// Starting Memory Address. - /// - EFI_PHYSICAL_ADDRESS StartingAddress; - /// - /// Ending Memory Address. - /// - EFI_PHYSICAL_ADDRESS EndingAddress; -} MEMMAP_DEVICE_PATH; - -/// -/// Hardware Vendor Device Path SubType. -/// -#define HW_VENDOR_DP 0x04 - -/// -/// The Vendor Device Path allows the creation of vendor-defined Device Paths. A vendor must -/// allocate a Vendor GUID for a Device Path. The Vendor GUID can then be used to define the -/// contents on the n bytes that follow in the Vendor Device Path node. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Vendor-assigned GUID that defines the data that follows. - /// - EFI_GUID Guid; - /// - /// Vendor-defined variable size data. - /// -} VENDOR_DEVICE_PATH; - -/// -/// Controller Device Path SubType. -/// -#define HW_CONTROLLER_DP 0x05 - -/// -/// Controller Device Path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Controller number. - /// - UINT32 ControllerNumber; -} CONTROLLER_DEVICE_PATH; - -/// -/// BMC Device Path SubType. -/// -#define HW_BMC_DP 0x06 - -/// -/// BMC Device Path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Interface Type. - /// - UINT8 InterfaceType; - /// - /// Base Address. - /// - UINT8 BaseAddress[8]; -} BMC_DEVICE_PATH; - -/// -/// ACPI Device Paths. -/// -#define ACPI_DEVICE_PATH 0x02 - -/// -/// ACPI Device Path SubType. -/// -#define ACPI_DP 0x01 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Device's PnP hardware ID stored in a numeric 32-bit - /// compressed EISA-type ID. This value must match the - /// corresponding _HID in the ACPI name space. - /// - UINT32 HID; - /// - /// Unique ID that is required by ACPI if two devices have the - /// same _HID. This value must also match the corresponding - /// _UID/_HID pair in the ACPI name space. Only the 32-bit - /// numeric value type of _UID is supported. Thus, strings must - /// not be used for the _UID in the ACPI name space. - /// - UINT32 UID; -} ACPI_HID_DEVICE_PATH; - -/// -/// Expanded ACPI Device Path SubType. -/// -#define ACPI_EXTENDED_DP 0x02 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Device's PnP hardware ID stored in a numeric 32-bit - /// compressed EISA-type ID. This value must match the - /// corresponding _HID in the ACPI name space. - /// - UINT32 HID; - /// - /// Unique ID that is required by ACPI if two devices have the - /// same _HID. This value must also match the corresponding - /// _UID/_HID pair in the ACPI name space. - /// - UINT32 UID; - /// - /// Device's compatible PnP hardware ID stored in a numeric - /// 32-bit compressed EISA-type ID. This value must match at - /// least one of the compatible device IDs returned by the - /// corresponding _CID in the ACPI name space. - /// - UINT32 CID; - /// - /// Optional variable length _HIDSTR. - /// Optional variable length _UIDSTR. - /// Optional variable length _CIDSTR. - /// -} ACPI_EXTENDED_HID_DEVICE_PATH; - -// -// EISA ID Macro -// EISA ID Definition 32-bits -// bits[15:0] - three character compressed ASCII EISA ID. -// bits[31:16] - binary number -// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' -// -#define PNP_EISA_ID_CONST 0x41d0 -#define EISA_ID(_Name, _Num) ((UINT32)((_Name) | (_Num) << 16)) -#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) -#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) - -#define PNP_EISA_ID_MASK 0xffff -#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) - -/// -/// ACPI _ADR Device Path SubType. -/// -#define ACPI_ADR_DP 0x03 - -/// -/// The _ADR device path is used to contain video output device attributes to support the Graphics -/// Output Protocol. The device path can contain multiple _ADR entries if multiple video output -/// devices are displaying the same output. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// _ADR value. For video output devices the value of this - /// field comes from Table B-2 of the ACPI 3.0 specification. At - /// least one _ADR value is required. - /// - UINT32 ADR; - // - // This device path may optionally contain more than one _ADR entry. - // -} ACPI_ADR_DEVICE_PATH; - -#define ACPI_ADR_DISPLAY_TYPE_OTHER 0 -#define ACPI_ADR_DISPLAY_TYPE_VGA 1 -#define ACPI_ADR_DISPLAY_TYPE_TV 2 -#define ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL 3 -#define ACPI_ADR_DISPLAY_TYPE_INTERNAL_DIGITAL 4 - -#define ACPI_DISPLAY_ADR(_DeviceIdScheme, _HeadId, _NonVgaOutput, _BiosCanDetect, _VendorInfo, _Type, _Port, _Index) \ - ((UINT32)( ((UINT32)((_DeviceIdScheme) & 0x1) << 31) | \ - (((_HeadId) & 0x7) << 18) | \ - (((_NonVgaOutput) & 0x1) << 17) | \ - (((_BiosCanDetect) & 0x1) << 16) | \ - (((_VendorInfo) & 0xf) << 12) | \ - (((_Type) & 0xf) << 8) | \ - (((_Port) & 0xf) << 4) | \ - ((_Index) & 0xf) )) - -/// -/// Messaging Device Paths. -/// This Device Path is used to describe the connection of devices outside the resource domain of the -/// system. This Device Path can describe physical messaging information like SCSI ID, or abstract -/// information like networking protocol IP addresses. -/// -#define MESSAGING_DEVICE_PATH 0x03 - -/// -/// ATAPI Device Path SubType -/// -#define MSG_ATAPI_DP 0x01 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Set to zero for primary, or one for secondary. - /// - UINT8 PrimarySecondary; - /// - /// Set to zero for master, or one for slave mode. - /// - UINT8 SlaveMaster; - /// - /// Logical Unit Number. - /// - UINT16 Lun; -} ATAPI_DEVICE_PATH; - -/// -/// SCSI Device Path SubType. -/// -#define MSG_SCSI_DP 0x02 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Target ID on the SCSI bus (PUN). - /// - UINT16 Pun; - /// - /// Logical Unit Number (LUN). - /// - UINT16 Lun; -} SCSI_DEVICE_PATH; - -/// -/// Fibre Channel SubType. -/// -#define MSG_FIBRECHANNEL_DP 0x03 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Reserved for the future. - /// - UINT32 Reserved; - /// - /// Fibre Channel World Wide Number. - /// - UINT64 WWN; - /// - /// Fibre Channel Logical Unit Number. - /// - UINT64 Lun; -} FIBRECHANNEL_DEVICE_PATH; - -/// -/// Fibre Channel Ex SubType. -/// -#define MSG_FIBRECHANNELEX_DP 0x15 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Reserved for the future. - /// - UINT32 Reserved; - /// - /// 8 byte array containing Fibre Channel End Device Port Name. - /// - UINT8 WWN[8]; - /// - /// 8 byte array containing Fibre Channel Logical Unit Number. - /// - UINT8 Lun[8]; -} FIBRECHANNELEX_DEVICE_PATH; - -/// -/// 1394 Device Path SubType -/// -#define MSG_1394_DP 0x04 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Reserved for the future. - /// - UINT32 Reserved; - /// - /// 1394 Global Unique ID (GUID). - /// - UINT64 Guid; -} F1394_DEVICE_PATH; - -/// -/// USB Device Path SubType. -/// -#define MSG_USB_DP 0x05 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// USB Parent Port Number. - /// - UINT8 ParentPortNumber; - /// - /// USB Interface Number. - /// - UINT8 InterfaceNumber; -} USB_DEVICE_PATH; - -/// -/// USB Class Device Path SubType. -/// -#define MSG_USB_CLASS_DP 0x0f -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Vendor ID assigned by USB-IF. A value of 0xFFFF will - /// match any Vendor ID. - /// - UINT16 VendorId; - /// - /// Product ID assigned by USB-IF. A value of 0xFFFF will - /// match any Product ID. - /// - UINT16 ProductId; - /// - /// The class code assigned by the USB-IF. A value of 0xFF - /// will match any class code. - /// - UINT8 DeviceClass; - /// - /// The subclass code assigned by the USB-IF. A value of - /// 0xFF will match any subclass code. - /// - UINT8 DeviceSubClass; - /// - /// The protocol code assigned by the USB-IF. A value of - /// 0xFF will match any protocol code. - /// - UINT8 DeviceProtocol; -} USB_CLASS_DEVICE_PATH; - -/// -/// USB WWID Device Path SubType. -/// -#define MSG_USB_WWID_DP 0x10 - -/// -/// This device path describes a USB device using its serial number. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// USB interface number. - /// - UINT16 InterfaceNumber; - /// - /// USB vendor id of the device. - /// - UINT16 VendorId; - /// - /// USB product id of the device. - /// - UINT16 ProductId; - /// - /// Last 64-or-fewer UTF-16 characters of the USB - /// serial number. The length of the string is - /// determined by the Length field less the offset of the - /// Serial Number field (10) - /// - /// CHAR16 SerialNumber[...]; -} USB_WWID_DEVICE_PATH; - -/// -/// Device Logical Unit SubType. -/// -#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Logical Unit Number for the interface. - /// - UINT8 Lun; -} DEVICE_LOGICAL_UNIT_DEVICE_PATH; - -/// -/// SATA Device Path SubType. -/// -#define MSG_SATA_DP 0x12 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// The HBA port number that facilitates the connection to the - /// device or a port multiplier. The value 0xFFFF is reserved. - /// - UINT16 HBAPortNumber; - /// - /// The Port multiplier port number that facilitates the connection - /// to the device. Must be set to 0xFFFF if the device is directly - /// connected to the HBA. - /// - UINT16 PortMultiplierPortNumber; - /// - /// Logical Unit Number. - /// - UINT16 Lun; -} SATA_DEVICE_PATH; - -/// -/// Flag for if the device is directly connected to the HBA. -/// -#define SATA_HBA_DIRECT_CONNECT_FLAG 0x8000 - -/// -/// I2O Device Path SubType. -/// -#define MSG_I2O_DP 0x06 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Target ID (TID) for a device. - /// - UINT32 Tid; -} I2O_DEVICE_PATH; - -/// -/// MAC Address Device Path SubType. -/// -#define MSG_MAC_ADDR_DP 0x0b -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// The MAC address for a network interface padded with 0s. - /// - EFI_MAC_ADDRESS MacAddress; - /// - /// Network interface type(i.e. 802.3, FDDI). - /// - UINT8 IfType; -} MAC_ADDR_DEVICE_PATH; - -/// -/// IPv4 Device Path SubType -/// -#define MSG_IPv4_DP 0x0c -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// The local IPv4 address. - /// - EFI_IPv4_ADDRESS LocalIpAddress; - /// - /// The remote IPv4 address. - /// - EFI_IPv4_ADDRESS RemoteIpAddress; - /// - /// The local port number. - /// - UINT16 LocalPort; - /// - /// The remote port number. - /// - UINT16 RemotePort; - /// - /// The network protocol(i.e. UDP, TCP). - /// - UINT16 Protocol; - /// - /// 0x00 - The Source IP Address was assigned though DHCP. - /// 0x01 - The Source IP Address is statically bound. - /// - BOOLEAN StaticIpAddress; - /// - /// The gateway IP address - /// - EFI_IPv4_ADDRESS GatewayIpAddress; - /// - /// The subnet mask - /// - EFI_IPv4_ADDRESS SubnetMask; -} IPv4_DEVICE_PATH; - -/// -/// IPv6 Device Path SubType. -/// -#define MSG_IPv6_DP 0x0d -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// The local IPv6 address. - /// - EFI_IPv6_ADDRESS LocalIpAddress; - /// - /// The remote IPv6 address. - /// - EFI_IPv6_ADDRESS RemoteIpAddress; - /// - /// The local port number. - /// - UINT16 LocalPort; - /// - /// The remote port number. - /// - UINT16 RemotePort; - /// - /// The network protocol(i.e. UDP, TCP). - /// - UINT16 Protocol; - /// - /// 0x00 - The Local IP Address was manually configured. - /// 0x01 - The Local IP Address is assigned through IPv6 - /// stateless auto-configuration. - /// 0x02 - The Local IP Address is assigned through IPv6 - /// stateful configuration. - /// - UINT8 IpAddressOrigin; - /// - /// The prefix length - /// - UINT8 PrefixLength; - /// - /// The gateway IP address - /// - EFI_IPv6_ADDRESS GatewayIpAddress; -} IPv6_DEVICE_PATH; - -/// -/// InfiniBand Device Path SubType. -/// -#define MSG_INFINIBAND_DP 0x09 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Flags to help identify/manage InfiniBand device path elements: - /// Bit 0 - IOC/Service (0b = IOC, 1b = Service). - /// Bit 1 - Extend Boot Environment. - /// Bit 2 - Console Protocol. - /// Bit 3 - Storage Protocol. - /// Bit 4 - Network Protocol. - /// All other bits are reserved. - /// - UINT32 ResourceFlags; - /// - /// 128-bit Global Identifier for remote fabric port. - /// - UINT8 PortGid[16]; - /// - /// 64-bit unique identifier to remote IOC or server process. - /// Interpretation of field specified by Resource Flags (bit 0). - /// - UINT64 ServiceId; - /// - /// 64-bit persistent ID of remote IOC port. - /// - UINT64 TargetPortId; - /// - /// 64-bit persistent ID of remote device. - /// - UINT64 DeviceId; -} INFINIBAND_DEVICE_PATH; - -#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01 -#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02 -#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04 -#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08 -#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10 - -/// -/// UART Device Path SubType. -/// -#define MSG_UART_DP 0x0e -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Reserved. - /// - UINT32 Reserved; - /// - /// The baud rate setting for the UART style device. A value of 0 - /// means that the device's default baud rate will be used. - /// - UINT64 BaudRate; - /// - /// The number of data bits for the UART style device. A value - /// of 0 means that the device's default number of data bits will be used. - /// - UINT8 DataBits; - /// - /// The parity setting for the UART style device. - /// Parity 0x00 - Default Parity. - /// Parity 0x01 - No Parity. - /// Parity 0x02 - Even Parity. - /// Parity 0x03 - Odd Parity. - /// Parity 0x04 - Mark Parity. - /// Parity 0x05 - Space Parity. - /// - UINT8 Parity; - /// - /// The number of stop bits for the UART style device. - /// Stop Bits 0x00 - Default Stop Bits. - /// Stop Bits 0x01 - 1 Stop Bit. - /// Stop Bits 0x02 - 1.5 Stop Bits. - /// Stop Bits 0x03 - 2 Stop Bits. - /// - UINT8 StopBits; -} UART_DEVICE_PATH; - -/// -/// NVDIMM Namespace Device Path SubType. -/// -#define NVDIMM_NAMESPACE_DP 0x20 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Namespace unique label identifier UUID. - /// - EFI_GUID Uuid; -} NVDIMM_NAMESPACE_DEVICE_PATH; - -// -// Use VENDOR_DEVICE_PATH struct -// -#define MSG_VENDOR_DP 0x0a -typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH; - -#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID -#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID -#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID -#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID - -/// -/// A new device path node is defined to declare flow control characteristics. -/// UART Flow Control Messaging Device Path -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL GUID. - /// - EFI_GUID Guid; - /// - /// Bitmap of supported flow control types. - /// Bit 0 set indicates hardware flow control. - /// Bit 1 set indicates Xon/Xoff flow control. - /// All other bits are reserved and are clear. - /// - UINT32 FlowControlMap; -} UART_FLOW_CONTROL_DEVICE_PATH; - -#define UART_FLOW_CONTROL_HARDWARE 0x00000001 -#define UART_FLOW_CONTROL_XON_XOFF 0x00000010 - -#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID -/// -/// Serial Attached SCSI (SAS) Device Path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// DEVICE_PATH_MESSAGING_SAS GUID. - /// - EFI_GUID Guid; - /// - /// Reserved for future use. - /// - UINT32 Reserved; - /// - /// SAS Address for Serial Attached SCSI Target. - /// - UINT64 SasAddress; - /// - /// SAS Logical Unit Number. - /// - UINT64 Lun; - /// - /// More Information about the device and its interconnect. - /// - UINT16 DeviceTopology; - /// - /// Relative Target Port (RTP). - /// - UINT16 RelativeTargetPort; -} SAS_DEVICE_PATH; - -/// -/// Serial Attached SCSI (SAS) Ex Device Path SubType -/// -#define MSG_SASEX_DP 0x16 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// 8-byte array of the SAS Address for Serial Attached SCSI Target Port. - /// - UINT8 SasAddress[8]; - /// - /// 8-byte array of the SAS Logical Unit Number. - /// - UINT8 Lun[8]; - /// - /// More Information about the device and its interconnect. - /// - UINT16 DeviceTopology; - /// - /// Relative Target Port (RTP). - /// - UINT16 RelativeTargetPort; -} SASEX_DEVICE_PATH; - -/// -/// NvmExpress Namespace Device Path SubType. -/// -#define MSG_NVME_NAMESPACE_DP 0x17 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - UINT32 NamespaceId; - UINT64 NamespaceUuid; -} NVME_NAMESPACE_DEVICE_PATH; - -/// -/// DNS Device Path SubType -/// -#define MSG_DNS_DP 0x1F -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Indicates the DNS server address is IPv4 or IPv6 address. - /// - UINT8 IsIPv6; - /// - /// Instance of the DNS server address. - /// - EFI_IP_ADDRESS DnsServerIp[]; -} DNS_DEVICE_PATH; - -/// -/// Uniform Resource Identifiers (URI) Device Path SubType -/// -#define MSG_URI_DP 0x18 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Instance of the URI pursuant to RFC 3986. - /// - CHAR8 Uri[]; -} URI_DEVICE_PATH; - -/// -/// Universal Flash Storage (UFS) Device Path SubType. -/// -#define MSG_UFS_DP 0x19 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Target ID on the UFS bus (PUN). - /// - UINT8 Pun; - /// - /// Logical Unit Number (LUN). - /// - UINT8 Lun; -} UFS_DEVICE_PATH; - -/// -/// SD (Secure Digital) Device Path SubType. -/// -#define MSG_SD_DP 0x1A -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - UINT8 SlotNumber; -} SD_DEVICE_PATH; - -/// -/// EMMC (Embedded MMC) Device Path SubType. -/// -#define MSG_EMMC_DP 0x1D -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - UINT8 SlotNumber; -} EMMC_DEVICE_PATH; - -/// -/// iSCSI Device Path SubType -/// -#define MSG_ISCSI_DP 0x13 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Network Protocol (0 = TCP, 1+ = reserved). - /// - UINT16 NetworkProtocol; - /// - /// iSCSI Login Options. - /// - UINT16 LoginOption; - /// - /// iSCSI Logical Unit Number. - /// - UINT64 Lun; - /// - /// iSCSI Target Portal group tag the initiator intends - /// to establish a session with. - /// - UINT16 TargetPortalGroupTag; - /// - /// iSCSI NodeTarget Name. The length of the name - /// is determined by subtracting the offset of this field from Length. - /// - /// CHAR8 iSCSI Target Name. -} ISCSI_DEVICE_PATH; - -#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000 -#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002 -#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000 -#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008 -#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000 -#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000 -#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000 -#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000 - -/// -/// VLAN Device Path SubType. -/// -#define MSG_VLAN_DP 0x14 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// VLAN identifier (0-4094). - /// - UINT16 VlanId; -} VLAN_DEVICE_PATH; - -/// -/// Bluetooth Device Path SubType. -/// -#define MSG_BLUETOOTH_DP 0x1b -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// 48bit Bluetooth device address. - /// - BLUETOOTH_ADDRESS BD_ADDR; -} BLUETOOTH_DEVICE_PATH; - -/// -/// Wi-Fi Device Path SubType. -/// -#define MSG_WIFI_DP 0x1C -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Service set identifier. A 32-byte octets string. - /// - UINT8 SSId[32]; -} WIFI_DEVICE_PATH; - -/// -/// Bluetooth LE Device Path SubType. -/// -#define MSG_BLUETOOTH_LE_DP 0x1E -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - BLUETOOTH_LE_ADDRESS Address; -} BLUETOOTH_LE_DEVICE_PATH; - -// -// Media Device Path -// -#define MEDIA_DEVICE_PATH 0x04 - -/// -/// Hard Drive Media Device Path SubType. -/// -#define MEDIA_HARDDRIVE_DP 0x01 - -/// -/// The Hard Drive Media Device Path is used to represent a partition on a hard drive. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Describes the entry in a partition table, starting with entry 1. - /// Partition number zero represents the entire device. Valid - /// partition numbers for a MBR partition are [1, 4]. Valid - /// partition numbers for a GPT partition are [1, NumberOfPartitionEntries]. - /// - UINT32 PartitionNumber; - /// - /// Starting LBA of the partition on the hard drive. - /// - UINT64 PartitionStart; - /// - /// Size of the partition in units of Logical Blocks. - /// - UINT64 PartitionSize; - /// - /// Signature unique to this partition: - /// If SignatureType is 0, this field has to be initialized with 16 zeros. - /// If SignatureType is 1, the MBR signature is stored in the first 4 bytes of this field. - /// The other 12 bytes are initialized with zeros. - /// If SignatureType is 2, this field contains a 16 byte signature. - /// - UINT8 Signature[16]; - /// - /// Partition Format: (Unused values reserved). - /// 0x01 - PC-AT compatible legacy MBR. - /// 0x02 - GUID Partition Table. - /// - UINT8 MBRType; - /// - /// Type of Disk Signature: (Unused values reserved). - /// 0x00 - No Disk Signature. - /// 0x01 - 32-bit signature from address 0x1b8 of the type 0x01 MBR. - /// 0x02 - GUID signature. - /// - UINT8 SignatureType; -} HARDDRIVE_DEVICE_PATH; - -#define MBR_TYPE_PCAT 0x01 -#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 - -#define NO_DISK_SIGNATURE 0x00 -#define SIGNATURE_TYPE_MBR 0x01 -#define SIGNATURE_TYPE_GUID 0x02 - -/// -/// CD-ROM Media Device Path SubType. -/// -#define MEDIA_CDROM_DP 0x02 - -/// -/// The CD-ROM Media Device Path is used to define a system partition that exists on a CD-ROM. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Boot Entry number from the Boot Catalog. The Initial/Default entry is defined as zero. - /// - UINT32 BootEntry; - /// - /// Starting RBA of the partition on the medium. CD-ROMs use Relative logical Block Addressing. - /// - UINT64 PartitionStart; - /// - /// Size of the partition in units of Blocks, also called Sectors. - /// - UINT64 PartitionSize; -} CDROM_DEVICE_PATH; - -// -// Use VENDOR_DEVICE_PATH struct -// -#define MEDIA_VENDOR_DP 0x03 ///< Media vendor device path subtype. - -/// -/// File Path Media Device Path SubType -/// -#define MEDIA_FILEPATH_DP 0x04 -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// A NULL-terminated Path string including directory and file names. - /// - CHAR16 PathName[1]; -} FILEPATH_DEVICE_PATH; - -#define SIZE_OF_FILEPATH_DEVICE_PATH OFFSET_OF(FILEPATH_DEVICE_PATH,PathName) - -/// -/// Media Protocol Device Path SubType. -/// -#define MEDIA_PROTOCOL_DP 0x05 - -/// -/// The Media Protocol Device Path is used to denote the protocol that is being -/// used in a device path at the location of the path specified. -/// Many protocols are inherent to the style of device path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// The ID of the protocol. - /// - EFI_GUID Protocol; -} MEDIA_PROTOCOL_DEVICE_PATH; - -/// -/// PIWG Firmware File SubType. -/// -#define MEDIA_PIWG_FW_FILE_DP 0x06 - -/// -/// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware file. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Firmware file name - /// - EFI_GUID FvFileName; -} MEDIA_FW_VOL_FILEPATH_DEVICE_PATH; - -/// -/// PIWG Firmware Volume Device Path SubType. -/// -#define MEDIA_PIWG_FW_VOL_DP 0x07 - -/// -/// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware volume. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Firmware volume name. - /// - EFI_GUID FvName; -} MEDIA_FW_VOL_DEVICE_PATH; - -/// -/// Media relative offset range device path. -/// -#define MEDIA_RELATIVE_OFFSET_RANGE_DP 0x08 - -/// -/// Used to describe the offset range of media relative. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - UINT32 Reserved; - UINT64 StartingOffset; - UINT64 EndingOffset; -} MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH; - -/// -/// This GUID defines a RAM Disk supporting a raw disk format in volatile memory. -/// -#define EFI_VIRTUAL_DISK_GUID \ - { \ - 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E } \ - } - -extern EFI_GUID gEfiVirtualDiskGuid; - -/// -/// This GUID defines a RAM Disk supporting an ISO image in volatile memory. -/// -#define EFI_VIRTUAL_CD_GUID \ - { \ - 0x3D5ABD30, 0x4175, 0x87CE, {0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB } \ - } -extern EFI_GUID gEfiVirtualCdGuid; - -/// -/// This GUID defines a RAM Disk supporting a raw disk format in persistent memory. -/// -#define EFI_PERSISTENT_VIRTUAL_DISK_GUID \ - { \ - 0x5CEA02C9, 0x4D07, 0x69D3, {0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 } \ - } - -extern EFI_GUID gEfiPersistentVirtualDiskGuid; - -/// -/// This GUID defines a RAM Disk supporting an ISO image in persistent memory. -/// -#define EFI_PERSISTENT_VIRTUAL_CD_GUID \ - { \ - 0x08018188, 0x42CD, 0xBB48, {0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D } \ - } - -extern EFI_GUID gEfiPersistentVirtualCdGuid; - -/// -/// Media ram disk device path. -/// -#define MEDIA_RAM_DISK_DP 0x09 - -/// -/// Used to describe the ram disk device path. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Starting Memory Address. - /// - UINT32 StartingAddr[2]; - /// - /// Ending Memory Address. - /// - UINT32 EndingAddr[2]; - /// - /// GUID that defines the type of the RAM Disk. - /// - EFI_GUID TypeGuid; - /// - /// RAM Diskinstance number, if supported. The default value is zero. - /// - UINT16 Instance; -} MEDIA_RAM_DISK_DEVICE_PATH; - -/// -/// BIOS Boot Specification Device Path. -/// -#define BBS_DEVICE_PATH 0x05 - -/// -/// BIOS Boot Specification Device Path SubType. -/// -#define BBS_BBS_DP 0x01 - -/// -/// This Device Path is used to describe the booting of non-EFI-aware operating systems. -/// -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - /// - /// Device Type as defined by the BIOS Boot Specification. - /// - UINT16 DeviceType; - /// - /// Status Flags as defined by the BIOS Boot Specification. - /// - UINT16 StatusFlag; - /// - /// Null-terminated ASCII string that describes the boot device to a user. - /// - CHAR8 String[1]; -} BBS_BBS_DEVICE_PATH; - -// -// DeviceType definitions - from BBS specification -// -#define BBS_TYPE_FLOPPY 0x01 -#define BBS_TYPE_HARDDRIVE 0x02 -#define BBS_TYPE_CDROM 0x03 -#define BBS_TYPE_PCMCIA 0x04 -#define BBS_TYPE_USB 0x05 -#define BBS_TYPE_EMBEDDED_NETWORK 0x06 -#define BBS_TYPE_BEV 0x80 -#define BBS_TYPE_UNKNOWN 0xFF - - -/// -/// Union of all possible Device Paths and pointers to Device Paths. -/// -typedef union { - EFI_DEVICE_PATH_PROTOCOL DevPath; - PCI_DEVICE_PATH Pci; - PCCARD_DEVICE_PATH PcCard; - MEMMAP_DEVICE_PATH MemMap; - VENDOR_DEVICE_PATH Vendor; - - CONTROLLER_DEVICE_PATH Controller; - BMC_DEVICE_PATH Bmc; - ACPI_HID_DEVICE_PATH Acpi; - ACPI_EXTENDED_HID_DEVICE_PATH ExtendedAcpi; - ACPI_ADR_DEVICE_PATH AcpiAdr; - - ATAPI_DEVICE_PATH Atapi; - SCSI_DEVICE_PATH Scsi; - ISCSI_DEVICE_PATH Iscsi; - FIBRECHANNEL_DEVICE_PATH FibreChannel; - FIBRECHANNELEX_DEVICE_PATH FibreChannelEx; - - F1394_DEVICE_PATH F1394; - USB_DEVICE_PATH Usb; - SATA_DEVICE_PATH Sata; - USB_CLASS_DEVICE_PATH UsbClass; - USB_WWID_DEVICE_PATH UsbWwid; - DEVICE_LOGICAL_UNIT_DEVICE_PATH LogicUnit; - I2O_DEVICE_PATH I2O; - MAC_ADDR_DEVICE_PATH MacAddr; - IPv4_DEVICE_PATH Ipv4; - IPv6_DEVICE_PATH Ipv6; - VLAN_DEVICE_PATH Vlan; - INFINIBAND_DEVICE_PATH InfiniBand; - UART_DEVICE_PATH Uart; - UART_FLOW_CONTROL_DEVICE_PATH UartFlowControl; - SAS_DEVICE_PATH Sas; - SASEX_DEVICE_PATH SasEx; - NVME_NAMESPACE_DEVICE_PATH NvmeNamespace; - DNS_DEVICE_PATH Dns; - URI_DEVICE_PATH Uri; - BLUETOOTH_DEVICE_PATH Bluetooth; - WIFI_DEVICE_PATH WiFi; - UFS_DEVICE_PATH Ufs; - SD_DEVICE_PATH Sd; - EMMC_DEVICE_PATH Emmc; - HARDDRIVE_DEVICE_PATH HardDrive; - CDROM_DEVICE_PATH CD; - - FILEPATH_DEVICE_PATH FilePath; - MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; - - MEDIA_FW_VOL_DEVICE_PATH FirmwareVolume; - MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FirmwareFile; - MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH Offset; - MEDIA_RAM_DISK_DEVICE_PATH RamDisk; - BBS_BBS_DEVICE_PATH Bbs; -} EFI_DEV_PATH; - - - -typedef union { - EFI_DEVICE_PATH_PROTOCOL *DevPath; - PCI_DEVICE_PATH *Pci; - PCCARD_DEVICE_PATH *PcCard; - MEMMAP_DEVICE_PATH *MemMap; - VENDOR_DEVICE_PATH *Vendor; - - CONTROLLER_DEVICE_PATH *Controller; - BMC_DEVICE_PATH *Bmc; - ACPI_HID_DEVICE_PATH *Acpi; - ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; - ACPI_ADR_DEVICE_PATH *AcpiAdr; - - ATAPI_DEVICE_PATH *Atapi; - SCSI_DEVICE_PATH *Scsi; - ISCSI_DEVICE_PATH *Iscsi; - FIBRECHANNEL_DEVICE_PATH *FibreChannel; - FIBRECHANNELEX_DEVICE_PATH *FibreChannelEx; - - F1394_DEVICE_PATH *F1394; - USB_DEVICE_PATH *Usb; - SATA_DEVICE_PATH *Sata; - USB_CLASS_DEVICE_PATH *UsbClass; - USB_WWID_DEVICE_PATH *UsbWwid; - DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicUnit; - I2O_DEVICE_PATH *I2O; - MAC_ADDR_DEVICE_PATH *MacAddr; - IPv4_DEVICE_PATH *Ipv4; - IPv6_DEVICE_PATH *Ipv6; - VLAN_DEVICE_PATH *Vlan; - INFINIBAND_DEVICE_PATH *InfiniBand; - UART_DEVICE_PATH *Uart; - UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl; - SAS_DEVICE_PATH *Sas; - SASEX_DEVICE_PATH *SasEx; - NVME_NAMESPACE_DEVICE_PATH *NvmeNamespace; - DNS_DEVICE_PATH *Dns; - URI_DEVICE_PATH *Uri; - BLUETOOTH_DEVICE_PATH *Bluetooth; - WIFI_DEVICE_PATH *WiFi; - UFS_DEVICE_PATH *Ufs; - SD_DEVICE_PATH *Sd; - EMMC_DEVICE_PATH *Emmc; - HARDDRIVE_DEVICE_PATH *HardDrive; - CDROM_DEVICE_PATH *CD; - - FILEPATH_DEVICE_PATH *FilePath; - MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; - - MEDIA_FW_VOL_DEVICE_PATH *FirmwareVolume; - MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FirmwareFile; - MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset; - MEDIA_RAM_DISK_DEVICE_PATH *RamDisk; - BBS_BBS_DEVICE_PATH *Bbs; - UINT8 *Raw; -} EFI_DEV_PATH_PTR; - -#define EFI_DEBUGPORT_PROTOCOL_GUID \ - { \ - 0xEBA4E8D2, 0x3858, 0x41EC, {0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \ - } -// -// DEBUGPORT variable definitions... -// -#define EFI_DEBUGPORT_VARIABLE_NAME L"DEBUGPORT" -#define EFI_DEBUGPORT_VARIABLE_GUID EFI_DEBUGPORT_PROTOCOL_GUID -extern EFI_GUID gEfiDebugPortVariableGuid; - -// -// DebugPort device path definitions... -// -#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID -extern EFI_GUID gEfiDebugPortProtocolGuid; - -typedef struct { - EFI_DEVICE_PATH_PROTOCOL Header; - EFI_GUID Guid; -} DEBUGPORT_DEVICE_PATH; - -#pragma pack() - -#define END_DEVICE_PATH_TYPE 0x7f -#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xFF -#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 - -extern EFI_GUID gEfiDevicePathProtocolGuid; - -#endif diff --git a/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h b/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h deleted file mode 100644 index b2fd6b2837..0000000000 --- a/BaseTools/Source/C/Include/Protocol/DevicePathUtilities.h +++ /dev/null @@ -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.
- 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 diff --git a/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h b/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h deleted file mode 100644 index 5a10ac72a4..0000000000 --- a/BaseTools/Source/C/Include/Protocol/GraphicsOutput.h +++ /dev/null @@ -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.
- - 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: - - EfiBltVideoFill - 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. - - EfiBltVideoToBltBuffer - 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. - - EfiBltBufferToVideo - 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. - - EfiBltVideoToVideo - 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 diff --git a/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h b/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h deleted file mode 100644 index f629546252..0000000000 --- a/BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h +++ /dev/null @@ -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.
- - 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 diff --git a/BaseTools/Source/C/Include/Protocol/HiiFramework.h b/BaseTools/Source/C/Include/Protocol/HiiFramework.h deleted file mode 100644 index 448350967b..0000000000 --- a/BaseTools/Source/C/Include/Protocol/HiiFramework.h +++ /dev/null @@ -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.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _FRAMEWORK_HII_H_ -#define _FRAMEWORK_HII_H_ - -//#include - -// -// To get EFI_GRAPHICS_OUTPUT_BLT_PIXEL, -// is defined in MdePkg/Protocol/GraphicsOutput.h -// -#include - -#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 with and by removing special characters such - as the 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 diff --git a/BaseTools/Source/C/Include/Protocol/UgaDraw.h b/BaseTools/Source/C/Include/Protocol/UgaDraw.h deleted file mode 100644 index 412b000aeb..0000000000 --- a/BaseTools/Source/C/Include/Protocol/UgaDraw.h +++ /dev/null @@ -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.
- - 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: - - EfiUgaVideoFill - 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. - - EfiUgaVideoToBltBuffer - 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. - - EfiUgaBltBufferToVideo - 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. - - EfiUgaVideoToVideo - 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 diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c index bf4706ee23..f9613a7d6d 100644 --- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c +++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c @@ -12,6 +12,8 @@ #define _CRT_SECURE_NO_WARNINGS +#include "WinNtInclude.h" + #include #include #include diff --git a/BaseTools/Source/C/Makefiles/footer.makefile b/BaseTools/Source/C/Makefiles/footer.makefile index 7546da8cf5..e914749169 100644 --- a/BaseTools/Source/C/Makefiles/footer.makefile +++ b/BaseTools/Source/C/Makefiles/footer.makefile @@ -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) diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile index f16b3297fc..31f94e9be9 100644 --- a/BaseTools/Source/C/Makefiles/header.makefile +++ b/BaseTools/Source/C/Makefiles/header.makefile @@ -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 diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common index 66f0f5ba4c..291e8f180c 100644 --- a/BaseTools/Source/C/Makefiles/ms.common +++ b/BaseTools/Source/C/Makefiles/ms.common @@ -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 CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334 @@ -83,5 +86,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 diff --git a/BaseTools/Source/C/Makefiles/ms.rule b/BaseTools/Source/C/Makefiles/ms.rule index 7d53316c43..a7ea626592 100644 --- a/BaseTools/Source/C/Makefiles/ms.rule +++ b/BaseTools/Source/C/Makefiles/ms.rule @@ -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$@ diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c index 428011ca04..be8e30dbde 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.c +++ b/BaseTools/Source/C/VolInfo/VolInfo.c @@ -23,9 +23,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include -#include -#include +#include +#include +#include #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 )