TianoCore EDK2 master
Loading...
Searching...
No Matches
UhcPeim.c File Reference
#include "UhcPeim.h"

Go to the source code of this file.

Functions

EFI_STATUS UhciStopHc (IN USB_UHC_DEV *Uhc, IN UINTN Timeout)
 
EFI_STATUS EFIAPI UhcEndOfPei (IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
 
EFI_STATUS EFIAPI UhcPeimEntry (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
 
EFI_STATUS EFIAPI UhcControlTransfer (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 DeviceAddress, IN UINT8 DeviceSpeed, IN UINT8 MaximumPacketLength, IN EFI_USB_DEVICE_REQUEST *Request, IN EFI_USB_DATA_DIRECTION TransferDirection, IN OUT VOID *Data OPTIONAL, IN OUT UINTN *DataLength OPTIONAL, IN UINTN TimeOut, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI UhcBulkTransfer (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 DeviceAddress, IN UINT8 EndPointAddress, IN UINT8 MaximumPacketLength, IN OUT VOID *Data, IN OUT UINTN *DataLength, IN OUT UINT8 *DataToggle, IN UINTN TimeOut, OUT UINT32 *TransferResult)
 
EFI_STATUS EFIAPI UhcGetRootHubPortNumber (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, OUT UINT8 *PortNumber)
 
EFI_STATUS EFIAPI UhcGetRootHubPortStatus (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, OUT EFI_USB_PORT_STATUS *PortStatus)
 
EFI_STATUS EFIAPI UhcSetRootHubPortFeature (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
 
EFI_STATUS EFIAPI UhcClearRootHubPortFeature (IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_HOST_CONTROLLER_PPI *This, IN UINT8 PortNumber, IN EFI_USB_PORT_FEATURE PortFeature)
 
EFI_STATUS InitializeUsbHC (IN USB_UHC_DEV *UhcDev)
 
EFI_STATUS CreateFrameList (USB_UHC_DEV *UhcDev)
 
UINT16 USBReadPortW (IN USB_UHC_DEV *UhcDev, IN UINT32 Port)
 
VOID USBWritePortW (IN USB_UHC_DEV *UhcDev, IN UINT32 Port, IN UINT16 Data)
 
VOID USBWritePortDW (IN USB_UHC_DEV *UhcDev, IN UINT32 Port, IN UINT32 Data)
 
VOID ClearStatusReg (IN USB_UHC_DEV *UhcDev, IN UINT32 StatusAddr)
 
BOOLEAN IsStatusOK (IN USB_UHC_DEV *UhcDev, IN UINT32 StatusRegAddr)
 
VOID SetFrameListBaseAddress (IN USB_UHC_DEV *UhcDev, IN UINT32 FrameListRegAddr, IN UINT32 Addr)
 
EFI_STATUS CreateQH (IN USB_UHC_DEV *UhcDev, OUT QH_STRUCT **PtrQH)
 
VOID SetQHHorizontalLinkPtr (IN QH_STRUCT *PtrQH, IN VOID *PtrNext)
 
VOID SetQHHorizontalQHorTDSelect (IN QH_STRUCT *PtrQH, IN BOOLEAN IsQH)
 
VOID SetQHHorizontalValidorInvalid (IN QH_STRUCT *PtrQH, IN BOOLEAN IsValid)
 
VOID SetQHVerticalLinkPtr (IN QH_STRUCT *PtrQH, IN VOID *PtrNext)
 
VOID SetQHVerticalQHorTDSelect (IN QH_STRUCT *PtrQH, IN BOOLEAN IsQH)
 
VOID SetQHVerticalValidorInvalid (IN QH_STRUCT *PtrQH, IN BOOLEAN IsValid)
 
EFI_STATUS AllocateTDorQHStruct (IN USB_UHC_DEV *UhcDev, IN UINT32 Size, OUT VOID **PtrStruct)
 
EFI_STATUS CreateTD (IN USB_UHC_DEV *UhcDev, OUT TD_STRUCT **PtrTD)
 
EFI_STATUS GenSetupStageTD (IN USB_UHC_DEV *UhcDev, IN UINT8 DevAddr, IN UINT8 Endpoint, IN UINT8 DeviceSpeed, IN UINT8 *DevRequest, IN UINT8 *RequestPhy, IN UINT8 RequestLen, OUT TD_STRUCT **PtrTD)
 
EFI_STATUS GenDataTD (IN USB_UHC_DEV *UhcDev, IN UINT8 DevAddr, IN UINT8 Endpoint, IN UINT8 *PtrData, IN UINT8 *DataPhy, IN UINT8 Len, IN UINT8 PktID, IN UINT8 Toggle, IN UINT8 DeviceSpeed, OUT TD_STRUCT **PtrTD)
 
EFI_STATUS CreateStatusTD (IN USB_UHC_DEV *UhcDev, IN UINT8 DevAddr, IN UINT8 Endpoint, IN UINT8 PktID, IN UINT8 DeviceSpeed, OUT TD_STRUCT **PtrTD)
 
VOID SetTDLinkPtrValidorInvalid (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsValid)
 
VOID SetTDLinkPtrQHorTDSelect (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsQH)
 
VOID SetTDLinkPtrDepthorBreadth (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsDepth)
 
VOID SetTDLinkPtr (IN TD_STRUCT *PtrTDStruct, IN VOID *PtrNext)
 
VOID * GetTDLinkPtr (IN TD_STRUCT *PtrTDStruct)
 
VOID EnableorDisableTDShortPacket (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsEnable)
 
VOID SetTDControlErrorCounter (IN TD_STRUCT *PtrTDStruct, IN UINT8 MaxErrors)
 
VOID SetTDLoworFullSpeedDevice (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsLowSpeedDevice)
 
VOID SetTDControlIsochronousorNot (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsIsochronous)
 
VOID SetorClearTDControlIOC (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsSet)
 
VOID SetTDStatusActiveorInactive (IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsActive)
 
UINT16 SetTDTokenMaxLength (IN TD_STRUCT *PtrTDStruct, IN UINT16 MaxLen)
 
VOID SetTDTokenDataToggle1 (IN TD_STRUCT *PtrTDStruct)
 
VOID SetTDTokenDataToggle0 (IN TD_STRUCT *PtrTDStruct)
 
VOID SetTDTokenEndPoint (IN TD_STRUCT *PtrTDStruct, IN UINTN EndPoint)
 
VOID SetTDTokenDeviceAddress (IN TD_STRUCT *PtrTDStruct, IN UINTN DevAddr)
 
VOID SetTDTokenPacketID (IN TD_STRUCT *PtrTDStruct, IN UINT8 PacketID)
 
BOOLEAN IsTDStatusActive (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN IsTDStatusStalled (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN IsTDStatusBufferError (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN IsTDStatusBabbleError (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN IsTDStatusNAKReceived (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN IsTDStatusCRCTimeOutError (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN IsTDStatusBitStuffError (IN TD_STRUCT *PtrTDStruct)
 
UINT16 GetTDStatusActualLength (IN TD_STRUCT *PtrTDStruct)
 
BOOLEAN GetTDLinkPtrValidorInvalid (IN TD_STRUCT *PtrTDStruct)
 
UINTN CountTDsNumber (IN TD_STRUCT *PtrFirstTD)
 
VOID LinkTDToQH (IN QH_STRUCT *PtrQH, IN TD_STRUCT *PtrTD)
 
VOID LinkTDToTD (IN TD_STRUCT *PtrPreTD, IN TD_STRUCT *PtrTD)
 
EFI_STATUS ExecuteControlTransfer (IN USB_UHC_DEV *UhcDev, IN TD_STRUCT *PtrTD, OUT UINTN *ActualLen, IN UINTN TimeOut, OUT UINT32 *TransferResult)
 
EFI_STATUS ExecBulkTransfer (IN USB_UHC_DEV *UhcDev, IN TD_STRUCT *PtrTD, IN OUT UINTN *ActualLen, IN UINT8 *DataToggle, IN UINTN TimeOut, OUT UINT32 *TransferResult)
 
VOID DeleteQueuedTDs (IN USB_UHC_DEV *UhcDev, IN TD_STRUCT *PtrFirstTD)
 
BOOLEAN CheckTDsResults (IN TD_STRUCT *PtrTD, OUT UINT32 *Result, OUT UINTN *ErrTDPos, OUT UINTN *ActualTransferSize)
 
EFI_STATUS CreateMemoryBlock (IN USB_UHC_DEV *UhcDev, OUT MEMORY_MANAGE_HEADER **MemoryHeader, IN UINTN MemoryBlockSizeInPages)
 
EFI_STATUS InitializeMemoryManagement (IN USB_UHC_DEV *UhcDev)
 
EFI_STATUS UhcAllocatePool (IN USB_UHC_DEV *UhcDev, OUT UINT8 **Pool, IN UINTN AllocSize)
 
EFI_STATUS AllocMemInMemoryBlock (IN MEMORY_MANAGE_HEADER *MemoryHeader, OUT VOID **Pool, IN UINTN NumberOfMemoryUnit)
 
VOID UhcFreePool (IN USB_UHC_DEV *UhcDev, IN UINT8 *Pool, IN UINTN AllocSize)
 
VOID InsertMemoryHeaderToList (IN MEMORY_MANAGE_HEADER *MemoryHeader, IN MEMORY_MANAGE_HEADER *NewMemoryHeader)
 
EFI_STATUS UhciMapUserRequest (IN USB_UHC_DEV *Uhc, IN OUT VOID *Request, OUT UINT8 **MappedAddr, OUT VOID **Map)
 
EFI_STATUS UhciMapUserData (IN USB_UHC_DEV *Uhc, IN EFI_USB_DATA_DIRECTION Direction, IN VOID *Data, IN OUT UINTN *Len, OUT UINT8 *PktId, OUT UINT8 **MappedAddr, OUT VOID **Map)
 

Detailed Description

PEIM to produce gPeiUsbHostControllerPpiGuid based on gPeiUsbControllerPpiGuid which is used to enable recovery function from USB Drivers.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UhcPeim.c.

Function Documentation

◆ AllocateTDorQHStruct()

EFI_STATUS AllocateTDorQHStruct ( IN USB_UHC_DEV UhcDev,
IN UINT32  Size,
OUT VOID **  PtrStruct 
)

Allocate TD or QH Struct.

Parameters
UhcDevThe UHCI device.
SizeThe size of allocation.
PtrStructPlace to store TD_STRUCT pointer.
Returns
EFI_SUCCESS Allocate successfully.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resource.

Definition at line 1453 of file UhcPeim.c.

◆ AllocMemInMemoryBlock()

EFI_STATUS AllocMemInMemoryBlock ( IN MEMORY_MANAGE_HEADER MemoryHeader,
OUT VOID **  Pool,
IN UINTN  NumberOfMemoryUnit 
)

Alloc Memory In MemoryBlock.

Parameters
MemoryHeaderThe pointer to memory manage header.
PoolBuffer pointer to store the buffer pointer.
NumberOfMemoryUnitThe size of the pool to be allocated.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_SUCCESSSuccess.

Definition at line 2956 of file UhcPeim.c.

◆ CheckTDsResults()

BOOLEAN CheckTDsResults ( IN TD_STRUCT PtrTD,
OUT UINT32 *  Result,
OUT UINTN ErrTDPos,
OUT UINTN ActualTransferSize 
)

Check TDs Results.

Parameters
PtrTDA pointer to TD_STRUCT data.
ResultThe result to return.
ErrTDPosThe Error TD position.
ActualTransferSizeActual transfer size.
Return values
TheTD is executed successfully or not.

Definition at line 2688 of file UhcPeim.c.

◆ ClearStatusReg()

VOID ClearStatusReg ( IN USB_UHC_DEV UhcDev,
IN UINT32  StatusAddr 
)

Clear the content of UHCI's Status Register.

Parameters
UhcDevThe UHCI device.
StatusAddrThe IO space address of the register.

Definition at line 1225 of file UhcPeim.c.

◆ CountTDsNumber()

UINTN CountTDsNumber ( IN TD_STRUCT PtrFirstTD)

Count TD Number from PtrFirstTD.

Parameters
PtrFirstTDPlace to store TD_STRUCT pointer.
Return values
Thequeued TDs number.

Definition at line 2405 of file UhcPeim.c.

◆ CreateFrameList()

EFI_STATUS CreateFrameList ( USB_UHC_DEV UhcDev)

Create Frame List Structure.

Parameters
UhcDevUHCI device.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_SUCCESSSuccess.

Definition at line 1101 of file UhcPeim.c.

◆ CreateMemoryBlock()

EFI_STATUS CreateMemoryBlock ( IN USB_UHC_DEV UhcDev,
OUT MEMORY_MANAGE_HEADER **  MemoryHeader,
IN UINTN  MemoryBlockSizeInPages 
)

Create Memory Block.

Parameters
UhcDevThe UCHI device.
MemoryHeaderThe Pointer to allocated memory block.
MemoryBlockSizeInPagesThe page size of memory block to be allocated.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_SUCCESSSuccess.

Definition at line 2770 of file UhcPeim.c.

◆ CreateQH()

EFI_STATUS CreateQH ( IN USB_UHC_DEV UhcDev,
OUT QH_STRUCT **  PtrQH 
)

Create QH and initialize.

Parameters
UhcDevThe UHCI device.
PtrQHPlace to store QH_STRUCT pointer.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_SUCCESSSuccess.

Definition at line 1295 of file UhcPeim.c.

◆ CreateStatusTD()

EFI_STATUS CreateStatusTD ( IN USB_UHC_DEV UhcDev,
IN UINT8  DevAddr,
IN UINT8  Endpoint,
IN UINT8  PktID,
IN UINT8  DeviceSpeed,
OUT TD_STRUCT **  PtrTD 
)

Generate Status Stage TD.

Parameters
UhcDevThe UHCI device.
DevAddrDevice address.
EndpointEndpoint number.
PktIDPacketID.
DeviceSpeedDevice Speed.
PtrTDTD_STRUCT generated.
Returns
EFI_SUCCESS Generate status stage TD successfully.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resource.

Definition at line 1763 of file UhcPeim.c.

◆ CreateTD()

EFI_STATUS CreateTD ( IN USB_UHC_DEV UhcDev,
OUT TD_STRUCT **  PtrTD 
)

Create a TD Struct.

Parameters
UhcDevThe UHCI device.
PtrTDPlace to store TD_STRUCT pointer.
Returns
EFI_SUCCESS Allocate successfully.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resource.

Definition at line 1489 of file UhcPeim.c.

◆ DeleteQueuedTDs()

VOID DeleteQueuedTDs ( IN USB_UHC_DEV UhcDev,
IN TD_STRUCT PtrFirstTD 
)

Delete Queued TDs.

Parameters
UhcDevThe UCHI device.
PtrFirstTDPlace to store TD_STRUCT pointer.

Definition at line 2645 of file UhcPeim.c.

◆ EnableorDisableTDShortPacket()

VOID EnableorDisableTDShortPacket ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsEnable 
)

Enable/Disable short packet detection mechanism.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsEnableEnable or disable short packet detection mechanism.

Definition at line 1963 of file UhcPeim.c.

◆ ExecBulkTransfer()

EFI_STATUS ExecBulkTransfer ( IN USB_UHC_DEV UhcDev,
IN TD_STRUCT PtrTD,
IN OUT UINTN ActualLen,
IN UINT8 *  DataToggle,
IN UINTN  TimeOut,
OUT UINT32 *  TransferResult 
)

Execute Bulk Transfer.

Parameters
UhcDevThe UCHI device.
PtrTDA pointer to TD_STRUCT data.
ActualLenActual transfer Length.
DataToggleDataToggle value.
TimeOutTimeOut value.
TransferResultTransfer Result.
Returns
EFI_DEVICE_ERROR The transfer failed due to transfer error.
EFI_TIMEOUT The transfer failed due to time out.
EFI_SUCCESS The transfer finished OK.

Definition at line 2574 of file UhcPeim.c.

◆ ExecuteControlTransfer()

EFI_STATUS ExecuteControlTransfer ( IN USB_UHC_DEV UhcDev,
IN TD_STRUCT PtrTD,
OUT UINTN ActualLen,
IN UINTN  TimeOut,
OUT UINT32 *  TransferResult 
)

Execute Control Transfer.

Parameters
UhcDevThe UCHI device.
PtrTDA pointer to TD_STRUCT data.
ActualLenActual transfer Length.
TimeOutTimeOut value.
TransferResultTransfer Result.
Returns
EFI_DEVICE_ERROR The transfer failed due to transfer error.
EFI_TIMEOUT The transfer failed due to time out.
EFI_SUCCESS The transfer finished OK.

Definition at line 2511 of file UhcPeim.c.

◆ GenDataTD()

EFI_STATUS GenDataTD ( IN USB_UHC_DEV UhcDev,
IN UINT8  DevAddr,
IN UINT8  Endpoint,
IN UINT8 *  PtrData,
IN UINT8 *  DataPhy,
IN UINT8  Len,
IN UINT8  PktID,
IN UINT8  Toggle,
IN UINT8  DeviceSpeed,
OUT TD_STRUCT **  PtrTD 
)

Generate Data Stage TD.

Parameters
UhcDevThe UHCI device.
DevAddrDevice address.
EndpointEndpoint number.
PtrDataCPU memory address of user data buffer to transfer.
DataPhyPCI memory address of user data buffer to transfer.
LenData length.
PktIDPacketID.
ToggleData toggle value.
DeviceSpeedDevice Speed.
PtrTDTD_STRUCT generated.
Returns
EFI_SUCCESS Generate data stage TD successfully.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resource.

Definition at line 1643 of file UhcPeim.c.

◆ GenSetupStageTD()

EFI_STATUS GenSetupStageTD ( IN USB_UHC_DEV UhcDev,
IN UINT8  DevAddr,
IN UINT8  Endpoint,
IN UINT8  DeviceSpeed,
IN UINT8 *  DevRequest,
IN UINT8 *  RequestPhy,
IN UINT8  RequestLen,
OUT TD_STRUCT **  PtrTD 
)

Generate Setup Stage TD.

Parameters
UhcDevThe UHCI device.
DevAddrDevice address.
EndpointEndpoint number.
DeviceSpeedDevice Speed.
DevRequestCPU memory address of request structure buffer to transfer.
RequestPhyPCI memory address of request structure buffer to transfer.
RequestLenRequest length.
PtrTDTD_STRUCT generated.
Returns
EFI_SUCCESS Generate setup stage TD successfully.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resource.

Definition at line 1529 of file UhcPeim.c.

◆ GetTDLinkPtr()

VOID * GetTDLinkPtr ( IN TD_STRUCT PtrTDStruct)

Get TD Link Pointer.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
GetTD Link Pointer in TD.

Definition at line 1944 of file UhcPeim.c.

◆ GetTDLinkPtrValidorInvalid()

BOOLEAN GetTDLinkPtrValidorInvalid ( IN TD_STRUCT PtrTDStruct)

Retrieve the information of whether the Link Pointer field is valid or not.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
Thelinker pointer field is valid or not.

Definition at line 2381 of file UhcPeim.c.

◆ GetTDStatusActualLength()

UINT16 GetTDStatusActualLength ( IN TD_STRUCT PtrTDStruct)

Retrieve the actual number of bytes that were tansferred.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
Theactual number of bytes that were tansferred.

Definition at line 2361 of file UhcPeim.c.

◆ InitializeMemoryManagement()

EFI_STATUS InitializeMemoryManagement ( IN USB_UHC_DEV UhcDev)

Initialize UHCI memory management.

Parameters
UhcDevThe UCHI device.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_SUCCESSSuccess.

Definition at line 2843 of file UhcPeim.c.

◆ InitializeUsbHC()

EFI_STATUS InitializeUsbHC ( IN USB_UHC_DEV UhcDev)

Initialize UHCI.

Parameters
UhcDevUHCI Device.
Return values
EFI_SUCCESSUHCI successfully initialized.
EFI_OUT_OF_RESOURCESResource can not be allocated.

Definition at line 1041 of file UhcPeim.c.

◆ InsertMemoryHeaderToList()

VOID InsertMemoryHeaderToList ( IN MEMORY_MANAGE_HEADER MemoryHeader,
IN MEMORY_MANAGE_HEADER NewMemoryHeader 
)

Insert a new memory header into list.

Parameters
MemoryHeaderA pointer to the memory header list.
NewMemoryHeaderA new memory header to be inserted into the list.

Definition at line 3159 of file UhcPeim.c.

◆ IsStatusOK()

BOOLEAN IsStatusOK ( IN USB_UHC_DEV UhcDev,
IN UINT32  StatusRegAddr 
)

Check whether the host controller operates well.

Parameters
UhcDevThe UHCI device.
StatusRegAddrThe io address of status register.
Return values
TRUEHost controller is working.
FALSEHost controller is halted or system error.

Definition at line 1247 of file UhcPeim.c.

◆ IsTDStatusActive()

BOOLEAN IsTDStatusActive ( IN TD_STRUCT PtrTDStruct)

Detect whether the TD is active.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheTD is active or not.

Definition at line 2207 of file UhcPeim.c.

◆ IsTDStatusBabbleError()

BOOLEAN IsTDStatusBabbleError ( IN TD_STRUCT PtrTDStruct)

Detect whether Babble Error is happened.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheBabble Error is happened or not.

Definition at line 2273 of file UhcPeim.c.

◆ IsTDStatusBitStuffError()

BOOLEAN IsTDStatusBitStuffError ( IN TD_STRUCT PtrTDStruct)

Detect whether Bitstuff Error is received.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheBitstuff Error is received or not.

Definition at line 2339 of file UhcPeim.c.

◆ IsTDStatusBufferError()

BOOLEAN IsTDStatusBufferError ( IN TD_STRUCT PtrTDStruct)

Detect whether Data Buffer Error is happened.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheData Buffer Error is happened or not.

Definition at line 2251 of file UhcPeim.c.

◆ IsTDStatusCRCTimeOutError()

BOOLEAN IsTDStatusCRCTimeOutError ( IN TD_STRUCT PtrTDStruct)

Detect whether CRC/Time Out Error is encountered.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheCRC/Time Out Error is encountered or not.

Definition at line 2317 of file UhcPeim.c.

◆ IsTDStatusNAKReceived()

BOOLEAN IsTDStatusNAKReceived ( IN TD_STRUCT PtrTDStruct)

Detect whether NAK is received.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheNAK is received or not.

Definition at line 2295 of file UhcPeim.c.

◆ IsTDStatusStalled()

BOOLEAN IsTDStatusStalled ( IN TD_STRUCT PtrTDStruct)

Detect whether the TD is stalled.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
Return values
TheTD is stalled or not.

Definition at line 2229 of file UhcPeim.c.

◆ LinkTDToQH()

VOID LinkTDToQH ( IN QH_STRUCT PtrQH,
IN TD_STRUCT PtrTD 
)

Link TD To QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
PtrTDPlace to store TD_STRUCT pointer.

Definition at line 2433 of file UhcPeim.c.

◆ LinkTDToTD()

VOID LinkTDToTD ( IN TD_STRUCT PtrPreTD,
IN TD_STRUCT PtrTD 
)

Link TD To TD.

Parameters
PtrPreTDPlace to store TD_STRUCT pointer.
PtrTDPlace to store TD_STRUCT pointer.

Definition at line 2465 of file UhcPeim.c.

◆ SetFrameListBaseAddress()

VOID SetFrameListBaseAddress ( IN USB_UHC_DEV UhcDev,
IN UINT32  FrameListRegAddr,
IN UINT32  Addr 
)

Set Frame List Base Address.

Parameters
UhcDevThe UHCI device.
FrameListRegAddrThe address of frame list register.
AddrThe address of frame list table.

Definition at line 1272 of file UhcPeim.c.

◆ SetorClearTDControlIOC()

VOID SetorClearTDControlIOC ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsSet 
)

Set if UCHI should issue an interrupt on completion of the frame in which this TD is executed

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsSetWhether HC should issue an interrupt on completion.

Definition at line 2044 of file UhcPeim.c.

◆ SetQHHorizontalLinkPtr()

VOID SetQHHorizontalLinkPtr ( IN QH_STRUCT PtrQH,
IN VOID *  PtrNext 
)

Set the horizontal link pointer in QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
PtrNextPlace to the next QH_STRUCT.

Definition at line 1327 of file UhcPeim.c.

◆ SetQHHorizontalQHorTDSelect()

VOID SetQHHorizontalQHorTDSelect ( IN QH_STRUCT PtrQH,
IN BOOLEAN  IsQH 
)

Set a QH or TD horizontally to be connected with a specific QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
IsQHSpecify QH or TD is connected.

Definition at line 1348 of file UhcPeim.c.

◆ SetQHHorizontalValidorInvalid()

VOID SetQHHorizontalValidorInvalid ( IN QH_STRUCT PtrQH,
IN BOOLEAN  IsValid 
)

Set the horizontal validor bit in QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
IsValidSpecify the horizontal linker is valid or not.

Definition at line 1368 of file UhcPeim.c.

◆ SetQHVerticalLinkPtr()

VOID SetQHVerticalLinkPtr ( IN QH_STRUCT PtrQH,
IN VOID *  PtrNext 
)

Set the vertical link pointer in QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
PtrNextPlace to the next QH_STRUCT.

Definition at line 1388 of file UhcPeim.c.

◆ SetQHVerticalQHorTDSelect()

VOID SetQHVerticalQHorTDSelect ( IN QH_STRUCT PtrQH,
IN BOOLEAN  IsQH 
)

Set a QH or TD vertically to be connected with a specific QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
IsQHSpecify QH or TD is connected.

Definition at line 1409 of file UhcPeim.c.

◆ SetQHVerticalValidorInvalid()

VOID SetQHVerticalValidorInvalid ( IN QH_STRUCT PtrQH,
IN BOOLEAN  IsValid 
)

Set the vertical validor bit in QH.

Parameters
PtrQHPlace to store QH_STRUCT pointer.
IsValidSpecify the vertical linker is valid or not.

Definition at line 1429 of file UhcPeim.c.

◆ SetTDControlErrorCounter()

VOID SetTDControlErrorCounter ( IN TD_STRUCT PtrTDStruct,
IN UINT8  MaxErrors 
)

Set the max error counter in TD.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
MaxErrorsThe number of allowable error.

Definition at line 1982 of file UhcPeim.c.

◆ SetTDControlIsochronousorNot()

VOID SetTDControlIsochronousorNot ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsIsochronous 
)

Set the TD is isochronous transfer type or not.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsIsochronousWhether the transaction isochronous transfer type.

Definition at line 2024 of file UhcPeim.c.

◆ SetTDLinkPtr()

VOID SetTDLinkPtr ( IN TD_STRUCT PtrTDStruct,
IN VOID *  PtrNext 
)

Set TD Link Pointer in TD.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
PtrNextPlace to the next TD_STRUCT.

Definition at line 1923 of file UhcPeim.c.

◆ SetTDLinkPtrDepthorBreadth()

VOID SetTDLinkPtrDepthorBreadth ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsDepth 
)

Set the traverse is depth-first or breadth-first.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsDepthSpecify the traverse is depth-first or breadth-first.

Definition at line 1903 of file UhcPeim.c.

◆ SetTDLinkPtrQHorTDSelect()

VOID SetTDLinkPtrQHorTDSelect ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsQH 
)

Set the Link Pointer pointing to a QH or TD.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsQHSpecify QH or TD is connected.

Definition at line 1884 of file UhcPeim.c.

◆ SetTDLinkPtrValidorInvalid()

VOID SetTDLinkPtrValidorInvalid ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsValid 
)

Set the link pointer validor bit in TD.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsValidSpecify the linker pointer is valid or not.

Definition at line 1864 of file UhcPeim.c.

◆ SetTDLoworFullSpeedDevice()

VOID SetTDLoworFullSpeedDevice ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsLowSpeedDevice 
)

Set the TD is targeting a low-speed device or not.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsLowSpeedDeviceWhether The device is low-speed.

Definition at line 2005 of file UhcPeim.c.

◆ SetTDStatusActiveorInactive()

VOID SetTDStatusActiveorInactive ( IN TD_STRUCT PtrTDStruct,
IN BOOLEAN  IsActive 
)

Set if the TD is active and can be executed.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
IsActiveWhether the TD is active and can be executed.

Definition at line 2064 of file UhcPeim.c.

◆ SetTDTokenDataToggle0()

VOID SetTDTokenDataToggle0 ( IN TD_STRUCT PtrTDStruct)

Set the data toggle bit to DATA0.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.

Definition at line 2131 of file UhcPeim.c.

◆ SetTDTokenDataToggle1()

VOID SetTDTokenDataToggle1 ( IN TD_STRUCT PtrTDStruct)

Set the data toggle bit to DATA1.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.

Definition at line 2114 of file UhcPeim.c.

◆ SetTDTokenDeviceAddress()

VOID SetTDTokenDeviceAddress ( IN TD_STRUCT PtrTDStruct,
IN UINTN  DevAddr 
)

Set Device Address the TD is targeting at.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
DevAddrThe Device Address of the target.

Definition at line 2168 of file UhcPeim.c.

◆ SetTDTokenEndPoint()

VOID SetTDTokenEndPoint ( IN TD_STRUCT PtrTDStruct,
IN UINTN  EndPoint 
)

Set EndPoint Number the TD is targeting at.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
EndPointThe Endport number of the target.

Definition at line 2149 of file UhcPeim.c.

◆ SetTDTokenMaxLength()

UINT16 SetTDTokenMaxLength ( IN TD_STRUCT PtrTDStruct,
IN UINT16  MaxLen 
)

Specifies the maximum number of data bytes allowed for the transfer.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
MaxLenThe maximum number of data bytes allowed.
Return values
Theallowed maximum number of data.

Definition at line 2089 of file UhcPeim.c.

◆ SetTDTokenPacketID()

VOID SetTDTokenPacketID ( IN TD_STRUCT PtrTDStruct,
IN UINT8  PacketID 
)

Set Packet Identification the TD is targeting at.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.
PacketIDThe Packet Identification of the target.

Definition at line 2187 of file UhcPeim.c.

◆ UhcAllocatePool()

EFI_STATUS UhcAllocatePool ( IN USB_UHC_DEV UhcDev,
OUT UINT8 **  Pool,
IN UINTN  AllocSize 
)

Initialize UHCI memory management.

Parameters
UhcDevThe UCHI device.
PoolBuffer pointer to store the buffer pointer.
AllocSizeThe size of the pool to be allocated.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_SUCCESSSuccess.

Definition at line 2874 of file UhcPeim.c.

◆ UhcBulkTransfer()

EFI_STATUS EFIAPI UhcBulkTransfer ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI This,
IN UINT8  DeviceAddress,
IN UINT8  EndPointAddress,
IN UINT8  MaximumPacketLength,
IN OUT VOID *  Data,
IN OUT UINTN DataLength,
IN OUT UINT8 *  DataToggle,
IN UINTN  TimeOut,
OUT UINT32 *  TransferResult 
)

Submits bulk transfer to a bulk endpoint of a USB device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
ThisThe pointer of PEI_USB_HOST_CONTROLLER_PPI.
DeviceAddressTarget device address.
EndPointAddressEndpoint number and its direction in bit 7.
MaximumPacketLengthMaximum packet size the endpoint is capable of sending or receiving.
DataArray of pointers to the buffers of data to transmit from or receive into.
DataLengthThe lenght of the data buffer.
DataToggleOn input, the initial data toggle for the transfer; On output, it is updated to to next data toggle to use of the subsequent bulk transfer.
TimeOutIndicates the maximum time, in millisecond, which the transfer is allowed to complete. If Timeout is 0, then the caller must wait for the function to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.
TransferResultA pointer to the detailed result information of the bulk transfer.
Return values
EFI_SUCCESSThe transfer was completed successfully.
EFI_OUT_OF_RESOURCESThe transfer failed due to lack of resource.
EFI_INVALID_PARAMETERParameters are invalid.
EFI_TIMEOUTThe transfer failed due to timeout.
EFI_DEVICE_ERRORThe transfer failed due to host controller error.

Definition at line 489 of file UhcPeim.c.

◆ UhcClearRootHubPortFeature()

EFI_STATUS EFIAPI UhcClearRootHubPortFeature ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI This,
IN UINT8  PortNumber,
IN EFI_USB_PORT_FEATURE  PortFeature 
)

Clears a feature for the specified root hub port.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
ThisThe pointer of PEI_USB_HOST_CONTROLLER_PPI.
PortNumberSpecifies the root hub port whose feature is requested to be cleared.
PortFeatureIndicates the feature selector associated with the feature clear request.
Return values
EFI_SUCCESSThe feature specified by PortFeature was cleared for the USB root hub port specified by PortNumber.
EFI_INVALID_PARAMETERPortNumber is invalid or PortFeature is invalid.

Definition at line 933 of file UhcPeim.c.

◆ UhcControlTransfer()

EFI_STATUS EFIAPI UhcControlTransfer ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI This,
IN UINT8  DeviceAddress,
IN UINT8  DeviceSpeed,
IN UINT8  MaximumPacketLength,
IN EFI_USB_DEVICE_REQUEST Request,
IN EFI_USB_DATA_DIRECTION  TransferDirection,
IN OUT VOID *Data  OPTIONAL,
IN OUT UINTN *DataLength  OPTIONAL,
IN UINTN  TimeOut,
OUT UINT32 *  TransferResult 
)

Submits control transfer to a target USB device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
ThisThe pointer of PEI_USB_HOST_CONTROLLER_PPI.
DeviceAddressThe target device address.
DeviceSpeedTarget device speed.
MaximumPacketLengthMaximum packet size the default control transfer endpoint is capable of sending or receiving.
RequestUSB device request to send.
TransferDirectionSpecifies the data direction for the data stage.
DataData buffer to be transmitted or received from USB device.
DataLengthThe size (in bytes) of the data buffer.
TimeOutIndicates the maximum timeout, in millisecond. If Timeout is 0, then the caller must wait for the function to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.
TransferResultReturn the result of this control transfer.
Return values
EFI_SUCCESSTransfer was completed successfully.
EFI_OUT_OF_RESOURCESThe transfer failed due to lack of resources.
EFI_INVALID_PARAMETERSome parameters are invalid.
EFI_TIMEOUTTransfer failed due to timeout.
EFI_DEVICE_ERRORTransfer failed due to host controller or device error.

Definition at line 241 of file UhcPeim.c.

◆ UhcEndOfPei()

EFI_STATUS EFIAPI UhcEndOfPei ( IN EFI_PEI_SERVICES **  PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor,
IN VOID *  Ppi 
)

One notified function to stop the Host Controller at the end of PEI

