TianoCore EDK2 master
Loading...
Searching...
No Matches
DebugCommunicationLibUsb3Dxe.c File Reference
#include <Base.h>
#include <PiDxe.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/HobLib.h>
#include <Protocol/PciIo.h>
#include <Protocol/IoMmu.h>
#include <Protocol/DxeSmmReadyToLock.h>
#include "DebugCommunicationLibUsb3Internal.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI Usb3NamedEventListen (IN CONST EFI_GUID *Name, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN EFI_EVENT *Event)
 
VOID Usb3MapOneDmaBuffer (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_PHYSICAL_ADDRESS Address, IN UINTN NumberOfBytes)
 
VOID Usb3MapDmaBuffers (IN USB3_DEBUG_PORT_HANDLE *Instance, IN EFI_PCI_IO_PROTOCOL *PciIo)
 
VOID EFIAPI Usb3DxeSmmReadyToLockNotify (IN EFI_EVENT Event, IN VOID *Context)
 
EDKII_IOMMU_PROTOCOLUsb3GetIoMmu (VOID)
 
VOID EFIAPI Usb3PciIoNotify (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_PHYSICAL_ADDRESSGetUsb3DebugPortInstanceAddrPtr (VOID)
 
EFI_STATUS Usb3AllocateDmaBuffer (IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINTN Pages, OUT VOID **Address)
 
VOID * AllocateAlignBuffer (IN UINTN BufferSize)
 
EFI_STATUS EFIAPI DebugCommunicationUsb3DxeConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI DebugCommunicationUsb3DxeDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

GUID gUsb3DbgGuid = USB3_DBG_GUID
 
USB3_DEBUG_PORT_HANDLE mUsb3Instance = { USB3DBG_UNINITIALIZED }
 
EFI_PHYSICAL_ADDRESS mUsb3InstanceAddr = 0
 
EFI_PHYSICAL_ADDRESSmUsb3InstanceAddrPtr = NULL
 
EFI_PCI_IO_PROTOCOLmUsb3PciIo = NULL
 

Detailed Description

Debug Port Library implementation based on usb3 debug port.

Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DebugCommunicationLibUsb3Dxe.c.

Function Documentation

◆ AllocateAlignBuffer()

VOID * AllocateAlignBuffer ( IN UINTN  BufferSize)

Allocate aligned memory for XHC's usage.

Parameters
BufferSizeThe size, in bytes, of the Buffer.
Returns
A pointer to the allocated buffer or NULL if allocation fails.

Definition at line 397 of file DebugCommunicationLibUsb3Dxe.c.

◆ DebugCommunicationUsb3DxeConstructor()

EFI_STATUS EFIAPI DebugCommunicationUsb3DxeConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The constructor function initialize USB3 debug port.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe constructor always returns EFI_SUCCESS.

Definition at line 442 of file DebugCommunicationLibUsb3Dxe.c.

◆ DebugCommunicationUsb3DxeDestructor()

EFI_STATUS EFIAPI DebugCommunicationUsb3DxeDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The destructor function.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe destructor always returns EFI_SUCCESS.

Definition at line 517 of file DebugCommunicationLibUsb3Dxe.c.

◆ GetUsb3DebugPortInstanceAddrPtr()

EFI_PHYSICAL_ADDRESS * GetUsb3DebugPortInstanceAddrPtr ( VOID  )

Return USB3 debug instance address pointer.

Definition at line 328 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3AllocateDmaBuffer()

EFI_STATUS Usb3AllocateDmaBuffer ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN UINTN  Pages,
OUT VOID **  Address 
)

Allocates pages that are suitable for an OperationBusMasterCommonBuffer or OperationBusMasterCommonBuffer64 mapping.

