TianoCore EDK2 master
Loading...
Searching...
No Matches
UhcPeim.h File Reference

Go to the source code of this file.

Data Structures

struct  FRAMELIST_ENTRY
 
struct  QUEUE_HEAD
 
struct  QH_STRUCT
 
struct  TD
 
struct  TD_STRUCT
 
struct  _MEMORY_MANAGE_HEADER
 
struct  USB_UHC_DEV
 

Macros

#define USB_SLOW_SPEED_DEVICE   0x01
 
#define USB_FULL_SPEED_DEVICE   0x02
 
#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES   16
 
#define USBCMD   0 /* Command Register Offset 00-01h */
 
#define USBCMD_RS   BIT0 /* Run/Stop */
 
#define USBCMD_HCRESET   BIT1 /* Host reset */
 
#define USBCMD_GRESET   BIT2 /* Global reset */
 
#define USBCMD_EGSM   BIT3 /* Global Suspend Mode */
 
#define USBCMD_FGR   BIT4 /* Force Global Resume */
 
#define USBCMD_SWDBG   BIT5 /* SW Debug mode */
 
#define USBCMD_CF   BIT6 /* Config Flag (sw only) */
 
#define USBCMD_MAXP   BIT7 /* Max Packet (0 = 32, 1 = 64) */
 
#define USBSTS   2 /* Status Register Offset 02-03h */
 
#define USBSTS_USBINT   BIT0 /* Interrupt due to IOC */
 
#define USBSTS_ERROR   BIT1 /* Interrupt due to error */
 
#define USBSTS_RD   BIT2 /* Resume Detect */
 
#define USBSTS_HSE   BIT3 /* Host System Error - basically PCI problems */
 
#define USBSTS_HCPE   BIT4 /* Host Controller Process Error - the scripts were buggy */
 
#define USBSTS_HCH   BIT5 /* HC Halted */
 
#define USBINTR   4 /* Interrupt Enable Register 04-05h */
 
#define USBINTR_TIMEOUT   BIT0 /* Timeout/CRC error enable */
 
#define USBINTR_RESUME   BIT1 /* Resume interrupt enable */
 
#define USBINTR_IOC   BIT2 /* Interrupt On Complete enable */
 
#define USBINTR_SP   BIT3 /* Short packet interrupt enable */
 
#define USBFRNUM   6
 
#define USBFLBASEADD   8
 
#define USBSOF   0x0c
 
#define USBPORTSC1   0x10 /*Port 1 offset 10-11h */
 
#define USBPORTSC2   0x12 /*Port 2 offset 12-13h */
 
#define USBPORTSC_CCS   BIT0 /* Current Connect Status ("device present") */
 
#define USBPORTSC_CSC   BIT1 /* Connect Status Change */
 
#define USBPORTSC_PED   BIT2 /* Port Enable / Disable */
 
#define USBPORTSC_PEDC   BIT3 /* Port Enable / Disable Change */
 
#define USBPORTSC_LSL   BIT4 /* Line Status Low bit*/
 
#define USBPORTSC_LSH   BIT5 /* Line Status High bit*/
 
#define USBPORTSC_RD   BIT6 /* Resume Detect */
 
#define USBPORTSC_LSDA   BIT8 /* Low Speed Device Attached */
 
#define USBPORTSC_PR   BIT9 /* Port Reset */
 
#define USBPORTSC_SUSP   BIT12 /* Suspend */
 
#define SETUP_PACKET_ID   0x2D
 
#define INPUT_PACKET_ID   0x69
 
#define OUTPUT_PACKET_ID   0xE1
 
#define ERROR_PACKET_ID   0x55
 
#define STALL_1_MICRO_SECOND   1
 
#define STALL_1_MILLI_SECOND   1000
 
#define USB_UHC_DEV_SIGNATURE   SIGNATURE_32 ('p', 'u', 'h', 'c')
 
