mirror of https://github.com/acidanthera/audk.git
modify coding style to pass ecc tool and provide comments that complied with Doxgen.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5429 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5f597758e2
commit
ab6495eacf
|
@ -1,4 +1,5 @@
|
|||
/** @file
|
||||
UEFI Component Name(2) protocol implementation for UHCI driver.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
|
@ -9,13 +10,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The UHCI driver model and HC protocol routines.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Uhci.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The UHCI driver model and HC protocol routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
@ -27,17 +18,16 @@ Revision History
|
|||
/**
|
||||
Provides software reset for the USB host controller according to UEFI 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param Attributes A bit mask of the reset operation to perform. See
|
||||
below for a list of the supported bit mask values.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param Attributes A bit mask of the reset operation to perform. See
|
||||
below for a list of the supported bit mask values.
|
||||
|
||||
@return EFI_SUCCESS : The reset operation succeeded.
|
||||
@return EFI_INVALID_PARAMETER : Attributes is not valid.
|
||||
@return EFI_UNSUPPORTED : This type of reset is not currently supported
|
||||
@return EFI_DEVICE_ERROR : Other errors
|
||||
@return EFI_SUCCESS The reset operation succeeded.
|
||||
@return EFI_INVALID_PARAMETER Attributes is not valid.
|
||||
@return EFI_UNSUPPORTED This type of reset is not currently supported.
|
||||
@return EFI_DEVICE_ERROR Other errors.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2Reset (
|
||||
|
@ -112,15 +102,14 @@ ON_INVAILD_PARAMETER:
|
|||
/**
|
||||
Retrieves current state of the USB host controller according to UEFI 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param State Variable to receive current device state
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param State Variable to receive current device state.
|
||||
|
||||
@return EFI_SUCCESS : The state is returned
|
||||
@return EFI_INVALID_PARAMETER : State is not valid.
|
||||
@return EFI_DEVICE_ERROR : Other errors2006
|
||||
@return EFI_SUCCESS The state is returned.
|
||||
@return EFI_INVALID_PARAMETER State is not valid.
|
||||
@return EFI_DEVICE_ERROR Other errors.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2GetState (
|
||||
|
@ -141,7 +130,7 @@ Uhci2GetState (
|
|||
UsbCmd = UhciReadReg (Uhc->PciIo, USBCMD_OFFSET);
|
||||
UsbSts = UhciReadReg (Uhc->PciIo, USBSTS_OFFSET);
|
||||
|
||||
if (UsbCmd & USBCMD_EGSM) {
|
||||
if ((UsbCmd & USBCMD_EGSM) !=0 ) {
|
||||
*State = EfiUsbHcStateSuspend;
|
||||
|
||||
} else if ((UsbSts & USBSTS_HCH) != 0) {
|
||||
|
@ -158,16 +147,15 @@ Uhci2GetState (
|
|||
/**
|
||||
Sets the USB host controller to a specific state according to UEFI 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param State Indicates the state of the host controller that will
|
||||
be set.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param State Indicates the state of the host controller that will
|
||||
be set.
|
||||
|
||||
@return EFI_SUCCESS : Host controller was successfully placed in the state
|
||||
@return EFI_INVALID_PARAMETER : State is invalid.
|
||||
@return EFI_DEVICE_ERROR : Failed to set the state
|
||||
@return EFI_SUCCESS Host controller was successfully placed in the state.
|
||||
@return EFI_INVALID_PARAMETER State is invalid.
|
||||
@return EFI_DEVICE_ERROR Failed to set the state.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2SetState (
|
||||
|
@ -265,19 +253,18 @@ ON_EXIT:
|
|||
/**
|
||||
Retrieves capabilities of USB host controller according to UEFI 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance
|
||||
@param MaxSpeed A pointer to the max speed USB host controller
|
||||
supports.
|
||||
@param PortNumber A pointer to the number of root hub ports.
|
||||
@param Is64BitCapable A pointer to an integer to show whether USB host
|
||||
controller supports 64-bit memory addressing.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param MaxSpeed A pointer to the max speed USB host controller
|
||||
supports.
|
||||
@param PortNumber A pointer to the number of root hub ports.
|
||||
@param Is64BitCapable A pointer to an integer to show whether USB host
|
||||
controller supports 64-bit memory addressing.
|
||||
|
||||
@return EFI_SUCCESS : capabilities were retrieved successfully.
|
||||
@return EFI_INVALID_PARAMETER : MaxSpeed or PortNumber or Is64BitCapable is NULL.
|
||||
@return EFI_DEVICE_ERROR : An error was encountered
|
||||
@return EFI_SUCCESS capabilities were retrieved successfully.
|
||||
@return EFI_INVALID_PARAMETER MaxSpeed or PortNumber or Is64BitCapable is NULL.
|
||||
@return EFI_DEVICE_ERROR An error was encountered.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2GetCapability (
|
||||
|
@ -329,17 +316,16 @@ Uhci2GetCapability (
|
|||
/**
|
||||
Retrieves the current status of a USB root hub port according to UEFI 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL.
|
||||
@param PortNumber The port to get status
|
||||
@param PortStatus A pointer to the current port status bits and port
|
||||
status change bits.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL.
|
||||
@param PortNumber The port to get status.
|
||||
@param PortStatus A pointer to the current port status bits and port
|
||||
status change bits.
|
||||
|
||||
@return EFI_SUCCESS : status of the USB root hub port was returned in PortStatus.
|
||||
@return EFI_INVALID_PARAMETER : PortNumber is invalid.
|
||||
@return EFI_DEVICE_ERROR : Can't read register
|
||||
@return EFI_SUCCESS status of the USB root hub port was returned in PortStatus.
|
||||
@return EFI_INVALID_PARAMETER PortNumber is invalid.
|
||||
@return EFI_DEVICE_ERROR Can't read register.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2GetRootHubPortStatus (
|
||||
|
@ -368,24 +354,24 @@ Uhci2GetRootHubPortStatus (
|
|||
|
||||
PortSC = UhciReadReg (Uhc->PciIo, Offset);
|
||||
|
||||
if (PortSC & USBPORTSC_CCS) {
|
||||
if ((PortSC & USBPORTSC_CCS) != 0) {
|
||||
PortStatus->PortStatus |= USB_PORT_STAT_CONNECTION;
|
||||
}
|
||||
|
||||
if (PortSC & USBPORTSC_PED) {
|
||||
if ((PortSC & USBPORTSC_PED) != 0) {
|
||||
PortStatus->PortStatus |= USB_PORT_STAT_ENABLE;
|
||||
}
|
||||
|
||||
if (PortSC & USBPORTSC_SUSP) {
|
||||
if ((PortSC & USBPORTSC_SUSP) != 0) {
|
||||
DEBUG ((EFI_D_INFO, "Uhci2GetRootHubPortStatus: port %d is suspended\n", PortNumber));
|
||||
PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
|
||||
}
|
||||
|
||||
if (PortSC & USBPORTSC_PR) {
|
||||
if ((PortSC & USBPORTSC_PR) != 0) {
|
||||
PortStatus->PortStatus |= USB_PORT_STAT_RESET;
|
||||
}
|
||||
|
||||
if (PortSC & USBPORTSC_LSDA) {
|
||||
if ((PortSC & USBPORTSC_LSDA) != 0) {
|
||||
PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
|
||||
}
|
||||
|
||||
|
@ -394,11 +380,11 @@ Uhci2GetRootHubPortStatus (
|
|||
//
|
||||
PortStatus->PortStatus |= USB_PORT_STAT_OWNER;
|
||||
|
||||
if (PortSC & USBPORTSC_CSC) {
|
||||
if ((PortSC & USBPORTSC_CSC) != 0) {
|
||||
PortStatus->PortChangeStatus |= USB_PORT_STAT_C_CONNECTION;
|
||||
}
|
||||
|
||||
if (PortSC & USBPORTSC_PEDC) {
|
||||
if ((PortSC & USBPORTSC_PEDC) != 0) {
|
||||
PortStatus->PortChangeStatus |= USB_PORT_STAT_C_ENABLE;
|
||||
}
|
||||
|
||||
|
@ -409,18 +395,17 @@ Uhci2GetRootHubPortStatus (
|
|||
/**
|
||||
Sets a feature for the specified root hub port according to UEFI 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL.
|
||||
@param PortNumber Specifies the root hub port whose feature is
|
||||
requested to be set.
|
||||
@param PortFeature Indicates the feature selector associated with the
|
||||
feature set request.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL.
|
||||
@param PortNumber Specifies the root hub port whose feature is
|
||||
requested to be set.
|
||||
@param PortFeature Indicates the feature selector associated with the
|
||||
feature set request.
|
||||
|
||||
@return EFI_SUCCESS : PortFeature was set for the root port
|
||||
@return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.
|
||||
@return EFI_DEVICE_ERROR : Can't read register
|
||||
@return EFI_SUCCESS PortFeature was set for the root port.
|
||||
@return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
|
||||
@return EFI_DEVICE_ERROR Can't read register.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2SetRootHubPortFeature (
|
||||
|
@ -449,7 +434,7 @@ Uhci2SetRootHubPortFeature (
|
|||
switch (PortFeature) {
|
||||
case EfiUsbPortSuspend:
|
||||
Command = UhciReadReg (Uhc->PciIo, USBCMD_OFFSET);
|
||||
if (!(Command & USBCMD_EGSM)) {
|
||||
if ((Command & USBCMD_EGSM) == 0) {
|
||||
//
|
||||
// if global suspend is not active, can set port suspend
|
||||
//
|
||||
|
@ -489,18 +474,17 @@ Uhci2SetRootHubPortFeature (
|
|||
/**
|
||||
Clears a feature for the specified root hub port according to Uefi 2.0 spec.
|
||||
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param PortNumber Specifies the root hub port whose feature is
|
||||
requested to be cleared.
|
||||
@param PortFeature Indicates the feature selector associated with the
|
||||
feature clear request.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param PortNumber Specifies the root hub port whose feature is
|
||||
requested to be cleared.
|
||||
@param PortFeature Indicates the feature selector associated with the
|
||||
feature clear request.
|
||||
|
||||
@return EFI_SUCCESS : PortFeature was cleared for the USB root hub port
|
||||
@return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.
|
||||
@return EFI_DEVICE_ERROR : Can't read register
|
||||
@return EFI_SUCCESS PortFeature was cleared for the USB root hub port.
|
||||
@return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
|
||||
@return EFI_DEVICE_ERROR Can't read register.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2ClearRootHubPortFeature (
|
||||
|
@ -591,27 +575,27 @@ Uhci2ClearRootHubPortFeature (
|
|||
|
||||
|
||||
/**
|
||||
Submits control transfer to a target USB device accroding to UEFI 2.0 spec..
|
||||
Submits control transfer to a target USB device accroding to UEFI 2.0 spec.
|
||||
|
||||
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
DeviceAddress : Target device address
|
||||
DeviceSpeed : Device speed
|
||||
MaximumPacketLength : Maximum packet size of the target endpoint
|
||||
Request : USB device request to send
|
||||
TransferDirection : Data direction of the Data stage in control transfer
|
||||
Data : Data to transmit/receive in data stage
|
||||
DataLength : Length of the data
|
||||
TimeOut : Maximum time, in microseconds, for transfer to complete.
|
||||
TransferResult : Variable to receive the transfer result
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param DeviceSpeed Device speed.
|
||||
@param MaximumPacketLength Maximum packet size of the target endpoint.
|
||||
@param Request USB device request to send.
|
||||
@param TransferDirection Data direction of the Data stage in control transfer.
|
||||
@param Data Data to transmit/receive in data stage.
|
||||
@param DataLength Length of the data.
|
||||
@param TimeOut Maximum time, in microseconds, for transfer to complete.
|
||||
@param Translator Transaction translator to be used by this device.
|
||||
@param TransferResult Variable to receive the transfer result.
|
||||
|
||||
@return EFI_SUCCESS : The control transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
|
||||
@return EFI_TIMEOUT : Failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR : Failed due to host controller or device error.
|
||||
@return EFI_SUCCESS The control transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES Failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@return EFI_TIMEOUT Failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR Failed due to host controller or device error.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2ControlTransfer (
|
||||
|
@ -747,32 +731,30 @@ ON_EXIT:
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Submits bulk transfer to a bulk endpoint of a USB device
|
||||
Submits bulk transfer to a bulk endpoint of a USB device.
|
||||
|
||||
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
DeviceAddress : Target device address
|
||||
EndPointAddress : Endpoint number and direction
|
||||
DeviceSpeed : Device speed
|
||||
MaximumPacketLength : Maximum packet size of the target endpoint
|
||||
DataBuffersNumber : Number of data buffers prepared for the transfer.
|
||||
Data : Array of pointers to the buffers of data
|
||||
DataLength : On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
DataToggle : On input, data toggle to use; On output, next data toggle
|
||||
Translator : A pointr to the transaction translator data.
|
||||
TimeOut : Maximum time out, in microseconds
|
||||
TransferResult : Variable to receive transfer result
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and direction.
|
||||
@param DeviceSpeed Device speed.
|
||||
@param MaximumPacketLength Maximum packet size of the target endpoint.
|
||||
@param DataBuffersNumber Number of data buffers prepared for the transfer.
|
||||
@param Data Array of pointers to the buffers of data.
|
||||
@param DataLength On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
@param DataToggle On input, data toggle to use; On output, next data toggle.
|
||||
@param TimeOut Maximum time out, in microseconds.
|
||||
@param Translator A pointr to the transaction translator data.
|
||||
@param TransferResult Variable to receive transfer result.
|
||||
|
||||
@return EFI_SUCCESS : The bulk transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
|
||||
@return EFI_TIMEOUT : Failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR : Failed due to host controller or device error.
|
||||
@return EFI_SUCCESS The bulk transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES Failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@return EFI_TIMEOUT Failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR Failed due to host controller or device error.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2BulkTransfer (
|
||||
|
@ -809,11 +791,7 @@ Uhci2BulkTransfer (
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if ((DataLength == NULL) || (Data == NULL) || (TransferResult == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (*DataLength == 0) {
|
||||
if ((DataLength == NULL) || (*DataLength == 0) || (Data == NULL) || (TransferResult == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -845,7 +823,7 @@ Uhci2BulkTransfer (
|
|||
// Map the source data buffer for bus master access,
|
||||
// then create a list of TDs
|
||||
//
|
||||
if (EndPointAddress & 0x80) {
|
||||
if ((EndPointAddress & 0x80) != 0) {
|
||||
Direction = EfiUsbDataIn;
|
||||
} else {
|
||||
Direction = EfiUsbDataOut;
|
||||
|
@ -906,27 +884,26 @@ ON_EXIT:
|
|||
Submits an asynchronous interrupt transfer to an
|
||||
interrupt endpoint of a USB device according to UEFI 2.0 spec.
|
||||
|
||||
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
DeviceAddress : Target device address
|
||||
EndPointAddress : Endpoint number and direction
|
||||
DeviceSpeed : Device speed
|
||||
MaximumPacketLength : Maximum packet size of the target endpoint
|
||||
IsNewTransfer : If TRUE, submit a new transfer, if FALSE cancel old transfer
|
||||
DataToggle : On input, data toggle to use; On output, next data toggle
|
||||
PollingInterval : Interrupt poll rate in milliseconds
|
||||
DataLength : On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
Translator : A pointr to the transaction translator data.
|
||||
CallBackFunction : Function to call periodically
|
||||
Context : User context
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and direction.
|
||||
@param DeviceSpeed Device speed.
|
||||
@param MaximumPacketLength Maximum packet size of the target endpoint.
|
||||
@param IsNewTransfer If TRUE, submit a new transfer, if FALSE cancel old transfer.
|
||||
@param DataToggle On input, data toggle to use; On output, next data toggle.
|
||||
@param PollingInterval Interrupt poll rate in milliseconds.
|
||||
@param DataLength On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
@param Translator A pointr to the transaction translator data.
|
||||
@param CallBackFunction Function to call periodically.
|
||||
@param Context User context.
|
||||
|
||||
@return EFI_SUCCESS : Transfer was submitted
|
||||
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
|
||||
@return EFI_OUT_OF_RESOURCES : Failed due to a lack of resources.
|
||||
@return EFI_DEVICE_ERROR : Can't read register
|
||||
@return EFI_SUCCESS Transfer was submitted.
|
||||
@return EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@return EFI_OUT_OF_RESOURCES Failed due to a lack of resources.
|
||||
@return EFI_DEVICE_ERROR Can't read register.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2AsyncInterruptTransfer (
|
||||
|
@ -1102,28 +1079,27 @@ FREE_DATA:
|
|||
Submits synchronous interrupt transfer to an interrupt endpoint
|
||||
of a USB device according to UEFI 2.0 spec.
|
||||
|
||||
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
DeviceAddress : Target device address
|
||||
EndPointAddress : Endpoint number and direction
|
||||
DeviceSpeed : Device speed
|
||||
MaximumPacketLength : Maximum packet size of the target endpoint
|
||||
DataBuffersNumber : Number of data buffers prepared for the transfer.
|
||||
Data : Array of pointers to the buffers of data
|
||||
DataLength : On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
DataToggle : On input, data toggle to use; On output, next data toggle
|
||||
TimeOut : Maximum time out, in microseconds
|
||||
Translator : A pointr to the transaction translator data.
|
||||
TransferResult : Variable to receive transfer result
|
||||
|
||||
@return EFI_SUCCESS : The transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER : Some parameters are invalid.
|
||||
@return EFI_TIMEOUT : Failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR : Failed due to host controller or device error.
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and direction.
|
||||
@param DeviceSpeed Device speed.
|
||||
@param MaximumPacketLength Maximum packet size of the target endpoint.
|
||||
@param Data Array of pointers to the buffers of data.
|
||||
@param DataLength On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
@param DataToggle On input, data toggle to use; On output, next data toggle.
|
||||
@param TimeOut Maximum time out, in microseconds.
|
||||
@param Translator A pointr to the transaction translator data.
|
||||
@param TransferResult Variable to receive transfer result.
|
||||
|
||||
@return EFI_SUCCESS The transfer was completed successfully.
|
||||
@return EFI_OUT_OF_RESOURCES Failed due to lack of resource.
|
||||
@return EFI_INVALID_PARAMETER Some parameters are invalid.
|
||||
@return EFI_TIMEOUT Failed due to timeout.
|
||||
@return EFI_DEVICE_ERROR Failed due to host controller or device error.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2SyncInterruptTransfer (
|
||||
|
@ -1254,22 +1230,21 @@ ON_EXIT:
|
|||
/**
|
||||
Submits isochronous transfer to a target USB device according to UEFI 2.0 spec.
|
||||
|
||||
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
DeviceAddress : Target device address
|
||||
EndPointAddress : Endpoint number and direction
|
||||
DeviceSpeed : Device speed
|
||||
MaximumPacketLength : Maximum packet size of the target endpoint
|
||||
DataBuffersNumber : Number of data buffers prepared for the transfer.
|
||||
Data : Array of pointers to the buffers of data
|
||||
DataLength : On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
Translator : A pointr to the transaction translator data.
|
||||
TransferResult : Variable to receive transfer result
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and direction.
|
||||
@param DeviceSpeed Device speed.
|
||||
@param MaximumPacketLength Maximum packet size of the target endpoint.
|
||||
@param DataBuffersNumber Number of data buffers prepared for the transfer.
|
||||
@param Data Array of pointers to the buffers of data.
|
||||
@param DataLength On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
@param Translator A pointr to the transaction translator data.
|
||||
@param TransferResult Variable to receive transfer result.
|
||||
|
||||
@return EFI_UNSUPPORTED
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2IsochronousTransfer (
|
||||
|
@ -1292,21 +1267,22 @@ Uhci2IsochronousTransfer (
|
|||
/**
|
||||
Submits Async isochronous transfer to a target USB device according to UEFI 2.0 spec.
|
||||
|
||||
This : A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
DeviceAddress : Target device address
|
||||
EndPointAddress : Endpoint number and direction
|
||||
DeviceSpeed : Device speed
|
||||
MaximumPacketLength : Maximum packet size of the target endpoint
|
||||
DataBuffersNumber : Number of data buffers prepared for the transfer.
|
||||
Data : Array of pointers to the buffers of data
|
||||
Translator : A pointr to the transaction translator data.
|
||||
IsochronousCallBack : Function to call when the transfer complete
|
||||
Context : Pass to the call back function as parameter
|
||||
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
|
||||
@param DeviceAddress Target device address.
|
||||
@param EndPointAddress Endpoint number and direction.
|
||||
@param DeviceSpeed Device speed.
|
||||
@param MaximumPacketLength Maximum packet size of the target endpoint.
|
||||
@param DataBuffersNumber Number of data buffers prepared for the transfer.
|
||||
@param Data Array of pointers to the buffers of data.
|
||||
@param DataLength On input, size of the data buffer, On output,
|
||||
actually transferred data size.
|
||||
@param Translator A pointr to the transaction translator data.
|
||||
@param IsochronousCallBack Function to call when the transfer complete.
|
||||
@param Context Pass to the call back function as parameter.
|
||||
|
||||
@return EFI_UNSUPPORTED
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Uhci2AsyncIsochronousTransfer (
|
||||
|
@ -1326,29 +1302,22 @@ Uhci2AsyncIsochronousTransfer (
|
|||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Entry point for EFI drivers.
|
||||
|
||||
@param ImageHandle EFI_HANDLE.
|
||||
@param SystemTable EFI_SYSTEM_TABLE.
|
||||
|
||||
@retval EFI_SUCCESS Driver is successfully loaded.
|
||||
@return Others Failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UhciDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Entry point for EFI drivers.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - EFI_HANDLE
|
||||
SystemTable - EFI_SYSTEM_TABLE
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS : Driver is successfully loaded
|
||||
Others : Failed
|
||||
|
||||
--*/
|
||||
{
|
||||
return EfiLibInstallDriverBindingComponentName2 (
|
||||
ImageHandle,
|
||||
|
@ -1366,11 +1335,11 @@ UhciDriverEntryPoint (
|
|||
ControllerHandle that has UsbHcProtocol installed will be supported.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Controller Handle of device to test
|
||||
@param RemainingDevicePath Not used
|
||||
@param Controller Handle of device to test.
|
||||
@param RemainingDevicePath Not used.
|
||||
|
||||
@return EFI_SUCCESS : This driver supports this device.
|
||||
@return EFI_UNSUPPORTED : This driver does not support this device.
|
||||
@return EFI_SUCCESS This driver supports this device.
|
||||
@return EFI_UNSUPPORTED This driver does not support this device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -1440,14 +1409,14 @@ ON_EXIT:
|
|||
|
||||
|
||||
/**
|
||||
Allocate and initialize the empty UHCI device
|
||||
Allocate and initialize the empty UHCI device.
|
||||
|
||||
@param PciIo The PCIIO to use
|
||||
@param PciIo The PCIIO to use.
|
||||
@param OriginalPciAttributes The original PCI attributes.
|
||||
|
||||
@return Allocated UHCI device
|
||||
@return Allocated UHCI device. If err, return NULL.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
USB_HC_DEV *
|
||||
UhciAllocateDev (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
|
@ -1517,14 +1486,13 @@ ON_ERROR:
|
|||
|
||||
|
||||
/**
|
||||
Free the UHCI device and release its associated resources
|
||||
Free the UHCI device and release its associated resources.
|
||||
|
||||
@param Uhc The UHCI device to release
|
||||
@param Uhc The UHCI device to release.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciFreeDev (
|
||||
IN USB_HC_DEV *Uhc
|
||||
|
@ -1538,7 +1506,7 @@ UhciFreeDev (
|
|||
UsbHcFreeMemPool (Uhc->MemPool);
|
||||
}
|
||||
|
||||
if (Uhc->CtrlNameTable) {
|
||||
if (Uhc->CtrlNameTable != NULL) {
|
||||
FreeUnicodeStringTable (Uhc->CtrlNameTable);
|
||||
}
|
||||
|
||||
|
@ -1547,15 +1515,14 @@ UhciFreeDev (
|
|||
|
||||
|
||||
/**
|
||||
Uninstall all Uhci Interface
|
||||
Uninstall all Uhci Interface.
|
||||
|
||||
@param Controller Controller handle
|
||||
@param Controller Controller handle.
|
||||
@param This Protocol instance pointer.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciCleanDevUp (
|
||||
IN EFI_HANDLE Controller,
|
||||
|
@ -1594,17 +1561,16 @@ UhciCleanDevUp (
|
|||
|
||||
|
||||
/**
|
||||
Starting the Usb UHCI Driver
|
||||
Starting the Usb UHCI Driver.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Controller Handle of device to test
|
||||
@param RemainingDevicePath Not used
|
||||
@param Controller Handle of device to test.
|
||||
@param RemainingDevicePath Not used.
|
||||
|
||||
@retval EFI_SUCCESS This driver supports this device.
|
||||
@retval EFI_UNSUPPORTED This driver does not support this device.
|
||||
@retval EFI_DEVICE_ERROR This driver cannot be started due to device Error
|
||||
EFI_OUT_OF_RESOURCES- Failed due to resource
|
||||
shortage
|
||||
@retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
|
||||
EFI_OUT_OF_RESOURCES- Failed due to resource shortage.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -1784,8 +1750,8 @@ CLOSE_PCIIO:
|
|||
created by this driver.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Controller Handle of device to stop driver on
|
||||
@param NumberOfChildren Number of Children in the ChildHandleBuffer
|
||||
@param Controller Handle of device to stop driver on.
|
||||
@param NumberOfChildren Number of Children in the ChildHandleBuffer.
|
||||
@param ChildHandleBuffer List of handles for the children we need to stop.
|
||||
|
||||
@return EFI_SUCCESS
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The definition for UHCI driver model and HC protocol routines.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,21 +11,10 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
Uhci.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The definition for UHCI driver model and HC protocol routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _UHCI_H
|
||||
#define _UHCI_H
|
||||
#ifndef _EFI_UHCI_H_
|
||||
#define _EFI_UHCI_H_
|
||||
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
@ -51,7 +42,7 @@ typedef struct _USB_HC_DEV USB_HC_DEV;
|
|||
#include "UhciSched.h"
|
||||
#include "UhciDebug.h"
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
UHC_1_MICROSECOND = 1,
|
||||
UHC_1_MILLISECOND = 1000 * UHC_1_MICROSECOND,
|
||||
UHC_1_SECOND = 1000 * UHC_1_MILLISECOND,
|
||||
|
@ -80,16 +71,17 @@ enum {
|
|||
// and the unit of Async is 100us.
|
||||
//
|
||||
UHC_SYNC_POLL_INTERVAL = 50 * UHC_1_MICROSECOND,
|
||||
UHC_ASYNC_POLL_INTERVAL = 50 * 10000UL,
|
||||
UHC_ASYNC_POLL_INTERVAL = 50 * 10000UL
|
||||
}UHC_TIMEOUT_EXPERIENCE_VALUE;
|
||||
|
||||
//
|
||||
// UHC raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
// to protect shared data structures.
|
||||
//
|
||||
UHCI_TPL = TPL_NOTIFY,
|
||||
|
||||
USB_HC_DEV_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')
|
||||
};
|
||||
//
|
||||
// UHC raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
// to protect shared data structures.
|
||||
//
|
||||
#define UHCI_TPL TPL_NOTIFY
|
||||
|
||||
#define USB_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
This file provides the information dump support for Uhci when in debug mode.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciDebug.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file provides the information dump support for Uhci when in debug mode.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
@ -27,11 +18,11 @@ Revision History
|
|||
|
||||
|
||||
/**
|
||||
Dump the content of QH structure
|
||||
Dump the content of QH structure.
|
||||
|
||||
@param QhSw Pointer to software QH structure
|
||||
@param QhSw Pointer to software QH structure.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -51,10 +42,10 @@ UhciDumpQh (
|
|||
/**
|
||||
Dump the content of TD structure.
|
||||
|
||||
@param TdSw Pointer to software TD structure
|
||||
@param IsCur Whether dump the whole list, or only dump the current TD
|
||||
@param TdSw Pointer to software TD structure.
|
||||
@param IsCur Whether dump the whole list, or only dump the current TD.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
This file contains the definination for host controller debug support routines
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciDebug.h
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains the definination for host controller debug support routines
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_UHCI_DEBUG_H_
|
||||
|
@ -27,11 +18,11 @@ Revision History
|
|||
|
||||
|
||||
/**
|
||||
Dump the content of QH structure
|
||||
Dump the content of QH structure.
|
||||
|
||||
@param QhSw Pointer to software QH structure
|
||||
@param QhSw Pointer to software QH structure.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -44,9 +35,9 @@ UhciDumpQh (
|
|||
/**
|
||||
Dump the content of TD structure.
|
||||
|
||||
@param TdSw Pointer to software TD structure
|
||||
@param TdSw Pointer to software TD structure.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The UHCI register operation routines.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,32 +11,21 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciQueue.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The UHCI register operation routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
||||
|
||||
/**
|
||||
Map address of request structure buffer
|
||||
Map address of request structure buffer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Request The user request buffer
|
||||
@param MappedAddr Mapped address of request
|
||||
@param Map Identificaion of this mapping to return
|
||||
@param Uhc The UHCI device.
|
||||
@param Request The user request buffer.
|
||||
@param MappedAddr Mapped address of request.
|
||||
@param Map Identificaion of this mapping to return.
|
||||
|
||||
@return EFI_SUCCESS : Success
|
||||
@return EFI_DEVICE_ERROR : Fail to map the user request
|
||||
@return EFI_SUCCESS Success.
|
||||
@return EFI_DEVICE_ERROR Fail to map the user request.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -68,18 +59,18 @@ UhciMapUserRequest (
|
|||
|
||||
|
||||
/**
|
||||
Map address of user data buffer
|
||||
Map address of user data buffer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Direction direction of the data transfer
|
||||
@param Data The user data buffer
|
||||
@param Len Length of the user data
|
||||
@param PktId Packet identificaion
|
||||
@param MappedAddr mapped address to return
|
||||
@param Map identificaion of this mapping to return
|
||||
@param Uhc The UHCI device.
|
||||
@param Direction Direction of the data transfer.
|
||||
@param Data The user data buffer.
|
||||
@param Len Length of the user data.
|
||||
@param PktId Packet identificaion.
|
||||
@param MappedAddr Mapped address to return.
|
||||
@param Map Identificaion of this mapping to return.
|
||||
|
||||
@return EFI_SUCCESS : Success
|
||||
@return EFI_DEVICE_ERROR : Fail to map the user data
|
||||
@return EFI_SUCCESS Success.
|
||||
@return EFI_DEVICE_ERROR Fail to map the user data.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -159,14 +150,13 @@ EXIT:
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Link the TD To QH
|
||||
Link the TD To QH.
|
||||
|
||||
@param Qh The queue head for the TD to link to
|
||||
@param Td The TD to link
|
||||
@param Qh The queue head for the TD to link to.
|
||||
@param Td The TD to link.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -183,12 +173,12 @@ UhciLinkTdToQh (
|
|||
|
||||
|
||||
/**
|
||||
Unlink TD from the QH
|
||||
Unlink TD from the QH.
|
||||
|
||||
@param Qh The queue head to unlink from
|
||||
@param Td The TD to unlink
|
||||
@param Qh The queue head to unlink from.
|
||||
@param Td The TD to unlink.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -205,15 +195,14 @@ UhciUnlinkTdFromQh (
|
|||
|
||||
|
||||
/**
|
||||
Append a new TD To the previous TD
|
||||
Append a new TD To the previous TD.
|
||||
|
||||
@param PrevTd Previous UHCI_TD_SW to be linked to
|
||||
@param ThisTd TD to link
|
||||
@param PrevTd Previous UHCI_TD_SW to be linked to.
|
||||
@param ThisTd TD to link.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciAppendTd (
|
||||
IN UHCI_TD_SW *PrevTd,
|
||||
|
@ -228,12 +217,12 @@ UhciAppendTd (
|
|||
|
||||
|
||||
/**
|
||||
Delete a list of TDs
|
||||
Delete a list of TDs.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param FirstTd TD link list head
|
||||
@param Uhc The UHCI device.
|
||||
@param FirstTd TD link list head.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -256,12 +245,12 @@ UhciDestoryTds (
|
|||
|
||||
|
||||
/**
|
||||
Create an initialize a new queue head
|
||||
Create an initialize a new queue head.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Interval The polling interval for the queue
|
||||
@param Uhc The UHCI device.
|
||||
@param Interval The polling interval for the queue.
|
||||
|
||||
@return The newly created queue header
|
||||
@return The newly created queue header.
|
||||
|
||||
**/
|
||||
UHCI_QH_SW *
|
||||
|
@ -289,14 +278,13 @@ UhciCreateQh (
|
|||
|
||||
|
||||
/**
|
||||
Create and intialize a TD
|
||||
Create and intialize a TD.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return The newly allocated and initialized TD
|
||||
@return The newly allocated and initialized TD.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UHCI_TD_SW *
|
||||
UhciCreateTd (
|
||||
IN USB_HC_DEV *Uhc
|
||||
|
@ -319,17 +307,16 @@ UhciCreateTd (
|
|||
|
||||
|
||||
/**
|
||||
Create and initialize a TD for Setup Stage of a control transfer
|
||||
Create and initialize a TD for Setup Stage of a control transfer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DevAddr Device address
|
||||
@param Request Device request
|
||||
@param IsLow Full speed or low speed
|
||||
@param Uhc The UHCI device.
|
||||
@param DevAddr Device address.
|
||||
@param Request Device request.
|
||||
@param IsLow Full speed or low speed.
|
||||
|
||||
@return The created setup Td Pointer
|
||||
@return The created setup Td Pointer.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UHCI_TD_SW *
|
||||
UhciCreateSetupTd (
|
||||
IN USB_HC_DEV *Uhc,
|
||||
|
@ -368,21 +355,20 @@ UhciCreateSetupTd (
|
|||
|
||||
|
||||
/**
|
||||
Create a TD for data
|
||||
Create a TD for data.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DevAddr Device address
|
||||
@param Endpoint Endpoint number
|
||||
@param DataPtr Data buffer
|
||||
@param Len Data length
|
||||
@param PktId Packet ID
|
||||
@param Toggle Data toggle value
|
||||
@param IsLow Full speed or low speed
|
||||
@param Uhc The UHCI device.
|
||||
@param DevAddr Device address.
|
||||
@param Endpoint Endpoint number.
|
||||
@param DataPtr Data buffer.
|
||||
@param Len Data length.
|
||||
@param PktId Packet ID.
|
||||
@param Toggle Data toggle value.
|
||||
@param IsLow Full speed or low speed.
|
||||
|
||||
@return Data Td pointer if success, otherwise NUL
|
||||
@return Data Td pointer if success, otherwise NULL.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UHCI_TD_SW *
|
||||
UhciCreateDataTd (
|
||||
IN USB_HC_DEV *Uhc,
|
||||
|
@ -430,17 +416,16 @@ UhciCreateDataTd (
|
|||
|
||||
|
||||
/**
|
||||
Create TD for the Status Stage of control transfer
|
||||
Create TD for the Status Stage of control transfer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DevAddr Device address
|
||||
@param PktId Packet ID
|
||||
@param IsLow Full speed or low speed
|
||||
@param Uhc The UHCI device.
|
||||
@param DevAddr Device address.
|
||||
@param PktId Packet ID.
|
||||
@param IsLow Full speed or low speed.
|
||||
|
||||
@return Status Td Pointer
|
||||
@return Status Td Pointer.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UHCI_TD_SW *
|
||||
UhciCreateStatusTd (
|
||||
IN USB_HC_DEV *Uhc,
|
||||
|
@ -479,18 +464,18 @@ UhciCreateStatusTd (
|
|||
|
||||
|
||||
/**
|
||||
Create Tds list for Control Transfer
|
||||
Create Tds list for Control Transfer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DeviceAddr The device address
|
||||
@param DataPktId Packet Identification of Data Tds
|
||||
@param Request A pointer to request structure buffer to transfer
|
||||
@param Data A pointer to user data buffer to transfer
|
||||
@param DataLen Length of user data to transfer
|
||||
@param MaxPacket Maximum packet size for control transfer
|
||||
@param IsLow Full speed or low speed
|
||||
@param Uhc The UHCI device.
|
||||
@param DeviceAddr The device address.
|
||||
@param DataPktId Packet Identification of Data Tds.
|
||||
@param Request A pointer to request structure buffer to transfer.
|
||||
@param Data A pointer to user data buffer to transfer.
|
||||
@param DataLen Length of user data to transfer.
|
||||
@param MaxPacket Maximum packet size for control transfer.
|
||||
@param IsLow Full speed or low speed.
|
||||
|
||||
@return The Td list head for the control transfer
|
||||
@return The Td list head for the control transfer.
|
||||
|
||||
**/
|
||||
UHCI_TD_SW *
|
||||
|
@ -610,19 +595,19 @@ FREE_TD:
|
|||
|
||||
|
||||
/**
|
||||
Create Tds list for Bulk/Interrupt Transfer
|
||||
Create Tds list for Bulk/Interrupt Transfer.
|
||||
|
||||
@param Uhc USB_HC_DEV
|
||||
@param DevAddr Address of Device
|
||||
@param EndPoint Endpoint Number
|
||||
@param PktId Packet Identification of Data Tds
|
||||
@param Data A pointer to user data buffer to transfer
|
||||
@param DataLen Length of user data to transfer
|
||||
@param DataToggle Data Toggle Pointer
|
||||
@param MaxPacket Maximum packet size for Bulk/Interrupt transfer
|
||||
@param IsLow Is Low Speed Device
|
||||
@param Uhc USB_HC_DEV.
|
||||
@param DevAddr Address of Device.
|
||||
@param EndPoint Endpoint Number.
|
||||
@param PktId Packet Identification of Data Tds.
|
||||
@param Data A pointer to user data buffer to transfer.
|
||||
@param DataLen Length of user data to transfer.
|
||||
@param DataToggle Data Toggle Pointer.
|
||||
@param MaxPacket Maximum packet size for Bulk/Interrupt transfer.
|
||||
@param IsLow Is Low Speed Device.
|
||||
|
||||
@return The Tds list head for the bulk transfer
|
||||
@return The Tds list head for the bulk transfer.
|
||||
|
||||
**/
|
||||
UHCI_TD_SW *
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The definition for UHCI register operation routines.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciQueue.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The definition for UHCI register operation routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_UHCI_QUEUE_H_
|
||||
|
@ -104,12 +95,12 @@ struct _UHCI_TD_SW {
|
|||
|
||||
|
||||
/**
|
||||
Link the TD To QH
|
||||
Link the TD To QH.
|
||||
|
||||
@param Qh The queue head for the TD to link to
|
||||
@param Td The TD to link
|
||||
@param Qh The queue head for the TD to link to.
|
||||
@param Td The TD to link.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -121,12 +112,12 @@ UhciLinkTdToQh (
|
|||
|
||||
|
||||
/**
|
||||
Unlink TD from the QH
|
||||
Unlink TD from the QH.
|
||||
|
||||
@param Qh The queue head to unlink from
|
||||
@param Td The TD to unlink
|
||||
@param Qh The queue head to unlink from.
|
||||
@param Td The TD to unlink.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -138,15 +129,15 @@ UhciUnlinkTdFromQh (
|
|||
|
||||
|
||||
/**
|
||||
Map address of request structure buffer
|
||||
Map address of request structure buffer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Request The user request buffer
|
||||
@param MappedAddr Mapped address of request
|
||||
@param Map Identificaion of this mapping to return
|
||||
@param Uhc The UHCI device.
|
||||
@param Request The user request buffer.
|
||||
@param MappedAddr Mapped address of request.
|
||||
@param Map Identificaion of this mapping to return.
|
||||
|
||||
@return EFI_SUCCESS : Success
|
||||
@return EFI_DEVICE_ERROR : Fail to map the user request
|
||||
@return EFI_SUCCESS Success.
|
||||
@return EFI_DEVICE_ERROR Fail to map the user request.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -160,18 +151,18 @@ UhciMapUserRequest (
|
|||
|
||||
|
||||
/**
|
||||
Map address of user data buffer
|
||||
Map address of user data buffer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Direction direction of the data transfer
|
||||
@param Data The user data buffer
|
||||
@param Len Length of the user data
|
||||
@param PktId Packet identificaion
|
||||
@param MappedAddr mapped address to return
|
||||
@param Map identificaion of this mapping to return
|
||||
@param Uhc The UHCI device.
|
||||
@param Direction Direction of the data transfer.
|
||||
@param Data The user data buffer.
|
||||
@param Len Length of the user data.
|
||||
@param PktId Packet identificaion.
|
||||
@param MappedAddr Mapped address to return.
|
||||
@param Map Identificaion of this mapping to return.
|
||||
|
||||
@return EFI_SUCCESS : Success
|
||||
@return EFI_DEVICE_ERROR : Fail to map the user data
|
||||
@return EFI_SUCCESS Success.
|
||||
@return EFI_DEVICE_ERROR Fail to map the user data.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -188,12 +179,12 @@ UhciMapUserData (
|
|||
|
||||
|
||||
/**
|
||||
Delete a list of TDs
|
||||
Delete a list of TDs.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param FirstTd TD link list head
|
||||
@param Uhc The UHCI device.
|
||||
@param FirstTd TD link list head.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -205,12 +196,12 @@ UhciDestoryTds (
|
|||
|
||||
|
||||
/**
|
||||
Create an initialize a new queue head
|
||||
Create an initialize a new queue head.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Interval The polling interval for the queue
|
||||
@param Uhc The UHCI device.
|
||||
@param Interval The polling interval for the queue.
|
||||
|
||||
@return The newly created queue header
|
||||
@return The newly created queue header.
|
||||
|
||||
**/
|
||||
UHCI_QH_SW *
|
||||
|
@ -222,18 +213,18 @@ UhciCreateQh (
|
|||
|
||||
|
||||
/**
|
||||
Create Tds list for Control Transfer
|
||||
Create Tds list for Control Transfer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DeviceAddr The device address
|
||||
@param DataPktId Packet Identification of Data Tds
|
||||
@param Request A pointer to request structure buffer to transfer
|
||||
@param Data A pointer to user data buffer to transfer
|
||||
@param DataLen Length of user data to transfer
|
||||
@param MaxPacket Maximum packet size for control transfer
|
||||
@param IsLow Full speed or low speed
|
||||
@param Uhc The UHCI device.
|
||||
@param DeviceAddr The device address.
|
||||
@param DataPktId Packet Identification of Data Tds.
|
||||
@param Request A pointer to request structure buffer to transfer.
|
||||
@param Data A pointer to user data buffer to transfer.
|
||||
@param DataLen Length of user data to transfer.
|
||||
@param MaxPacket Maximum packet size for control transfer.
|
||||
@param IsLow Full speed or low speed.
|
||||
|
||||
@return The Td list head for the control transfer
|
||||
@return The Td list head for the control transfer.
|
||||
|
||||
**/
|
||||
UHCI_TD_SW *
|
||||
|
@ -251,19 +242,19 @@ UhciCreateCtrlTds (
|
|||
|
||||
|
||||
/**
|
||||
Create Tds list for Bulk/Interrupt Transfer
|
||||
Create Tds list for Bulk/Interrupt Transfer.
|
||||
|
||||
@param Uhc USB_HC_DEV
|
||||
@param DevAddr Address of Device
|
||||
@param EndPoint Endpoint Number
|
||||
@param PktId Packet Identification of Data Tds
|
||||
@param Data A pointer to user data buffer to transfer
|
||||
@param DataLen Length of user data to transfer
|
||||
@param DataToggle Data Toggle Pointer
|
||||
@param MaxPacket Maximum packet size for Bulk/Interrupt transfer
|
||||
@param IsLow Is Low Speed Device
|
||||
@param Uhc USB_HC_DEV.
|
||||
@param DevAddr Address of Device.
|
||||
@param EndPoint Endpoint Number.
|
||||
@param PktId Packet Identification of Data Tds.
|
||||
@param Data A pointer to user data buffer to transfer.
|
||||
@param DataLen Length of user data to transfer.
|
||||
@param DataToggle Data Toggle Pointer.
|
||||
@param MaxPacket Maximum packet size for Bulk/Interrupt transfer.
|
||||
@param IsLow Is Low Speed Device.
|
||||
|
||||
@return The Tds list head for the bulk transfer
|
||||
@return The Tds list head for the bulk transfer.
|
||||
|
||||
**/
|
||||
UHCI_TD_SW *
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The UHCI register operation routines.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,29 +11,18 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciReg.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The UHCI register operation routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
||||
|
||||
/**
|
||||
Read a UHCI register
|
||||
Read a UHCI register.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
|
||||
@return Content of register
|
||||
@return Content of register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
|
@ -63,13 +54,13 @@ UhciReadReg (
|
|||
|
||||
|
||||
/**
|
||||
Write data to UHCI register
|
||||
Write data to UHCI register.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param Data Data to write
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
@param Data Data to write.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -97,13 +88,13 @@ UhciWriteReg (
|
|||
|
||||
|
||||
/**
|
||||
Set a bit of the UHCI Register
|
||||
Set a bit of the UHCI Register.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param Bit The bit to set
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
@param Bit The bit to set.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -122,13 +113,13 @@ UhciSetRegBit (
|
|||
|
||||
|
||||
/**
|
||||
Clear a bit of the UHCI Register
|
||||
Clear a bit of the UHCI Register.
|
||||
|
||||
@param PciIo The PCI_IO protocol to access the PCI
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param Bit The bit to clear
|
||||
@param PciIo The PCI_IO protocol to access the PCI.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
@param Bit The bit to clear.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -148,11 +139,11 @@ UhciClearRegBit (
|
|||
|
||||
/**
|
||||
Clear all the interrutp status bits, these bits
|
||||
are Write-Clean
|
||||
are Write-Clean.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -173,15 +164,14 @@ UhciAckAllInterrupt (
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stop the host controller
|
||||
Stop the host controller.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Timeout Max time allowed
|
||||
@param Uhc The UHCI device.
|
||||
@param Timeout Max time allowed.
|
||||
|
||||
@retval EFI_SUCCESS The host controller is stopped
|
||||
@retval EFI_TIMEOUT Failed to stop the host controller
|
||||
@retval EFI_SUCCESS The host controller is stopped.
|
||||
@retval EFI_TIMEOUT Failed to stop the host controller.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -214,12 +204,12 @@ UhciStopHc (
|
|||
|
||||
|
||||
/**
|
||||
Check whether the host controller operates well
|
||||
Check whether the host controller operates well.
|
||||
|
||||
@param PciIo The PCI_IO protocol to use
|
||||
@param PciIo The PCI_IO protocol to use.
|
||||
|
||||
@retval TRUE Host controller is working
|
||||
@retval FALSE Host controller is halted or system error
|
||||
@retval TRUE Host controller is working.
|
||||
@retval FALSE Host controller is halted or system error.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
|
@ -231,7 +221,7 @@ UhciIsHcWorking (
|
|||
|
||||
UsbSts = UhciReadReg (PciIo, USBSTS_OFFSET);
|
||||
|
||||
if (UsbSts & (USBSTS_HCPE | USBSTS_HSE | USBSTS_HCH)) {
|
||||
if ((UsbSts & (USBSTS_HCPE | USBSTS_HSE | USBSTS_HCH)) != 0) {
|
||||
DEBUG ((EFI_D_ERROR, "UhciIsHcWorking: current USB state is %x\n", UsbSts));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -244,10 +234,10 @@ UhciIsHcWorking (
|
|||
Set the UHCI frame list base address. It can't use
|
||||
UhciWriteReg which access memory in UINT16.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Addr Address to set
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Addr Address to set.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -277,11 +267,11 @@ UhciSetFrameListBaseAddr (
|
|||
|
||||
|
||||
/**
|
||||
Disable USB Emulation
|
||||
Disable USB Emulation.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL protocol to use
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL protocol to use.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The definition for UHCI register operation routines.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciReg.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The definition for UHCI register operation routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_UHCI_REG_H_
|
||||
|
@ -27,7 +18,7 @@ Revision History
|
|||
|
||||
#define BIT(a) (1 << (a))
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
UHCI_FRAME_NUM = 1024,
|
||||
|
||||
//
|
||||
|
@ -104,16 +95,16 @@ enum {
|
|||
USBTD_NAK = BIT(3), // NAK is received
|
||||
USBTD_CRC = BIT(2), // CRC/Time out error
|
||||
USBTD_BITSTUFF = BIT(1) // Bit stuff error
|
||||
};
|
||||
}UHCI_REGISTER_OFFSET;
|
||||
|
||||
|
||||
/**
|
||||
Read a UHCI register
|
||||
Read a UHCI register.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
|
||||
@return Content of register
|
||||
@return Content of register.
|
||||
|
||||
**/
|
||||
UINT16
|
||||
|
@ -126,13 +117,13 @@ UhciReadReg (
|
|||
|
||||
|
||||
/**
|
||||
Write data to UHCI register
|
||||
Write data to UHCI register.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param Data Data to write
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
@param Data Data to write.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -146,13 +137,13 @@ UhciWriteReg (
|
|||
|
||||
|
||||
/**
|
||||
Set a bit of the UHCI Register
|
||||
Set a bit of the UHCI Register.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param Bit The bit to set
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
@param Bit The bit to set.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -166,13 +157,13 @@ UhciSetRegBit (
|
|||
|
||||
|
||||
/**
|
||||
Clear a bit of the UHCI Register
|
||||
Clear a bit of the UHCI Register.
|
||||
|
||||
@param PciIo The PCI_IO protocol to access the PCI
|
||||
@param Offset Register offset to USB_BAR_INDEX
|
||||
@param Bit The bit to clear
|
||||
@param PciIo The PCI_IO protocol to access the PCI.
|
||||
@param Offset Register offset to USB_BAR_INDEX.
|
||||
@param Bit The bit to clear.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -186,11 +177,11 @@ UhciClearRegBit (
|
|||
|
||||
/**
|
||||
Clear all the interrutp status bits, these bits
|
||||
are Write-Clean
|
||||
are Write-Clean.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -201,13 +192,13 @@ UhciAckAllInterrupt (
|
|||
|
||||
|
||||
/**
|
||||
Stop the host controller
|
||||
Stop the host controller.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Timeout Max time allowed
|
||||
@param Uhc The UHCI device.
|
||||
@param Timeout Max time allowed.
|
||||
|
||||
@retval EFI_SUCCESS The host controller is stopped
|
||||
@retval EFI_TIMEOUT Failed to stop the host controller
|
||||
@retval EFI_SUCCESS The host controller is stopped.
|
||||
@retval EFI_TIMEOUT Failed to stop the host controller.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -220,12 +211,12 @@ UhciStopHc (
|
|||
|
||||
|
||||
/**
|
||||
Check whether the host controller operates well
|
||||
Check whether the host controller operates well.
|
||||
|
||||
@param PciIo The PCI_IO protocol to use
|
||||
@param PciIo The PCI_IO protocol to use.
|
||||
|
||||
@retval TRUE Host controller is working
|
||||
@retval FALSE Host controller is halted or system error
|
||||
@retval TRUE Host controller is working.
|
||||
@retval FALSE Host controller is halted or system error.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
|
@ -239,10 +230,10 @@ UhciIsHcWorking (
|
|||
Set the UHCI frame list base address. It can't use
|
||||
UhciWriteReg which access memory in UINT16.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use
|
||||
@param Addr Address to set
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL to use.
|
||||
@param Addr Address to set.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -254,11 +245,11 @@ UhciSetFrameListBaseAddr (
|
|||
|
||||
|
||||
/**
|
||||
Disable USB Emulation
|
||||
Disable USB Emulation.
|
||||
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL protocol to use
|
||||
@param PciIo The EFI_PCI_IO_PROTOCOL protocol to use.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The EHCI register operation routines.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,30 +11,19 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciSched.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The EHCI register operation routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
||||
|
||||
/**
|
||||
Create Frame List Structure
|
||||
Create Frame List Structure.
|
||||
|
||||
@param Uhc UHCI device
|
||||
@param Uhc UHCI device.
|
||||
|
||||
@retval EFI_OUT_OF_RESOURCES Can't allocate memory resources
|
||||
@retval EFI_UNSUPPORTED Map memory fail
|
||||
@retval EFI_SUCCESS Success
|
||||
@retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
|
||||
@retval EFI_UNSUPPORTED Map memory fail.
|
||||
@retval EFI_SUCCESS Success.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -155,11 +146,11 @@ ON_ERROR:
|
|||
|
||||
|
||||
/**
|
||||
Destory FrameList buffer
|
||||
Destory FrameList buffer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -201,11 +192,11 @@ UhciDestoryFrameList (
|
|||
|
||||
/**
|
||||
Convert the poll rate to the maxium 2^n that is smaller
|
||||
than Interval
|
||||
than Interval.
|
||||
|
||||
@param Interval The poll rate to convert
|
||||
@param Interval The poll rate to convert.
|
||||
|
||||
@return The converted poll rate
|
||||
@return The converted poll rate.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
|
@ -235,10 +226,10 @@ UhciConvertPollRate (
|
|||
Link a queue head (for asynchronous interrupt transfer) to
|
||||
the frame list.
|
||||
|
||||
@param FrameBase The base of the frame list
|
||||
@param Qh The queue head to link into
|
||||
@param FrameBase The base of the frame list.
|
||||
@param Qh The queue head to link into.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -340,10 +331,10 @@ UhciLinkQhToFrameList (
|
|||
the precedence node, and pointer there next to QhSw's
|
||||
next.
|
||||
|
||||
@param FrameBase The base address of the frame list
|
||||
@param Qh The queue head to unlink
|
||||
@param FrameBase The base address of the frame list.
|
||||
@param Qh The queue head to unlink.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -398,17 +389,16 @@ UhciUnlinkQhFromFrameList (
|
|||
|
||||
|
||||
/**
|
||||
Check TDs Results
|
||||
Check TDs Results.
|
||||
|
||||
@param Uhc This UHCI device
|
||||
@param Td UHCI_TD_SW to check
|
||||
@param IsLow Is Low Speed Device
|
||||
@param QhResult Return the result of this TD list
|
||||
@param Uhc This UHCI device.
|
||||
@param Td UHCI_TD_SW to check.
|
||||
@param IsLow Is Low Speed Device.
|
||||
@param QhResult Return the result of this TD list.
|
||||
|
||||
@return Whether the TD's result is finialized.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
UhciCheckTdStatus (
|
||||
IN USB_HC_DEV *Uhc,
|
||||
|
@ -452,23 +442,23 @@ UhciCheckTdStatus (
|
|||
// upper layer won't distinguish these condtions. So, only
|
||||
// set these bits when TD is actually halted.
|
||||
//
|
||||
if (State & USBTD_STALLED) {
|
||||
if (State & USBTD_BABBLE) {
|
||||
if ((State & USBTD_STALLED) != 0) {
|
||||
if ((State & USBTD_BABBLE) != 0) {
|
||||
QhResult->Result |= EFI_USB_ERR_BABBLE;
|
||||
|
||||
} else if (TdHw->ErrorCount != 0) {
|
||||
QhResult->Result |= EFI_USB_ERR_STALL;
|
||||
}
|
||||
|
||||
if (State & USBTD_CRC) {
|
||||
if ((State & USBTD_CRC) != 0) {
|
||||
QhResult->Result |= EFI_USB_ERR_CRC;
|
||||
}
|
||||
|
||||
if (State & USBTD_BUFFERR) {
|
||||
if ((State & USBTD_BUFFERR) != 0) {
|
||||
QhResult->Result |= EFI_USB_ERR_BUFFER;
|
||||
}
|
||||
|
||||
if (Td->TdHw.Status & USBTD_BITSTUFF) {
|
||||
if ((Td->TdHw.Status & USBTD_BITSTUFF) != 0) {
|
||||
QhResult->Result |= EFI_USB_ERR_BITSTUFF;
|
||||
}
|
||||
|
||||
|
@ -479,7 +469,7 @@ UhciCheckTdStatus (
|
|||
Finished = TRUE;
|
||||
goto ON_EXIT;
|
||||
|
||||
} else if (State & USBTD_ACTIVE) {
|
||||
} else if ((State & USBTD_ACTIVE) != 0) {
|
||||
//
|
||||
// The TD is still active, no need to check further.
|
||||
//
|
||||
|
@ -540,18 +530,18 @@ ON_EXIT:
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Check the result of the transfer
|
||||
Check the result of the transfer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Td The first TDs of the transfer
|
||||
@param TimeOut TimeOut value in milliseconds
|
||||
@param IsLow Is Low Speed Device
|
||||
@param QhResult The variable to return result
|
||||
@param Uhc The UHCI device.
|
||||
@param Qh The queue head of the transfer.
|
||||
@param Td The first TDs of the transfer.
|
||||
@param TimeOut TimeOut value in milliseconds.
|
||||
@param IsLow Is Low Speed Device.
|
||||
@param QhResult The variable to return result.
|
||||
|
||||
@retval EFI_SUCCESS The transfer finished with success
|
||||
@retval EFI_DEVICE_ERROR Transfer failed
|
||||
@retval EFI_SUCCESS The transfer finished with success.
|
||||
@retval EFI_DEVICE_ERROR Transfer failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -606,16 +596,15 @@ UhciExecuteTransfer (
|
|||
|
||||
|
||||
/**
|
||||
Update Async Request, QH and TDs
|
||||
Update Async Request, QH and TDs.
|
||||
|
||||
@param AsyncReq The UHCI asynchronous transfer to update
|
||||
@param Result Transfer reslut
|
||||
@param ErrTdPos Error TD Position
|
||||
@param AsyncReq The UHCI asynchronous transfer to update.
|
||||
@param Result Transfer reslut.
|
||||
@param NextToggle The toggle of next data.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciUpdateAsyncReq (
|
||||
IN UHCI_ASYNC_REQUEST *AsyncReq,
|
||||
|
@ -653,23 +642,23 @@ UhciUpdateAsyncReq (
|
|||
|
||||
|
||||
/**
|
||||
Create Async Request node, and Link to List
|
||||
Create Async Request node, and Link to List.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Qh The queue head of the transfer
|
||||
@param FirstTd First TD of the transfer
|
||||
@param DevAddr Device Address
|
||||
@param EndPoint EndPoint Address
|
||||
@param DataLen Data length
|
||||
@param Interval Polling Interval when inserted to frame list
|
||||
@param Mapping Mapping value
|
||||
@param Data Data buffer, unmapped
|
||||
@param Callback Callback after interrupt transfeer
|
||||
@param Context Callback Context passed as function parameter
|
||||
@param IsLow Is Low Speed
|
||||
@param Uhc The UHCI device.
|
||||
@param Qh The queue head of the transfer.
|
||||
@param FirstTd First TD of the transfer.
|
||||
@param DevAddr Device Address.
|
||||
@param EndPoint EndPoint Address.
|
||||
@param DataLen Data length.
|
||||
@param Interval Polling Interval when inserted to frame list.
|
||||
@param Mapping Mapping value.
|
||||
@param Data Data buffer, unmapped.
|
||||
@param Callback Callback after interrupt transfeer.
|
||||
@param Context Callback Context passed as function parameter.
|
||||
@param IsLow Is Low Speed.
|
||||
|
||||
@retval EFI_SUCCESS An asynchronous transfer is created
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error
|
||||
@retval EFI_SUCCESS An asynchronous transfer is created.
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
|
||||
|
||||
**/
|
||||
|
@ -725,17 +714,15 @@ UhciCreateAsyncReq (
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Free an asynchronous request's resource such as memory
|
||||
Free an asynchronous request's resource such as memory.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param AsyncReq The asynchronous request to free
|
||||
@param Uhc The UHCI device.
|
||||
@param AsyncReq The asynchronous request to free.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciFreeAsyncReq (
|
||||
IN USB_HC_DEV *Uhc,
|
||||
|
@ -766,15 +753,14 @@ UhciFreeAsyncReq (
|
|||
UHC's recycle list to wait for a while before release the memory.
|
||||
Until then, hardware won't hold point to the request.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param AsyncReq The asynchronous request to free
|
||||
@param Uhc The UHCI device.
|
||||
@param AsyncReq The asynchronous request to free.
|
||||
@param FreeNow If TRUE, free the resource immediately, otherwise
|
||||
add the request to recycle wait list.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciUnlinkAsyncReq (
|
||||
IN USB_HC_DEV *Uhc,
|
||||
|
@ -802,16 +788,16 @@ UhciUnlinkAsyncReq (
|
|||
|
||||
|
||||
/**
|
||||
Delete Async Interrupt QH and TDs
|
||||
Delete Async Interrupt QH and TDs.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DevAddr Device Address
|
||||
@param EndPoint EndPoint Address
|
||||
@param Toggle The next data toggle to use
|
||||
@param Uhc The UHCI device.
|
||||
@param DevAddr Device Address.
|
||||
@param EndPoint EndPoint Address.
|
||||
@param Toggle The next data toggle to use.
|
||||
|
||||
@retval EFI_SUCCESS The request is deleted
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error
|
||||
@retval EFI_NOT_FOUND The asynchronous isn't found
|
||||
@retval EFI_SUCCESS The request is deleted.
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error.
|
||||
@retval EFI_NOT_FOUND The asynchronous isn't found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -886,12 +872,11 @@ UhciRemoveAsyncReq (
|
|||
existing for at least 50ms, far enough for the hardware
|
||||
to clear its cache.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UhciRecycleAsyncReq (
|
||||
IN USB_HC_DEV *Uhc
|
||||
|
@ -917,9 +902,9 @@ UhciRecycleAsyncReq (
|
|||
/**
|
||||
Release all the asynchronous transfers on the lsit.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -952,12 +937,12 @@ UhciFreeAllAsyncReq (
|
|||
|
||||
|
||||
/**
|
||||
Interrupt transfer periodic check handler
|
||||
Interrupt transfer periodic check handler.
|
||||
|
||||
@param Event The event of the time
|
||||
@param Context Context of the event, pointer to USB_HC_DEV
|
||||
@param Event The event of the time.
|
||||
@param Context Context of the event, pointer to USB_HC_DEV.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The definition for EHCI register operation routines.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,24 +11,13 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
UhciSched.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The definition for EHCI register operation routines.
|
||||
|
||||
Revision History
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_UHCI_SCHED_H_
|
||||
#define _EFI_UHCI_SCHED_H_
|
||||
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
UHCI_ASYNC_INT_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'a'),
|
||||
|
||||
//
|
||||
|
@ -40,7 +31,7 @@ enum {
|
|||
EFI_USB_ERR_TIMEOUT | EFI_USB_ERR_BITSTUFF |
|
||||
EFI_USB_ERR_SYSTEM
|
||||
|
||||
};
|
||||
}UHCI_ERR_FAIL_MASK;
|
||||
|
||||
//
|
||||
// Structure to return the result of UHCI QH execution.
|
||||
|
@ -91,36 +82,29 @@ struct _UHCI_ASYNC_REQUEST{
|
|||
#define UHCI_ASYNC_INT_FROM_LINK(a) \
|
||||
CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)
|
||||
|
||||
|
||||
/**
|
||||
Create Frame List Structure.
|
||||
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return EFI_OUT_OF_RESOURCES Can't allocate memory resources.
|
||||
@return EFI_UNSUPPORTED Map memory fail.
|
||||
@return EFI_SUCCESS Success.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
UhciInitFrameList (
|
||||
IN USB_HC_DEV *Uhc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Create Frame List Structure
|
||||
|
||||
Arguments:
|
||||
|
||||
Uhc - UHCI device
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_OUT_OF_RESOURCES - Can't allocate memory resources
|
||||
EFI_UNSUPPORTED - Map memory fail
|
||||
EFI_SUCCESS - Success
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
Destory FrameList buffer
|
||||
Destory FrameList buffer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -132,11 +116,11 @@ UhciDestoryFrameList (
|
|||
|
||||
/**
|
||||
Convert the poll rate to the maxium 2^n that is smaller
|
||||
than Interval
|
||||
than Interval.
|
||||
|
||||
@param Interval The poll rate to convert
|
||||
@param Interval The poll rate to convert.
|
||||
|
||||
@return The converted poll rate
|
||||
@return The converted poll rate.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
|
@ -150,10 +134,10 @@ UhciConvertPollRate (
|
|||
Link a queue head (for asynchronous interrupt transfer) to
|
||||
the frame list.
|
||||
|
||||
@param FrameBase The base of the frame list
|
||||
@param Qh The queue head to link into
|
||||
@param FrameBase The base of the frame list.
|
||||
@param Qh The queue head to link into.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -169,10 +153,10 @@ UhciLinkQhToFrameList (
|
|||
the precedence node, and pointer there next to QhSw's
|
||||
next.
|
||||
|
||||
@param FrameBase The base address of the frame list
|
||||
@param Qh The queue head to unlink
|
||||
@param FrameBase The base address of the frame list.
|
||||
@param Qh The queue head to unlink.
|
||||
|
||||
@return None
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -184,16 +168,17 @@ UhciUnlinkQhFromFrameList (
|
|||
|
||||
|
||||
/**
|
||||
Check the result of the transfer
|
||||
Check the result of the transfer.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Td The first TDs of the transfer
|
||||
@param TimeOut TimeOut value in milliseconds
|
||||
@param IsLow Is Low Speed Device
|
||||
@param QhResult The variable to return result
|
||||
@param Uhc The UHCI device.
|
||||
@param Qh The queue head of the transfer.
|
||||
@param Td The first TDs of the transfer.
|
||||
@param TimeOut TimeOut value in milliseconds.
|
||||
@param IsLow Is Low Speed Device.
|
||||
@param QhResult The variable to return result.
|
||||
|
||||
@retval EFI_SUCCESS The transfer finished with success
|
||||
@retval EFI_DEVICE_ERROR Transfer failed
|
||||
@retval EFI_SUCCESS The transfer finished with success.
|
||||
@retval EFI_DEVICE_ERROR Transfer failed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -209,24 +194,23 @@ UhciExecuteTransfer (
|
|||
|
||||
|
||||
/**
|
||||
Create Async Request node, and Link to List
|
||||
Create Async Request node, and Link to List.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Qh The queue head of the transfer
|
||||
@param FirstTd First TD of the transfer
|
||||
@param DevAddr Device Address
|
||||
@param EndPoint EndPoint Address
|
||||
@param Toggle Data Toggle
|
||||
@param DataLen Data length
|
||||
@param Interval Polling Interval when inserted to frame list
|
||||
@param Mapping Mapping value
|
||||
@param Data Data buffer, unmapped
|
||||
@param Callback Callback after interrupt transfeer
|
||||
@param Context Callback Context passed as function parameter
|
||||
@param IsLow Is Low Speed
|
||||
@param Uhc The UHCI device.
|
||||
@param Qh The queue head of the transfer.
|
||||
@param FirstTd First TD of the transfer.
|
||||
@param DevAddr Device Address.
|
||||
@param EndPoint EndPoint Address.
|
||||
@param DataLen Data length.
|
||||
@param Interval Polling Interval when inserted to frame list.
|
||||
@param Mapping Mapping value.
|
||||
@param Data Data buffer, unmapped.
|
||||
@param Callback Callback after interrupt transfeer.
|
||||
@param Context Callback Context passed as function parameter.
|
||||
@param IsLow Is Low Speed.
|
||||
|
||||
@retval EFI_SUCCESS An asynchronous transfer is created
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error
|
||||
@retval EFI_SUCCESS An asynchronous transfer is created.
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error.
|
||||
@retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
|
||||
|
||||
**/
|
||||
|
@ -249,16 +233,16 @@ UhciCreateAsyncReq (
|
|||
|
||||
|
||||
/**
|
||||
Delete Async Interrupt QH and TDs
|
||||
Delete Async Interrupt QH and TDs.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param DevAddr Device Address
|
||||
@param EndPoint EndPoint Address
|
||||
@param Toggle The next data toggle to use
|
||||
@param Uhc The UHCI device.
|
||||
@param DevAddr Device Address.
|
||||
@param EndPoint EndPoint Address.
|
||||
@param Toggle The next data toggle to use.
|
||||
|
||||
@retval EFI_SUCCESS The request is deleted
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error
|
||||
@retval EFI_NOT_FOUND The asynchronous isn't found
|
||||
@retval EFI_SUCCESS The request is deleted.
|
||||
@retval EFI_INVALID_PARAMETER Paremeter is error.
|
||||
@retval EFI_NOT_FOUND The asynchronous isn't found.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -274,9 +258,9 @@ UhciRemoveAsyncReq (
|
|||
/**
|
||||
Release all the asynchronous transfers on the lsit.
|
||||
|
||||
@param Uhc The UHCI device
|
||||
@param Uhc The UHCI device.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
@ -287,12 +271,12 @@ UhciFreeAllAsyncReq (
|
|||
|
||||
|
||||
/**
|
||||
Interrupt transfer periodic check handler
|
||||
Interrupt transfer periodic check handler.
|
||||
|
||||
@param Event The event of the time
|
||||
@param Context Context of the event, pointer to USB_HC_DEV
|
||||
@param Event The event of the time.
|
||||
@param Context Context of the event, pointer to USB_HC_DEV.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
The routine procedure for uhci memory allocate/free.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,30 +11,20 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
EhciMem.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
**/
|
||||
|
||||
#include "Uhci.h"
|
||||
|
||||
|
||||
/**
|
||||
Allocate a block of memory to be used by the buffer pool
|
||||
Allocate a block of memory to be used by the buffer pool.
|
||||
|
||||
@param Pool The buffer pool to allocate memory for
|
||||
@param Pages How many pages to allocate
|
||||
@param Pool The buffer pool to allocate memory for.
|
||||
@param Pages How many pages to allocate.
|
||||
|
||||
@return The allocated memory block or NULL if failed
|
||||
@return The allocated memory block or NULL if failed.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
USBHC_MEM_BLOCK *
|
||||
UsbHcAllocMemBlock (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
|
@ -126,15 +118,14 @@ FREE_BITARRAY:
|
|||
|
||||
|
||||
/**
|
||||
Free the memory block from the memory pool
|
||||
Free the memory block from the memory pool.
|
||||
|
||||
@param Pool The memory pool to free the block from
|
||||
@param Block The memory block to free
|
||||
@param Pool The memory pool to free the block from.
|
||||
@param Block The memory block to free.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UsbHcFreeMemBlock (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
|
@ -159,17 +150,15 @@ UsbHcFreeMemBlock (
|
|||
|
||||
|
||||
/**
|
||||
Alloc some memory from the block
|
||||
Alloc some memory from the block.
|
||||
|
||||
@param Block The memory block to allocate memory from
|
||||
@param Mem The variable to store the memory allocated
|
||||
@param Units Number of memory units to allocate
|
||||
@param Block The memory block to allocate memory from.
|
||||
@param Units Number of memory units to allocate.
|
||||
|
||||
@return EFI_SUCCESS : The needed memory is allocated
|
||||
@return EFI_NOT_FOUND : Can't find the free memory
|
||||
@return EFI_SUCCESS The needed memory is allocated.
|
||||
@return EFI_NOT_FOUND Can't find the free memory.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID *
|
||||
UsbHcAllocMemFromBlock (
|
||||
IN USBHC_MEM_BLOCK *Block,
|
||||
|
@ -235,15 +224,14 @@ UsbHcAllocMemFromBlock (
|
|||
|
||||
|
||||
/**
|
||||
Insert the memory block to the pool's list of the blocks
|
||||
Insert the memory block to the pool's list of the blocks.
|
||||
|
||||
@param Head The head of the memory pool's block list
|
||||
@param Block The memory block to insert
|
||||
@param Head The head of the memory pool's block list.
|
||||
@param Block The memory block to insert.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UsbHcInsertMemBlockToPool (
|
||||
IN USBHC_MEM_BLOCK *Head,
|
||||
|
@ -259,13 +247,12 @@ UsbHcInsertMemBlockToPool (
|
|||
/**
|
||||
Is the memory block empty?
|
||||
|
||||
@param Block The memory block to check
|
||||
@param Block The memory block to check.
|
||||
|
||||
@return TRUE : The memory block is empty
|
||||
@return FALSE : The memory block isn't empty
|
||||
@return TRUE The memory block is empty.
|
||||
@return FALSE The memory block isn't empty.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
BOOLEAN
|
||||
UsbHcIsMemBlockEmpty (
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
|
@ -284,15 +271,14 @@ UsbHcIsMemBlockEmpty (
|
|||
|
||||
|
||||
/**
|
||||
Unlink the memory block from the pool's list
|
||||
Unlink the memory block from the pool's list.
|
||||
|
||||
@param Head The block list head of the memory's pool
|
||||
@param Head The block list head of the memory's pool.
|
||||
@param BlockToUnlink The memory block to unlink.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
UsbHcUnlinkMemBlock (
|
||||
IN USBHC_MEM_BLOCK *Head,
|
||||
|
@ -314,16 +300,15 @@ UsbHcUnlinkMemBlock (
|
|||
|
||||
|
||||
/**
|
||||
Initialize the memory management pool for the host controller
|
||||
Initialize the memory management pool for the host controller.
|
||||
|
||||
@param Pool The USB memory pool to initialize
|
||||
@param PciIo The PciIo that can be used to access the host controller
|
||||
@param Check4G Whether the host controller requires allocated memory
|
||||
from one 4G address space.
|
||||
@param Which4G The 4G memory area each memory allocated should be from
|
||||
@param PciIo The PciIo that can be used to access the host controller.
|
||||
@param Check4G Whether the host controller requires allocated memory
|
||||
from one 4G address space.
|
||||
@param Which4G The 4G memory area each memory allocated should be from.
|
||||
|
||||
@return EFI_SUCCESS : The memory pool is initialized
|
||||
@return EFI_OUT_OF_RESOURCE : Fail to init the memory pool
|
||||
@return EFI_SUCCESS The memory pool is initialized.
|
||||
@return EFI_OUT_OF_RESOURCE Fail to init the memory pool.
|
||||
|
||||
**/
|
||||
USBHC_MEM_POOL *
|
||||
|
@ -356,12 +341,12 @@ UsbHcInitMemPool (
|
|||
|
||||
|
||||
/**
|
||||
Release the memory management pool
|
||||
Release the memory management pool.
|
||||
|
||||
@param Pool The USB memory pool to free
|
||||
@param Pool The USB memory pool to free.
|
||||
|
||||
@return EFI_SUCCESS : The memory pool is freed
|
||||
@return EFI_DEVICE_ERROR : Failed to free the memory pool
|
||||
@return EFI_SUCCESS The memory pool is freed.
|
||||
@return EFI_DEVICE_ERROR Failed to free the memory pool.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -393,10 +378,10 @@ UsbHcFreeMemPool (
|
|||
Allocate some memory from the host controller's memory pool
|
||||
which can be used to communicate with host controller.
|
||||
|
||||
@param Pool The host controller's memory pool
|
||||
@param Size Size of the memory to allocate
|
||||
@param Pool The host controller's memory pool.
|
||||
@param Size Size of the memory to allocate.
|
||||
|
||||
@return The allocated memory or NULL
|
||||
@return The allocated memory or NULL.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
|
@ -467,13 +452,13 @@ UsbHcAllocateMem (
|
|||
|
||||
|
||||
/**
|
||||
Free the allocated memory back to the memory pool
|
||||
Free the allocated memory back to the memory pool.
|
||||
|
||||
@param Pool The memory pool of the host controller
|
||||
@param Mem The memory to free
|
||||
@param Size The size of the memory to free
|
||||
@param Pool The memory pool of the host controller.
|
||||
@param Mem The memory to free.
|
||||
@param Size The size of the memory to free.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/** @file
|
||||
|
||||
This file contains the definination for host controller memory management routines
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -9,16 +11,6 @@ http://opensource.org/licenses/bsd-license.php
|
|||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
EhciMem.h
|
||||
|
||||
Abstract:
|
||||
|
||||
This file contains the definination for host controller memory management routines
|
||||
|
||||
Revision History
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _EFI_EHCI_MEM_H_
|
||||
|
@ -58,12 +50,12 @@ typedef struct _USBHC_MEM_POOL {
|
|||
USBHC_MEM_BLOCK *Head;
|
||||
} USBHC_MEM_POOL;
|
||||
|
||||
enum {
|
||||
typedef enum {
|
||||
USBHC_MEM_UNIT = 64, // Memory allocation unit, must be 2^n, n>4
|
||||
|
||||
USBHC_MEM_UNIT_MASK = USBHC_MEM_UNIT - 1,
|
||||
USBHC_MEM_DEFAULT_PAGES = 16
|
||||
};
|
||||
}UHCI_MEM_UNIT_DATA;
|
||||
|
||||
#define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))
|
||||
|
||||
|
@ -80,44 +72,34 @@ enum {
|
|||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
Initialize the memory management pool for the host controller.
|
||||
|
||||
@param PciIo The PciIo that can be used to access the host controller.
|
||||
@param Check4G Whether the host controller requires allocated memory
|
||||
from one 4G address space.
|
||||
@param Which4G The 4G memory area each memory allocated should be from.
|
||||
|
||||
@retval EFI_SUCCESS The memory pool is initialized.
|
||||
@retval EFI_OUT_OF_RESOURCE Fail to init the memory pool.
|
||||
|
||||
**/
|
||||
USBHC_MEM_POOL *
|
||||
UsbHcInitMemPool (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN BOOLEAN Check4G,
|
||||
IN UINT32 Which4G
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the memory management pool for the host controller
|
||||
|
||||
Arguments:
|
||||
|
||||
Pool - The USB memory pool to initialize
|
||||
PciIo - The PciIo that can be used to access the host controller
|
||||
Check4G - Whether the host controller requires allocated memory
|
||||
from one 4G address space.
|
||||
Which4G - The 4G memory area each memory allocated should be from
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS : The memory pool is initialized
|
||||
EFI_OUT_OF_RESOURCE : Fail to init the memory pool
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Release the memory management pool
|
||||
Release the memory management pool.
|
||||
|
||||
@param Pool The USB memory pool to free
|
||||
@param Pool The USB memory pool to free.
|
||||
|
||||
@return EFI_SUCCESS : The memory pool is freed
|
||||
@return EFI_DEVICE_ERROR : Failed to free the memory pool
|
||||
@return EFI_SUCCESS The memory pool is freed.
|
||||
@return EFI_DEVICE_ERROR Failed to free the memory pool.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
|
@ -132,10 +114,10 @@ UsbHcFreeMemPool (
|
|||
Allocate some memory from the host controller's memory pool
|
||||
which can be used to communicate with host controller.
|
||||
|
||||
@param Pool The host controller's memory pool
|
||||
@param Size Size of the memory to allocate
|
||||
@param Pool The host controller's memory pool.
|
||||
@param Size Size of the memory to allocate.
|
||||
|
||||
@return The allocated memory or NULL
|
||||
@return The allocated memory or NULL.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
|
@ -148,13 +130,13 @@ UsbHcAllocateMem (
|
|||
|
||||
|
||||
/**
|
||||
Free the allocated memory back to the memory pool
|
||||
Free the allocated memory back to the memory pool.
|
||||
|
||||
@param Pool The memory pool of the host controller
|
||||
@param Mem The memory to free
|
||||
@param Size The size of the memory to free
|
||||
@param Pool The memory pool of the host controller.
|
||||
@param Mem The memory to free.
|
||||
@param Size The size of the memory to free.
|
||||
|
||||
@return VOID
|
||||
@return None.
|
||||
|
||||
**/
|
||||
VOID
|
||||
|
|
Loading…
Reference in New Issue