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

Go to the source code of this file.

Functions

UINT32 EhcReadCapRegister (IN USB2_HC_DEV *Ehc, IN UINT32 Offset)
 
UINT32 EhcReadDbgRegister (IN CONST USB2_HC_DEV *Ehc, IN UINT32 Offset)
 
BOOLEAN EhcIsDebugPortInUse (IN CONST USB2_HC_DEV *Ehc, IN CONST UINT8 *PortNumber OPTIONAL)
 
UINT32 EhcReadOpReg (IN USB2_HC_DEV *Ehc, IN UINT32 Offset)
 
VOID EhcWriteOpReg (IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Data)
 
VOID EhcSetOpRegBit (IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit)
 
VOID EhcClearOpRegBit (IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit)
 
EFI_STATUS EhcWaitOpRegBit (IN USB2_HC_DEV *Ehc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)
 
VOID EhcClearLegacySupport (IN USB2_HC_DEV *Ehc)
 
EFI_STATUS EhcSetAndWaitDoorBell (IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
 
VOID EhcAckAllInterrupt (IN USB2_HC_DEV *Ehc)
 
EFI_STATUS EhcEnablePeriodSchd (IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
 
EFI_STATUS EhcEnableAsyncSchd (IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
 
BOOLEAN EhcIsHalt (IN USB2_HC_DEV *Ehc)
 
BOOLEAN EhcIsSysError (IN USB2_HC_DEV *Ehc)
 
EFI_STATUS EhcResetHC (IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
 
EFI_STATUS EhcHaltHC (IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
 
EFI_STATUS EhcRunHC (IN USB2_HC_DEV *Ehc, IN UINT32 Timeout)
 
EFI_STATUS EhcInitHC (IN USB2_HC_DEV *Ehc)
 

Detailed Description

The EHCI register operation routines.

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

Definition in file EhciReg.c.

Function Documentation

◆ EhcAckAllInterrupt()

VOID EhcAckAllInterrupt ( IN USB2_HC_DEV Ehc)

Clear all the interrutp status bits, these bits are Write-Clean.

Parameters
EhcThe EHCI device.

Definition at line 376 of file EhciReg.c.

◆ EhcClearLegacySupport()

VOID EhcClearLegacySupport ( IN USB2_HC_DEV Ehc)

Add support for UEFI Over Legacy (UoL) feature, stop the legacy USB SMI support.

Parameters
EhcThe EHCI device.

Definition at line 295 of file EhciReg.c.

◆ EhcClearOpRegBit()

VOID EhcClearOpRegBit ( IN USB2_HC_DEV Ehc,
IN UINT32  Offset,
IN UINT32  Bit 
)

Clear one bit of the operational register while keeping other bits.

Parameters
EhcThe EHCI device.
OffsetThe offset of the operational register.
BitThe bit mask of the register to clear.

Definition at line 238 of file EhciReg.c.

◆ EhcEnableAsyncSchd()

EFI_STATUS EhcEnableAsyncSchd ( IN USB2_HC_DEV Ehc,
IN UINT32  Timeout 
)

Enable asynchrounous schedule.

Parameters
EhcThe EHCI device.
TimeoutTime to wait before abort.
Return values
EFI_SUCCESSThe EHCI asynchronous schedule is enabled.
Returns
Others Failed to enable the asynchronous scheudle.

Definition at line 419 of file EhciReg.c.

◆ EhcEnablePeriodSchd()

EFI_STATUS EhcEnablePeriodSchd ( IN USB2_HC_DEV Ehc,
IN UINT32  Timeout 
)

Enable the periodic schedule then wait EHC to actually enable it.

Parameters
EhcThe EHCI device.
TimeoutThe time to wait before abort (in millisecond, ms).
Return values
EFI_SUCCESSThe periodical schedule is enabled.
EFI_TIMEOUTTime out happened while enabling periodic schedule.

Definition at line 395 of file EhciReg.c.

◆ EhcHaltHC()

EFI_STATUS EhcHaltHC ( IN USB2_HC_DEV Ehc,
IN UINT32  Timeout 
)

Halt the host controller.

Parameters
EhcThe EHCI device.
TimeoutTime to wait before abort.
Return values
EFI_SUCCESSThe EHCI is halt.
EFI_TIMEOUTFailed to halt the controller before Timeout.

Definition at line 511 of file EhciReg.c.

◆ EhcInitHC()

EFI_STATUS EhcInitHC ( IN USB2_HC_DEV Ehc)

Initialize the HC hardware. EHCI spec lists the five things to do to initialize the hardware:

  1. Program CTRLDSSEGMENT
  2. Set USBINTR to enable interrupts
  3. Set periodic list base
  4. Set USBCMD, interrupt threshold, frame list size etc
  5. Write 1 to CONFIGFLAG to route all ports to EHCI
Parameters
EhcThe EHCI device.
Returns
EFI_SUCCESS The EHCI has come out of halt state.
EFI_TIMEOUT Time out happened.

Definition at line 562 of file EhciReg.c.

◆ EhcIsDebugPortInUse()

BOOLEAN EhcIsDebugPortInUse ( IN CONST USB2_HC_DEV Ehc,
IN CONST UINT8 *PortNumber  OPTIONAL 
)

Check whether the host controller has an in-use debug port.

Parameters
[in]EhcThe Enhanced Host Controller to query.
[in]PortNumberIf PortNumber is not NULL, then query whether PortNumber is an in-use debug port on Ehc. (PortNumber is taken in UEFI notation, i.e., zero-based.) Otherwise, query whether Ehc has any in-use debug port.
Return values
TRUEPortNumber is an in-use debug port on Ehc (if PortNumber is not NULL), or some port on Ehc is an in-use debug port (otherwise).
FALSEPortNumber is not an in-use debug port on Ehc (if PortNumber is not NULL), or no port on Ehc is an in-use debug port (otherwise).

Definition at line 104 of file EhciReg.c.

◆ EhcIsHalt()

BOOLEAN EhcIsHalt ( IN USB2_HC_DEV Ehc)

Whether Ehc is halted.

Parameters
EhcThe EHCI device.
Return values
TRUEThe controller is halted.
FALSEIt isn't halted.

Definition at line 442 of file EhciReg.c.

◆ EhcIsSysError()

BOOLEAN EhcIsSysError ( IN USB2_HC_DEV Ehc)

Whether system error occurred.

Parameters
EhcThe EHCI device.
Returns
TRUE System error happened.
FALSE No system error.

Definition at line 459 of file EhciReg.c.

◆ EhcReadCapRegister()

UINT32 EhcReadCapRegister ( IN USB2_HC_DEV Ehc,
IN UINT32  Offset 
)

Read EHCI capability register.

Parameters
EhcThe EHCI device.
OffsetCapability register address.
Returns
The register content read.
Return values
Iferr, return 0xffff.

Definition at line 23 of file EhciReg.c.

◆ EhcReadDbgRegister()

UINT32 EhcReadDbgRegister ( IN CONST USB2_HC_DEV Ehc,
IN UINT32  Offset 
)

Read EHCI debug port register.

Parameters
EhcThe EHCI device.
OffsetDebug port register offset.
Returns
The register content read.
Return values
Iferr, return 0xffff.

Definition at line 59 of file EhciReg.c.

◆ EhcReadOpReg()

UINT32 EhcReadOpReg ( IN USB2_HC_DEV Ehc,
IN UINT32  Offset 
)

Read EHCI Operation register.

Parameters
EhcThe EHCI device.
OffsetThe operation register offset.
Returns
The register content read.
Return values
Iferr, return 0xffff.

Definition at line 147 of file EhciReg.c.

◆ EhcResetHC()

EFI_STATUS EhcResetHC ( IN USB2_HC_DEV Ehc,
IN UINT32  Timeout 
)

Reset the host controller.

Parameters
EhcThe EHCI device.
TimeoutTime to wait before abort (in millisecond, ms).
Return values
EFI_SUCCESSThe host controller is reset.
Returns
Others Failed to reset the host.

Definition at line 477 of file EhciReg.c.

◆ EhcRunHC()

EFI_STATUS EhcRunHC ( IN USB2_HC_DEV Ehc,
IN UINT32  Timeout 
)

Set the EHCI to run.

Parameters
EhcThe EHCI device.
TimeoutTime to wait before abort.
Return values
EFI_SUCCESSThe EHCI is running.
Returns
Others Failed to set the EHCI to run.

Definition at line 534 of file EhciReg.c.

◆ EhcSetAndWaitDoorBell()

EFI_STATUS EhcSetAndWaitDoorBell ( IN USB2_HC_DEV Ehc,
IN UINT32  Timeout 
)

Set door bell and wait it to be ACKed by host controller. This function is used to synchronize with the hardware.

Parameters
EhcThe EHCI device.
TimeoutThe time to wait before abort (in millisecond, ms).
Return values
EFI_SUCCESSSynchronized with the hardware.
EFI_TIMEOUTTime out happened while waiting door bell to set.

Definition at line 343 of file EhciReg.c.

◆ EhcSetOpRegBit()

VOID EhcSetOpRegBit ( IN USB2_HC_DEV Ehc,
IN UINT32  Offset,
IN UINT32  Bit 
)

Set one bit of the operational register while keeping other bits.

Parameters
EhcThe EHCI device.
OffsetThe offset of the operational register.
BitThe bit mask of the register to set.

Definition at line 216 of file EhciReg.c.

◆ EhcWaitOpRegBit()

EFI_STATUS EhcWaitOpRegBit ( IN USB2_HC_DEV Ehc,
IN UINT32  Offset,
IN UINT32  Bit,
IN BOOLEAN  WaitToSet,
IN UINT32  Timeout 
)

Wait the operation register's bit as specified by Bit to become set (or clear).

Parameters
EhcThe EHCI device.
OffsetThe offset of the operation register.
BitThe bit of the register to wait for.
WaitToSetWait the bit to set or clear.
TimeoutThe time to wait before abort (in millisecond).
Return values
EFI_SUCCESSThe bit successfully changed by host controller.
EFI_TIMEOUTThe time out occurred.

Definition at line 266 of file EhciReg.c.

◆ EhcWriteOpReg()

VOID EhcWriteOpReg ( IN USB2_HC_DEV Ehc,
IN UINT32  Offset,
IN UINT32  Data 
)

Write the data to the EHCI operation register.

Parameters
EhcThe EHCI device.
OffsetEHCI operation register offset.
DataThe data to write.

Definition at line 183 of file EhciReg.c.