#define PEI_RECOVERY_USB_UHC_DEV_FROM_UHCI_THIS(a)   CR (a, USB_UHC_DEV, UsbHostControllerPpi, USB_UHC_DEV_SIGNATURE)
 
#define PEI_RECOVERY_USB_UHC_DEV_FROM_THIS_NOTIFY(a)   CR (a, USB_UHC_DEV, EndOfPeiNotifyList, USB_UHC_DEV_SIGNATURE)
 

Typedefs

typedef struct _MEMORY_MANAGE_HEADER MEMORY_MANAGE_HEADER
 

Functions

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)
 
VOID SetTDDataBuffer (IN TD_STRUCT *PtrTDStruct)
 
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)
 
EFI_STATUS IoMmuMap (IN EDKII_IOMMU_PPI *IoMmu, IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
VOID IoMmuUnmap (IN EDKII_IOMMU_PPI *IoMmu, IN VOID *Mapping)
 
EFI_STATUS IoMmuAllocateBuffer (IN EDKII_IOMMU_PPI *IoMmu, IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
VOID IoMmuInit (OUT EDKII_IOMMU_PPI **IoMmu)
 

Detailed Description

Private Header file for Usb Host Controller PEIM

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

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

Definition in file UhcPeim.h.

Macro Definition Documentation

◆ ERROR_PACKET_ID

#define ERROR_PACKET_ID   0x55

Definition at line 89 of file UhcPeim.h.

◆ INPUT_PACKET_ID

#define INPUT_PACKET_ID   0x69

Definition at line 87 of file UhcPeim.h.

◆ NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES

#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES   16

Definition at line 34 of file UhcPeim.h.

◆ OUTPUT_PACKET_ID

#define OUTPUT_PACKET_ID   0xE1

Definition at line 88 of file UhcPeim.h.

◆ PEI_RECOVERY_USB_UHC_DEV_FROM_THIS_NOTIFY

#define PEI_RECOVERY_USB_UHC_DEV_FROM_THIS_NOTIFY (   a)    CR (a, USB_UHC_DEV, EndOfPeiNotifyList, USB_UHC_DEV_SIGNATURE)

Definition at line 192 of file UhcPeim.h.

◆ PEI_RECOVERY_USB_UHC_DEV_FROM_UHCI_THIS

#define PEI_RECOVERY_USB_UHC_DEV_FROM_UHCI_THIS (   a)    CR (a, USB_UHC_DEV, UsbHostControllerPpi, USB_UHC_DEV_SIGNATURE)

Definition at line 191 of file UhcPeim.h.

◆ SETUP_PACKET_ID

#define SETUP_PACKET_ID   0x2D

Definition at line 86 of file UhcPeim.h.

◆ STALL_1_MICRO_SECOND

#define STALL_1_MICRO_SECOND   1

Definition at line 91 of file UhcPeim.h.

◆ STALL_1_MILLI_SECOND

#define STALL_1_MILLI_SECOND   1000

Definition at line 92 of file UhcPeim.h.

◆ USB_FULL_SPEED_DEVICE

#define USB_FULL_SPEED_DEVICE   0x02

Definition at line 29 of file UhcPeim.h.

◆ USB_SLOW_SPEED_DEVICE

#define USB_SLOW_SPEED_DEVICE   0x01

Definition at line 28 of file UhcPeim.h.

◆ USB_UHC_DEV_SIGNATURE

#define USB_UHC_DEV_SIGNATURE   SIGNATURE_32 ('p', 'u', 'h', 'c')

Definition at line 169 of file UhcPeim.h.

◆ USBCMD

#define USBCMD   0 /* Command Register Offset 00-01h */

Definition at line 36 of file UhcPeim.h.

◆ USBCMD_CF

#define USBCMD_CF   BIT6 /* Config Flag (sw only) */

Definition at line 43 of file UhcPeim.h.

◆ USBCMD_EGSM

#define USBCMD_EGSM   BIT3 /* Global Suspend Mode */

Definition at line 40 of file UhcPeim.h.

◆ USBCMD_FGR

#define USBCMD_FGR   BIT4 /* Force Global Resume */

Definition at line 41 of file UhcPeim.h.

◆ USBCMD_GRESET

#define USBCMD_GRESET   BIT2 /* Global reset */

Definition at line 39 of file UhcPeim.h.

◆ USBCMD_HCRESET

#define USBCMD_HCRESET   BIT1 /* Host reset */

Definition at line 38 of file UhcPeim.h.

◆ USBCMD_MAXP

#define USBCMD_MAXP   BIT7 /* Max Packet (0 = 32, 1 = 64) */

Definition at line 44 of file UhcPeim.h.

◆ USBCMD_RS

#define USBCMD_RS   BIT0 /* Run/Stop */

Definition at line 37 of file UhcPeim.h.

◆ USBCMD_SWDBG

#define USBCMD_SWDBG   BIT5 /* SW Debug mode */

Definition at line 42 of file UhcPeim.h.

◆ USBFLBASEADD

#define USBFLBASEADD   8

Definition at line 66 of file UhcPeim.h.

◆ USBFRNUM

#define USBFRNUM   6

Definition at line 63 of file UhcPeim.h.

◆ USBINTR

#define USBINTR   4 /* Interrupt Enable Register 04-05h */

Definition at line 56 of file UhcPeim.h.

◆ USBINTR_IOC

#define USBINTR_IOC   BIT2 /* Interrupt On Complete enable */

Definition at line 59 of file UhcPeim.h.

◆ USBINTR_RESUME

#define USBINTR_RESUME   BIT1 /* Resume interrupt enable */

Definition at line 58 of file UhcPeim.h.

◆ USBINTR_SP

#define USBINTR_SP   BIT3 /* Short packet interrupt enable */

Definition at line 60 of file UhcPeim.h.

◆ USBINTR_TIMEOUT

#define USBINTR_TIMEOUT   BIT0 /* Timeout/CRC error enable */

Definition at line 57 of file UhcPeim.h.

◆ USBPORTSC1

#define USBPORTSC1   0x10 /*Port 1 offset 10-11h */

Definition at line 72 of file UhcPeim.h.

◆ USBPORTSC2

#define USBPORTSC2   0x12 /*Port 2 offset 12-13h */

Definition at line 73 of file UhcPeim.h.

◆ USBPORTSC_CCS

#define USBPORTSC_CCS   BIT0 /* Current Connect Status ("device present") */

Definition at line 75 of file UhcPeim.h.

◆ USBPORTSC_CSC

#define USBPORTSC_CSC   BIT1 /* Connect Status Change */

Definition at line 76 of file UhcPeim.h.

◆ USBPORTSC_LSDA

#define USBPORTSC_LSDA   BIT8 /* Low Speed Device Attached */

Definition at line 82 of file UhcPeim.h.

◆ USBPORTSC_LSH

#define USBPORTSC_LSH   BIT5 /* Line Status High bit*/

Definition at line 80 of file UhcPeim.h.

◆ USBPORTSC_LSL

#define USBPORTSC_LSL   BIT4 /* Line Status Low bit*/

Definition at line 79 of file UhcPeim.h.

◆ USBPORTSC_PED

#define USBPORTSC_PED   BIT2 /* Port Enable / Disable */

Definition at line 77 of file UhcPeim.h.

◆ USBPORTSC_PEDC

#define USBPORTSC_PEDC   BIT3 /* Port Enable / Disable Change */

Definition at line 78 of file UhcPeim.h.

◆ USBPORTSC_PR

#define USBPORTSC_PR   BIT9 /* Port Reset */

Definition at line 83 of file UhcPeim.h.

◆ USBPORTSC_RD

#define USBPORTSC_RD   BIT6 /* Resume Detect */

Definition at line 81 of file UhcPeim.h.

◆ USBPORTSC_SUSP

#define USBPORTSC_SUSP   BIT12 /* Suspend */

Definition at line 84 of file UhcPeim.h.

◆ USBSOF

#define USBSOF   0x0c

Definition at line 69 of file UhcPeim.h.

◆ USBSTS

#define USBSTS   2 /* Status Register Offset 02-03h */

Definition at line 47 of file UhcPeim.h.

◆ USBSTS_ERROR

#define USBSTS_ERROR   BIT1 /* Interrupt due to error */

Definition at line 49 of file UhcPeim.h.

◆ USBSTS_HCH

#define USBSTS_HCH   BIT5 /* HC Halted */

Definition at line 53 of file UhcPeim.h.

◆ USBSTS_HCPE

#define USBSTS_HCPE   BIT4 /* Host Controller Process Error - the scripts were buggy */

Definition at line 52 of file UhcPeim.h.

◆ USBSTS_HSE

#define USBSTS_HSE   BIT3 /* Host System Error - basically PCI problems */

Definition at line 51 of file UhcPeim.h.

◆ USBSTS_RD

#define USBSTS_RD   BIT2 /* Resume Detect */

Definition at line 50 of file UhcPeim.h.

◆ USBSTS_USBINT

#define USBSTS_USBINT   BIT0 /* Interrupt due to IOC */

Definition at line 48 of file UhcPeim.h.

Typedef Documentation

◆ MEMORY_MANAGE_HEADER

Definition at line 159 of file UhcPeim.h.

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.

◆ IoMmuAllocateBuffer()

EFI_STATUS IoMmuAllocateBuffer ( IN EDKII_IOMMU_PPI IoMmu,
IN UINTN  Pages,
OUT VOID **  HostAddress,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress,
OUT VOID **  Mapping 
)

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

Parameters
IoMmuPointer to IOMMU PPI.
PagesThe number of pages to allocate.
HostAddressA pointer to store the base system memory address of the allocated range.
DeviceAddressThe resulting map address for the bus master PCI controller to use to access the hosts HostAddress.
MappingA resulting value to pass to Unmap().
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 134 of file DmaMem.c.

◆ IoMmuInit()

VOID IoMmuInit ( OUT EDKII_IOMMU_PPI **  IoMmu)

Initialize IOMMU.

Parameters
IoMmuPointer to pointer to IOMMU PPI.

Definition at line 238 of file DmaMem.c.

◆ IoMmuMap()

EFI_STATUS IoMmuMap ( IN EDKII_IOMMU_PPI IoMmu,
IN EDKII_IOMMU_OPERATION  Operation,
IN VOID *  HostAddress,
IN OUT UINTN NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress,
OUT VOID **  Mapping 
)

Provides the controller-specific addresses required to access system memory from a DMA bus master.

Parameters
IoMmuPointer to IOMMU PPI.
OperationIndicates if the bus master is going to read or write to system memory.
HostAddressThe system memory address to map to the PCI controller.
NumberOfBytesOn input the number of bytes to map. On output the number of bytes that were mapped.
DeviceAddressThe resulting map address for the bus master PCI controller to use to access the hosts HostAddress.
MappingA resulting value to pass to Unmap().
Return values
EFI_SUCCESSThe range was mapped for the returned NumberOfBytes.
EFI_UNSUPPORTEDThe HostAddress cannot be mapped as a common buffer.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_DEVICE_ERRORThe system hardware could not map the requested address.

Definition at line 33 of file DmaMem.c.

◆ IoMmuUnmap()

VOID IoMmuUnmap ( IN EDKII_IOMMU_PPI IoMmu,
IN VOID *  Mapping 
)

Completes the Map() operation and releases any corresponding resources.

Parameters
IoMmuPointer to IOMMU PPI.
MappingThe mapping value returned from Map().

Definition at line 103 of file DmaMem.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.

◆ SetTDDataBuffer()

VOID SetTDDataBuffer ( IN TD_STRUCT PtrTDStruct)

Set the beginning address of the data buffer that will be used during the transaction.

Parameters
PtrTDStructPlace to store TD_STRUCT pointer.

◆ 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.
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.

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.
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.

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.

◆ 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.

◆ 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.