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

Go to the source code of this file.

Functions

EFI_STATUS EhcCreateHelpQ (IN USB2_HC_DEV *Ehc)
 
EFI_STATUS EhcInitSched (IN USB2_HC_DEV *Ehc)
 
VOID EhcFreeSched (IN USB2_HC_DEV *Ehc)
 
VOID EhcLinkQhToAsync (IN USB2_HC_DEV *Ehc, IN EHC_QH *Qh)
 
VOID EhcUnlinkQhFromAsync (IN USB2_HC_DEV *Ehc, IN EHC_QH *Qh)
 
VOID EhcLinkQhToPeriod (IN USB2_HC_DEV *Ehc, IN EHC_QH *Qh)
 
VOID EhcUnlinkQhFromPeriod (IN USB2_HC_DEV *Ehc, IN EHC_QH *Qh)
 
BOOLEAN EhcCheckUrbResult (IN USB2_HC_DEV *Ehc, IN URB *Urb)
 
EFI_STATUS EhcExecTransfer (IN USB2_HC_DEV *Ehc, IN URB *Urb, IN UINTN TimeOut)
 
EFI_STATUS EhciDelAsyncIntTransfer (IN USB2_HC_DEV *Ehc, IN UINT8 DevAddr, IN UINT8 EpNum, OUT UINT8 *DataToggle)
 
VOID EhciDelAllAsyncIntTransfers (IN USB2_HC_DEV *Ehc)
 
URBEhciInsertAsyncIntTransfer (IN USB2_HC_DEV *Ehc, IN UINT8 DevAddr, IN UINT8 EpAddr, IN UINT8 DevSpeed, IN UINT8 Toggle, IN UINTN MaxPacket, IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub, IN UINTN DataLen, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context, IN UINTN Interval)
 
EFI_STATUS EhcFlushAsyncIntMap (IN USB2_HC_DEV *Ehc, IN URB *Urb)
 
VOID EhcUpdateAsyncRequest (IN USB2_HC_DEV *Ehc, IN URB *Urb)
 
VOID EFIAPI EhcMonitorAsyncRequests (IN EFI_EVENT Event, IN VOID *Context)
 

Detailed Description

EHCI transfer scheduling routines.

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

Definition in file EhciSched.c.

Function Documentation

◆ EhcCheckUrbResult()

BOOLEAN EhcCheckUrbResult ( IN USB2_HC_DEV Ehc,
IN URB Urb 
)

Check the URB's execution result and update the URB's result accordingly.

Parameters
EhcThe EHCI device.
UrbThe URB to check result.
Returns
Whether the result of URB transfer is finialized.

Definition at line 549 of file EhciSched.c.

◆ EhcCreateHelpQ()

EFI_STATUS EhcCreateHelpQ ( IN USB2_HC_DEV Ehc)

Create helper QTD/QH for the EHCI device.

Parameters
EhcThe EHCI device.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resource for helper QTD/QH.
EFI_SUCCESSHelper QH/QTD are created.

Definition at line 23 of file EhciSched.c.

◆ EhcExecTransfer()

EFI_STATUS EhcExecTransfer ( IN USB2_HC_DEV Ehc,
IN URB Urb,
IN UINTN  TimeOut 
)

Execute the transfer by polling the URB. This is a synchronous operation.

Parameters
EhcThe EHCI device.
UrbThe URB to execute.
TimeOutThe time to wait before abort, in millisecond.
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 668 of file EhciSched.c.

◆ EhcFlushAsyncIntMap()

EFI_STATUS EhcFlushAsyncIntMap ( IN USB2_HC_DEV Ehc,
IN URB Urb 
)

Flush data from PCI controller specific address to mapped system memory address.

Parameters
EhcThe EHCI device.
UrbThe URB to unmap.
Return values
EFI_SUCCESSSuccess to flush data to mapped system memory.
EFI_DEVICE_ERRORFail to flush data to mapped system memory.

Definition at line 888 of file EhciSched.c.

◆ EhcFreeSched()

VOID EhcFreeSched ( IN USB2_HC_DEV Ehc)

Free the schedule data. It may be partially initialized.

Parameters
EhcThe EHCI device.

Definition at line 250 of file EhciSched.c.

◆ EhciDelAllAsyncIntTransfers()

VOID EhciDelAllAsyncIntTransfers ( IN USB2_HC_DEV Ehc)

Remove all the asynchronous interrutp transfers.