Parameters
[in]PeiServicesPointer to PEI Services Table.
[in]NotifyDescriptorPointer to the descriptor for the Notification event that caused this function to execute.
[in]PpiPointer to the PPI data associated with this function.
Return values
EFI_SUCCESSThe function completes successfully
others

Definition at line 67 of file UhcPeim.c.

◆ UhcFreePool()

VOID UhcFreePool ( IN USB_UHC_DEV UhcDev,
IN UINT8 *  Pool,
IN UINTN  AllocSize 
)

Uhci Free Pool.

Parameters
UhcDevThe UHCI device.
PoolA pointer to store the buffer address.
AllocSizeThe size of the pool to be freed.

Definition at line 3091 of file UhcPeim.c.

◆ UhcGetRootHubPortNumber()

EFI_STATUS EFIAPI UhcGetRootHubPortNumber ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI This,
OUT UINT8 *  PortNumber 
)

Retrieves the number of root hub ports.

Parameters
[in]PeiServicesThe pointer to the PEI Services Table.
[in]ThisThe pointer to this instance of the PEI_USB_HOST_CONTROLLER_PPI.
[out]PortNumberThe pointer to the number of the root hub ports.
Return values
EFI_SUCCESSThe port number was retrieved successfully.
EFI_INVALID_PARAMETERPortNumber is NULL.

