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:
eric_tian 2008-07-09 01:50:16 +00:00
parent 5f597758e2
commit ab6495eacf
13 changed files with 659 additions and 832 deletions

View File

@ -1,4 +1,5 @@
/** @file /** @file
UEFI Component Name(2) protocol implementation for UHCI driver.
Copyright (c) 2004 - 2007, Intel Corporation Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ComponentName.c
Abstract:
**/ **/
#include "Uhci.h" #include "Uhci.h"

View File

@ -1,5 +1,7 @@
/** @file /** @file
The UHCI driver model and HC protocol routines.
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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" #include "Uhci.h"
@ -27,17 +18,16 @@ Revision History
/** /**
Provides software reset for the USB host controller according to UEFI 2.0 spec. 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 This A pointer to the EFI_USB2_HC_PROTOCOL instance.
@param Attributes A bit mask of the reset operation to perform. See @param Attributes A bit mask of the reset operation to perform. See
below for a list of the supported bit mask values. below for a list of the supported bit mask values.
@return EFI_SUCCESS : The reset operation succeeded. @return EFI_SUCCESS The reset operation succeeded.
@return EFI_INVALID_PARAMETER : Attributes is not valid. @return EFI_INVALID_PARAMETER Attributes is not valid.
@return EFI_UNSUPPORTED : This type of reset is not currently supported @return EFI_UNSUPPORTED This type of reset is not currently supported.
@return EFI_DEVICE_ERROR : Other errors @return EFI_DEVICE_ERROR Other errors.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2Reset ( Uhci2Reset (
@ -112,15 +102,14 @@ ON_INVAILD_PARAMETER:
/** /**
Retrieves current state of the USB host controller according to UEFI 2.0 spec. 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 This A pointer to the EFI_USB2_HC_PROTOCOL instance.
@param State Variable to receive current device state @param State Variable to receive current device state.
@return EFI_SUCCESS : The state is returned @return EFI_SUCCESS The state is returned.
@return EFI_INVALID_PARAMETER : State is not valid. @return EFI_INVALID_PARAMETER State is not valid.
@return EFI_DEVICE_ERROR : Other errors2006 @return EFI_DEVICE_ERROR Other errors.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2GetState ( Uhci2GetState (
@ -141,7 +130,7 @@ Uhci2GetState (
UsbCmd = UhciReadReg (Uhc->PciIo, USBCMD_OFFSET); UsbCmd = UhciReadReg (Uhc->PciIo, USBCMD_OFFSET);
UsbSts = UhciReadReg (Uhc->PciIo, USBSTS_OFFSET); UsbSts = UhciReadReg (Uhc->PciIo, USBSTS_OFFSET);
if (UsbCmd & USBCMD_EGSM) { if ((UsbCmd & USBCMD_EGSM) !=0 ) {
*State = EfiUsbHcStateSuspend; *State = EfiUsbHcStateSuspend;
} else if ((UsbSts & USBSTS_HCH) != 0) { } 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. 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 This A pointer to the EFI_USB2_HC_PROTOCOL instance.
@param State Indicates the state of the host controller that will @param State Indicates the state of the host controller that will
be set. be set.
@return EFI_SUCCESS : Host controller was successfully placed in the state @return EFI_SUCCESS Host controller was successfully placed in the state.
@return EFI_INVALID_PARAMETER : State is invalid. @return EFI_INVALID_PARAMETER State is invalid.
@return EFI_DEVICE_ERROR : Failed to set the state @return EFI_DEVICE_ERROR Failed to set the state.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2SetState ( Uhci2SetState (
@ -265,19 +253,18 @@ ON_EXIT:
/** /**
Retrieves capabilities of USB host controller according to UEFI 2.0 spec. Retrieves capabilities of USB host controller according to UEFI 2.0 spec.
@param This A pointer to the EFI_USB2_HC_PROTOCOL instance @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
@param MaxSpeed A pointer to the max speed USB host controller @param MaxSpeed A pointer to the max speed USB host controller
supports. supports.
@param PortNumber A pointer to the number of root hub ports. @param PortNumber A pointer to the number of root hub ports.
@param Is64BitCapable A pointer to an integer to show whether USB host @param Is64BitCapable A pointer to an integer to show whether USB host
controller supports 64-bit memory addressing. controller supports 64-bit memory addressing.
@return EFI_SUCCESS : capabilities were retrieved successfully. @return EFI_SUCCESS capabilities were retrieved successfully.
@return EFI_INVALID_PARAMETER : MaxSpeed or PortNumber or Is64BitCapable is NULL. @return EFI_INVALID_PARAMETER MaxSpeed or PortNumber or Is64BitCapable is NULL.
@return EFI_DEVICE_ERROR : An error was encountered @return EFI_DEVICE_ERROR An error was encountered.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2GetCapability ( Uhci2GetCapability (
@ -329,17 +316,16 @@ Uhci2GetCapability (
/** /**
Retrieves the current status of a USB root hub port according to UEFI 2.0 spec. 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 This A pointer to the EFI_USB2_HC_PROTOCOL.
@param PortNumber The port to get status @param PortNumber The port to get status.
@param PortStatus A pointer to the current port status bits and port @param PortStatus A pointer to the current port status bits and port
status change bits. status change bits.
@return EFI_SUCCESS : status of the USB root hub port was returned in PortStatus. @return EFI_SUCCESS status of the USB root hub port was returned in PortStatus.
@return EFI_INVALID_PARAMETER : PortNumber is invalid. @return EFI_INVALID_PARAMETER PortNumber is invalid.
@return EFI_DEVICE_ERROR : Can't read register @return EFI_DEVICE_ERROR Can't read register.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2GetRootHubPortStatus ( Uhci2GetRootHubPortStatus (
@ -368,24 +354,24 @@ Uhci2GetRootHubPortStatus (
PortSC = UhciReadReg (Uhc->PciIo, Offset); PortSC = UhciReadReg (Uhc->PciIo, Offset);
if (PortSC & USBPORTSC_CCS) { if ((PortSC & USBPORTSC_CCS) != 0) {
PortStatus->PortStatus |= USB_PORT_STAT_CONNECTION; PortStatus->PortStatus |= USB_PORT_STAT_CONNECTION;
} }
if (PortSC & USBPORTSC_PED) { if ((PortSC & USBPORTSC_PED) != 0) {
PortStatus->PortStatus |= USB_PORT_STAT_ENABLE; 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)); DEBUG ((EFI_D_INFO, "Uhci2GetRootHubPortStatus: port %d is suspended\n", PortNumber));
PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND; PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
} }
if (PortSC & USBPORTSC_PR) { if ((PortSC & USBPORTSC_PR) != 0) {
PortStatus->PortStatus |= USB_PORT_STAT_RESET; PortStatus->PortStatus |= USB_PORT_STAT_RESET;
} }
if (PortSC & USBPORTSC_LSDA) { if ((PortSC & USBPORTSC_LSDA) != 0) {
PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
} }
@ -394,11 +380,11 @@ Uhci2GetRootHubPortStatus (
// //
PortStatus->PortStatus |= USB_PORT_STAT_OWNER; PortStatus->PortStatus |= USB_PORT_STAT_OWNER;
if (PortSC & USBPORTSC_CSC) { if ((PortSC & USBPORTSC_CSC) != 0) {
PortStatus->PortChangeStatus |= USB_PORT_STAT_C_CONNECTION; PortStatus->PortChangeStatus |= USB_PORT_STAT_C_CONNECTION;
} }
if (PortSC & USBPORTSC_PEDC) { if ((PortSC & USBPORTSC_PEDC) != 0) {
PortStatus->PortChangeStatus |= USB_PORT_STAT_C_ENABLE; 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. 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 This A pointer to the EFI_USB2_HC_PROTOCOL.
@param PortNumber Specifies the root hub port whose feature is @param PortNumber Specifies the root hub port whose feature is
requested to be set. requested to be set.
@param PortFeature Indicates the feature selector associated with the @param PortFeature Indicates the feature selector associated with the
feature set request. feature set request.
@return EFI_SUCCESS : PortFeature was set for the root port @return EFI_SUCCESS PortFeature was set for the root port.
@return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid. @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
@return EFI_DEVICE_ERROR : Can't read register @return EFI_DEVICE_ERROR Can't read register.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2SetRootHubPortFeature ( Uhci2SetRootHubPortFeature (
@ -449,7 +434,7 @@ Uhci2SetRootHubPortFeature (
switch (PortFeature) { switch (PortFeature) {
case EfiUsbPortSuspend: case EfiUsbPortSuspend:
Command = UhciReadReg (Uhc->PciIo, USBCMD_OFFSET); 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 // 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. 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 This A pointer to the EFI_USB2_HC_PROTOCOL instance.
@param PortNumber Specifies the root hub port whose feature is @param PortNumber Specifies the root hub port whose feature is
requested to be cleared. requested to be cleared.
@param PortFeature Indicates the feature selector associated with the @param PortFeature Indicates the feature selector associated with the
feature clear request. feature clear request.
@return EFI_SUCCESS : PortFeature was cleared for the USB root hub port @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_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
@return EFI_DEVICE_ERROR : Can't read register @return EFI_DEVICE_ERROR Can't read register.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2ClearRootHubPortFeature ( 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. @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
DeviceAddress : Target device address @param DeviceAddress Target device address.
DeviceSpeed : Device speed @param DeviceSpeed Device speed.
MaximumPacketLength : Maximum packet size of the target endpoint @param MaximumPacketLength Maximum packet size of the target endpoint.
Request : USB device request to send @param Request USB device request to send.
TransferDirection : Data direction of the Data stage in control transfer @param TransferDirection Data direction of the Data stage in control transfer.
Data : Data to transmit/receive in data stage @param Data Data to transmit/receive in data stage.
DataLength : Length of the data @param DataLength Length of the data.
TimeOut : Maximum time, in microseconds, for transfer to complete. @param TimeOut Maximum time, in microseconds, for transfer to complete.
TransferResult : Variable to receive the transfer result @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_SUCCESS The control transfer was completed successfully.
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource. @return EFI_OUT_OF_RESOURCES Failed due to lack of resource.
@return EFI_INVALID_PARAMETER : Some parameters are invalid. @return EFI_INVALID_PARAMETER Some parameters are invalid.
@return EFI_TIMEOUT : Failed due to timeout. @return EFI_TIMEOUT Failed due to timeout.
@return EFI_DEVICE_ERROR : Failed due to host controller or device error. @return EFI_DEVICE_ERROR Failed due to host controller or device error.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2ControlTransfer ( 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. @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
DeviceAddress : Target device address @param DeviceAddress Target device address.
EndPointAddress : Endpoint number and direction @param EndPointAddress Endpoint number and direction.
DeviceSpeed : Device speed @param DeviceSpeed Device speed.
MaximumPacketLength : Maximum packet size of the target endpoint @param MaximumPacketLength Maximum packet size of the target endpoint.
DataBuffersNumber : Number of data buffers prepared for the transfer. @param DataBuffersNumber Number of data buffers prepared for the transfer.
Data : Array of pointers to the buffers of data @param Data Array of pointers to the buffers of data.
DataLength : On input, size of the data buffer, On output, @param DataLength On input, size of the data buffer, On output,
actually transferred data size. actually transferred data size.
DataToggle : On input, data toggle to use; On output, next data toggle @param DataToggle On input, data toggle to use; On output, next data toggle.
Translator : A pointr to the transaction translator data. @param TimeOut Maximum time out, in microseconds.
TimeOut : Maximum time out, in microseconds @param Translator A pointr to the transaction translator data.
TransferResult : Variable to receive transfer result @param TransferResult Variable to receive transfer result.
@return EFI_SUCCESS : The bulk transfer was completed successfully. @return EFI_SUCCESS The bulk transfer was completed successfully.
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource. @return EFI_OUT_OF_RESOURCES Failed due to lack of resource.
@return EFI_INVALID_PARAMETER : Some parameters are invalid. @return EFI_INVALID_PARAMETER Some parameters are invalid.
@return EFI_TIMEOUT : Failed due to timeout. @return EFI_TIMEOUT Failed due to timeout.
@return EFI_DEVICE_ERROR : Failed due to host controller or device error. @return EFI_DEVICE_ERROR Failed due to host controller or device error.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2BulkTransfer ( Uhci2BulkTransfer (
@ -809,11 +791,7 @@ Uhci2BulkTransfer (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if ((DataLength == NULL) || (Data == NULL) || (TransferResult == NULL)) { if ((DataLength == NULL) || (*DataLength == 0) || (Data == NULL) || (TransferResult == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (*DataLength == 0) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -845,7 +823,7 @@ Uhci2BulkTransfer (
// Map the source data buffer for bus master access, // Map the source data buffer for bus master access,
// then create a list of TDs // then create a list of TDs
// //
if (EndPointAddress & 0x80) { if ((EndPointAddress & 0x80) != 0) {
Direction = EfiUsbDataIn; Direction = EfiUsbDataIn;
} else { } else {
Direction = EfiUsbDataOut; Direction = EfiUsbDataOut;
@ -906,27 +884,26 @@ ON_EXIT:
Submits an asynchronous interrupt transfer to an Submits an asynchronous interrupt transfer to an
interrupt endpoint of a USB device according to UEFI 2.0 spec. interrupt endpoint of a USB device according to UEFI 2.0 spec.
This : A pointer to the EFI_USB2_HC_PROTOCOL instance. @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
DeviceAddress : Target device address @param DeviceAddress Target device address.
EndPointAddress : Endpoint number and direction @param EndPointAddress Endpoint number and direction.
DeviceSpeed : Device speed @param DeviceSpeed Device speed.
MaximumPacketLength : Maximum packet size of the target endpoint @param MaximumPacketLength Maximum packet size of the target endpoint.
IsNewTransfer : If TRUE, submit a new transfer, if FALSE cancel old transfer @param IsNewTransfer If TRUE, submit a new transfer, if FALSE cancel old transfer.
DataToggle : On input, data toggle to use; On output, next data toggle @param DataToggle On input, data toggle to use; On output, next data toggle.
PollingInterval : Interrupt poll rate in milliseconds @param PollingInterval Interrupt poll rate in milliseconds.
DataLength : On input, size of the data buffer, On output, @param DataLength On input, size of the data buffer, On output,
actually transferred data size. actually transferred data size.
Translator : A pointr to the transaction translator data. @param Translator A pointr to the transaction translator data.
CallBackFunction : Function to call periodically @param CallBackFunction Function to call periodically.
Context : User context @param Context User context.
@return EFI_SUCCESS : Transfer was submitted @return EFI_SUCCESS Transfer was submitted.
@return EFI_INVALID_PARAMETER : Some parameters are invalid. @return EFI_INVALID_PARAMETER Some parameters are invalid.
@return EFI_OUT_OF_RESOURCES : Failed due to a lack of resources. @return EFI_OUT_OF_RESOURCES Failed due to a lack of resources.
@return EFI_DEVICE_ERROR : Can't read register @return EFI_DEVICE_ERROR Can't read register.
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2AsyncInterruptTransfer ( Uhci2AsyncInterruptTransfer (
@ -1102,28 +1079,27 @@ FREE_DATA:
Submits synchronous interrupt transfer to an interrupt endpoint Submits synchronous interrupt transfer to an interrupt endpoint
of a USB device according to UEFI 2.0 spec. 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. @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
@return EFI_OUT_OF_RESOURCES : Failed due to lack of resource. @param DeviceAddress Target device address.
@return EFI_INVALID_PARAMETER : Some parameters are invalid. @param EndPointAddress Endpoint number and direction.
@return EFI_TIMEOUT : Failed due to timeout. @param DeviceSpeed Device speed.
@return EFI_DEVICE_ERROR : Failed due to host controller or device error. @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 EFI_STATUS
EFIAPI EFIAPI
Uhci2SyncInterruptTransfer ( Uhci2SyncInterruptTransfer (
@ -1254,22 +1230,21 @@ ON_EXIT:
/** /**
Submits isochronous transfer to a target USB device according to UEFI 2.0 spec. Submits isochronous transfer to a target USB device according to UEFI 2.0 spec.
This : A pointer to the EFI_USB2_HC_PROTOCOL instance. @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
DeviceAddress : Target device address @param DeviceAddress Target device address.
EndPointAddress : Endpoint number and direction @param EndPointAddress Endpoint number and direction.
DeviceSpeed : Device speed @param DeviceSpeed Device speed.
MaximumPacketLength : Maximum packet size of the target endpoint @param MaximumPacketLength Maximum packet size of the target endpoint.
DataBuffersNumber : Number of data buffers prepared for the transfer. @param DataBuffersNumber Number of data buffers prepared for the transfer.
Data : Array of pointers to the buffers of data @param Data Array of pointers to the buffers of data.
DataLength : On input, size of the data buffer, On output, @param DataLength On input, size of the data buffer, On output,
actually transferred data size. actually transferred data size.
Translator : A pointr to the transaction translator data. @param Translator A pointr to the transaction translator data.
TransferResult : Variable to receive transfer result @param TransferResult Variable to receive transfer result.
@return EFI_UNSUPPORTED @return EFI_UNSUPPORTED
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2IsochronousTransfer ( Uhci2IsochronousTransfer (
@ -1292,21 +1267,22 @@ Uhci2IsochronousTransfer (
/** /**
Submits Async isochronous transfer to a target USB device according to UEFI 2.0 spec. 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. @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
DeviceAddress : Target device address @param DeviceAddress Target device address.
EndPointAddress : Endpoint number and direction @param EndPointAddress Endpoint number and direction.
DeviceSpeed : Device speed @param DeviceSpeed Device speed.
MaximumPacketLength : Maximum packet size of the target endpoint @param MaximumPacketLength Maximum packet size of the target endpoint.
DataBuffersNumber : Number of data buffers prepared for the transfer. @param DataBuffersNumber Number of data buffers prepared for the transfer.
Data : Array of pointers to the buffers of data @param Data Array of pointers to the buffers of data.
Translator : A pointr to the transaction translator data. @param DataLength On input, size of the data buffer, On output,
IsochronousCallBack : Function to call when the transfer complete actually transferred data size.
Context : Pass to the call back function as parameter @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 @return EFI_UNSUPPORTED
**/ **/
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
Uhci2AsyncIsochronousTransfer ( Uhci2AsyncIsochronousTransfer (
@ -1326,29 +1302,22 @@ Uhci2AsyncIsochronousTransfer (
return EFI_UNSUPPORTED; 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 EFI_STATUS
EFIAPI EFIAPI
UhciDriverEntryPoint ( UhciDriverEntryPoint (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable 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 ( return EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
@ -1366,11 +1335,11 @@ UhciDriverEntryPoint (
ControllerHandle that has UsbHcProtocol installed will be supported. ControllerHandle that has UsbHcProtocol installed will be supported.
@param This Protocol instance pointer. @param This Protocol instance pointer.
@param Controller Handle of device to test @param Controller Handle of device to test.
@param RemainingDevicePath Not used @param RemainingDevicePath Not used.
@return EFI_SUCCESS : This driver supports this device. @return EFI_SUCCESS This driver supports this device.
@return EFI_UNSUPPORTED : This driver does not support this device. @return EFI_UNSUPPORTED This driver does not support this device.
**/ **/
EFI_STATUS 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 * USB_HC_DEV *
UhciAllocateDev ( UhciAllocateDev (
IN EFI_PCI_IO_PROTOCOL *PciIo, 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 VOID
UhciFreeDev ( UhciFreeDev (
IN USB_HC_DEV *Uhc IN USB_HC_DEV *Uhc
@ -1538,7 +1506,7 @@ UhciFreeDev (
UsbHcFreeMemPool (Uhc->MemPool); UsbHcFreeMemPool (Uhc->MemPool);
} }
if (Uhc->CtrlNameTable) { if (Uhc->CtrlNameTable != NULL) {
FreeUnicodeStringTable (Uhc->CtrlNameTable); 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. @param This Protocol instance pointer.
@return VOID @return None.
**/ **/
STATIC
VOID VOID
UhciCleanDevUp ( UhciCleanDevUp (
IN EFI_HANDLE Controller, 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 This Protocol instance pointer.
@param Controller Handle of device to test @param Controller Handle of device to test.
@param RemainingDevicePath Not used @param RemainingDevicePath Not used.
@retval EFI_SUCCESS This driver supports this device. @retval EFI_SUCCESS This driver supports this device.
@retval EFI_UNSUPPORTED This driver does not support 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 @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
EFI_OUT_OF_RESOURCES- Failed due to resource EFI_OUT_OF_RESOURCES- Failed due to resource shortage.
shortage
**/ **/
EFI_STATUS EFI_STATUS
@ -1784,8 +1750,8 @@ CLOSE_PCIIO:
created by this driver. created by this driver.
@param This Protocol instance pointer. @param This Protocol instance pointer.
@param Controller Handle of device to stop driver on @param Controller Handle of device to stop driver on.
@param NumberOfChildren Number of Children in the ChildHandleBuffer @param NumberOfChildren Number of Children in the ChildHandleBuffer.
@param ChildHandleBuffer List of handles for the children we need to stop. @param ChildHandleBuffer List of handles for the children we need to stop.
@return EFI_SUCCESS @return EFI_SUCCESS

View File

@ -1,5 +1,7 @@
/** @file /** @file
The definition for UHCI driver model and HC protocol routines.
Copyright (c) 2004 - 2007, Intel Corporation Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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 #ifndef _EFI_UHCI_H_
#define _UHCI_H #define _EFI_UHCI_H_
#include <PiDxe.h> #include <PiDxe.h>
@ -51,7 +42,7 @@ typedef struct _USB_HC_DEV USB_HC_DEV;
#include "UhciSched.h" #include "UhciSched.h"
#include "UhciDebug.h" #include "UhciDebug.h"
enum { typedef enum {
UHC_1_MICROSECOND = 1, UHC_1_MICROSECOND = 1,
UHC_1_MILLISECOND = 1000 * UHC_1_MICROSECOND, UHC_1_MILLISECOND = 1000 * UHC_1_MICROSECOND,
UHC_1_SECOND = 1000 * UHC_1_MILLISECOND, UHC_1_SECOND = 1000 * UHC_1_MILLISECOND,
@ -80,16 +71,17 @@ enum {
// and the unit of Async is 100us. // and the unit of Async is 100us.
// //
UHC_SYNC_POLL_INTERVAL = 50 * UHC_1_MICROSECOND, 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) #pragma pack(1)
typedef struct { typedef struct {

View File

@ -1,5 +1,7 @@
/** @file /** @file
This file provides the information dump support for Uhci when in debug mode.
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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" #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 VOID
@ -51,10 +42,10 @@ UhciDumpQh (
/** /**
Dump the content of TD structure. Dump the content of TD structure.
@param TdSw Pointer to software TD structure @param TdSw Pointer to software TD structure.
@param IsCur Whether dump the whole list, or only dump the current TD @param IsCur Whether dump the whole list, or only dump the current TD.
@return None @return None.
**/ **/
VOID VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
This file contains the definination for host controller debug support routines
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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_ #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 VOID
@ -44,9 +35,9 @@ UhciDumpQh (
/** /**
Dump the content of TD structure. 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 VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
The UHCI register operation routines.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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" #include "Uhci.h"
/** /**
Map address of request structure buffer Map address of request structure buffer.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param Request The user request buffer @param Request The user request buffer.
@param MappedAddr Mapped address of request @param MappedAddr Mapped address of request.
@param Map Identificaion of this mapping to return @param Map Identificaion of this mapping to return.
@return EFI_SUCCESS : Success @return EFI_SUCCESS Success.
@return EFI_DEVICE_ERROR : Fail to map the user request @return EFI_DEVICE_ERROR Fail to map the user request.
**/ **/
EFI_STATUS 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 Uhc The UHCI device.
@param Direction direction of the data transfer @param Direction Direction of the data transfer.
@param Data The user data buffer @param Data The user data buffer.
@param Len Length of the user data @param Len Length of the user data.
@param PktId Packet identificaion @param PktId Packet identificaion.
@param MappedAddr mapped address to return @param MappedAddr Mapped address to return.
@param Map identificaion of this mapping to return @param Map Identificaion of this mapping to return.
@return EFI_SUCCESS : Success @return EFI_SUCCESS Success.
@return EFI_DEVICE_ERROR : Fail to map the user data @return EFI_DEVICE_ERROR Fail to map the user data.
**/ **/
EFI_STATUS 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 Qh The queue head for the TD to link to.
@param Td The TD to link @param Td The TD to link.
@return VOID @return None.
**/ **/
VOID 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 Qh The queue head to unlink from.
@param Td The TD to unlink @param Td The TD to unlink.
@return VOID @return None.
**/ **/
VOID 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 PrevTd Previous UHCI_TD_SW to be linked to.
@param ThisTd TD to link @param ThisTd TD to link.
@return VOID @return None.
**/ **/
STATIC
VOID VOID
UhciAppendTd ( UhciAppendTd (
IN UHCI_TD_SW *PrevTd, 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 Uhc The UHCI device.
@param FirstTd TD link list head @param FirstTd TD link list head.
@return VOID @return None.
**/ **/
VOID 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 Uhc The UHCI device.
@param Interval The polling interval for the queue @param Interval The polling interval for the queue.
@return The newly created queue header @return The newly created queue header.
**/ **/
UHCI_QH_SW * 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 * UHCI_TD_SW *
UhciCreateTd ( UhciCreateTd (
IN USB_HC_DEV *Uhc 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 Uhc The UHCI device.
@param DevAddr Device address @param DevAddr Device address.
@param Request Device request @param Request Device request.
@param IsLow Full speed or low speed @param IsLow Full speed or low speed.
@return The created setup Td Pointer @return The created setup Td Pointer.
**/ **/
STATIC
UHCI_TD_SW * UHCI_TD_SW *
UhciCreateSetupTd ( UhciCreateSetupTd (
IN USB_HC_DEV *Uhc, 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 Uhc The UHCI device.
@param DevAddr Device address @param DevAddr Device address.
@param Endpoint Endpoint number @param Endpoint Endpoint number.
@param DataPtr Data buffer @param DataPtr Data buffer.
@param Len Data length @param Len Data length.
@param PktId Packet ID @param PktId Packet ID.
@param Toggle Data toggle value @param Toggle Data toggle value.
@param IsLow Full speed or low speed @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 * UHCI_TD_SW *
UhciCreateDataTd ( UhciCreateDataTd (
IN USB_HC_DEV *Uhc, 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 Uhc The UHCI device.
@param DevAddr Device address @param DevAddr Device address.
@param PktId Packet ID @param PktId Packet ID.
@param IsLow Full speed or low speed @param IsLow Full speed or low speed.
@return Status Td Pointer @return Status Td Pointer.
**/ **/
STATIC
UHCI_TD_SW * UHCI_TD_SW *
UhciCreateStatusTd ( UhciCreateStatusTd (
IN USB_HC_DEV *Uhc, 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 Uhc The UHCI device.
@param DeviceAddr The device address @param DeviceAddr The device address.
@param DataPktId Packet Identification of Data Tds @param DataPktId Packet Identification of Data Tds.
@param Request A pointer to request structure buffer to transfer @param Request A pointer to request structure buffer to transfer.
@param Data A pointer to user data buffer to transfer @param Data A pointer to user data buffer to transfer.
@param DataLen Length of user data to transfer @param DataLen Length of user data to transfer.
@param MaxPacket Maximum packet size for control transfer @param MaxPacket Maximum packet size for control transfer.
@param IsLow Full speed or low speed @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 * 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 Uhc USB_HC_DEV.
@param DevAddr Address of Device @param DevAddr Address of Device.
@param EndPoint Endpoint Number @param EndPoint Endpoint Number.
@param PktId Packet Identification of Data Tds @param PktId Packet Identification of Data Tds.
@param Data A pointer to user data buffer to transfer @param Data A pointer to user data buffer to transfer.
@param DataLen Length of user data to transfer @param DataLen Length of user data to transfer.
@param DataToggle Data Toggle Pointer @param DataToggle Data Toggle Pointer.
@param MaxPacket Maximum packet size for Bulk/Interrupt transfer @param MaxPacket Maximum packet size for Bulk/Interrupt transfer.
@param IsLow Is Low Speed Device @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 * UHCI_TD_SW *

View File

@ -1,5 +1,7 @@
/** @file /** @file
The definition for UHCI register operation routines.
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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_ #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 Qh The queue head for the TD to link to.
@param Td The TD to link @param Td The TD to link.
@return VOID @return None.
**/ **/
VOID 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 Qh The queue head to unlink from.
@param Td The TD to unlink @param Td The TD to unlink.
@return VOID @return None.
**/ **/
VOID VOID
@ -138,15 +129,15 @@ UhciUnlinkTdFromQh (
/** /**
Map address of request structure buffer Map address of request structure buffer.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param Request The user request buffer @param Request The user request buffer.
@param MappedAddr Mapped address of request @param MappedAddr Mapped address of request.
@param Map Identificaion of this mapping to return @param Map Identificaion of this mapping to return.
@return EFI_SUCCESS : Success @return EFI_SUCCESS Success.
@return EFI_DEVICE_ERROR : Fail to map the user request @return EFI_DEVICE_ERROR Fail to map the user request.
**/ **/
EFI_STATUS 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 Uhc The UHCI device.
@param Direction direction of the data transfer @param Direction Direction of the data transfer.
@param Data The user data buffer @param Data The user data buffer.
@param Len Length of the user data @param Len Length of the user data.
@param PktId Packet identificaion @param PktId Packet identificaion.
@param MappedAddr mapped address to return @param MappedAddr Mapped address to return.
@param Map identificaion of this mapping to return @param Map Identificaion of this mapping to return.
@return EFI_SUCCESS : Success @return EFI_SUCCESS Success.
@return EFI_DEVICE_ERROR : Fail to map the user data @return EFI_DEVICE_ERROR Fail to map the user data.
**/ **/
EFI_STATUS EFI_STATUS
@ -188,12 +179,12 @@ UhciMapUserData (
/** /**
Delete a list of TDs Delete a list of TDs.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param FirstTd TD link list head @param FirstTd TD link list head.
@return VOID @return None.
**/ **/
VOID 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 Uhc The UHCI device.
@param Interval The polling interval for the queue @param Interval The polling interval for the queue.
@return The newly created queue header @return The newly created queue header.
**/ **/
UHCI_QH_SW * 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 Uhc The UHCI device.
@param DeviceAddr The device address @param DeviceAddr The device address.
@param DataPktId Packet Identification of Data Tds @param DataPktId Packet Identification of Data Tds.
@param Request A pointer to request structure buffer to transfer @param Request A pointer to request structure buffer to transfer.
@param Data A pointer to user data buffer to transfer @param Data A pointer to user data buffer to transfer.
@param DataLen Length of user data to transfer @param DataLen Length of user data to transfer.
@param MaxPacket Maximum packet size for control transfer @param MaxPacket Maximum packet size for control transfer.
@param IsLow Full speed or low speed @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 * 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 Uhc USB_HC_DEV.
@param DevAddr Address of Device @param DevAddr Address of Device.
@param EndPoint Endpoint Number @param EndPoint Endpoint Number.
@param PktId Packet Identification of Data Tds @param PktId Packet Identification of Data Tds.
@param Data A pointer to user data buffer to transfer @param Data A pointer to user data buffer to transfer.
@param DataLen Length of user data to transfer @param DataLen Length of user data to transfer.
@param DataToggle Data Toggle Pointer @param DataToggle Data Toggle Pointer.
@param MaxPacket Maximum packet size for Bulk/Interrupt transfer @param MaxPacket Maximum packet size for Bulk/Interrupt transfer.
@param IsLow Is Low Speed Device @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 * UHCI_TD_SW *

View File

@ -1,5 +1,7 @@
/** @file /** @file
The UHCI register operation routines.
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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" #include "Uhci.h"
/** /**
Read a UHCI register Read a UHCI register.
@param PciIo The EFI_PCI_IO_PROTOCOL to use @param PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@return Content of register @return Content of register.
**/ **/
UINT16 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 PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@param Data Data to write @param Data Data to write.
@return VOID @return None.
**/ **/
VOID 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 PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@param Bit The bit to set @param Bit The bit to set.
@return None @return None.
**/ **/
VOID 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 PciIo The PCI_IO protocol to access the PCI.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@param Bit The bit to clear @param Bit The bit to clear.
@return None @return None.
**/ **/
VOID VOID
@ -148,11 +139,11 @@ UhciClearRegBit (
/** /**
Clear all the interrutp status bits, these bits 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 VOID
@ -173,15 +164,14 @@ UhciAckAllInterrupt (
} }
/** /**
Stop the host controller Stop the host controller.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param Timeout Max time allowed @param Timeout Max time allowed.
@retval EFI_SUCCESS The host controller is stopped @retval EFI_SUCCESS The host controller is stopped.
@retval EFI_TIMEOUT Failed to stop the host controller @retval EFI_TIMEOUT Failed to stop the host controller.
**/ **/
EFI_STATUS 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 TRUE Host controller is working.
@retval FALSE Host controller is halted or system error @retval FALSE Host controller is halted or system error.
**/ **/
BOOLEAN BOOLEAN
@ -231,7 +221,7 @@ UhciIsHcWorking (
UsbSts = UhciReadReg (PciIo, USBSTS_OFFSET); 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)); DEBUG ((EFI_D_ERROR, "UhciIsHcWorking: current USB state is %x\n", UsbSts));
return FALSE; return FALSE;
} }
@ -244,10 +234,10 @@ UhciIsHcWorking (
Set the UHCI frame list base address. It can't use Set the UHCI frame list base address. It can't use
UhciWriteReg which access memory in UINT16. UhciWriteReg which access memory in UINT16.
@param PciIo The EFI_PCI_IO_PROTOCOL to use @param PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Addr Address to set @param Addr Address to set.
@return VOID @return None.
**/ **/
VOID 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 VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
The definition for UHCI register operation routines.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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_ #ifndef _EFI_UHCI_REG_H_
@ -27,7 +18,7 @@ Revision History
#define BIT(a) (1 << (a)) #define BIT(a) (1 << (a))
enum { typedef enum {
UHCI_FRAME_NUM = 1024, UHCI_FRAME_NUM = 1024,
// //
@ -104,16 +95,16 @@ enum {
USBTD_NAK = BIT(3), // NAK is received USBTD_NAK = BIT(3), // NAK is received
USBTD_CRC = BIT(2), // CRC/Time out error USBTD_CRC = BIT(2), // CRC/Time out error
USBTD_BITSTUFF = BIT(1) // Bit stuff 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 PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@return Content of register @return Content of register.
**/ **/
UINT16 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 PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@param Data Data to write @param Data Data to write.
@return VOID @return None.
**/ **/
VOID 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 PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@param Bit The bit to set @param Bit The bit to set.
@return None @return None.
**/ **/
VOID 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 PciIo The PCI_IO protocol to access the PCI.
@param Offset Register offset to USB_BAR_INDEX @param Offset Register offset to USB_BAR_INDEX.
@param Bit The bit to clear @param Bit The bit to clear.
@return None @return None.
**/ **/
VOID VOID
@ -186,11 +177,11 @@ UhciClearRegBit (
/** /**
Clear all the interrutp status bits, these bits 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 VOID
@ -201,13 +192,13 @@ UhciAckAllInterrupt (
/** /**
Stop the host controller Stop the host controller.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param Timeout Max time allowed @param Timeout Max time allowed.
@retval EFI_SUCCESS The host controller is stopped @retval EFI_SUCCESS The host controller is stopped.
@retval EFI_TIMEOUT Failed to stop the host controller @retval EFI_TIMEOUT Failed to stop the host controller.
**/ **/
EFI_STATUS 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 TRUE Host controller is working.
@retval FALSE Host controller is halted or system error @retval FALSE Host controller is halted or system error.
**/ **/
BOOLEAN BOOLEAN
@ -239,10 +230,10 @@ UhciIsHcWorking (
Set the UHCI frame list base address. It can't use Set the UHCI frame list base address. It can't use
UhciWriteReg which access memory in UINT16. UhciWriteReg which access memory in UINT16.
@param PciIo The EFI_PCI_IO_PROTOCOL to use @param PciIo The EFI_PCI_IO_PROTOCOL to use.
@param Addr Address to set @param Addr Address to set.
@return VOID @return None.
**/ **/
VOID 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 VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
The EHCI register operation routines.
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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" #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_OUT_OF_RESOURCES Can't allocate memory resources.
@retval EFI_UNSUPPORTED Map memory fail @retval EFI_UNSUPPORTED Map memory fail.
@retval EFI_SUCCESS Success @retval EFI_SUCCESS Success.
**/ **/
EFI_STATUS 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 VOID
@ -201,11 +192,11 @@ UhciDestoryFrameList (
/** /**
Convert the poll rate to the maxium 2^n that is smaller 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 UINTN
@ -235,10 +226,10 @@ UhciConvertPollRate (
Link a queue head (for asynchronous interrupt transfer) to Link a queue head (for asynchronous interrupt transfer) to
the frame list. the frame list.
@param FrameBase The base of the frame list @param FrameBase The base of the frame list.
@param Qh The queue head to link into @param Qh The queue head to link into.
@return None @return None.
**/ **/
VOID VOID
@ -340,10 +331,10 @@ UhciLinkQhToFrameList (
the precedence node, and pointer there next to QhSw's the precedence node, and pointer there next to QhSw's
next. next.
@param FrameBase The base address of the frame list @param FrameBase The base address of the frame list.
@param Qh The queue head to unlink @param Qh The queue head to unlink.
@return None @return None.
**/ **/
VOID VOID
@ -398,17 +389,16 @@ UhciUnlinkQhFromFrameList (
/** /**
Check TDs Results Check TDs Results.
@param Uhc This UHCI device @param Uhc This UHCI device.
@param Td UHCI_TD_SW to check @param Td UHCI_TD_SW to check.
@param IsLow Is Low Speed Device @param IsLow Is Low Speed Device.
@param QhResult Return the result of this TD list @param QhResult Return the result of this TD list.
@return Whether the TD's result is finialized. @return Whether the TD's result is finialized.
**/ **/
STATIC
BOOLEAN BOOLEAN
UhciCheckTdStatus ( UhciCheckTdStatus (
IN USB_HC_DEV *Uhc, IN USB_HC_DEV *Uhc,
@ -452,23 +442,23 @@ UhciCheckTdStatus (
// upper layer won't distinguish these condtions. So, only // upper layer won't distinguish these condtions. So, only
// set these bits when TD is actually halted. // set these bits when TD is actually halted.
// //
if (State & USBTD_STALLED) { if ((State & USBTD_STALLED) != 0) {
if (State & USBTD_BABBLE) { if ((State & USBTD_BABBLE) != 0) {
QhResult->Result |= EFI_USB_ERR_BABBLE; QhResult->Result |= EFI_USB_ERR_BABBLE;
} else if (TdHw->ErrorCount != 0) { } else if (TdHw->ErrorCount != 0) {
QhResult->Result |= EFI_USB_ERR_STALL; QhResult->Result |= EFI_USB_ERR_STALL;
} }
if (State & USBTD_CRC) { if ((State & USBTD_CRC) != 0) {
QhResult->Result |= EFI_USB_ERR_CRC; QhResult->Result |= EFI_USB_ERR_CRC;
} }
if (State & USBTD_BUFFERR) { if ((State & USBTD_BUFFERR) != 0) {
QhResult->Result |= EFI_USB_ERR_BUFFER; 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; QhResult->Result |= EFI_USB_ERR_BITSTUFF;
} }
@ -479,7 +469,7 @@ UhciCheckTdStatus (
Finished = TRUE; Finished = TRUE;
goto ON_EXIT; goto ON_EXIT;
} else if (State & USBTD_ACTIVE) { } else if ((State & USBTD_ACTIVE) != 0) {
// //
// The TD is still active, no need to check further. // 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 Uhc The UHCI device.
@param Td The first TDs of the transfer @param Qh The queue head of the transfer.
@param TimeOut TimeOut value in milliseconds @param Td The first TDs of the transfer.
@param IsLow Is Low Speed Device @param TimeOut TimeOut value in milliseconds.
@param QhResult The variable to return result @param IsLow Is Low Speed Device.
@param QhResult The variable to return result.
@retval EFI_SUCCESS The transfer finished with success @retval EFI_SUCCESS The transfer finished with success.
@retval EFI_DEVICE_ERROR Transfer failed @retval EFI_DEVICE_ERROR Transfer failed.
**/ **/
EFI_STATUS 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 AsyncReq The UHCI asynchronous transfer to update.
@param Result Transfer reslut @param Result Transfer reslut.
@param ErrTdPos Error TD Position @param NextToggle The toggle of next data.
@return VOID @return None.
**/ **/
STATIC
VOID VOID
UhciUpdateAsyncReq ( UhciUpdateAsyncReq (
IN UHCI_ASYNC_REQUEST *AsyncReq, 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 Uhc The UHCI device.
@param Qh The queue head of the transfer @param Qh The queue head of the transfer.
@param FirstTd First TD of the transfer @param FirstTd First TD of the transfer.
@param DevAddr Device Address @param DevAddr Device Address.
@param EndPoint EndPoint Address @param EndPoint EndPoint Address.
@param DataLen Data length @param DataLen Data length.
@param Interval Polling Interval when inserted to frame list @param Interval Polling Interval when inserted to frame list.
@param Mapping Mapping value @param Mapping Mapping value.
@param Data Data buffer, unmapped @param Data Data buffer, unmapped.
@param Callback Callback after interrupt transfeer @param Callback Callback after interrupt transfeer.
@param Context Callback Context passed as function parameter @param Context Callback Context passed as function parameter.
@param IsLow Is Low Speed @param IsLow Is Low Speed.
@retval EFI_SUCCESS An asynchronous transfer is created @retval EFI_SUCCESS An asynchronous transfer is created.
@retval EFI_INVALID_PARAMETER Paremeter is error @retval EFI_INVALID_PARAMETER Paremeter is error.
@retval EFI_OUT_OF_RESOURCES Failed because of resource shortage. @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 Uhc The UHCI device.
@param AsyncReq The asynchronous request to free @param AsyncReq The asynchronous request to free.
@return None @return None.
**/ **/
STATIC
VOID VOID
UhciFreeAsyncReq ( UhciFreeAsyncReq (
IN USB_HC_DEV *Uhc, IN USB_HC_DEV *Uhc,
@ -766,15 +753,14 @@ UhciFreeAsyncReq (
UHC's recycle list to wait for a while before release the memory. UHC's recycle list to wait for a while before release the memory.
Until then, hardware won't hold point to the request. Until then, hardware won't hold point to the request.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param AsyncReq The asynchronous request to free @param AsyncReq The asynchronous request to free.
@param FreeNow If TRUE, free the resource immediately, otherwise @param FreeNow If TRUE, free the resource immediately, otherwise
add the request to recycle wait list. add the request to recycle wait list.
@return None @return None.
**/ **/
STATIC
VOID VOID
UhciUnlinkAsyncReq ( UhciUnlinkAsyncReq (
IN USB_HC_DEV *Uhc, 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 Uhc The UHCI device.
@param DevAddr Device Address @param DevAddr Device Address.
@param EndPoint EndPoint Address @param EndPoint EndPoint Address.
@param Toggle The next data toggle to use @param Toggle The next data toggle to use.
@retval EFI_SUCCESS The request is deleted @retval EFI_SUCCESS The request is deleted.
@retval EFI_INVALID_PARAMETER Paremeter is error @retval EFI_INVALID_PARAMETER Paremeter is error.
@retval EFI_NOT_FOUND The asynchronous isn't found @retval EFI_NOT_FOUND The asynchronous isn't found.
**/ **/
EFI_STATUS EFI_STATUS
@ -886,12 +872,11 @@ UhciRemoveAsyncReq (
existing for at least 50ms, far enough for the hardware existing for at least 50ms, far enough for the hardware
to clear its cache. to clear its cache.
@param Uhc The UHCI device @param Uhc The UHCI device.
@return None @return None.
**/ **/
STATIC
VOID VOID
UhciRecycleAsyncReq ( UhciRecycleAsyncReq (
IN USB_HC_DEV *Uhc IN USB_HC_DEV *Uhc
@ -917,9 +902,9 @@ UhciRecycleAsyncReq (
/** /**
Release all the asynchronous transfers on the lsit. Release all the asynchronous transfers on the lsit.
@param Uhc The UHCI device @param Uhc The UHCI device.
@return VOID @return None.
**/ **/
VOID VOID
@ -952,12 +937,12 @@ UhciFreeAllAsyncReq (
/** /**
Interrupt transfer periodic check handler Interrupt transfer periodic check handler.
@param Event The event of the time @param Event The event of the time.
@param Context Context of the event, pointer to USB_HC_DEV @param Context Context of the event, pointer to USB_HC_DEV.
@return VOID @return None.
**/ **/
VOID VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
The definition for EHCI register operation routines.
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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_ #ifndef _EFI_UHCI_SCHED_H_
#define _EFI_UHCI_SCHED_H_ #define _EFI_UHCI_SCHED_H_
enum { typedef enum {
UHCI_ASYNC_INT_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'a'), 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_TIMEOUT | EFI_USB_ERR_BITSTUFF |
EFI_USB_ERR_SYSTEM EFI_USB_ERR_SYSTEM
}; }UHCI_ERR_FAIL_MASK;
// //
// Structure to return the result of UHCI QH execution. // Structure to return the result of UHCI QH execution.
@ -91,36 +82,29 @@ struct _UHCI_ASYNC_REQUEST{
#define UHCI_ASYNC_INT_FROM_LINK(a) \ #define UHCI_ASYNC_INT_FROM_LINK(a) \
CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE) 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 EFI_STATUS
UhciInitFrameList ( UhciInitFrameList (
IN USB_HC_DEV *Uhc 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 VOID
@ -132,11 +116,11 @@ UhciDestoryFrameList (
/** /**
Convert the poll rate to the maxium 2^n that is smaller 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 UINTN
@ -150,10 +134,10 @@ UhciConvertPollRate (
Link a queue head (for asynchronous interrupt transfer) to Link a queue head (for asynchronous interrupt transfer) to
the frame list. the frame list.
@param FrameBase The base of the frame list @param FrameBase The base of the frame list.
@param Qh The queue head to link into @param Qh The queue head to link into.
@return None @return None.
**/ **/
VOID VOID
@ -169,10 +153,10 @@ UhciLinkQhToFrameList (
the precedence node, and pointer there next to QhSw's the precedence node, and pointer there next to QhSw's
next. next.
@param FrameBase The base address of the frame list @param FrameBase The base address of the frame list.
@param Qh The queue head to unlink @param Qh The queue head to unlink.
@return None @return None.
**/ **/
VOID VOID
@ -184,16 +168,17 @@ UhciUnlinkQhFromFrameList (
/** /**
Check the result of the transfer Check the result of the transfer.
@param Uhc The UHCI device @param Uhc The UHCI device.
@param Td The first TDs of the transfer @param Qh The queue head of the transfer.
@param TimeOut TimeOut value in milliseconds @param Td The first TDs of the transfer.
@param IsLow Is Low Speed Device @param TimeOut TimeOut value in milliseconds.
@param QhResult The variable to return result @param IsLow Is Low Speed Device.
@param QhResult The variable to return result.
@retval EFI_SUCCESS The transfer finished with success @retval EFI_SUCCESS The transfer finished with success.
@retval EFI_DEVICE_ERROR Transfer failed @retval EFI_DEVICE_ERROR Transfer failed.
**/ **/
EFI_STATUS 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 Uhc The UHCI device.
@param Qh The queue head of the transfer @param Qh The queue head of the transfer.
@param FirstTd First TD of the transfer @param FirstTd First TD of the transfer.
@param DevAddr Device Address @param DevAddr Device Address.
@param EndPoint EndPoint Address @param EndPoint EndPoint Address.
@param Toggle Data Toggle @param DataLen Data length.
@param DataLen Data length @param Interval Polling Interval when inserted to frame list.
@param Interval Polling Interval when inserted to frame list @param Mapping Mapping value.
@param Mapping Mapping value @param Data Data buffer, unmapped.
@param Data Data buffer, unmapped @param Callback Callback after interrupt transfeer.
@param Callback Callback after interrupt transfeer @param Context Callback Context passed as function parameter.
@param Context Callback Context passed as function parameter @param IsLow Is Low Speed.
@param IsLow Is Low Speed
@retval EFI_SUCCESS An asynchronous transfer is created @retval EFI_SUCCESS An asynchronous transfer is created.
@retval EFI_INVALID_PARAMETER Paremeter is error @retval EFI_INVALID_PARAMETER Paremeter is error.
@retval EFI_OUT_OF_RESOURCES Failed because of resource shortage. @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 Uhc The UHCI device.
@param DevAddr Device Address @param DevAddr Device Address.
@param EndPoint EndPoint Address @param EndPoint EndPoint Address.
@param Toggle The next data toggle to use @param Toggle The next data toggle to use.
@retval EFI_SUCCESS The request is deleted @retval EFI_SUCCESS The request is deleted.
@retval EFI_INVALID_PARAMETER Paremeter is error @retval EFI_INVALID_PARAMETER Paremeter is error.
@retval EFI_NOT_FOUND The asynchronous isn't found @retval EFI_NOT_FOUND The asynchronous isn't found.
**/ **/
EFI_STATUS EFI_STATUS
@ -274,9 +258,9 @@ UhciRemoveAsyncReq (
/** /**
Release all the asynchronous transfers on the lsit. Release all the asynchronous transfers on the lsit.
@param Uhc The UHCI device @param Uhc The UHCI device.
@return VOID @return None.
**/ **/
VOID VOID
@ -287,12 +271,12 @@ UhciFreeAllAsyncReq (
/** /**
Interrupt transfer periodic check handler Interrupt transfer periodic check handler.
@param Event The event of the time @param Event The event of the time.
@param Context Context of the event, pointer to USB_HC_DEV @param Context Context of the event, pointer to USB_HC_DEV.
@return VOID @return None.
**/ **/
VOID VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
The routine procedure for uhci memory allocate/free.
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
EhciMem.c
Abstract:
Revision History
**/ **/
#include "Uhci.h" #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 Pool The buffer pool to allocate memory for.
@param Pages How many pages to allocate @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 * USBHC_MEM_BLOCK *
UsbHcAllocMemBlock ( UsbHcAllocMemBlock (
IN USBHC_MEM_POOL *Pool, 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 Pool The memory pool to free the block from.
@param Block The memory block to free @param Block The memory block to free.
@return VOID @return None.
**/ **/
STATIC
VOID VOID
UsbHcFreeMemBlock ( UsbHcFreeMemBlock (
IN USBHC_MEM_POOL *Pool, 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 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 Units Number of memory units to allocate
@return EFI_SUCCESS : The needed memory is allocated @return EFI_SUCCESS The needed memory is allocated.
@return EFI_NOT_FOUND : Can't find the free memory @return EFI_NOT_FOUND Can't find the free memory.
**/ **/
STATIC
VOID * VOID *
UsbHcAllocMemFromBlock ( UsbHcAllocMemFromBlock (
IN USBHC_MEM_BLOCK *Block, 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 Head The head of the memory pool's block list.
@param Block The memory block to insert @param Block The memory block to insert.
@return VOID @return None.
**/ **/
STATIC
VOID VOID
UsbHcInsertMemBlockToPool ( UsbHcInsertMemBlockToPool (
IN USBHC_MEM_BLOCK *Head, IN USBHC_MEM_BLOCK *Head,
@ -259,13 +247,12 @@ UsbHcInsertMemBlockToPool (
/** /**
Is the memory block empty? 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 TRUE The memory block is empty.
@return FALSE : The memory block isn't empty @return FALSE The memory block isn't empty.
**/ **/
STATIC
BOOLEAN BOOLEAN
UsbHcIsMemBlockEmpty ( UsbHcIsMemBlockEmpty (
IN USBHC_MEM_BLOCK *Block 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. @param BlockToUnlink The memory block to unlink.
@return VOID @return None.
**/ **/
STATIC
VOID VOID
UsbHcUnlinkMemBlock ( UsbHcUnlinkMemBlock (
IN USBHC_MEM_BLOCK *Head, 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 PciIo The PciIo that can be used to access the host controller @param Check4G Whether the host controller requires allocated memory
@param Check4G Whether the host controller requires allocated memory from one 4G address space.
from one 4G address space. @param Which4G The 4G memory area each memory allocated should be from.
@param Which4G The 4G memory area each memory allocated should be from
@return EFI_SUCCESS : The memory pool is initialized @return EFI_SUCCESS The memory pool is initialized.
@return EFI_OUT_OF_RESOURCE : Fail to init the memory pool @return EFI_OUT_OF_RESOURCE Fail to init the memory pool.
**/ **/
USBHC_MEM_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_SUCCESS The memory pool is freed.
@return EFI_DEVICE_ERROR : Failed to free the memory pool @return EFI_DEVICE_ERROR Failed to free the memory pool.
**/ **/
EFI_STATUS EFI_STATUS
@ -393,10 +378,10 @@ UsbHcFreeMemPool (
Allocate some memory from the host controller's memory pool Allocate some memory from the host controller's memory pool
which can be used to communicate with host controller. which can be used to communicate with host controller.
@param Pool The host controller's memory pool @param Pool The host controller's memory pool.
@param Size Size of the memory to allocate @param Size Size of the memory to allocate.
@return The allocated memory or NULL @return The allocated memory or NULL.
**/ **/
VOID * 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 Pool The memory pool of the host controller.
@param Mem The memory to free @param Mem The memory to free.
@param Size The size of the memory to free @param Size The size of the memory to free.
@return VOID @return None.
**/ **/
VOID VOID

View File

@ -1,5 +1,7 @@
/** @file /** @file
This file contains the definination for host controller memory management routines
Copyright (c) 2007, Intel Corporation Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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_ #ifndef _EFI_EHCI_MEM_H_
@ -58,12 +50,12 @@ typedef struct _USBHC_MEM_POOL {
USBHC_MEM_BLOCK *Head; USBHC_MEM_BLOCK *Head;
} USBHC_MEM_POOL; } USBHC_MEM_POOL;
enum { typedef enum {
USBHC_MEM_UNIT = 64, // Memory allocation unit, must be 2^n, n>4 USBHC_MEM_UNIT = 64, // Memory allocation unit, must be 2^n, n>4
USBHC_MEM_UNIT_MASK = USBHC_MEM_UNIT - 1, USBHC_MEM_UNIT_MASK = USBHC_MEM_UNIT - 1,
USBHC_MEM_DEFAULT_PAGES = 16 USBHC_MEM_DEFAULT_PAGES = 16
}; }UHCI_MEM_UNIT_DATA;
#define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK)) #define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))
@ -80,44 +72,34 @@ enum {
} while (0) } 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 * USBHC_MEM_POOL *
UsbHcInitMemPool ( UsbHcInitMemPool (
IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_PCI_IO_PROTOCOL *PciIo,
IN BOOLEAN Check4G, IN BOOLEAN Check4G,
IN UINT32 Which4G 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_SUCCESS The memory pool is freed.
@return EFI_DEVICE_ERROR : Failed to free the memory pool @return EFI_DEVICE_ERROR Failed to free the memory pool.
**/ **/
EFI_STATUS EFI_STATUS
@ -132,10 +114,10 @@ UsbHcFreeMemPool (
Allocate some memory from the host controller's memory pool Allocate some memory from the host controller's memory pool
which can be used to communicate with host controller. which can be used to communicate with host controller.
@param Pool The host controller's memory pool @param Pool The host controller's memory pool.
@param Size Size of the memory to allocate @param Size Size of the memory to allocate.
@return The allocated memory or NULL @return The allocated memory or NULL.
**/ **/
VOID * 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 Pool The memory pool of the host controller.
@param Mem The memory to free @param Mem The memory to free.
@param Size The size of the memory to free @param Size The size of the memory to free.
@return VOID @return None.
**/ **/
VOID VOID