From 6b14ef6b282821c82ba40bad78f8afb7bca5d077 Mon Sep 17 00:00:00 2001 From: Tom Lendacky Date: Fri, 8 Mar 2024 07:30:44 -0800 Subject: OvmfPkg/BaseMemEncryptSevLib: Fix uncrustify errors BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4654 In prep for follow-on patches, fix an area of the code that does not meet the uncrustify coding standards. Cc: Ard Biesheuvel Cc: Erdem Aktas Cc: Gerd Hoffmann Cc: Jiewen Yao Cc: Laszlo Ersek Cc: Michael Roth Cc: Min Xu Reviewed-by: Gerd Hoffmann Signed-off-by: Tom Lendacky --- .../X64/SnpPageStateChangeInternal.c | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c index 46c6682..6a11adb 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c @@ -2,7 +2,7 @@ SEV-SNP Page Validation functions. - Copyright (c) 2021 AMD Incorporated. All rights reserved.
+ Copyright (c) 2021 - 2024, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -78,7 +78,9 @@ PvalidateRange ( IN BOOLEAN Validate ) { - UINTN RmpPageSize, Ret, i; + UINTN RmpPageSize; + UINTN Index; + UINTN Ret; EFI_PHYSICAL_ADDRESS Address; for ( ; StartIndex <= EndIndex; StartIndex++) { @@ -96,7 +98,7 @@ PvalidateRange ( // the RMP entry is 4K and we are validating it as a 2MB. // if ((Ret == PVALIDATE_RET_SIZE_MISMATCH) && (RmpPageSize == PvalidatePageSize2MB)) { - for (i = 0; i < PAGES_PER_LARGE_ENTRY; i++) { + for (Index = 0; Index < PAGES_PER_LARGE_ENTRY; Index++) { Ret = AsmPvalidate (PvalidatePageSize4K, Validate, Address); if (Ret) { break; @@ -135,18 +137,19 @@ BuildPageStateBuffer ( ) { EFI_PHYSICAL_ADDRESS NextAddress; - UINTN i, RmpPageSize; + UINTN RmpPageSize; + UINTN Index; // Clear the page state structure SetMem (Info, sizeof (*Info), 0); - i = 0; + Index = 0; NextAddress = EndAddress; // // Populate the page state entry structure // - while ((BaseAddress < EndAddress) && (i < SNP_PAGE_STATE_MAX_ENTRY)) { + while ((BaseAddress < EndAddress) && (Index < SNP_PAGE_STATE_MAX_ENTRY)) { // // Is this a 2MB aligned page? Check if we can use the Large RMP entry. // @@ -160,14 +163,14 @@ BuildPageStateBuffer ( NextAddress = BaseAddress + EFI_PAGE_SIZE; } - Info->Entry[i].GuestFrameNumber = BaseAddress >> EFI_PAGE_SHIFT; - Info->Entry[i].PageSize = RmpPageSize; - Info->Entry[i].Operation = MemoryStateToGhcbOp (State); - Info->Entry[i].CurrentPage = 0; - Info->Header.EndEntry = (UINT16)i; + Info->Entry[Index].GuestFrameNumber = BaseAddress >> EFI_PAGE_SHIFT; + Info->Entry[Index].PageSize = RmpPageSize; + Info->Entry[Index].Operation = MemoryStateToGhcbOp (State); + Info->Entry[Index].CurrentPage = 0; + Info->Header.EndEntry = (UINT16)Index; BaseAddress = NextAddress; - i++; + Index++; } return NextAddress; -- cgit v1.1