Definition at line 708 of file UhcPeim.c.

◆ UhcGetRootHubPortStatus()

EFI_STATUS EFIAPI UhcGetRootHubPortStatus ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI This,
IN UINT8  PortNumber,
OUT EFI_USB_PORT_STATUS PortStatus 
)

Retrieves the current status of a USB root hub port.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
ThisThe pointer of PEI_USB_HOST_CONTROLLER_PPI.
PortNumberThe root hub port to retrieve the state from.
PortStatusVariable to receive the port state.
Return values
EFI_SUCCESSThe status of the USB root hub port specified. by PortNumber was returned in PortStatus.
EFI_INVALID_PARAMETERPortNumber is invalid.

Definition at line 756 of file UhcPeim.c.

◆ UhciMapUserData()

EFI_STATUS UhciMapUserData ( IN USB_UHC_DEV Uhc,
IN EFI_USB_DATA_DIRECTION  Direction,
IN VOID *  Data,
IN OUT UINTN Len,
OUT UINT8 *  PktId,
OUT UINT8 **  MappedAddr,
OUT VOID **  Map 
)

Map address of user data buffer.

Parameters
UhcThe UHCI device.
DirectionDirection of the data transfer.
DataThe user data buffer.
LenLength of the user data.
PktIdPacket identificaion.
MappedAddrMapped address to return.
MapIdentificaion of this mapping to return.
Returns
EFI_SUCCESS Success.
EFI_DEVICE_ERROR Fail to map the user data.

