#include <Library/Tcg2PpVendorLib.h>\r
#include <Library/MmServicesTableLib.h>\r
\r
-#define PP_INF_VERSION_1_2 "1.2"\r
+#define PP_INF_VERSION_1_2 "1.2"\r
\r
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;\r
BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;\r
UINT32\r
EFIAPI\r
Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (\r
- OUT UINT32 *MostRecentRequest,\r
- OUT UINT32 *Response\r
+ OUT UINT32 *MostRecentRequest,\r
+ OUT UINT32 *Response\r
)\r
{\r
- EFI_STATUS Status;\r
- UINTN DataSize;\r
- EFI_TCG2_PHYSICAL_PRESENCE PpData;\r
+ EFI_STATUS Status;\r
+ UINTN DataSize;\r
+ EFI_TCG2_PHYSICAL_PRESENCE PpData;\r
\r
DEBUG ((DEBUG_INFO, "[TPM2] ReturnOperationResponseToOsFunction\n"));\r
\r
// Get the Physical Presence variable\r
//\r
DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
- Status = mTcg2PpSmmVariable->SmmGetVariable (\r
- TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
- &gEfiTcg2PhysicalPresenceGuid,\r
- NULL,\r
- &DataSize,\r
- &PpData\r
- );\r
+ Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+ TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+ &gEfiTcg2PhysicalPresenceGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &PpData\r
+ );\r
if (EFI_ERROR (Status)) {\r
*MostRecentRequest = 0;\r
*Response = 0;\r
**/\r
UINT32\r
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (\r
- IN OUT UINT32 *OperationRequest,\r
- IN OUT UINT32 *RequestParameter\r
+ IN OUT UINT32 *OperationRequest,\r
+ IN OUT UINT32 *RequestParameter\r
)\r
{\r
EFI_STATUS Status;\r
// Get the Physical Presence variable\r
//\r
DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
- Status = mTcg2PpSmmVariable->SmmGetVariable (\r
- TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
- &gEfiTcg2PhysicalPresenceGuid,\r
- NULL,\r
- &DataSize,\r
- &PpData\r
- );\r
+ Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+ TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+ &gEfiTcg2PhysicalPresenceGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &PpData\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;\r
}\r
\r
if ((*OperationRequest > TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) &&\r
- (*OperationRequest < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN) ) {\r
+ (*OperationRequest < TCG2_PHYSICAL_PRESENCE_STORAGE_MANAGEMENT_BEGIN))\r
+ {\r
ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED;\r
goto EXIT;\r
}\r
\r
if ((PpData.PPRequest != *OperationRequest) ||\r
- (PpData.PPRequestParameter != *RequestParameter)) {\r
- PpData.PPRequest = (UINT8)*OperationRequest;\r
+ (PpData.PPRequestParameter != *RequestParameter))\r
+ {\r
+ PpData.PPRequest = (UINT8)*OperationRequest;\r
PpData.PPRequestParameter = *RequestParameter;\r
- DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
- Status = mTcg2PpSmmVariable->SmmSetVariable (\r
- TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
- &gEfiTcg2PhysicalPresenceGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- DataSize,\r
- &PpData\r
- );\r
+ DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
+ Status = mTcg2PpSmmVariable->SmmSetVariable (\r
+ TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+ &gEfiTcg2PhysicalPresenceGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ DataSize,\r
+ &PpData\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "[TPM2] Set PP variable failure! Status = %r\n", Status));\r
ReturnCode = TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE;\r
\r
if (*OperationRequest >= TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
- Status = mTcg2PpSmmVariable->SmmGetVariable (\r
- TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
- &gEfiTcg2PhysicalPresenceGuid,\r
- NULL,\r
- &DataSize,\r
- &Flags\r
- );\r
+ Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+ TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
+ &gEfiTcg2PhysicalPresenceGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &Flags\r
+ );\r
if (EFI_ERROR (Status)) {\r
Flags.PPFlags = mTcg2PhysicalPresenceFlags;\r
}\r
+\r
ReturnCode = Tcg2PpVendorLibSubmitRequestToPreOSFunction (*OperationRequest, Flags.PPFlags, *RequestParameter);\r
}\r
\r
if (ReturnCode != TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {\r
DEBUG ((DEBUG_ERROR, "[TPM2] Submit PP Request failure! Sync PPRQ/PPRM with PP variable.\n", Status));\r
DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
- ZeroMem(&PpData, DataSize);\r
+ ZeroMem (&PpData, DataSize);\r
Status = mTcg2PpSmmVariable->SmmGetVariable (\r
TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
&gEfiTcg2PhysicalPresenceGuid,\r
UINT32\r
EFIAPI\r
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (\r
- IN UINT32 OperationRequest,\r
- IN UINT32 RequestParameter\r
+ IN UINT32 OperationRequest,\r
+ IN UINT32 RequestParameter\r
)\r
{\r
- UINT32 TempOperationRequest;\r
- UINT32 TempRequestParameter;\r
+ UINT32 TempOperationRequest;\r
+ UINT32 TempRequestParameter;\r
\r
TempOperationRequest = OperationRequest;\r
TempRequestParameter = RequestParameter;\r
\r
- return Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx(&TempOperationRequest, &TempRequestParameter);\r
+ return Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (&TempOperationRequest, &TempRequestParameter);\r
}\r
\r
/**\r
UINT32\r
EFIAPI\r
Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (\r
- IN UINT32 OperationRequest\r
+ IN UINT32 OperationRequest\r
)\r
{\r
EFI_STATUS Status;\r
// Get the Physical Presence variable\r
//\r
DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE);\r
- Status = mTcg2PpSmmVariable->SmmGetVariable (\r
- TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
- &gEfiTcg2PhysicalPresenceGuid,\r
- NULL,\r
- &DataSize,\r
- &PpData\r
- );\r
+ Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+ TCG2_PHYSICAL_PRESENCE_VARIABLE,\r
+ &gEfiTcg2PhysicalPresenceGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &PpData\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "[TPM2] Get PP variable failure! Status = %r\n", Status));\r
return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
}\r
+\r
//\r
// Get the Physical Presence flags\r
//\r
DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE_FLAGS);\r
- Status = mTcg2PpSmmVariable->SmmGetVariable (\r
- TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
- &gEfiTcg2PhysicalPresenceGuid,\r
- NULL,\r
- &DataSize,\r
- &Flags\r
- );\r
+ Status = mTcg2PpSmmVariable->SmmGetVariable (\r
+ TCG2_PHYSICAL_PRESENCE_FLAGS_VARIABLE,\r
+ &gEfiTcg2PhysicalPresenceGuid,\r
+ NULL,\r
+ &DataSize,\r
+ &Flags\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "[TPM2] Get PP flags failure! Status = %r\n", Status));\r
return TCG_PP_GET_USER_CONFIRMATION_BLOCKED_BY_BIOS_CONFIGURATION;\r
if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CLEAR) == 0) {\r
RequestConfirmed = TRUE;\r
}\r
+\r
break;\r
\r
case TCG2_PHYSICAL_PRESENCE_NO_ACTION:\r
if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_PCRS) == 0) {\r
RequestConfirmed = TRUE;\r
}\r
+\r
break;\r
\r
case TCG2_PHYSICAL_PRESENCE_CHANGE_EPS:\r
if ((Flags.PPFlags & TCG2_BIOS_TPM_MANAGEMENT_FLAG_PP_REQUIRED_FOR_CHANGE_EPS) == 0) {\r
RequestConfirmed = TRUE;\r
}\r
+\r
break;\r
\r
case TCG2_PHYSICAL_PRESENCE_LOG_ALL_DIGESTS:\r
if ((Flags.PPFlags & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_ENABLE_BLOCK_SID) == 0) {\r
RequestConfirmed = TRUE;\r
}\r
+\r
break;\r
\r
case TCG2_PHYSICAL_PRESENCE_DISABLE_BLOCK_SID:\r
if ((Flags.PPFlags & TCG2_BIOS_STORAGE_MANAGEMENT_FLAG_PP_REQUIRED_FOR_DISABLE_BLOCK_SID) == 0) {\r
RequestConfirmed = TRUE;\r
}\r
+\r
break;\r
\r
case TCG2_PHYSICAL_PRESENCE_SET_PP_REQUIRED_FOR_ENABLE_BLOCK_SID_FUNC_TRUE:\r
return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
}\r
} else {\r
- //\r
- // TCG PP lower than 1.3. (1.0, 1.1, 1.2)\r
- //\r
- if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {\r
- RequestConfirmed = TRUE;\r
- } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
- return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
- }\r
+ //\r
+ // TCG PP lower than 1.3. (1.0, 1.1, 1.2)\r
+ //\r
+ if (OperationRequest <= TCG2_PHYSICAL_PRESENCE_NO_ACTION_MAX) {\r
+ RequestConfirmed = TRUE;\r
+ } else if (OperationRequest < TCG2_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
+ return TCG_PP_GET_USER_CONFIRMATION_NOT_IMPLEMENTED;\r
+ }\r
}\r
+\r
break;\r
}\r
\r
{\r
EFI_STATUS Status;\r
\r
- if (AsciiStrnCmp(PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer), sizeof(PP_INF_VERSION_1_2) - 1) >= 0) {\r
+ if (AsciiStrnCmp (PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer), sizeof (PP_INF_VERSION_1_2) - 1) >= 0) {\r
mIsTcg2PPVerLowerThan_1_3 = TRUE;\r
}\r
\r
//\r
// Locate SmmVariableProtocol.\r
//\r
- Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mTcg2PpSmmVariable);\r
+ Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mTcg2PpSmmVariable);\r
ASSERT_EFI_ERROR (Status);\r
\r
- mTcg2PhysicalPresenceFlags = PcdGet32(PcdTcg2PhysicalPresenceFlags);\r
+ mTcg2PhysicalPresenceFlags = PcdGet32 (PcdTcg2PhysicalPresenceFlags);\r
\r
return EFI_SUCCESS;\r
}\r