MdePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdePkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:05 -08:00
committed by mergify[bot]
parent 1436aea4d5
commit 2f88bd3a12
975 changed files with 55681 additions and 57790 deletions

View File

@@ -25,10 +25,10 @@
**/
VOID *
InternalHstiFindAip (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
OUT VOID **HstiData OPTIONAL,
OUT UINTN *HstiSize OPTIONAL
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
OUT VOID **HstiData OPTIONAL,
OUT UINTN *HstiSize OPTIONAL
)
{
EFI_STATUS Status;
@@ -55,9 +55,9 @@ InternalHstiFindAip (
return NULL;
}
Hsti = NULL;
Aip = NULL;
InformationBlock = NULL;
Hsti = NULL;
Aip = NULL;
InformationBlock = NULL;
InformationBlockSize = 0;
for (Index = 0; Index < NoHandles; Index++) {
Status = gBS->HandleProtocol (
@@ -88,6 +88,7 @@ InternalHstiFindAip (
break;
}
}
FreePool (InfoTypesBuffer);
if (AipCandidate == NULL) {
@@ -97,7 +98,7 @@ InternalHstiFindAip (
//
// Check HSTI Role
//
Aip = AipCandidate;
Aip = AipCandidate;
Status = Aip->GetInformation (
Aip,
&gAdapterInfoPlatformSecurityGuid,
@@ -110,7 +111,8 @@ InternalHstiFindAip (
Hsti = InformationBlock;
if ((Hsti->Role == Role) &&
((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0))) {
((ImplementationID == NULL) || (StrCmp (ImplementationID, Hsti->ImplementationID) == 0)))
{
break;
} else {
Hsti = NULL;
@@ -118,6 +120,7 @@ InternalHstiFindAip (
continue;
}
}
FreePool (Handles);
if (Hsti == NULL) {
@@ -127,9 +130,11 @@ InternalHstiFindAip (
if (HstiData != NULL) {
*HstiData = InformationBlock;
}
if (HstiSize != NULL) {
*HstiSize = InformationBlockSize;
}
return Aip;
}
@@ -144,8 +149,8 @@ InternalHstiFindAip (
**/
BOOLEAN
InternalHstiIsValidTable (
IN VOID *HstiData,
IN UINTN HstiSize
IN VOID *HstiData,
IN UINTN HstiSize
)
{
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
@@ -164,11 +169,13 @@ InternalHstiIsValidTable (
DEBUG ((DEBUG_ERROR, "HstiData == NULL\n"));
return FALSE;
}
if (HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) {
if (HstiSize < sizeof (ADAPTER_INFO_PLATFORM_SECURITY)) {
DEBUG ((DEBUG_ERROR, "HstiSize < sizeof(ADAPTER_INFO_PLATFORM_SECURITY)\n"));
return FALSE;
}
if (((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) {
if (((HstiSize - sizeof (ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < Hsti->SecurityFeaturesSize) {
DEBUG ((DEBUG_ERROR, "((HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY)) / 3) < SecurityFeaturesSize\n"));
return FALSE;
}
@@ -185,7 +192,8 @@ InternalHstiIsValidTable (
// Check Role
//
if ((Hsti->Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) ||
(Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM)) {
(Hsti->Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM))
{
DEBUG ((DEBUG_ERROR, "Role < PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE ||\n"));
DEBUG ((DEBUG_ERROR, "Role > PLATFORM_SECURITY_ROLE_IMPLEMENTOR_ODM\n"));
return FALSE;
@@ -194,18 +202,19 @@ InternalHstiIsValidTable (
//
// Check ImplementationID
//
for (Index = 0; Index < sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0]); Index++) {
for (Index = 0; Index < sizeof (Hsti->ImplementationID)/sizeof (Hsti->ImplementationID[0]); Index++) {
if (Hsti->ImplementationID[Index] == 0) {
break;
}
}
if (Index == sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {
if (Index == sizeof (Hsti->ImplementationID)/sizeof (Hsti->ImplementationID[0])) {
DEBUG ((DEBUG_ERROR, "ImplementationID has no NUL CHAR\n"));
return FALSE;
}
ErrorStringSize = HstiSize - sizeof(ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;
ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);
ErrorStringSize = HstiSize - sizeof (ADAPTER_INFO_PLATFORM_SECURITY) - Hsti->SecurityFeaturesSize * 3;
ErrorString = (CHAR16 *)((UINTN)Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3);
//
// basic check for ErrorString
@@ -214,6 +223,7 @@ InternalHstiIsValidTable (
DEBUG ((DEBUG_ERROR, "ErrorStringSize == 0\n"));
return FALSE;
}
if ((ErrorStringSize & BIT0) != 0) {
DEBUG ((DEBUG_ERROR, "(ErrorStringSize & BIT0) != 0\n"));
return FALSE;
@@ -222,10 +232,10 @@ InternalHstiIsValidTable (
//
// ErrorString might not be CHAR16 aligned.
//
CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));
CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar));
for (ErrorStringLength = 0; (ErrorChar != 0) && (ErrorStringLength < (ErrorStringSize/2)); ErrorStringLength++) {
ErrorString++;
CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));
CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar));
}
//
@@ -235,6 +245,7 @@ InternalHstiIsValidTable (
DEBUG ((DEBUG_ERROR, "ErrorString has no NUL CHAR\n"));
return FALSE;
}
if (ErrorStringLength == (ErrorStringSize/2)) {
DEBUG ((DEBUG_ERROR, "ErrorString Length incorrect\n"));
return FALSE;
@@ -262,48 +273,50 @@ InternalHstiIsValidTable (
EFI_STATUS
EFIAPI
HstiLibSetTable (
IN VOID *Hsti,
IN UINTN HstiSize
IN VOID *Hsti,
IN UINTN HstiSize
)
{
EFI_STATUS Status;
EFI_HANDLE Handle;
HSTI_AIP_PRIVATE_DATA *HstiAip;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
UINT32 Role;
CHAR16 *ImplementationID;
UINT32 SecurityFeaturesSize;
UINT8 *SecurityFeaturesRequired;
EFI_STATUS Status;
EFI_HANDLE Handle;
HSTI_AIP_PRIVATE_DATA *HstiAip;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
UINT32 Role;
CHAR16 *ImplementationID;
UINT32 SecurityFeaturesSize;
UINT8 *SecurityFeaturesRequired;
if (!InternalHstiIsValidTable (Hsti, HstiSize)) {
return EFI_VOLUME_CORRUPTED;
}
Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role;
Role = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->Role;
ImplementationID = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->ImplementationID;
Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL);
Aip = InternalHstiFindAip (Role, ImplementationID, NULL, NULL);
if (Aip != NULL) {
return EFI_ALREADY_STARTED;
}
HstiAip = AllocateZeroPool (sizeof(HSTI_AIP_PRIVATE_DATA));
HstiAip = AllocateZeroPool (sizeof (HSTI_AIP_PRIVATE_DATA));
if (HstiAip == NULL) {
return EFI_OUT_OF_RESOURCES;
}
HstiAip->Hsti = AllocateCopyPool (HstiSize, Hsti);
if (HstiAip->Hsti == NULL) {
FreePool (HstiAip);
return EFI_OUT_OF_RESOURCES;
}
if (Role != PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) {
SecurityFeaturesRequired = (UINT8 *)HstiAip->Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY);
SecurityFeaturesSize = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->SecurityFeaturesSize;
SecurityFeaturesRequired = (UINT8 *)HstiAip->Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY);
SecurityFeaturesSize = ((ADAPTER_INFO_PLATFORM_SECURITY *)Hsti)->SecurityFeaturesSize;
ZeroMem (SecurityFeaturesRequired, SecurityFeaturesSize);
}
HstiAip->Signature = HSTI_AIP_PRIVATE_SIGNATURE;
CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof(EFI_ADAPTER_INFORMATION_PROTOCOL));
HstiAip->HstiSize = HstiSize;
CopyMem (&HstiAip->Aip, &mAdapterInformationProtocol, sizeof (EFI_ADAPTER_INFORMATION_PROTOCOL));
HstiAip->HstiSize = HstiSize;
HstiAip->HstiMaxSize = HstiSize;
Handle = NULL;
@@ -340,18 +353,19 @@ HstiLibSetTable (
EFI_STATUS
EFIAPI
HstiLibGetTable (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
OUT VOID **Hsti,
OUT UINTN *HstiSize
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
OUT VOID **Hsti,
OUT UINTN *HstiSize
)
{
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
Aip = InternalHstiFindAip (Role, ImplementationID, Hsti, HstiSize);
if (Aip == NULL) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
@@ -374,18 +388,18 @@ HstiLibGetTable (
**/
EFI_STATUS
InternalHstiRecordFeaturesVerified (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN UINT32 ByteIndex,
IN UINT8 Bit,
IN BOOLEAN Set
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN UINT32 ByteIndex,
IN UINT8 Bit,
IN BOOLEAN Set
)
{
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
UINTN HstiSize;
UINT8 *SecurityFeaturesVerified;
EFI_STATUS Status;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
UINTN HstiSize;
UINT8 *SecurityFeaturesVerified;
EFI_STATUS Status;
Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize);
if (Aip == NULL) {
@@ -396,7 +410,7 @@ InternalHstiRecordFeaturesVerified (
return EFI_UNSUPPORTED;
}
SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2);
SecurityFeaturesVerified = (UINT8 *)((UINTN)Hsti + sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 2);
if (Set) {
SecurityFeaturesVerified[ByteIndex] = (UINT8)(SecurityFeaturesVerified[ByteIndex] | (Bit));
@@ -432,10 +446,10 @@ InternalHstiRecordFeaturesVerified (
EFI_STATUS
EFIAPI
HstiLibSetFeaturesVerified (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN UINT32 ByteIndex,
IN UINT8 BitMask
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN UINT32 ByteIndex,
IN UINT8 BitMask
)
{
return InternalHstiRecordFeaturesVerified (
@@ -465,10 +479,10 @@ HstiLibSetFeaturesVerified (
EFI_STATUS
EFIAPI
HstiLibClearFeaturesVerified (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN UINT32 ByteIndex,
IN UINT8 BitMask
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN UINT32 ByteIndex,
IN UINT8 BitMask
)
{
return InternalHstiRecordFeaturesVerified (
@@ -498,20 +512,20 @@ HstiLibClearFeaturesVerified (
**/
EFI_STATUS
InternalHstiRecordErrorString (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN CHAR16 *ErrorString,
IN BOOLEAN Append
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN CHAR16 *ErrorString,
IN BOOLEAN Append
)
{
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
UINTN HstiSize;
UINTN StringSize;
VOID *NewHsti;
UINTN NewHstiSize;
UINTN Offset;
EFI_STATUS Status;
EFI_ADAPTER_INFORMATION_PROTOCOL *Aip;
ADAPTER_INFO_PLATFORM_SECURITY *Hsti;
UINTN HstiSize;
UINTN StringSize;
VOID *NewHsti;
UINTN NewHstiSize;
UINTN Offset;
EFI_STATUS Status;
Aip = InternalHstiFindAip (Role, ImplementationID, (VOID **)&Hsti, &HstiSize);
if (Aip == NULL) {
@@ -519,14 +533,15 @@ InternalHstiRecordErrorString (
}
if (Append) {
Offset = HstiSize - sizeof(CHAR16);
Offset = HstiSize - sizeof (CHAR16);
} else {
Offset = sizeof(ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;
Offset = sizeof (ADAPTER_INFO_PLATFORM_SECURITY) + Hsti->SecurityFeaturesSize * 3;
}
StringSize = StrSize (ErrorString);
NewHstiSize = Offset + StringSize;
NewHsti = AllocatePool (NewHstiSize);
NewHsti = AllocatePool (NewHstiSize);
if (NewHsti == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -562,9 +577,9 @@ InternalHstiRecordErrorString (
EFI_STATUS
EFIAPI
HstiLibAppendErrorString (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN CHAR16 *ErrorString
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN CHAR16 *ErrorString
)
{
return InternalHstiRecordErrorString (
@@ -592,9 +607,9 @@ HstiLibAppendErrorString (
EFI_STATUS
EFIAPI
HstiLibSetErrorString (
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN CHAR16 *ErrorString
IN UINT32 Role,
IN CHAR16 *ImplementationID OPTIONAL,
IN CHAR16 *ErrorString
)
{
return InternalHstiRecordErrorString (