summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Tcg/Tcg2Smm
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:12 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commitc411b485b63a671a1e276700cff025c73997233c (patch)
treee7a57ca51b659161ab4bc9da95e988760ec57e7a /SecurityPkg/Tcg/Tcg2Smm
parent39de741e2dcb8f11e9b4438e37224797643d8451 (diff)
downloadedk2-c411b485b63a671a1e276700cff025c73997233c.tar.gz
edk2-c411b485b63a671a1e276700cff025c73997233c.tar.bz2
edk2-c411b485b63a671a1e276700cff025c73997233c.zip
SecurityPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SecurityPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Diffstat (limited to 'SecurityPkg/Tcg/Tcg2Smm')
-rw-r--r--SecurityPkg/Tcg/Tcg2Smm/Tcg2MmDependencyDxe.c8
-rw-r--r--SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c152
-rw-r--r--SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h10
-rw-r--r--SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c4
-rw-r--r--SecurityPkg/Tcg/Tcg2Smm/Tcg2TraditionalMm.c8
5 files changed, 94 insertions, 88 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2MmDependencyDxe.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2MmDependencyDxe.c
index 4f2d7c58ed..eb69b870ed 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2MmDependencyDxe.c
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2MmDependencyDxe.c
@@ -29,12 +29,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
Tcg2MmDependencyDxeEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
Handle = NULL;
Status = gBS->InstallProtocolInterface (
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
index 9f5111552b..498fb626bd 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c
@@ -18,10 +18,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Tcg2Smm.h"
EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable = NULL;
-TCG_NVS *mTcgNvs = NULL;
-UINTN mPpSoftwareSmi;
-UINTN mMcSoftwareSmi;
-EFI_HANDLE mReadyToLockHandle;
+TCG_NVS *mTcgNvs = NULL;
+UINTN mPpSoftwareSmi;
+UINTN mMcSoftwareSmi;
+EFI_HANDLE mReadyToLockHandle;
/**
Communication service SMI Handler entry.
@@ -47,32 +47,33 @@ EFI_HANDLE mReadyToLockHandle;
EFI_STATUS
EFIAPI
TpmNvsCommunciate (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *RegisterContext,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *RegisterContext,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
)
{
- EFI_STATUS Status;
- UINTN TempCommBufferSize;
- TPM_NVS_MM_COMM_BUFFER *CommParams;
+ EFI_STATUS Status;
+ UINTN TempCommBufferSize;
+ TPM_NVS_MM_COMM_BUFFER *CommParams;
DEBUG ((DEBUG_VERBOSE, "%a()\n", __FUNCTION__));
//
// If input is invalid, stop processing this SMI
//
- if (CommBuffer == NULL || CommBufferSize == NULL) {
+ if ((CommBuffer == NULL) || (CommBufferSize == NULL)) {
return EFI_SUCCESS;
}
TempCommBufferSize = *CommBufferSize;
- if(TempCommBufferSize != sizeof (TPM_NVS_MM_COMM_BUFFER)) {
+ if (TempCommBufferSize != sizeof (TPM_NVS_MM_COMM_BUFFER)) {
DEBUG ((DEBUG_ERROR, "[%a] MM Communication buffer size is invalid for this handler!\n", __FUNCTION__));
return EFI_ACCESS_DENIED;
}
- if (!IsBufferOutsideMmValid ((UINTN) CommBuffer, TempCommBufferSize)) {
+
+ if (!IsBufferOutsideMmValid ((UINTN)CommBuffer, TempCommBufferSize)) {
DEBUG ((DEBUG_ERROR, "[%a] - MM Communication buffer in invalid location!\n", __FUNCTION__));
return EFI_ACCESS_DENIED;
}
@@ -80,14 +81,14 @@ TpmNvsCommunciate (
//
// Farm out the job to individual functions based on what was requested.
//
- CommParams = (TPM_NVS_MM_COMM_BUFFER*) CommBuffer;
- Status = EFI_SUCCESS;
+ CommParams = (TPM_NVS_MM_COMM_BUFFER *)CommBuffer;
+ Status = EFI_SUCCESS;
switch (CommParams->Function) {
case TpmNvsMmExchangeInfo:
DEBUG ((DEBUG_VERBOSE, "[%a] - Function requested: MM_EXCHANGE_NVS_INFO\n", __FUNCTION__));
CommParams->RegisteredPpSwiValue = mPpSoftwareSmi;
CommParams->RegisteredMcSwiValue = mMcSoftwareSmi;
- mTcgNvs = (TCG_NVS*) (UINTN) CommParams->TargetAddress;
+ mTcgNvs = (TCG_NVS *)(UINTN)CommParams->TargetAddress;
break;
default:
@@ -96,7 +97,7 @@ TpmNvsCommunciate (
break;
}
- CommParams->ReturnStatus = (UINT64) Status;
+ CommParams->ReturnStatus = (UINT64)Status;
return EFI_SUCCESS;
}
@@ -120,17 +121,16 @@ TpmNvsCommunciate (
EFI_STATUS
EFIAPI
PhysicalPresenceCallback (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *Context,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *Context,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
)
{
- UINT32 MostRecentRequest;
- UINT32 Response;
- UINT32 OperationRequest;
- UINT32 RequestParameter;
-
+ UINT32 MostRecentRequest;
+ UINT32 Response;
+ UINT32 OperationRequest;
+ UINT32 RequestParameter;
if (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS) {
mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction (
@@ -138,18 +138,18 @@ PhysicalPresenceCallback (
&Response
);
mTcgNvs->PhysicalPresence.LastRequest = MostRecentRequest;
- mTcgNvs->PhysicalPresence.Response = Response;
+ mTcgNvs->PhysicalPresence.Response = Response;
return EFI_SUCCESS;
- } else if ((mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS)
- || (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) {
-
- OperationRequest = mTcgNvs->PhysicalPresence.Request;
- RequestParameter = mTcgNvs->PhysicalPresence.RequestParameter;
+ } else if ( (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS)
+ || (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2))
+ {
+ OperationRequest = mTcgNvs->PhysicalPresence.Request;
+ RequestParameter = mTcgNvs->PhysicalPresence.RequestParameter;
mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx (
&OperationRequest,
&RequestParameter
);
- mTcgNvs->PhysicalPresence.Request = OperationRequest;
+ mTcgNvs->PhysicalPresence.Request = OperationRequest;
mTcgNvs->PhysicalPresence.RequestParameter = RequestParameter;
} else if (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) {
mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction (mTcgNvs->PPRequestUserConfirm);
@@ -158,7 +158,6 @@ PhysicalPresenceCallback (
return EFI_SUCCESS;
}
-
/**
Software SMI callback for MemoryClear which is called from ACPI method.
@@ -179,28 +178,28 @@ PhysicalPresenceCallback (
EFI_STATUS
EFIAPI
MemoryClearCallback (
- IN EFI_HANDLE DispatchHandle,
- IN CONST VOID *Context,
- IN OUT VOID *CommBuffer,
- IN OUT UINTN *CommBufferSize
+ IN EFI_HANDLE DispatchHandle,
+ IN CONST VOID *Context,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
)
{
- EFI_STATUS Status;
- UINTN DataSize;
- UINT8 MorControl;
+ EFI_STATUS Status;
+ UINTN DataSize;
+ UINT8 MorControl;
mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_SUCCESS;
if (mTcgNvs->MemoryClear.Parameter == ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE) {
- MorControl = (UINT8) mTcgNvs->MemoryClear.Request;
+ MorControl = (UINT8)mTcgNvs->MemoryClear.Request;
} else if (mTcgNvs->MemoryClear.Parameter == ACPI_FUNCTION_PTS_CLEAR_MOR_BIT) {
DataSize = sizeof (UINT8);
- Status = mSmmVariable->SmmGetVariable (
- MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
- &gEfiMemoryOverwriteControlDataGuid,
- NULL,
- &DataSize,
- &MorControl
- );
+ Status = mSmmVariable->SmmGetVariable (
+ MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
+ &gEfiMemoryOverwriteControlDataGuid,
+ NULL,
+ &DataSize,
+ &MorControl
+ );
if (EFI_ERROR (Status)) {
mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
DEBUG ((DEBUG_ERROR, "[TPM] Get MOR variable failure! Status = %r\n", Status));
@@ -210,6 +209,7 @@ MemoryClearCallback (
if (MOR_CLEAR_MEMORY_VALUE (MorControl) == 0x0) {
return EFI_SUCCESS;
}
+
MorControl &= ~MOR_CLEAR_MEMORY_BIT_MASK;
} else {
mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
@@ -218,13 +218,13 @@ MemoryClearCallback (
}
DataSize = sizeof (UINT8);
- Status = mSmmVariable->SmmSetVariable (
- MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
- &gEfiMemoryOverwriteControlDataGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- DataSize,
- &MorControl
- );
+ Status = mSmmVariable->SmmSetVariable (
+ MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
+ &gEfiMemoryOverwriteControlDataGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ DataSize,
+ &MorControl
+ );
if (EFI_ERROR (Status)) {
mTcgNvs->MemoryClear.ReturnCode = MOR_REQUEST_GENERAL_FAILURE;
DEBUG ((DEBUG_ERROR, "[TPM] Set MOR variable failure! Status = %r\n", Status));
@@ -249,16 +249,17 @@ TcgMmReadyToLock (
IN CONST EFI_GUID *Protocol,
IN VOID *Interface,
IN EFI_HANDLE Handle
-)
+ )
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = EFI_SUCCESS;
if (mReadyToLockHandle != NULL) {
- Status = gMmst->MmiHandlerUnRegister (mReadyToLockHandle);
+ Status = gMmst->MmiHandlerUnRegister (mReadyToLockHandle);
mReadyToLockHandle = NULL;
}
+
return Status;
}
@@ -284,17 +285,17 @@ InitializeTcgCommon (
EFI_HANDLE McSwHandle;
EFI_HANDLE NotifyHandle;
- if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm20DtpmGuid)){
+ if (!CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm20DtpmGuid)) {
DEBUG ((DEBUG_ERROR, "No TPM2 DTPM instance required!\n"));
return EFI_UNSUPPORTED;
}
// Initialize variables first
mReadyToLockHandle = NULL;
- SwDispatch = NULL;
- PpSwHandle = NULL;
- McSwHandle = NULL;
- NotifyHandle = NULL;
+ SwDispatch = NULL;
+ PpSwHandle = NULL;
+ McSwHandle = NULL;
+ NotifyHandle = NULL;
// Register a root handler to communicate the NVS region and SMI channel between MM and DXE
Status = gMmst->MmiHandlerRegister (TpmNvsCommunciate, &gTpmNvsMmGuid, &mReadyToLockHandle);
@@ -307,35 +308,37 @@ InitializeTcgCommon (
//
// Get the Sw dispatch protocol and register SMI callback functions.
//
- Status = gMmst->MmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID**)&SwDispatch);
+ Status = gMmst->MmLocateProtocol (&gEfiSmmSwDispatch2ProtocolGuid, NULL, (VOID **)&SwDispatch);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a] Failed to locate Sw dispatch protocol - %r!\n", __FUNCTION__, Status));
goto Cleanup;
}
- SwContext.SwSmiInputValue = (UINTN) -1;
- Status = SwDispatch->Register (SwDispatch, PhysicalPresenceCallback, &SwContext, &PpSwHandle);
+ SwContext.SwSmiInputValue = (UINTN)-1;
+ Status = SwDispatch->Register (SwDispatch, PhysicalPresenceCallback, &SwContext, &PpSwHandle);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a] Failed to register PP callback as SW MM handler - %r!\n", __FUNCTION__, Status));
goto Cleanup;
}
+
mPpSoftwareSmi = SwContext.SwSmiInputValue;
- SwContext.SwSmiInputValue = (UINTN) -1;
- Status = SwDispatch->Register (SwDispatch, MemoryClearCallback, &SwContext, &McSwHandle);
+ SwContext.SwSmiInputValue = (UINTN)-1;
+ Status = SwDispatch->Register (SwDispatch, MemoryClearCallback, &SwContext, &McSwHandle);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[%a] Failed to register MC callback as SW MM handler - %r!\n", __FUNCTION__, Status));
goto Cleanup;
}
+
mMcSoftwareSmi = SwContext.SwSmiInputValue;
//
// Locate SmmVariableProtocol.
//
- Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID**)&mSmmVariable);
+ Status = gMmst->MmLocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mSmmVariable);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
// Should not happen
@@ -359,12 +362,15 @@ Cleanup:
if (NotifyHandle != NULL) {
gMmst->MmRegisterProtocolNotify (&gEfiMmReadyToLockProtocolGuid, NULL, &NotifyHandle);
}
- if (McSwHandle != NULL && SwDispatch != NULL) {
+
+ if ((McSwHandle != NULL) && (SwDispatch != NULL)) {
SwDispatch->UnRegister (SwDispatch, McSwHandle);
}
- if (PpSwHandle != NULL && SwDispatch != NULL) {
+
+ if ((PpSwHandle != NULL) && (SwDispatch != NULL)) {
SwDispatch->UnRegister (SwDispatch, PpSwHandle);
}
+
if (mReadyToLockHandle != NULL) {
gMmst->MmiHandlerUnRegister (mReadyToLockHandle);
}
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
index d7f78aa432..84b65eb089 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
@@ -37,14 +37,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// The definition for TCG MOR
//
-#define ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE 1
-#define ACPI_FUNCTION_PTS_CLEAR_MOR_BIT 2
+#define ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE 1
+#define ACPI_FUNCTION_PTS_CLEAR_MOR_BIT 2
//
// The return code for Memory Clear Interface Functions
//
-#define MOR_REQUEST_SUCCESS 0
-#define MOR_REQUEST_GENERAL_FAILURE 1
+#define MOR_REQUEST_SUCCESS 0
+#define MOR_REQUEST_GENERAL_FAILURE 1
/**
Notify the system that the SMM variable driver is ready.
@@ -84,4 +84,4 @@ InitializeTcgCommon (
VOID
);
-#endif // __TCG_SMM_H__
+#endif // __TCG_SMM_H__
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c
index 9e0095efbc..77fa3691f4 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.c
@@ -63,8 +63,8 @@ IsBufferOutsideMmValid (
EFI_STATUS
EFIAPI
InitializeTcgStandaloneMm (
- IN EFI_HANDLE ImageHandle,
- IN EFI_MM_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_MM_SYSTEM_TABLE *SystemTable
)
{
return InitializeTcgCommon ();
diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2TraditionalMm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2TraditionalMm.c
index 5930090b4e..514171cfac 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2TraditionalMm.c
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2TraditionalMm.c
@@ -27,8 +27,8 @@ Tcg2NotifyMmReady (
VOID
)
{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
+ EFI_STATUS Status;
+ EFI_HANDLE Handle;
Handle = NULL;
Status = gBS->InstallProtocolInterface (
@@ -74,8 +74,8 @@ IsBufferOutsideMmValid (
EFI_STATUS
EFIAPI
InitializeTcgSmm (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return InitializeTcgCommon ();