summaryrefslogtreecommitdiffstats
path: root/ArmPkg/Drivers/MmCommunicationDxe
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:53:50 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit429309e0c6b74792d679681a8edd0d5ae0ff850c (patch)
tree9d26d88024790b459c60a44e14500b7c7076f0d1 /ArmPkg/Drivers/MmCommunicationDxe
parent7c2a6033c149625482a18cd51b65513c8fb8fe15 (diff)
downloadedk2-429309e0c6b74792d679681a8edd0d5ae0ff850c.tar.gz
edk2-429309e0c6b74792d679681a8edd0d5ae0ff850c.tar.bz2
edk2-429309e0c6b74792d679681a8edd0d5ae0ff850c.zip
ArmPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the ArmPkg 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: Andrew Fish <afish@apple.com>
Diffstat (limited to 'ArmPkg/Drivers/MmCommunicationDxe')
-rw-r--r--ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h14
-rw-r--r--ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c196
2 files changed, 122 insertions, 88 deletions
diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
index 32753947e1..5c5fcb5768 100644
--- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
+++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunicate.h
@@ -9,14 +9,14 @@
#ifndef MM_COMMUNICATE_H_
#define MM_COMMUNICATE_H_
-#define MM_MAJOR_VER_MASK 0xEFFF0000
-#define MM_MINOR_VER_MASK 0x0000FFFF
-#define MM_MAJOR_VER_SHIFT 16
+#define MM_MAJOR_VER_MASK 0xEFFF0000
+#define MM_MINOR_VER_MASK 0x0000FFFF
+#define MM_MAJOR_VER_SHIFT 16
-#define MM_MAJOR_VER(x) (((x) & MM_MAJOR_VER_MASK) >> MM_MAJOR_VER_SHIFT)
-#define MM_MINOR_VER(x) ((x) & MM_MINOR_VER_MASK)
+#define MM_MAJOR_VER(x) (((x) & MM_MAJOR_VER_MASK) >> MM_MAJOR_VER_SHIFT)
+#define MM_MINOR_VER(x) ((x) & MM_MINOR_VER_MASK)
-#define MM_CALLER_MAJOR_VER 0x1UL
-#define MM_CALLER_MINOR_VER 0x0
+#define MM_CALLER_MAJOR_VER 0x1UL
+#define MM_CALLER_MINOR_VER 0x0
#endif /* MM_COMMUNICATE_H_ */
diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
index b1e3095809..7c8284104d 100644
--- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
+++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c
@@ -63,18 +63,18 @@ STATIC EFI_HANDLE mMmCommunicateHandle;
EFI_STATUS
EFIAPI
MmCommunication2Communicate (
- IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This,
- IN OUT VOID *CommBufferPhysical,
- IN OUT VOID *CommBufferVirtual,
- IN OUT UINTN *CommSize OPTIONAL
+ IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This,
+ IN OUT VOID *CommBufferPhysical,
+ IN OUT VOID *CommBufferVirtual,
+ IN OUT UINTN *CommSize OPTIONAL
)
{
- EFI_MM_COMMUNICATE_HEADER *CommunicateHeader;
- ARM_SMC_ARGS CommunicateSmcArgs;
- EFI_STATUS Status;
- UINTN BufferSize;
+ EFI_MM_COMMUNICATE_HEADER *CommunicateHeader;
+ ARM_SMC_ARGS CommunicateSmcArgs;
+ EFI_STATUS Status;
+ UINTN BufferSize;
- Status = EFI_ACCESS_DENIED;
+ Status = EFI_ACCESS_DENIED;
BufferSize = 0;
ZeroMem (&CommunicateSmcArgs, sizeof (ARM_SMC_ARGS));
@@ -100,15 +100,17 @@ MmCommunication2Communicate (
// This case can be used by the consumer of this driver to find out the
// max size that can be used for allocating CommBuffer.
if ((*CommSize == 0) ||
- (*CommSize > mNsCommBuffMemRegion.Length)) {
+ (*CommSize > mNsCommBuffMemRegion.Length))
+ {
*CommSize = mNsCommBuffMemRegion.Length;
return EFI_BAD_BUFFER_SIZE;
}
+
//
// CommSize must match MessageLength + sizeof (EFI_MM_COMMUNICATE_HEADER);
//
if (*CommSize != BufferSize) {
- return EFI_INVALID_PARAMETER;
+ return EFI_INVALID_PARAMETER;
}
}
@@ -117,7 +119,8 @@ MmCommunication2Communicate (
// environment then return the expected size.
//
if ((BufferSize == 0) ||
- (BufferSize > mNsCommBuffMemRegion.Length)) {
+ (BufferSize > mNsCommBuffMemRegion.Length))
+ {
CommunicateHeader->MessageLength = mNsCommBuffMemRegion.Length -
sizeof (CommunicateHeader->HeaderGuid) -
sizeof (CommunicateHeader->MessageLength);
@@ -143,41 +146,41 @@ MmCommunication2Communicate (
ArmCallSmc (&CommunicateSmcArgs);
switch (CommunicateSmcArgs.Arg0) {
- case ARM_SMC_MM_RET_SUCCESS:
- ZeroMem (CommBufferVirtual, BufferSize);
- // On successful return, the size of data being returned is inferred from
- // MessageLength + Header.
- CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegion.VirtualBase;
- BufferSize = CommunicateHeader->MessageLength +
- sizeof (CommunicateHeader->HeaderGuid) +
- sizeof (CommunicateHeader->MessageLength);
-
- CopyMem (
- CommBufferVirtual,
- (VOID *)mNsCommBuffMemRegion.VirtualBase,
- BufferSize
- );
- Status = EFI_SUCCESS;
- break;
-
- case ARM_SMC_MM_RET_INVALID_PARAMS:
- Status = EFI_INVALID_PARAMETER;
- break;
-
- case ARM_SMC_MM_RET_DENIED:
- Status = EFI_ACCESS_DENIED;
- break;
-
- case ARM_SMC_MM_RET_NO_MEMORY:
- // Unexpected error since the CommSize was checked for zero length
- // prior to issuing the SMC
- Status = EFI_OUT_OF_RESOURCES;
- ASSERT (0);
- break;
-
- default:
- Status = EFI_ACCESS_DENIED;
- ASSERT (0);
+ case ARM_SMC_MM_RET_SUCCESS:
+ ZeroMem (CommBufferVirtual, BufferSize);
+ // On successful return, the size of data being returned is inferred from
+ // MessageLength + Header.
+ CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegion.VirtualBase;
+ BufferSize = CommunicateHeader->MessageLength +
+ sizeof (CommunicateHeader->HeaderGuid) +
+ sizeof (CommunicateHeader->MessageLength);
+
+ CopyMem (
+ CommBufferVirtual,
+ (VOID *)mNsCommBuffMemRegion.VirtualBase,
+ BufferSize
+ );
+ Status = EFI_SUCCESS;
+ break;
+
+ case ARM_SMC_MM_RET_INVALID_PARAMS:
+ Status = EFI_INVALID_PARAMETER;
+ break;
+
+ case ARM_SMC_MM_RET_DENIED:
+ Status = EFI_ACCESS_DENIED;
+ break;
+
+ case ARM_SMC_MM_RET_NO_MEMORY:
+ // Unexpected error since the CommSize was checked for zero length
+ // prior to issuing the SMC
+ Status = EFI_OUT_OF_RESOURCES;
+ ASSERT (0);
+ break;
+
+ default:
+ Status = EFI_ACCESS_DENIED;
+ ASSERT (0);
}
return Status;
@@ -209,7 +212,7 @@ VOID
EFIAPI
NotifySetVirtualAddressMap (
IN EFI_EVENT Event,
- IN VOID *Context
+ IN VOID *Context
)
{
EFI_STATUS Status;
@@ -219,19 +222,23 @@ NotifySetVirtualAddressMap (
(VOID **)&mNsCommBuffMemRegion.VirtualBase
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "NotifySetVirtualAddressMap():"
- " Unable to convert MM runtime pointer. Status:0x%r\n", Status));
+ DEBUG ((
+ DEBUG_ERROR,
+ "NotifySetVirtualAddressMap():"
+ " Unable to convert MM runtime pointer. Status:0x%r\n",
+ Status
+ ));
}
-
}
STATIC
EFI_STATUS
-GetMmCompatibility ()
+GetMmCompatibility (
+ )
{
- EFI_STATUS Status;
- UINT32 MmVersion;
- ARM_SMC_ARGS MmVersionArgs;
+ EFI_STATUS Status;
+ UINT32 MmVersion;
+ ARM_SMC_ARGS MmVersionArgs;
// MM_VERSION uses SMC32 calling conventions
MmVersionArgs.Arg0 = ARM_SMC_ID_MM_VERSION_AARCH32;
@@ -240,27 +247,38 @@ GetMmCompatibility ()
MmVersion = MmVersionArgs.Arg0;
- if ((MM_MAJOR_VER(MmVersion) == MM_CALLER_MAJOR_VER) &&
- (MM_MINOR_VER(MmVersion) >= MM_CALLER_MINOR_VER)) {
- DEBUG ((DEBUG_INFO, "MM Version: Major=0x%x, Minor=0x%x\n",
- MM_MAJOR_VER(MmVersion), MM_MINOR_VER(MmVersion)));
+ if ((MM_MAJOR_VER (MmVersion) == MM_CALLER_MAJOR_VER) &&
+ (MM_MINOR_VER (MmVersion) >= MM_CALLER_MINOR_VER))
+ {
+ DEBUG ((
+ DEBUG_INFO,
+ "MM Version: Major=0x%x, Minor=0x%x\n",
+ MM_MAJOR_VER (MmVersion),
+ MM_MINOR_VER (MmVersion)
+ ));
Status = EFI_SUCCESS;
} else {
- DEBUG ((DEBUG_ERROR, "Incompatible MM Versions.\n Current Version: Major=0x%x, Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n",
- MM_MAJOR_VER(MmVersion), MM_MINOR_VER(MmVersion), MM_CALLER_MAJOR_VER, MM_CALLER_MINOR_VER));
+ DEBUG ((
+ DEBUG_ERROR,
+ "Incompatible MM Versions.\n Current Version: Major=0x%x, Minor=0x%x.\n Expected: Major=0x%x, Minor>=0x%x.\n",
+ MM_MAJOR_VER (MmVersion),
+ MM_MINOR_VER (MmVersion),
+ MM_CALLER_MAJOR_VER,
+ MM_CALLER_MINOR_VER
+ ));
Status = EFI_UNSUPPORTED;
}
return Status;
}
-STATIC EFI_GUID* CONST mGuidedEventGuid[] = {
+STATIC EFI_GUID *CONST mGuidedEventGuid[] = {
&gEfiEndOfDxeEventGroupGuid,
&gEfiEventExitBootServicesGuid,
&gEfiEventReadyToBootGuid,
};
-STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)];
+STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)];
/**
Event notification that is fired when GUIDed Event Group is signaled.
@@ -277,15 +295,15 @@ MmGuidedEventNotify (
IN VOID *Context
)
{
- EFI_MM_COMMUNICATE_HEADER Header;
- UINTN Size;
+ EFI_MM_COMMUNICATE_HEADER Header;
+ UINTN Size;
//
// Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure
//
CopyGuid (&Header.HeaderGuid, Context);
Header.MessageLength = 1;
- Header.Data[0] = 0;
+ Header.Data[0] = 0;
Size = sizeof (Header);
MmCommunication2Communicate (&mMmCommunication2, &Header, &Header, &Size);
@@ -308,23 +326,23 @@ MmGuidedEventNotify (
EFI_STATUS
EFIAPI
MmCommunication2Initialize (
- IN EFI_HANDLE ImageHandle,
+ IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- UINTN Index;
+ EFI_STATUS Status;
+ UINTN Index;
// Check if we can make the MM call
Status = GetMmCompatibility ();
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto ReturnErrorStatus;
}
mNsCommBuffMemRegion.PhysicalBase = PcdGet64 (PcdMmBufferBase);
// During boot , Virtual and Physical are same
mNsCommBuffMemRegion.VirtualBase = mNsCommBuffMemRegion.PhysicalBase;
- mNsCommBuffMemRegion.Length = PcdGet64 (PcdMmBufferSize);
+ mNsCommBuffMemRegion.Length = PcdGet64 (PcdMmBufferSize);
ASSERT (mNsCommBuffMemRegion.PhysicalBase != 0);
@@ -339,8 +357,11 @@ MmCommunication2Initialize (
EFI_MEMORY_RUNTIME
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "MmCommunicateInitialize: "
- "Failed to add MM-NS Buffer Memory Space\n"));
+ DEBUG ((
+ DEBUG_ERROR,
+ "MmCommunicateInitialize: "
+ "Failed to add MM-NS Buffer Memory Space\n"
+ ));
goto ReturnErrorStatus;
}
@@ -350,8 +371,11 @@ MmCommunication2Initialize (
EFI_MEMORY_WB | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "MmCommunicateInitialize: "
- "Failed to set MM-NS Buffer Memory attributes\n"));
+ DEBUG ((
+ DEBUG_ERROR,
+ "MmCommunicateInitialize: "
+ "Failed to set MM-NS Buffer Memory attributes\n"
+ ));
goto CleanAddedMemorySpace;
}
@@ -362,9 +386,12 @@ MmCommunication2Initialize (
EFI_NATIVE_INTERFACE,
&mMmCommunication2
);
- if (EFI_ERROR(Status)) {
- DEBUG ((DEBUG_ERROR, "MmCommunicationInitialize: "
- "Failed to install MM communication protocol\n"));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "MmCommunicationInitialize: "
+ "Failed to install MM communication protocol\n"
+ ));
goto CleanAddedMemorySpace;
}
@@ -381,17 +408,24 @@ MmCommunication2Initialize (
ASSERT_EFI_ERROR (Status);
for (Index = 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) {
- Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
- MmGuidedEventNotify, mGuidedEventGuid[Index],
- mGuidedEventGuid[Index], &mGuidedEvent[Index]);
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ MmGuidedEventNotify,
+ mGuidedEventGuid[Index],
+ mGuidedEventGuid[Index],
+ &mGuidedEvent[Index]
+ );
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
while (Index-- > 0) {
gBS->CloseEvent (mGuidedEvent[Index]);
}
+
goto UninstallProtocol;
}
}
+
return EFI_SUCCESS;
UninstallProtocol: