summaryrefslogtreecommitdiffstats
path: root/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c
diff options
context:
space:
mode:
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c')
-rw-r--r--SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c83
1 files changed, 42 insertions, 41 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c
index cce676eb8a..15842a317e 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.c
@@ -13,7 +13,7 @@
#include <Ppi/IoMmu.h>
#include "DebugCommunicationLibUsb3Internal.h"
-GUID gUsb3DbgGuid = USB3_DBG_GUID;
+GUID gUsb3DbgGuid = USB3_DBG_GUID;
/**
USB3 IOMMU PPI notify.
@@ -33,7 +33,7 @@ Usb3IoMmuPpiNotify (
IN VOID *Ppi
)
{
- USB3_DEBUG_PORT_HANDLE *Instance;
+ USB3_DEBUG_PORT_HANDLE *Instance;
DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__));
@@ -60,7 +60,7 @@ Usb3IoMmuPpiNotify (
return EFI_SUCCESS;
}
-EFI_PEI_NOTIFY_DESCRIPTOR mUsb3IoMmuPpiNotifyDesc = {
+EFI_PEI_NOTIFY_DESCRIPTOR mUsb3IoMmuPpiNotifyDesc = {
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEdkiiIoMmuPpiGuid,
Usb3IoMmuPpiNotify
@@ -94,12 +94,12 @@ IoMmuAllocateBuffer (
OUT VOID **Mapping
)
{
- EFI_STATUS Status;
- UINTN NumberOfBytes;
+ EFI_STATUS Status;
+ UINTN NumberOfBytes;
- *HostAddress = NULL;
+ *HostAddress = NULL;
*DeviceAddress = 0;
- *Mapping = NULL;
+ *Mapping = NULL;
Status = IoMmu->AllocateBuffer (
IoMmu,
@@ -113,19 +113,20 @@ IoMmuAllocateBuffer (
}
NumberOfBytes = EFI_PAGES_TO_SIZE (Pages);
- Status = IoMmu->Map (
- IoMmu,
- EdkiiIoMmuOperationBusMasterCommonBuffer,
- *HostAddress,
- &NumberOfBytes,
- DeviceAddress,
- Mapping
- );
+ Status = IoMmu->Map (
+ IoMmu,
+ EdkiiIoMmuOperationBusMasterCommonBuffer,
+ *HostAddress,
+ &NumberOfBytes,
+ DeviceAddress,
+ Mapping
+ );
if (EFI_ERROR (Status)) {
IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
*HostAddress = NULL;
return EFI_OUT_OF_RESOURCES;
}
+
Status = IoMmu->SetAttribute (
IoMmu,
*Mapping,
@@ -134,7 +135,7 @@ IoMmuAllocateBuffer (
if (EFI_ERROR (Status)) {
IoMmu->Unmap (IoMmu, *Mapping);
IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
- *Mapping = NULL;
+ *Mapping = NULL;
*HostAddress = NULL;
return Status;
}
@@ -153,15 +154,15 @@ Usb3GetIoMmu (
VOID
)
{
- EFI_STATUS Status;
- EDKII_IOMMU_PPI *IoMmu;
+ EFI_STATUS Status;
+ EDKII_IOMMU_PPI *IoMmu;
- IoMmu = NULL;
+ IoMmu = NULL;
Status = PeiServicesLocatePpi (
&gEdkiiIoMmuPpiGuid,
0,
NULL,
- (VOID **) &IoMmu
+ (VOID **)&IoMmu
);
if (!EFI_ERROR (Status) && (IoMmu != NULL)) {
return IoMmu;
@@ -179,10 +180,10 @@ GetUsb3DebugPortInstanceAddrPtr (
VOID
)
{
- USB3_DEBUG_PORT_HANDLE *Instance;
- EFI_PHYSICAL_ADDRESS *AddrPtr;
- EFI_PEI_HOB_POINTERS Hob;
- EFI_STATUS Status;
+ USB3_DEBUG_PORT_HANDLE *Instance;
+ EFI_PHYSICAL_ADDRESS *AddrPtr;
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_STATUS Status;
Hob.Raw = GetFirstGuidHob (&gUsb3DbgGuid);
if (Hob.Raw == NULL) {
@@ -196,9 +197,9 @@ GetUsb3DebugPortInstanceAddrPtr (
);
ASSERT (AddrPtr != NULL);
ZeroMem (AddrPtr, sizeof (EFI_PHYSICAL_ADDRESS) + sizeof (USB3_DEBUG_PORT_HANDLE));
- Instance = (USB3_DEBUG_PORT_HANDLE *) (AddrPtr + 1);
- *AddrPtr = (EFI_PHYSICAL_ADDRESS) (UINTN) Instance;
- Instance->FromHob = TRUE;
+ Instance = (USB3_DEBUG_PORT_HANDLE *)(AddrPtr + 1);
+ *AddrPtr = (EFI_PHYSICAL_ADDRESS)(UINTN)Instance;
+ Instance->FromHob = TRUE;
Instance->Initialized = USB3DBG_UNINITIALIZED;
if (Usb3GetIoMmu () == NULL) {
Status = PeiServicesNotifyPpi (&mUsb3IoMmuPpiNotifyDesc);
@@ -219,18 +220,18 @@ GetUsb3DebugPortInstanceAddrPtr (
@return A pointer to the allocated buffer or NULL if allocation fails.
**/
-VOID*
+VOID *
AllocateAlignBuffer (
- IN UINTN BufferSize
+ IN UINTN BufferSize
)
{
- VOID *Buf;
- EFI_PHYSICAL_ADDRESS Address;
- EFI_STATUS Status;
- VOID *MemoryDiscoveredPpi;
- EDKII_IOMMU_PPI *IoMmu;
- VOID *HostAddress;
- VOID *Mapping;
+ VOID *Buf;
+ EFI_PHYSICAL_ADDRESS Address;
+ EFI_STATUS Status;
+ VOID *MemoryDiscoveredPpi;
+ EDKII_IOMMU_PPI *IoMmu;
+ VOID *HostAddress;
+ VOID *Mapping;
Buf = NULL;
@@ -241,7 +242,7 @@ AllocateAlignBuffer (
&gEfiPeiMemoryDiscoveredPpiGuid,
0,
NULL,
- (VOID **) &MemoryDiscoveredPpi
+ (VOID **)&MemoryDiscoveredPpi
);
if (!EFI_ERROR (Status)) {
IoMmu = Usb3GetIoMmu ();
@@ -254,8 +255,8 @@ AllocateAlignBuffer (
&Mapping
);
if (!EFI_ERROR (Status)) {
- ASSERT (Address == ((EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress));
- Buf = (VOID *)(UINTN) Address;
+ ASSERT (Address == ((EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress));
+ Buf = (VOID *)(UINTN)Address;
}
} else {
Status = PeiServicesAllocatePages (
@@ -264,10 +265,10 @@ AllocateAlignBuffer (
&Address
);
if (!EFI_ERROR (Status)) {
- Buf = (VOID *)(UINTN) Address;
+ Buf = (VOID *)(UINTN)Address;
}
}
}
+
return Buf;
}
-