16GUID gUsb3DbgGuid = USB3_DBG_GUID;
38 DEBUG ((DEBUG_INFO,
"%a()\n", __func__));
41 ASSERT (Instance !=
NULL);
42 if (!Instance->Ready) {
46 Instance->InNotify =
TRUE;
58 Instance->InNotify =
FALSE;
64 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
92 OUT VOID **HostAddress,
104 Status = IoMmu->AllocateBuffer (
111 if (EFI_ERROR (Status)) {
112 return EFI_OUT_OF_RESOURCES;
116 Status = IoMmu->Map (
124 if (EFI_ERROR (Status)) {
125 IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
127 return EFI_OUT_OF_RESOURCES;
130 Status = IoMmu->SetAttribute (
133 EDKII_IOMMU_ACCESS_READ | EDKII_IOMMU_ACCESS_WRITE
135 if (EFI_ERROR (Status)) {
136 IoMmu->Unmap (IoMmu, *Mapping);
137 IoMmu->FreeBuffer (IoMmu, Pages, *HostAddress);
167 if (!EFI_ERROR (Status) && (IoMmu !=
NULL)) {
189 if (Hob.Raw ==
NULL) {
198 ASSERT (AddrPtr !=
NULL);
202 Instance->FromHob =
TRUE;
203 Instance->Initialized = USB3DBG_UNINITIALIZED;
209 AddrPtr = GET_GUID_HOB_DATA (Hob.Guid);
231 VOID *MemoryDiscoveredPpi;
242 &gEfiPeiMemoryDiscoveredPpiGuid,
245 (VOID **)&MemoryDiscoveredPpi
247 if (!EFI_ERROR (Status)) {
257 if (!EFI_ERROR (Status)) {
259 Buf = (VOID *)(
UINTN)Address;
267 if (!EFI_ERROR (Status)) {
268 Buf = (VOID *)(
UINTN)Address;
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
USB3_DEBUG_PORT_HANDLE * GetUsb3DebugPortInstance(VOID)
EFI_STATUS EFIAPI Usb3IoMmuPpiNotify(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, IN VOID *Ppi)
VOID * AllocateAlignBuffer(IN UINTN BufferSize)
EFI_PHYSICAL_ADDRESS * GetUsb3DebugPortInstanceAddrPtr(VOID)
EDKII_IOMMU_PPI * Usb3GetIoMmu(VOID)
EFI_STATUS IoMmuAllocateBuffer(IN EDKII_IOMMU_PPI *IoMmu, IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
RETURN_STATUS EFIAPI InitializeUsbDebugHardware(IN USB_DEBUG_PORT_HANDLE *Handle)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
EFI_STATUS EFIAPI PeiServicesAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
EFI_GUID gEdkiiIoMmuPpiGuid
@ EdkiiIoMmuOperationBusMasterCommonBuffer
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_PAGES_TO_SIZE(Pages)
#define EFI_SIZE_TO_PAGES(Size)