]> xenbits.xensource.com Git - ovmf.git/commitdiff
OvmfPkg: Consume new alignment-related macros
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 22 Mar 2023 07:02:42 +0000 (00:02 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sat, 1 Apr 2023 23:11:44 +0000 (23:11 +0000)
This patch substitutes the macros that were renamed in the second
patch with the new, shared alignment macros.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
OvmfPkg/AmdSevDxe/AmdSevDxe.c
OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c

index 71a1eaaf0a1dd0ed6011a26f2301d83d9ef7c502..9b0d0e92b6f7dcef23b61ec66b4efda896f52c24 100644 (file)
@@ -44,8 +44,6 @@ STATIC BOOLEAN  mAcceptAllMemoryAtEBS = TRUE;
 \r
 STATIC EFI_EVENT  mAcceptAllMemoryEvent = NULL;\r
 \r
-#define IS_ALIGNED_(x, y)  ((((x) & ((y) - 1)) == 0))\r
-\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
@@ -60,8 +58,8 @@ AmdSevMemoryAccept (
   // multiple of SIZE_4KB. Use an assert instead of returning an erros since\r
   // this is an EDK2-internal protocol.\r
   //\r
-  ASSERT (IS_ALIGNED_ (StartAddress, SIZE_4KB));\r
-  ASSERT (IS_ALIGNED_ (Size, SIZE_4KB));\r
+  ASSERT (IS_ALIGNED (StartAddress, SIZE_4KB));\r
+  ASSERT (IS_ALIGNED (Size, SIZE_4KB));\r
   ASSERT (Size != 0);\r
 \r
   MemEncryptSevSnpPreValidateSystemRam (\r
index f35bba5deb4669175887ea13e00df3b7cd034775..7a8878b1a9c22b88b479404e1aead95dc0db7fde 100644 (file)
@@ -20,7 +20,6 @@
 \r
 #include "SnpPageStateChange.h"\r
 \r
-#define IS_ALIGNED_(x, y)  ((((x) & (y - 1)) == 0))\r
 #define PAGES_PER_LARGE_ENTRY  512\r
 \r
 STATIC\r
@@ -150,7 +149,7 @@ BuildPageStateBuffer (
     //\r
     // Is this a 2MB aligned page? Check if we can use the Large RMP entry.\r
     //\r
-    if (UseLargeEntry && IS_ALIGNED_ (BaseAddress, SIZE_2MB) &&\r
+    if (UseLargeEntry && IS_ALIGNED (BaseAddress, SIZE_2MB) &&\r
         ((EndAddress - BaseAddress) >= SIZE_2MB))\r
     {\r
       RmpPageSize = PvalidatePageSize2MB;\r