Parameters
PciIoPointer to PciIo for USB3 debug port.
PagesThe number of pages to allocate.
AddressA pointer to store the base system memory address of the allocated range.
Return values
EFI_SUCCESSThe requested memory pages were allocated.
EFI_UNSUPPORTEDAttributes is unsupported. The only legal attribute bits are MEMORY_WRITE_COMBINE and MEMORY_CACHED.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESThe memory pages could not be allocated.

Definition at line 360 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3DxeSmmReadyToLockNotify()

VOID EFIAPI Usb3DxeSmmReadyToLockNotify ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Invoke a notification event

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextThe pointer to the notification function's context, which is implementation-dependent.

Definition at line 182 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3GetIoMmu()

EDKII_IOMMU_PROTOCOL * Usb3GetIoMmu ( VOID  )

USB3 get IOMMU protocol.

Returns
Pointer to IOMMU protocol.

Definition at line 220 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3MapDmaBuffers()

VOID Usb3MapDmaBuffers ( IN USB3_DEBUG_PORT_HANDLE Instance,
IN EFI_PCI_IO_PROTOCOL PciIo 
)

USB3 map DMA buffers.

Parameters
InstancePointer to USB3 debug port instance.
PciIoPointer to PciIo for USB3 debug port.

Definition at line 124 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3MapOneDmaBuffer()

VOID Usb3MapOneDmaBuffer ( IN EFI_PCI_IO_PROTOCOL PciIo,
IN EFI_PHYSICAL_ADDRESS  Address,
IN UINTN  NumberOfBytes 
)

USB3 map one DMA buffer.

Parameters
PciIoPointer to PciIo for USB3 debug port.
AddressDMA buffer address to be mapped.
NumberOfBytesNumber of bytes to be mapped.

Definition at line 92 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3NamedEventListen()

EFI_STATUS EFIAPI Usb3NamedEventListen ( IN CONST EFI_GUID Name,
IN EFI_TPL  NotifyTpl,
IN EFI_EVENT_NOTIFY  NotifyFunction,
IN EFI_EVENT Event 
)

Creates a named event that can be signaled.

This function creates an event using NotifyTpl, NotifyFunction. If Name is NULL, then ASSERT(). If NotifyTpl is not a legal TPL value, then ASSERT(). If NotifyFunction is NULL, then ASSERT().

Parameters
NameSupplies the GUID name of the event.
NotifyTplSupplies the task priority level of the event notifications.
NotifyFunctionSupplies the function to notify when the event is signaled.
EventA pointer to the event created.
Return values
EFI_SUCCESSA named event was created.
EFI_OUT_OF_RESOURCESThere are not enough resource to create the named event.

Definition at line 44 of file DebugCommunicationLibUsb3Dxe.c.

◆ Usb3PciIoNotify()

VOID EFIAPI Usb3PciIoNotify ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Invoke a notification event

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextThe pointer to the notification function's context, which is implementation-dependent.

Definition at line 250 of file DebugCommunicationLibUsb3Dxe.c.

Variable Documentation

◆ gUsb3DbgGuid

GUID gUsb3DbgGuid = USB3_DBG_GUID

Definition at line 18 of file DebugCommunicationLibUsb3Dxe.c.

◆ mUsb3Instance

USB3_DEBUG_PORT_HANDLE mUsb3Instance = { USB3DBG_UNINITIALIZED }

Definition at line 20 of file DebugCommunicationLibUsb3Dxe.c.

◆ mUsb3InstanceAddr

EFI_PHYSICAL_ADDRESS mUsb3InstanceAddr = 0

Definition at line 21 of file DebugCommunicationLibUsb3Dxe.c.

◆ mUsb3InstanceAddrPtr

EFI_PHYSICAL_ADDRESS* mUsb3InstanceAddrPtr = NULL

Definition at line 22 of file DebugCommunicationLibUsb3Dxe.c.

◆ mUsb3PciIo

EFI_PCI_IO_PROTOCOL* mUsb3PciIo = NULL

Definition at line 23 of file DebugCommunicationLibUsb3Dxe.c.