summaryrefslogtreecommitdiff
path: root/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-10-05 22:25:51 +0800
committerJiewen Yao <jiewen.yao@intel.com>2017-10-24 19:43:22 +0800
commit602ca88a55162bf84c369d6924131f128a0ed356 (patch)
tree13a196e6bb2ade628fe877a4c7ed0c71a92535d7 /Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c
parent5d307a4d238923cf79451899c7e6663ff210e48c (diff)
downloadedk2-platforms-602ca88a55162bf84c369d6924131f128a0ed356.tar.xz
Clean up Checkpoint.
1) CheckPointLib interface to be feature based, instead of phase based. 2) Rename file from Dump to Check. 3) Add TestPointStub to help convert PEI/SMM info to DXE protocol. 4) Implement all check points. Cc: Michael A Kubacki <michael.a.kubacki@intel.com> Cc: Amy Chan <amy.chan@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Brett Wang <brett.wang@intel.com> Cc: Daocheng Bu <daocheng.bu@intel.com> Cc: Isaac W Oram <isaac.w.oram@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Amy Chan <amy.chan@intel.com>
Diffstat (limited to 'Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c')
-rw-r--r--Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c
index f648e589b7..fac07c52f5 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointLib/PeiTestPoint.c
@@ -24,9 +24,9 @@ InternalGetTestPointInfoSize (
UINTN ErrorStringMaxSize;
CHAR16 ErrorChar;
- ErrorString = (CHAR16 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + 3 * TestPoint->FeaturesSize);
+ ErrorString = (CHAR16 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TEST_POINT_FEATURES_ITEM_NUMBER * TestPoint->FeaturesSize);
- ErrorStringMaxSize = MaxSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * 3;
+ ErrorStringMaxSize = MaxSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * TEST_POINT_FEATURES_ITEM_NUMBER;
//
// ErrorString might not be CHAR16 aligned.
//
@@ -36,7 +36,7 @@ InternalGetTestPointInfoSize (
CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar));
}
- return sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + 3 * TestPoint->FeaturesSize + (ErrorStringLength + 1) * sizeof(CHAR16);
+ return sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TEST_POINT_FEATURES_ITEM_NUMBER * TestPoint->FeaturesSize + (ErrorStringLength + 1) * sizeof(CHAR16);
}
/**
@@ -135,8 +135,8 @@ InternalTestPointIsValidTable (
DEBUG ((EFI_D_ERROR, "TestPointSize < sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT)\n"));
return FALSE;
}
- if (((TestPointSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT)) / 3) < TestPoint->FeaturesSize) {
- DEBUG ((EFI_D_ERROR, "((TestPointSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT)) / 3) < FeaturesSize\n"));
+ if (((TestPointSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT)) / TEST_POINT_FEATURES_ITEM_NUMBER) < TestPoint->FeaturesSize) {
+ DEBUG ((EFI_D_ERROR, "((TestPointSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT)) / TEST_POINT_FEATURES_ITEM_NUMBER) < FeaturesSize\n"));
return FALSE;
}
@@ -171,8 +171,8 @@ InternalTestPointIsValidTable (
return FALSE;
}
- ErrorStringSize = TestPointSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * 3;
- ErrorString = (CHAR16 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * 3);
+ ErrorStringSize = TestPointSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * TEST_POINT_FEATURES_ITEM_NUMBER;
+ ErrorString = (CHAR16 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * TEST_POINT_FEATURES_ITEM_NUMBER);
//
// basic check for ErrorString
@@ -215,9 +215,6 @@ InternalTestPointIsValidTable (
One system should have only one PLATFORM_TEST_POINT_ROLE_PLATFORM_REFERENCE.
- If the Role is NOT PLATFORM_TEST_POINT_ROLE_PLATFORM_REFERENCE,
- FeaturesRequired field will be ignored.
-
@param TestPoint TestPoint data
@param TestPointSize TestPoint size
@@ -237,10 +234,11 @@ TestPointLibSetTable (
EFI_STATUS Status;
UINT32 Role;
CHAR16 *ImplementationID;
- UINT32 FeaturesSize;
- UINT8 *FeaturesRequired;
+
+ DEBUG ((EFI_D_ERROR, "TestPointLibSetTable\n"));
if (!InternalTestPointIsValidTable (TestPoint, TestPointSize)) {
+ DEBUG ((EFI_D_ERROR, "InternalTestPointIsValidTable\n"));
return EFI_VOLUME_CORRUPTED;
}
@@ -248,6 +246,7 @@ TestPointLibSetTable (
ImplementationID = ((ADAPTER_INFO_PLATFORM_TEST_POINT *)TestPoint)->ImplementationID;
Status = InternalTestPointFindAip (Role, ImplementationID, NULL, NULL, NULL);
if (!EFI_ERROR(Status)) {
+ DEBUG ((EFI_D_ERROR, "Aip (0x%x, %S) is found\n", Role, ImplementationID));
return EFI_ALREADY_STARTED;
}
@@ -255,11 +254,6 @@ TestPointLibSetTable (
if (NewTestPoint == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- if (Role != PLATFORM_TEST_POINT_ROLE_PLATFORM_REFERENCE) {
- FeaturesRequired = (UINT8 *)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT);
- FeaturesSize = ((ADAPTER_INFO_PLATFORM_TEST_POINT *)TestPoint)->FeaturesSize;
- ZeroMem (FeaturesRequired, FeaturesSize);
- }
CopyMem (NewTestPoint, TestPoint, TestPointSize);
@@ -335,7 +329,7 @@ InternalTestPointRecordFeaturesVerified (
return EFI_UNSUPPORTED;
}
- FeaturesVerified = (UINT8 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TestPoint->FeaturesSize * 2);
+ FeaturesVerified = (UINT8 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TestPoint->FeaturesSize * 1);
if (Set) {
FeaturesVerified[ByteIndex] = (UINT8)(FeaturesVerified[ByteIndex] | (Bit));
@@ -370,6 +364,7 @@ TestPointLibSetFeaturesVerified (
IN UINT8 BitMask
)
{
+ DEBUG ((DEBUG_INFO, "TestPointLibSetFeaturesVerified - Index:0x%x Mask:0x%02x\n", ByteIndex, BitMask));
return InternalTestPointRecordFeaturesVerified (
Role,
ImplementationID,
@@ -403,6 +398,7 @@ TestPointLibClearFeaturesVerified (
IN UINT8 BitMask
)
{
+ DEBUG ((DEBUG_INFO, "TestPointLibClearFeaturesVerified - Index:0x%x Mask:0x%02x\n", ByteIndex, BitMask));
return InternalTestPointRecordFeaturesVerified (
Role,
ImplementationID,
@@ -454,7 +450,7 @@ InternalTestPointRecordErrorString (
if (Append) {
Offset = TestPointSize - sizeof(CHAR16);
} else {
- Offset = sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TestPoint->FeaturesSize * 3;
+ Offset = sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TestPoint->FeaturesSize * TEST_POINT_FEATURES_ITEM_NUMBER;
}
StringSize = StrSize (ErrorString);
@@ -500,7 +496,7 @@ TestPointLibAppendErrorString (
IN CHAR16 *ErrorString
)
{
- DEBUG ((DEBUG_ERROR, "TestPointLibAppendErrorString - (0x%x) %s\n", Role, ErrorString));
+ DEBUG ((DEBUG_INFO, "TestPointLibAppendErrorString - (0x%x) %s\n", Role, ErrorString));
return InternalTestPointRecordErrorString (
Role,
ImplementationID,
@@ -531,7 +527,7 @@ TestPointLibSetErrorString (
IN CHAR16 *ErrorString
)
{
- DEBUG ((DEBUG_ERROR, "TestPointLibSetErrorString - %s\n", ErrorString));
+ DEBUG ((DEBUG_INFO, "TestPointLibSetErrorString - %s\n", ErrorString));
return InternalTestPointRecordErrorString (
Role,
ImplementationID,