Definition at line 3231 of file UhcPeim.c.

◆ UhciMapUserRequest()

EFI_STATUS UhciMapUserRequest ( IN USB_UHC_DEV Uhc,
IN OUT VOID *  Request,
OUT UINT8 **  MappedAddr,
OUT VOID **  Map 
)

Map address of request structure buffer.

Parameters
UhcThe UHCI device.
RequestThe user request buffer.
MappedAddrMapped address of request.
MapIdentificaion of this mapping to return.
Returns
EFI_SUCCESS Success.
EFI_DEVICE_ERROR Fail to map the user request.

Definition at line 3187 of file UhcPeim.c.

◆ UhciStopHc()

EFI_STATUS UhciStopHc ( IN USB_UHC_DEV Uhc,
IN UINTN  Timeout 
)

Stop the host controller.

Parameters
UhcThe UHCI device.
TimeoutMax time allowed.
Return values
EFI_SUCCESSThe host controller is stopped.
EFI_TIMEOUTFailed to stop the host controller.

Definition at line 24 of file UhcPeim.c.

◆ UhcPeimEntry()

EFI_STATUS EFIAPI UhcPeimEntry ( IN EFI_PEI_FILE_HANDLE  FileHandle,
IN CONST EFI_PEI_SERVICES **  PeiServices 
)