Parameters
EhcThe EHCI device.

Definition at line 780 of file EhciSched.c.

◆ EhciDelAsyncIntTransfer()

EFI_STATUS EhciDelAsyncIntTransfer ( IN USB2_HC_DEV Ehc,
IN UINT8  DevAddr,
IN UINT8  EpNum,
OUT UINT8 *  DataToggle 
)

Delete a single asynchronous interrupt transfer for the device and endpoint.

Parameters
EhcThe EHCI device.
DevAddrThe address of the target device.
EpNumThe endpoint of the target.
DataToggleReturn the next data toggle to use.
Return values
EFI_SUCCESSAn asynchronous transfer is removed.
EFI_NOT_FOUNDNo transfer for the device is found.

Definition at line 733 of file EhciSched.c.

◆ EhciInsertAsyncIntTransfer()

URB * EhciInsertAsyncIntTransfer ( IN USB2_HC_DEV Ehc,
IN UINT8  DevAddr,
IN UINT8  EpAddr,
IN UINT8  DevSpeed,
IN UINT8  Toggle,
IN UINTN  MaxPacket,
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR Hub,
IN UINTN  DataLen,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,
IN VOID *  Context,
IN UINTN  Interval 
)

Insert a single asynchronous interrupt transfer for the device and endpoint.

Parameters
EhcThe EHCI device.
DevAddrThe device address.
EpAddrEndpoint addrress & its direction.
DevSpeedThe device speed.
ToggleInitial data toggle to use.
MaxPacketThe max packet length of the endpoint.
HubThe transaction translator to use.
DataLenThe length of data buffer.
CallbackThe function to call when data is transferred.
ContextThe context to the callback.
IntervalThe interval for interrupt transfer.
Returns
Created URB or NULL.

Definition at line 819 of file EhciSched.c.

◆ EhcInitSched()

EFI_STATUS EhcInitSched ( IN USB2_HC_DEV Ehc)

Initialize the schedule data structure such as frame list.

Parameters
EhcThe EHCI device to init schedule data.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resource to init schedule data.
EFI_SUCCESSThe schedule data is initialized.

Definition at line 102 of file EhciSched.c.

◆ EhcLinkQhToAsync()

VOID EhcLinkQhToAsync ( IN USB2_HC_DEV Ehc,
IN EHC_QH Qh 
)

Link the queue head to the asynchronous schedule list. UEFI only supports one CTRL/BULK transfer at a time due to its interfaces. This simplifies the AsynList management: A reclamation header is always linked to the AsyncListAddr, the only active QH is appended to it.

Parameters
EhcThe EHCI device.
QhThe queue head to link.

Definition at line 312 of file EhciSched.c.

◆ EhcLinkQhToPeriod()

VOID EhcLinkQhToPeriod ( IN USB2_HC_DEV Ehc,
IN EHC_QH Qh 
)

Link a queue head for interrupt transfer to the periodic schedule frame list. This code is very much the same as that in UHCI.

Parameters
EhcThe EHCI device.
QhThe queue head to link.

Definition at line 389 of file EhciSched.c.

◆ EhcMonitorAsyncRequests()

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

Interrupt transfer periodic check handler.

Parameters
EventInterrupt event.
ContextPointer to USB2_HC_DEV.

Definition at line 1021 of file EhciSched.c.

◆ EhcUnlinkQhFromAsync()

VOID EhcUnlinkQhFromAsync ( IN USB2_HC_DEV Ehc,
IN EHC_QH Qh 
)

Unlink a queue head from the asynchronous schedule list. Need to synchronize with hardware.

Parameters
EhcThe EHCI device.
QhThe queue head to unlink.

Definition at line 345 of file EhciSched.c.

◆ EhcUnlinkQhFromPeriod()

VOID EhcUnlinkQhFromPeriod ( IN USB2_HC_DEV Ehc,
IN EHC_QH Qh 
)

Unlink an interrupt queue head from the periodic schedule frame list.

Parameters
EhcThe EHCI device.
QhThe queue head to unlink.

Definition at line 490 of file EhciSched.c.

◆ EhcUpdateAsyncRequest()

VOID EhcUpdateAsyncRequest ( IN USB2_HC_DEV Ehc,
IN URB Urb 
)

Update the queue head for next round of asynchronous transfer.

Parameters
EhcThe EHCI device.
UrbThe URB to update.

Definition at line 937 of file EhciSched.c.