[edk2-devel] [edk2-platforms][PATCH v2 3/5] MinPlatformPkg/TestPointCheckLib: Fix incorrect array index

Michael Kubacki mikuback at linux.microsoft.com
Fri Aug 6 01:32:48 UTC 2021


From: Michael Kubacki <michael.kubacki at microsoft.com>

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

TestPointSmmEndOfDxeSmrrFunctional() uses the incorrect byte index
to skip the test. It should use byte 6 instead of byte 5.

Also defines a macro "TEST_POINT_INDEX_BYTE6_SMM" for the byte index
6 value.

Cc: Chasel Chiu <chasel.chiu at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Eric Dong <eric.dong at intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
---
 Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.c | 26 +++++++++++---------
 Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h                   |  1 +
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.c
index 4b4f874c7bbc..75200969d3e7 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPointCheckLib.c
@@ -109,7 +109,7 @@ TestPointSmmEndOfDxeSmrrFunctional (
   EFI_STATUS  Status;
   BOOLEAN     Result;
 
-  if ((mFeatureImplemented[5] & TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCTIONAL) == 0) {
+  if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] & TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCTIONAL) == 0) {
     return EFI_SUCCESS;
   }
 
@@ -125,7 +125,7 @@ TestPointSmmEndOfDxeSmrrFunctional (
     TestPointLibSetFeaturesVerified (
       PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
       NULL,
-      5,
+      TEST_POINT_INDEX_BYTE6_SMM,
       TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCTIONAL
       );
   }
@@ -156,7 +156,8 @@ TestPointSmmReadyToLockSmmMemoryAttributeTableFunctional (
   EFI_STATUS  Status;
   BOOLEAN     Result;
 
-  if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTIONAL) == 0) {
+  if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] &
+    TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTIONAL) == 0) {
     return EFI_SUCCESS;
   }
 
@@ -173,7 +174,7 @@ TestPointSmmReadyToLockSmmMemoryAttributeTableFunctional (
     TestPointLibSetFeaturesVerified (
       PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
       NULL,
-      6,
+      TEST_POINT_INDEX_BYTE6_SMM,
       TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTIONAL
       );
   }
@@ -202,7 +203,8 @@ TestPointSmmReadyToLockSecureSmmCommunicationBuffer (
   EFI_MEMORY_ATTRIBUTES_TABLE  *MemoryAttributesTable;
   UINTN                        MemoryAttributesTableSize;
 
-  if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER) == 0) {
+  if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] &
+    TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER) == 0) {
     return EFI_SUCCESS;
   }
 
@@ -248,7 +250,8 @@ TestPointSmmReadyToBootSmmPageProtection (
   EFI_STATUS  Status;
   BOOLEAN     Result;
 
-  if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) == 0) {
+  if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM]
+    & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) == 0) {
     return EFI_SUCCESS;
   }
 
@@ -264,7 +267,7 @@ TestPointSmmReadyToBootSmmPageProtection (
     TestPointLibSetFeaturesVerified (
       PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
       NULL,
-      6,
+      TEST_POINT_INDEX_BYTE6_SMM,
       TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION
       );
   }
@@ -280,7 +283,7 @@ TestPointSmmReadyToBootSmmPageProtection (
       TestPointLibSetFeaturesVerified (
         PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
         NULL,
-        6,
+        TEST_POINT_INDEX_BYTE6_SMM,
         TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER
         );
     }
@@ -312,7 +315,8 @@ TestPointSmmReadyToBootSmmPageProtectionHandler (
   TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO      *CommData;
   UINTN                                               TempCommBufferSize;
 
-  if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) == 0) {
+  if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM]
+    & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) == 0) {
     return EFI_SUCCESS;
   }
 
@@ -390,14 +394,14 @@ TestPointSmmReadyToBootSmmPageProtectionHandler (
       TestPointLibSetFeaturesVerified (
         PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
         NULL,
-        6,
+        TEST_POINT_INDEX_BYTE6_SMM,
         TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER
         );
     } else {
       TestPointLibClearFeaturesVerified (
         PLATFORM_TEST_POINT_ROLE_PLATFORM_IBV,
         NULL,
-        6,
+        TEST_POINT_INDEX_BYTE6_SMM,
         TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER
         );
     }
diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h b/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h
index 7265e2268961..73c30522179c 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h
+++ b/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheckLib.h
@@ -738,6 +738,7 @@ TestPointSmmExitBootServices (
 #define TEST_POINT_SMM_READY_TO_BOOT                                                        L" - SMM Ready To Boot - "
 #define TEST_POINT_SMM_EXIT_BOOT_SERVICES                                                   L" - SMM Exit Boot Services - "
 
+#define TEST_POINT_INDEX_BYTE6_SMM                                                          6
 #define TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUNCTIONAL                                     BIT0
 #define TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTIONAL            BIT1
 #define TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER                  BIT2
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78770): https://edk2.groups.io/g/devel/message/78770
Mute This Topic: https://groups.io/mt/84699700/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list