Initializes Usb Host Controller.

Parameters
FileHandleHandle of the file being invoked.
PeiServicesDescribes the list of possible PEI Services.
Return values
EFI_SUCCESSPPI successfully installed.
EFI_OUT_OF_RESOURCESCan't allocate memory resource.

Definition at line 97 of file UhcPeim.c.

◆ UhcSetRootHubPortFeature()

EFI_STATUS EFIAPI UhcSetRootHubPortFeature ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_USB_HOST_CONTROLLER_PPI This,
IN UINT8  PortNumber,
IN EFI_USB_PORT_FEATURE  PortFeature 
)

Sets a feature for the specified root hub port.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES
ThisThe pointer of PEI_USB_HOST_CONTROLLER_PPI
PortNumberRoot hub port to set.
PortFeatureFeature to set.
Return values
EFI_SUCCESSThe feature specified by PortFeature was set.
EFI_INVALID_PARAMETERPortNumber is invalid or PortFeature is invalid.
EFI_TIMEOUTThe time out occurred.

Definition at line 855 of file UhcPeim.c.

◆ USBReadPortW()

UINT16 USBReadPortW ( IN USB_UHC_DEV UhcDev,
IN UINT32  Port 
)

Read a 16bit width data from Uhc HC IO space register.

Parameters
UhcDevThe UHCI device.
PortThe IO space address of the register.
Return values
theregister content read.

Definition at line 1173 of file UhcPeim.c.

◆ USBWritePortDW()

VOID USBWritePortDW ( IN USB_UHC_DEV UhcDev,
IN UINT32  Port,
IN UINT32  Data 
)

Write a 32bit width data into Uhc HC IO space register.

Parameters
UhcDevThe UHCI device.
PortThe IO space address of the register.
DataThe data written into the register.

Definition at line 1208 of file UhcPeim.c.

◆ USBWritePortW()

VOID USBWritePortW ( IN USB_UHC_DEV UhcDev,
IN UINT32  Port,
IN UINT16  Data 
)

Write a 16bit width data into Uhc HC IO space register.

Parameters
UhcDevThe UHCI device.
PortThe IO space address of the register.
DataThe data written into the register.

Definition at line 1190 of file UhcPeim.c.