MdeModulePkg/EhciDxe: factor out EhcIsDebugPortInUse()

The EhcReset(), EhcGetRootHubPortStatus() and EhcDriverBindingStart()
functions need to see whether the host controller (or a specific port on
the host controller) can be accessed, dependent on the controller having
(or the specific port being) an in-use debug port. Because the condition
isn't simple, extract it to a separate function.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Suggested-by: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Laszlo Ersek
2018-09-05 19:06:19 +02:00
parent 22cf747fcf
commit b48ec0e8ab
4 changed files with 80 additions and 30 deletions

View File

@@ -137,19 +137,28 @@ EhcReadCapRegister (
);
/**
Read EHCI debug port register.
Check whether the host controller has an in-use debug port.
@param Ehc The EHCI device.
@param Offset Debug port register address.
@param[in] Ehc The Enhanced Host Controller to query.
@return The register content read.
@retval If err, return 0xffff.
@param[in] PortNumber If 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.
@retval TRUE PortNumber 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).
@retval FALSE PortNumber 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).
**/
UINT32
EhcReadDbgRegister (
IN USB2_HC_DEV *Ehc,
IN UINT32 Offset
BOOLEAN
EhcIsDebugPortInUse (
IN CONST USB2_HC_DEV *Ehc,
IN CONST UINT8 *PortNumber OPTIONAL
);
/**