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


Michael Kubacki
 

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

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

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@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTestPoin=
tCheckLib.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/Test=
PointCheckLib/SmmTestPointCheckLib.c
index 4b4f874c7bbc..75200969d3e7 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTes=
tPointCheckLib.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/SmmTes=
tPointCheckLib.c
@@ -109,7 +109,7 @@ TestPointSmmEndOfDxeSmrrFunctional (
EFI_STATUS Status;
BOOLEAN Result;
=20
- if ((mFeatureImplemented[5] & TEST_POINT_BYTE6_SMM_END_OF_DXE_SMRR_FUN=
CTIONAL) =3D=3D 0) {
+ if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] & TEST_POINT_BYTE=
6_SMM_END_OF_DXE_SMRR_FUNCTIONAL) =3D=3D 0) {
return EFI_SUCCESS;
}
=20
@@ -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 @@ TestPointSmmReadyToLockSmmMemoryAttributeTableFunctio=
nal (
EFI_STATUS Status;
BOOLEAN Result;
=20
- if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_M=
EMORY_ATTRIBUTE_TABLE_FUNCTIONAL) =3D=3D 0) {
+ if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] &
+ TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SMM_MEMORY_ATTRIBUTE_TABLE_FUNCTI=
ONAL) =3D=3D 0) {
return EFI_SUCCESS;
}
=20
@@ -173,7 +174,7 @@ TestPointSmmReadyToLockSmmMemoryAttributeTableFunctio=
nal (
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_FUNC=
TIONAL
);
}
@@ -202,7 +203,8 @@ TestPointSmmReadyToLockSecureSmmCommunicationBuffer (
EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable;
UINTN MemoryAttributesTableSize;
=20
- if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECUR=
E_SMM_COMMUNICATION_BUFFER) =3D=3D 0) {
+ if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM] &
+ TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFFER) =
=3D=3D 0) {
return EFI_SUCCESS;
}
=20
@@ -248,7 +250,8 @@ TestPointSmmReadyToBootSmmPageProtection (
EFI_STATUS Status;
BOOLEAN Result;
=20
- if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_P=
AGE_LEVEL_PROTECTION) =3D=3D 0) {
+ if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM]
+ & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) =3D=3D=
0) {
return EFI_SUCCESS;
}
=20
@@ -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_BUFF=
ER
);
}
@@ -312,7 +315,8 @@ TestPointSmmReadyToBootSmmPageProtectionHandler (
TEST_POINT_SMM_COMMUNICATION_UEFI_GCD_MAP_INFO *CommData;
UINTN TempCommBufferSize=
;
=20
- if ((mFeatureImplemented[6] & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_P=
AGE_LEVEL_PROTECTION) =3D=3D 0) {
+ if ((mFeatureImplemented[TEST_POINT_INDEX_BYTE6_SMM]
+ & TEST_POINT_BYTE6_SMM_READY_TO_BOOT_SMM_PAGE_LEVEL_PROTECTION) =3D=3D=
0) {
return EFI_SUCCESS;
}
=20
@@ -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_BUFF=
ER
);
} 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_BUFF=
ER
);
}
diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/TestPointCheck=
Lib.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 - "
=20
+#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_FU=
NCTIONAL BIT1
#define TEST_POINT_BYTE6_SMM_READY_TO_LOCK_SECURE_SMM_COMMUNICATION_BUFF=
ER BIT2
--=20
2.28.0.windows.1

Join devel@edk2.groups.io to automatically receive all group messages.