/** @file\r
+ UEFI Component Name(2) protocol implementation for EHCI driver.\r
\r
Copyright (c) 2006 - 2007, Intel Corporation \r
\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- ComponentName.c\r
-\r
-Abstract:\r
-\r
-\r
**/\r
\r
#include "Ehci.h"\r
/** @file\r
+ \r
+ The Ehci controller driver.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- Ehci.c\r
-\r
-Abstract:\r
-\r
-\r
-Revision History\r
-\r
**/\r
\r
\r
/**\r
Retrieves the capablility of root hub ports.\r
\r
- @param This This EFI_USB_HC_PROTOCOL instance.\r
- @param MaxSpeed Max speed supported by the controller\r
- @param PortNumber Number of the root hub ports.\r
- @param Is64BitCapable Whether the controller supports 64-bit memory\r
- addressing.\r
+ @param This This EFI_USB_HC_PROTOCOL instance.\r
+ @param MaxSpeed Max speed supported by the controller.\r
+ @param PortNumber Number of the root hub ports.\r
+ @param Is64BitCapable Whether the controller supports 64-bit memory\r
+ addressing.\r
\r
- @return EFI_SUCCESS : host controller capability were retrieved successfully.\r
- @return EFI_INVALID_PARAMETER : Either of the three capability pointer is NULL\r
+ @retval EFI_SUCCESS Host controller capability were retrieved successfully.\r
+ @retval EFI_INVALID_PARAMETER Either of the three capability pointer is NULL.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcGetCapability (\r
/**\r
Provides software reset for the USB host controller.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param Attributes A bit mask of the reset operation to perform.\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param Attributes A bit mask of the reset operation to perform.\r
\r
- @return EFI_SUCCESS : The reset operation succeeded.\r
- @return EFI_INVALID_PARAMETER : Attributes is not valid.\r
- @return EFI_UNSUPPOURTED : The type of reset specified by Attributes is\r
- @return not currently supported by the host controller.\r
- @return EFI_DEVICE_ERROR : Host controller isn't halted to reset.\r
+ @retval EFI_SUCCESS The reset operation succeeded.\r
+ @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
+ @retval EFI_UNSUPPOURTED The type of reset specified by Attributes is\r
+ not currently supported by the host controller.\r
+ @retval EFI_DEVICE_ERROR Host controller isn't halted to reset.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcReset (\r
/**\r
Retrieve the current state of the USB host controller.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param State Variable to return the current host controller\r
- state.\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param State Variable to return the current host controller\r
+ state.\r
\r
- @return EFI_SUCCESS : Host controller state was returned in State.\r
- @return EFI_INVALID_PARAMETER : State is NULL.\r
- @return EFI_DEVICE_ERROR : An error was encountered while attempting to\r
- @return retrieve the host controller's current state.\r
+ @retval EFI_SUCCESS Host controller state was returned in State.\r
+ @retval EFI_INVALID_PARAMETER State is NULL.\r
+ @retval EFI_DEVICE_ERROR An error was encountered while attempting to\r
+ retrieve the host controller's current state.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcGetState (\r
/**\r
Sets the USB host controller to a specific state.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param State The state of the host controller that will be set.\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param State The state of the host controller that will be set.\r
\r
- @return EFI_SUCCESS : The USB host controller was successfully placed\r
- @return in the state specified by State.\r
- @return EFI_INVALID_PARAMETER : State is invalid.\r
- @return EFI_DEVICE_ERROR : Failed to set the state due to device error.\r
+ @retval EFI_SUCCESS The USB host controller was successfully placed\r
+ in the state specified by State.\r
+ @retval EFI_INVALID_PARAMETER State is invalid.\r
+ @retval EFI_DEVICE_ERROR Failed to set the state due to device error.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcSetState (\r
/**\r
Retrieves the current status of a USB root hub port.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param PortNumber The root hub port to retrieve the state from. This\r
- value is zero-based.\r
- @param PortStatus Variable to receive the port state\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param PortNumber The root hub port to retrieve the state from.\r
+ This value is zero-based.\r
+ @param PortStatus Variable to receive the port state.\r
\r
- @return EFI_SUCCESS : The status of the USB root hub port specified\r
- @return by PortNumber was returned in PortStatus.\r
- @return EFI_INVALID_PARAMETER : PortNumber is invalid.\r
- @return EFI_DEVICE_ERROR : Can't read register\r
+ @retval EFI_SUCCESS The status of the USB root hub port specified.\r
+ by PortNumber was returned in PortStatus.\r
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
+ @retval EFI_DEVICE_ERROR Can't read register.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcGetRootHubPortStatus (\r
/**\r
Sets a feature for the specified root hub port.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param PortNumber Root hub port to set.\r
- @param PortFeature Feature to set\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param PortNumber Root hub port to set.\r
+ @param PortFeature Feature to set.\r
\r
- @return EFI_SUCCESS : The feature specified by PortFeature was set\r
- @return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.\r
- @return EFI_DEVICE_ERROR : Can't read register\r
+ @retval EFI_SUCCESS The feature specified by PortFeature was set.\r
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
+ @retval EFI_DEVICE_ERROR Can't read register.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcSetRootHubPortFeature (\r
/**\r
Clears a feature for the specified root hub port.\r
\r
- @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
- @param PortNumber Specifies the root hub port whose feature is\r
- requested to be cleared.\r
- @param PortFeature Indicates the feature selector associated with the\r
- feature clear request.\r
+ @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
+ @param PortNumber Specifies the root hub port whose feature is\r
+ requested to be cleared.\r
+ @param PortFeature Indicates the feature selector associated with the\r
+ feature clear request.\r
\r
- @return EFI_SUCCESS : The feature specified by PortFeature was cleared\r
- @return for the USB root hub port specified by PortNumber.\r
- @return EFI_INVALID_PARAMETER : PortNumber is invalid or PortFeature is invalid.\r
- @return EFI_DEVICE_ERROR : Can't read register\r
+ @retval EFI_SUCCESS The feature specified by PortFeature was cleared\r
+ for the USB root hub port specified by PortNumber.\r
+ @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
+ @retval EFI_DEVICE_ERROR Can't read register.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcClearRootHubPortFeature (\r
/**\r
Submits control transfer to a target USB device.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param DeviceAddress The target device address\r
- @param DeviceSpeed Target device speed.\r
- @param MaximumPacketLength Maximum packet size the default control transfer\r
- endpoint is capable of sending or receiving.\r
- @param Request USB device request to send\r
- @param TransferDirection Specifies the data direction for the data stage\r
- @param Data Data buffer to be transmitted or received from USB\r
- device.\r
- @param DataLength The size (in bytes) of the data buffer\r
- @param TimeOut Indicates the maximum timeout, in millisecond,\r
- @param Translator Transaction translator to be used by this device.\r
- @param TransferResult Return the result of this control transfer.\r
-\r
- @return EFI_SUCCESS : Transfer was completed successfully.\r
- @return EFI_OUT_OF_RESOURCES : The transfer failed due to lack of resources.\r
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.\r
- @return EFI_TIMEOUT : Transfer failed due to timeout.\r
- @return EFI_DEVICE_ERROR : Transfer failed due to host controller or device error.\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param DeviceAddress The target device address.\r
+ @param DeviceSpeed Target device speed.\r
+ @param MaximumPacketLength Maximum packet size the default control transfer\r
+ endpoint is capable of sending or receiving.\r
+ @param Request USB device request to send.\r
+ @param TransferDirection Specifies the data direction for the data stage\r
+ @param Data Data buffer to be transmitted or received from USB\r
+ device.\r
+ @param DataLength The size (in bytes) of the data buffer.\r
+ @param TimeOut Indicates the maximum timeout, in millisecond.\r
+ @param Translator Transaction translator to be used by this device.\r
+ @param TransferResult Return the result of this control transfer.\r
+\r
+ @retval EFI_SUCCESS Transfer was completed successfully.\r
+ @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.\r
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+ @retval EFI_TIMEOUT Transfer failed due to timeout.\r
+ @retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcControlTransfer (\r
/**\r
Submits bulk transfer to a bulk endpoint of a USB device.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param DeviceAddress Target device address\r
- @param EndPointAddress Endpoint number and its direction in bit 7. .\r
- @param DeviceSpeed Device speed, Low speed device doesn't support bulk\r
- transfer.\r
- @param MaximumPacketLength Maximum packet size the endpoint is capable of\r
- sending or receiving.\r
- @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
- @param Data Array of pointers to the buffers of data to transmit\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param DeviceAddress Target device address.\r
+ @param EndPointAddress Endpoint number and its direction in bit 7.\r
+ @param DeviceSpeed Device speed, Low speed device doesn't support bulk\r
+ transfer.\r
+ @param MaximumPacketLength Maximum packet size the endpoint is capable of\r
+ sending or receiving.\r
+ @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
+ @param Data Array of pointers to the buffers of data to transmit\r
from or receive into.\r
- @param DataLength The lenght of the data buffer\r
- @param DataToggle On input, the initial data toggle for the transfer;\r
- On output, it is updated to to next data toggle to\r
- use of the subsequent bulk\r
- transfer.\r
- @param Translator A pointr to the transaction translator data.\r
- @param TimeOut Indicates the maximum time, in millisecond, which\r
- the transfer is allowed to complete.\r
- @param TransferResult A pointer to the detailed result information of the\r
- bulk transfer.\r
-\r
- @return EFI_SUCCESS : The transfer was completed successfully.\r
- @return EFI_OUT_OF_RESOURCES : The transfer failed due to lack of resource.\r
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.\r
- @return EFI_TIMEOUT : The transfer failed due to timeout.\r
- @return EFI_DEVICE_ERROR : The transfer failed due to host controller error.\r
+ @param DataLength The lenght of the data buffer.\r
+ @param DataToggle On input, the initial data toggle for the transfer;\r
+ On output, it is updated to to next data toggle to\r
+ use of the subsequent bulk transfer.\r
+ @param TimeOut Indicates the maximum time, in millisecond, which\r
+ the transfer is allowed to complete.\r
+ @param Translator A pointr to the transaction translator data.\r
+ @param TransferResult A pointer to the detailed result information of the\r
+ bulk transfer.\r
+\r
+ @retval EFI_SUCCESS The transfer was completed successfully.\r
+ @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+ @retval EFI_TIMEOUT The transfer failed due to timeout.\r
+ @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcBulkTransfer (\r
Submits an asynchronous interrupt transfer to an\r
interrupt endpoint of a USB device.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param DeviceAddress Target device address\r
- @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
- @param DeviceSpeed Indicates device speed.\r
- @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
- @param IsNewTransfer If TRUE, to submit an new asynchronous interrupt\r
- transfer If FALSE, to remove the specified\r
- asynchronous interrupt\r
- @param DataToggle On input, the initial data toggle to use; on output,\r
- it is updated to indicate the next data toggle\r
- @param PollingInterval The he interval, in milliseconds, that the transfer\r
- is polled.\r
- @param DataLength The length of data to receive at the rate specified\r
- by PollingInterval.\r
- @param Translator Transaction translator to use.\r
- @param CallBackFunction Function to call at the rate specified by\r
- PollingInterval\r
- @param Context Context to CallBackFunction.\r
-\r
- @return EFI_SUCCESS : The request has been successfully submitted or canceled.\r
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.\r
- @return EFI_OUT_OF_RESOURCES : The request failed due to a lack of resources.\r
- @return EFI_DEVICE_ERROR : The transfer failed due to host controller error.\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param DeviceAddress Target device address.\r
+ @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
+ @param DeviceSpeed Indicates device speed.\r
+ @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
+ @param IsNewTransfer If TRUE, to submit an new asynchronous interrupt\r
+ transfer If FALSE, to remove the specified\r
+ asynchronous interrupt.\r
+ @param DataToggle On input, the initial data toggle to use; on output,\r
+ it is updated to indicate the next data toggle.\r
+ @param PollingInterval The he interval, in milliseconds, that the transfer\r
+ is polled.\r
+ @param DataLength The length of data to receive at the rate specified\r
+ by PollingInterval.\r
+ @param Translator Transaction translator to use.\r
+ @param CallBackFunction Function to call at the rate specified by\r
+ PollingInterval.\r
+ @param Context Context to CallBackFunction.\r
+\r
+ @retval EFI_SUCCESS The request has been successfully submitted or canceled.\r
+ @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
+ @retval EFI_OUT_OF_RESOURCES The request failed due to a lack of resources.\r
+ @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcAsyncInterruptTransfer (\r
Submits synchronous interrupt transfer to an interrupt endpoint\r
of a USB device.\r
\r
- @param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param DeviceAddress Target device address\r
- @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
- @param DeviceSpeed Indicates device speed.\r
- @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
- of sending or receiving.\r
- @param Data Buffer of data that will be transmitted to USB\r
- device or received from USB device.\r
- @param DataLength On input, the size, in bytes, of the data buffer; On\r
- output, the number of bytes transferred.\r
- @param DataToggle On input, the initial data toggle to use; on output,\r
- it is updated to indicate the next data toggle\r
- @param TimeOut Maximum time, in second, to complete\r
- @param Translator Transaction translator to use.\r
- @param TransferResult Variable to receive the transfer result\r
-\r
- @return EFI_SUCCESS : The transfer was completed successfully.\r
- @return EFI_OUT_OF_RESOURCES : The transfer failed due to lack of resource.\r
- @return EFI_INVALID_PARAMETER : Some parameters are invalid.\r
- @return EFI_TIMEOUT : The transfer failed due to timeout.\r
- @return EFI_DEVICE_ERROR : The failed due to host controller or device error\r
+ @param This This EFI_USB2_HC_PROTOCOL instance.\r
+ @param DeviceAddress Target device address.\r
+ @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
+ @param DeviceSpeed Indicates device speed.\r
+ @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
+ of sending or receiving.\r
+ @param Data Buffer of data that will be transmitted to USB\r
+ device or received from USB device.\r
+ @param DataLength On input, the size, in bytes, of the data buffer; On\r
+ output, the number of bytes transferred.\r
+ @param DataToggle On input, the initial data toggle to use; on output,\r
+ it is updated to indicate the next data toggle.\r
+ @param TimeOut Maximum time, in second, to complete.\r
+ @param Translator Transaction translator to use.\r
+ @param TransferResult Variable to receive the transfer result.\r
+\r
+ @return EFI_SUCCESS The transfer was completed successfully.\r
+ @return EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
+ @return EFI_INVALID_PARAMETER Some parameters are invalid.\r
+ @return EFI_TIMEOUT The transfer failed due to timeout.\r
+ @return EFI_DEVICE_ERROR The failed due to host controller or device error\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcSyncInterruptTransfer (\r
Submits isochronous transfer to a target USB device.\r
\r
@param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param DeviceAddress Target device address\r
- @param EndPointAddress End point address with its direction\r
+ @param DeviceAddress Target device address.\r
+ @param EndPointAddress End point address with its direction.\r
@param DeviceSpeed Device speed, Low speed device doesn't support this\r
type.\r
@param MaximumPacketLength Maximum packet size that the endpoint is capable of\r
@param Data Array of pointers to the buffers of data that will\r
be transmitted to USB device or received from USB\r
device.\r
- @param DataLength The size, in bytes, of the data buffer\r
+ @param DataLength The size, in bytes, of the data buffer.\r
@param Translator Transaction translator to use.\r
- @param TransferResult Variable to receive the transfer result\r
+ @param TransferResult Variable to receive the transfer result.\r
\r
- @return EFI_UNSUPPORTED : Isochronous transfer is unsupported.\r
+ @return EFI_UNSUPPORTED Isochronous transfer is unsupported.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcIsochronousTransfer (\r
Submits Async isochronous transfer to a target USB device.\r
\r
@param This This EFI_USB2_HC_PROTOCOL instance.\r
- @param DeviceAddress Target device address\r
- @param EndPointAddress End point address with its direction\r
+ @param DeviceAddress Target device address.\r
+ @param EndPointAddress End point address with its direction.\r
@param DeviceSpeed Device speed, Low speed device doesn't support this\r
type.\r
@param MaximumPacketLength Maximum packet size that the endpoint is capable of\r
@param Data Array of pointers to the buffers of data that will\r
be transmitted to USB device or received from USB\r
device.\r
- @param DataLength The size, in bytes, of the data buffer\r
+ @param DataLength The size, in bytes, of the data buffer.\r
@param Translator Transaction translator to use.\r
- @param IsochronousCallBack Function to be called when the transfer complete\r
+ @param IsochronousCallBack Function to be called when the transfer complete.\r
@param Context Context passed to the call back function as\r
- parameter\r
+ parameter.\r
\r
- @return EFI_UNSUPPORTED : Isochronous transfer isn't supported\r
+ @return EFI_UNSUPPORTED Isochronous transfer isn't supported.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
EhcAsyncIsochronousTransfer (\r
return EFI_UNSUPPORTED;\r
}\r
\r
+/**\r
+ Entry point for EFI drivers.\r
+\r
+ @param ImageHandle EFI_HANDLE.\r
+ @param SystemTable EFI_SYSTEM_TABLE.\r
+\r
+ @return EFI_SUCCESS Success.\r
+ EFI_DEVICE_ERROR Fail.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
EhcDriverEntryPoint (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Entry point for EFI drivers.\r
-\r
-Arguments:\r
-\r
- ImageHandle - EFI_HANDLE\r
- SystemTable - EFI_SYSTEM_TABLE\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS Success\r
- EFI_DEVICE_ERROR Fail\r
-\r
---*/\r
{\r
return EfiLibInstallDriverBindingComponentName2 (\r
ImageHandle,\r
be supported.\r
\r
@param This Protocol instance pointer.\r
- @param Controlle Handle of device to test\r
- @param RemainingDevicePath Not used\r
+ @param Controller Handle of device to test.\r
+ @param RemainingDevicePath Not used.\r
\r
- @return EFI_SUCCESS : This driver supports this device.\r
- @return EFI_UNSUPPORTED : This driver does not support this device.\r
+ @return EFI_SUCCESS This driver supports this device.\r
+ @return EFI_UNSUPPORTED This driver does not support this device.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Create and initialize a USB2_HC_DEV\r
+ Create and initialize a USB2_HC_DEV.\r
\r
- @param PciIo The PciIo on this device\r
- @param OriginalPciAttributes Original PCI attributes\r
+ @param PciIo The PciIo on this device.\r
+ @param OriginalPciAttributes Original PCI attributes.\r
\r
- @return The allocated and initialized USB2_HC_DEV structure\r
- @return if created, otherwise NULL.\r
+ @return The allocated and initialized USB2_HC_DEV structure if created,\r
+ otherwise NULL.\r
\r
**/\r
-STATIC\r
USB2_HC_DEV *\r
EhcCreateUsb2Hc (\r
IN EFI_PCI_IO_PROTOCOL *PciIo,\r
\r
\r
/**\r
- Starting the Usb EHCI Driver\r
+ Starting the Usb EHCI Driver.\r
\r
@param This Protocol instance pointer.\r
- @param Controller Handle of device to test\r
- @param RemainingDevicePath Not used\r
+ @param Controller Handle of device to test.\r
+ @param RemainingDevicePath Not used.\r
\r
- @return EFI_SUCCESS : supports this device.\r
- @return EFI_UNSUPPORTED : do not support this device.\r
- @return EFI_DEVICE_ERROR : cannot be started due to device Error\r
- @return EFI_OUT_OF_RESOURCES : cannot allocate resources\r
+ @return EFI_SUCCESS supports this device.\r
+ @return EFI_UNSUPPORTED do not support this device.\r
+ @return EFI_DEVICE_ERROR cannot be started due to device Error.\r
+ @return EFI_OUT_OF_RESOURCES cannot allocate resources.\r
\r
**/\r
EFI_STATUS\r
created by this driver.\r
\r
@param This Protocol instance pointer.\r
- @param Controller Handle of device to stop driver on\r
- @param NumberOfChildren Number of Children in the ChildHandleBuffer\r
+ @param Controller Handle of device to stop driver on.\r
+ @param NumberOfChildren Number of Children in the ChildHandleBuffer.\r
@param ChildHandleBuffer List of handles for the children we need to stop.\r
\r
- @return EFI_SUCCESS Success\r
- @return EFI_DEVICE_ERROR Fail\r
+ @return EFI_SUCCESS Success.\r
+ @return EFI_DEVICE_ERROR Fail.\r
\r
**/\r
EFI_STATUS\r
\r
EhcFreeSched (Ehc);\r
\r
- if (Ehc->ControllerNameTable) {\r
+ if (Ehc->ControllerNameTable != NULL) {\r
FreeUnicodeStringTable (Ehc->ControllerNameTable);\r
}\r
\r
/** @file\r
\r
+ Provides some data struct used by EHCI controller driver.\r
+\r
Copyright (c) 2006 - 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- Ehci.h\r
-\r
-Abstract:\r
-\r
-\r
-Revision History\r
-\r
**/\r
\r
#ifndef _EFI_EHCI_H_\r
#include "EhciSched.h"\r
#include "EhciDebug.h"\r
\r
-enum {\r
+typedef enum {\r
EHC_1_MICROSECOND = 1,\r
EHC_1_MILLISECOND = 1000 * EHC_1_MICROSECOND,\r
EHC_1_SECOND = 1000 * EHC_1_MILLISECOND,\r
// and the unit of Async is 100us, means 50ms as interval.\r
//\r
EHC_SYNC_POLL_INTERVAL = 20 * EHC_1_MICROSECOND,\r
- EHC_ASYNC_POLL_INTERVAL = 50 * 10000U,\r
+ EHC_ASYNC_POLL_INTERVAL = 50 * 10000U\r
+} EHC_TIMEOUT_EXPERIENCE_VALUE;\r
+\r
\r
//\r
// EHC raises TPL to TPL_NOTIFY to serialize all its operations\r
// to protect shared data structures.\r
//\r
- EHC_TPL = TPL_NOTIFY,\r
+#define EHC_TPL TPL_NOTIFY\r
\r
- USB2_HC_DEV_SIGNATURE = EFI_SIGNATURE_32 ('e', 'h', 'c', 'i')\r
-};\r
+#define USB2_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('e', 'h', 'c', 'i')\r
\r
//\r
//Iterate through the doule linked list. NOT delete safe\r
/** @file\r
\r
+ This file provides the information dump support for EHCI when in debug mode.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciDebug.c\r
-\r
-Abstract:\r
- This file provides the information dump support for EHCI when in debug mode.\r
-\r
-Revision History\r
-\r
**/\r
\r
\r
#include "Ehci.h"\r
\r
/**\r
- Dump the status byte in QTD/QH to a more friendly\r
- format\r
+ Dump the status byte in QTD/QH to a more friendly format.\r
\r
- @param State The state in the QTD/QH\r
+ @param State The state in the QTD/QH.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
EhcDumpStatus (\r
IN UINT32 State\r
\r
\r
/**\r
- Dump the fields of a QTD\r
+ Dump the fields of a QTD.\r
\r
- @param Qtd The QTD to dump\r
- @param Msg The message to print before the dump\r
+ @param Qtd The QTD to dump.\r
+ @param Msg The message to print before the dump.\r
\r
@return None\r
\r
\r
\r
/**\r
- Dump the queue head\r
+ Dump the queue head.\r
\r
- @param Qh The queue head to dump\r
- @param Msg The message to print before the dump\r
- @param DumpBuf Whether to dump the memory buffer of the associated QTD\r
+ @param Qh The queue head to dump.\r
+ @param Msg The message to print before the dump.\r
+ @param DumpBuf Whether to dump the memory buffer of the associated QTD.\r
\r
@return None\r
\r
\r
\r
/**\r
- Dump the buffer in the form of hex\r
+ Dump the buffer in the form of hex.\r
\r
- @param Buf The buffer to dump\r
- @param Len The length of buffer\r
+ @param Buf The buffer to dump.\r
+ @param Len The length of buffer.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Dump the fields of a QTD\r
+ Dump the fields of a QTD.\r
\r
- @param Qtd The QTD to dump\r
- @param Msg The message to print before the dump\r
+ @param Qtd The QTD to dump.\r
+ @param Msg The message to print before the dump.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Dump the queue head\r
+ Dump the queue head.\r
\r
- @param Qh The queue head to dump\r
- @param Msg The message to print before the dump\r
- @param DumpBuf Whether to dump the memory buffer of the associated QTD\r
+ @param Qh The queue head to dump.\r
+ @param Msg The message to print before the dump.\r
+ @param DumpBuf Whether to dump the memory buffer of the associated QTD.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Dump the buffer in the form of hex\r
+ Dump the buffer in the form of hex.\r
\r
- @param Buf The buffer to dump\r
- @param Len The length of buffer\r
+ @param Buf The buffer to dump.\r
+ @param Len The length of buffer.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
/** @file\r
\r
+ The EHCI register operation routines.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciReg.c\r
-\r
-Abstract:\r
-\r
- The EHCI register operation routines.\r
-\r
-\r
-Revision History\r
-\r
**/\r
\r
\r
\r
\r
/**\r
- Read EHCI capability register\r
+ Read EHCI capability register.\r
\r
- @param Ehc The Ehc device\r
- @param Offset Capability register address\r
+ @param Ehc The EHCI device.\r
+ @param Offset Capability register address.\r
\r
- @return The register content read\r
+ @return The register content read.\r
+ @retval If err, return 0xffff.\r
\r
**/\r
UINT32\r
\r
\r
/**\r
- Read Ehc Operation register\r
+ Read EHCI Operation register.\r
\r
- @param Ehc The EHCI device\r
- @param Offset The operation register offset\r
+ @param Ehc The EHCI device.\r
+ @param Offset The operation register offset.\r
\r
- @return The register content read\r
+ @return The register content read.\r
+ @retval If err, return 0xffff.\r
\r
**/\r
UINT32\r
\r
\r
/**\r
- Write the data to the EHCI operation register\r
+ Write the data to the EHCI operation register.\r
\r
- @param Ehc The EHCI device\r
- @param Offset EHCI operation register offset\r
- @param Data The data to write\r
+ @param Ehc The EHCI device.\r
+ @param Offset EHCI operation register offset.\r
+ @param Data The data to write.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Set one bit of the operational register while keeping other bits\r
+ Set one bit of the operational register while keeping other bits.\r
\r
- @param Ehc The EHCI device\r
- @param Offset The offset of the operational register\r
- @param Bit The bit mask of the register to set\r
+ @param Ehc The EHCI device.\r
+ @param Offset The offset of the operational register.\r
+ @param Bit The bit mask of the register to set.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
EhcSetOpRegBit (\r
IN USB2_HC_DEV *Ehc,\r
\r
\r
/**\r
- Clear one bit of the operational register while keeping other bits\r
+ Clear one bit of the operational register while keeping other bits.\r
\r
- @param Ehc The EHCI device\r
- @param Offset The offset of the operational register\r
- @param Bit The bit mask of the register to clear\r
+ @param Ehc The EHCI device.\r
+ @param Offset The offset of the operational register.\r
+ @param Bit The bit mask of the register to clear.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
EhcClearOpRegBit (\r
IN USB2_HC_DEV *Ehc,\r
\r
/**\r
Wait the operation register's bit as specified by Bit\r
- to become set (or clear)\r
+ to become set (or clear).\r
\r
- @param Ehc The EHCI device\r
- @param Offset The offset of the operation register\r
- @param Bit The bit of the register to wait for\r
- @param WaitToSet Wait the bit to set or clear\r
- @param Timeout The time to wait before abort (in millisecond)\r
+ @param Ehc The EHCI device.\r
+ @param Offset The offset of the operation register.\r
+ @param Bit The bit of the register to wait for.\r
+ @param WaitToSet Wait the bit to set or clear.\r
+ @param Timeout The time to wait before abort (in millisecond).\r
\r
- @retval EFI_SUCCESS The bit successfully changed by host controller\r
- @retval EFI_TIMEOUT The time out occurred\r
+ @retval EFI_SUCCESS The bit successfully changed by host controller.\r
+ @retval EFI_TIMEOUT The time out occurred.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EhcWaitOpRegBit (\r
IN USB2_HC_DEV *Ehc,\r
\r
/**\r
Add support for UEFI Over Legacy (UoL) feature, stop\r
- the legacy USB SMI support\r
+ the legacy USB SMI support.\r
\r
@param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, ExtendCap, 1, &Value);\r
\r
TimeOut = 40;\r
- while (TimeOut--) {\r
+ while (TimeOut-- != 0) {\r
gBS->Stall (500);\r
\r
PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, ExtendCap, 1, &Value);\r
Set door bell and wait it to be ACKed by host controller.\r
This function is used to synchronize with the hardware.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout The time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout The time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : Synchronized with the hardware\r
- @return EFI_TIMEOUT : Time out happened while waiting door bell to set\r
+ @retval EFI_SUCCESS Synchronized with the hardware.\r
+ @retval EFI_TIMEOUT Time out happened while waiting door bell to set.\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Clear all the interrutp status bits, these bits\r
- are Write-Clean\r
+ are Write-Clean.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
Enable the periodic schedule then wait EHC to\r
actually enable it.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout The time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout The time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : The periodical schedule is enabled\r
- @return EFI_TIMEOUT : Time out happened while enabling periodic schedule\r
+ @retval EFI_SUCCESS The periodical schedule is enabled.\r
+ @retval EFI_TIMEOUT Time out happened while enabling periodic schedule.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EhcEnablePeriodSchd (\r
IN USB2_HC_DEV *Ehc,\r
}\r
\r
\r
-\r
/**\r
- Disable periodic schedule\r
+ Disable periodic schedule.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : Periodic schedule is disabled.\r
- @return EFI_DEVICE_ERROR : Fail to disable periodic schedule\r
+ @retval EFI_SUCCESS Periodic schedule is disabled.\r
+ @retval EFI_DEVICE_ERROR Fail to disable periodic schedule.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Enable asynchrounous schedule\r
+ Enable asynchrounous schedule.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort.\r
\r
- @return EFI_SUCCESS : The EHCI asynchronous schedule is enabled\r
- @return Others : Failed to enable the asynchronous scheudle\r
+ @retval EFI_SUCCESS The EHCI asynchronous schedule is enabled.\r
+ @return Others Failed to enable the asynchronous scheudle.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EhcEnableAsyncSchd (\r
IN USB2_HC_DEV *Ehc,\r
\r
\r
/**\r
- Disable asynchrounous schedule\r
+ Disable asynchrounous schedule.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : The asynchronous schedule is disabled\r
- @return Others : Failed to disable the asynchronous schedule\r
+ @retval EFI_SUCCESS The asynchronous schedule is disabled.\r
+ @return Others Failed to disable the asynchronous schedule.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Whether Ehc is halted\r
+ Whether Ehc is halted.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return TRUE : The controller is halted\r
- @return FALSE : It isn't halted\r
+ @retval TRUE The controller is halted.\r
+ @retval FALSE It isn't halted.\r
\r
**/\r
BOOLEAN\r
\r
\r
/**\r
- Whether system error occurred\r
+ Whether system error occurred.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return TRUE : System error happened\r
- @return FALSE : No system error\r
+ @return TRUE System error happened.\r
+ @return FALSE No system error.\r
\r
**/\r
BOOLEAN\r
\r
\r
/**\r
- Reset the host controller\r
+ Reset the host controller.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : The host controller is reset\r
- @return Others : Failed to reset the host\r
+ @retval EFI_SUCCESS The host controller is reset.\r
+ @return Others Failed to reset the host.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Halt the host controller\r
+ Halt the host controller.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort.\r
\r
- @return EFI_SUCCESS : The EHCI is halt\r
- @return EFI_TIMEOUT : Failed to halt the controller before Timeout\r
+ @retval EFI_SUCCESS The EHCI is halt.\r
+ @retval EFI_TIMEOUT Failed to halt the controller before Timeout.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Set the EHCI to run\r
+ Set the EHCI to run.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort.\r
\r
- @return EFI_SUCCESS : The EHCI is running\r
- @return Others : Failed to set the EHCI to run\r
+ @retval EFI_SUCCESS The EHCI is running.\r
+ @return Others Failed to set the EHCI to run.\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Initialize the HC hardware.\r
- EHCI spec lists the five things to do to initialize the hardware\r
+ EHCI spec lists the five things to do to initialize the hardware:\r
1. Program CTRLDSSEGMENT\r
2. Set USBINTR to enable interrupts\r
3. Set periodic list base\r
4. Set USBCMD, interrupt threshold, frame list size etc\r
5. Write 1 to CONFIGFLAG to route all ports to EHCI\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return EFI_SUCCESS : The EHCI has come out of halt state\r
- @return EFI_TIMEOUT : Time out happened\r
+ @return EFI_SUCCESS The EHCI has come out of halt state.\r
+ @return EFI_TIMEOUT Time out happened.\r
\r
**/\r
EFI_STATUS\r
/** @file\r
\r
+ This file contains the definination for host controller register operation routines.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciReg.h\r
-\r
-Abstract:\r
-\r
- This file contains the definination for host controller register operation routines\r
-\r
-Revision History\r
-\r
**/\r
\r
#ifndef _EFI_EHCI_REG_H_\r
#define _EFI_EHCI_REG_H_\r
\r
\r
-enum {\r
+typedef enum {\r
//\r
// Capability register offset\r
//\r
EHC_PCI_CLASSC = 0x09,\r
EHC_PCI_CLASSC_PI = 0x20,\r
EHC_BAR_INDEX = 0 /* how many bytes away from USB_BASE to 0x10 */\r
-};\r
+}EHCI_REGISTER_OFFSET;\r
\r
#define EHC_LINK_TERMINATED(Link) (((Link) & 0x01) != 0)\r
\r
} USB_CLASSC;\r
#pragma pack()\r
\r
+/**\r
+ Read EHCI capability register.\r
+\r
+ @param Ehc The EHCI device.\r
+ @param Offset Capability register address.\r
+\r
+ @return The register content.\r
\r
+**/\r
UINT32\r
EhcReadCapRegister (\r
IN USB2_HC_DEV *Ehc,\r
IN UINT32 Offset\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Read EHCI capability register\r
-\r
-Arguments:\r
-\r
- Ehc - The Ehc device\r
- Offset - Capability register address\r
-\r
-Returns:\r
-\r
- The register content read\r
-\r
---*/\r
;\r
\r
\r
/**\r
- Read Ehc Operation register\r
+ Read EHCI Operation register.\r
\r
- @param Ehc The EHCI device\r
- @param Offset The operation register offset\r
+ @param Ehc The EHCI device.\r
+ @param Offset The operation register offset.\r
\r
- @return The register content read\r
+ @return The register content.\r
\r
**/\r
UINT32\r
\r
\r
/**\r
- Write the data to the EHCI operation register\r
+ Write the data to the EHCI operation register.\r
\r
- @param Ehc The EHCI device\r
- @param Offset EHCI operation register offset\r
- @param Data The data to write\r
+ @param Ehc The EHCI device.\r
+ @param Offset EHCI operation register offset.\r
+ @param Data The data to write.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
/**\r
Add support for UEFI Over Legacy (UoL) feature, stop\r
- the legacy USB SMI support\r
+ the legacy USB SMI support.\r
\r
@param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
Set door bell and wait it to be ACKed by host controller.\r
This function is used to synchronize with the hardware.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout The time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout The time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : Synchronized with the hardware\r
- @return EFI_TIMEOUT : Time out happened while waiting door bell to set\r
+ @retval EFI_SUCCESS Synchronized with the hardware.\r
+ @retval EFI_TIMEOUT Time out happened while waiting door bell to set.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Clear all the interrutp status bits, these bits\r
- are Write-Clean\r
+ Clear all the interrutp status bits, these bits are Write-Clean.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Whether Ehc is halted\r
+ Whether Ehc is halted.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return TRUE : The controller is halted\r
- @return FALSE : It isn't halted\r
+ @retval TRUE The controller is halted.\r
+ @retval FALSE It isn't halted.\r
\r
**/\r
BOOLEAN\r
\r
\r
/**\r
- Whether system error occurred\r
+ Whether system error occurred.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return TRUE : System error happened\r
- @return FALSE : No system error\r
+ @retval TRUE System error happened.\r
+ @retval FALSE No system error.\r
\r
**/\r
BOOLEAN\r
;\r
\r
\r
-\r
/**\r
- Reset the host controller\r
+ Reset the host controller.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort (in millisecond, ms)\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort (in millisecond, ms).\r
\r
- @return EFI_SUCCESS : The host controller is reset\r
- @return Others : Failed to reset the host\r
+ @retval EFI_SUCCESS The host controller is reset.\r
+ @return Others Failed to reset the host.\r
\r
**/\r
EFI_STATUS\r
;\r
\r
\r
-\r
/**\r
- Halt the host controller\r
+ Halt the host controller.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort.\r
\r
- @return EFI_SUCCESS : The EHCI is halt\r
- @return EFI_TIMEOUT : Failed to halt the controller before Timeout\r
+ @return EFI_SUCCESS The EHCI is halt.\r
+ @return EFI_TIMEOUT Failed to halt the controller before Timeout.\r
\r
**/\r
EFI_STATUS\r
;\r
\r
\r
-\r
/**\r
- Set the EHCI to run\r
+ Set the EHCI to run.\r
\r
- @param Ehc The EHCI device\r
- @param Timeout Time to wait before abort\r
+ @param Ehc The EHCI device.\r
+ @param Timeout Time to wait before abort.\r
\r
- @return EFI_SUCCESS : The EHCI is running\r
- @return Others : Failed to set the EHCI to run\r
+ @return EFI_SUCCESS The EHCI is running.\r
+ @return Others Failed to set the EHCI to run.\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Initialize the HC hardware.\r
- EHCI spec lists the five things to do to initialize the hardware\r
+ EHCI spec lists the five things to do to initialize the hardware:\r
1. Program CTRLDSSEGMENT\r
2. Set USBINTR to enable interrupts\r
3. Set periodic list base\r
4. Set USBCMD, interrupt threshold, frame list size etc\r
5. Write 1 to CONFIGFLAG to route all ports to EHCI\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return EFI_SUCCESS : The EHCI has come out of halt state\r
- @return EFI_TIMEOUT : Time out happened\r
+ @return EFI_SUCCESS The EHCI has come out of halt state.\r
+ @return EFI_TIMEOUT Time out happened.\r
\r
**/\r
EFI_STATUS\r
/** @file\r
\r
+ EHCI transfer scheduling routines.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciSched.c\r
-\r
-Abstract:\r
-\r
- EHCI transfer scheduling routines\r
-\r
-Revision History\r
-\r
**/\r
\r
#include "Ehci.h"\r
\r
\r
/**\r
- Create helper QTD/QH for the EHCI device\r
+ Create helper QTD/QH for the EHCI device.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for helper QTD/QH\r
- @retval EFI_SUCCESS Helper QH/QTD are created\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for helper QTD/QH.\r
+ @retval EFI_SUCCESS Helper QH/QTD are created.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EhcCreateHelpQ (\r
IN USB2_HC_DEV *Ehc\r
}\r
\r
\r
-\r
/**\r
- Initialize the schedule data structure such as frame list\r
+ Initialize the schedule data structure such as frame list.\r
\r
- @param Ehc The EHCI device to init schedule data for\r
+ @param Ehc The EHCI device to init schedule data.\r
\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data\r
- @retval EFI_SUCCESS The schedule data is initialized\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data.\r
+ @retval EFI_SUCCESS The schedule data is initialized.\r
\r
**/\r
EFI_STATUS\r
}\r
\r
\r
-\r
/**\r
Free the schedule data. It may be partially initialized.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
}\r
\r
\r
-\r
/**\r
Link the queue head to the asynchronous schedule list.\r
UEFI only supports one CTRL/BULK transfer at a time\r
management: A reclamation header is always linked to\r
the AsyncListAddr, the only active QH is appended to it.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to link\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to link.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
/**\r
Unlink a queue head from the asynchronous schedule list.\r
- Need to synchronize with hardware\r
+ Need to synchronize with hardware.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to unlink\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to unlink.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
schedule frame list. This code is very much the same as\r
that in UHCI.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to link\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to link.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
/**\r
Unlink an interrupt queue head from the periodic\r
- schedule frame list\r
+ schedule frame list.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to unlink\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to unlink.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
}\r
\r
\r
-\r
/**\r
Check the URB's execution result and update the URB's\r
result accordingly.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to check result\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to check result.\r
\r
@return Whether the result of URB transfer is finialized.\r
\r
**/\r
-STATIC\r
BOOLEAN\r
EhcCheckUrbResult (\r
IN USB2_HC_DEV *Ehc,\r
/**\r
Execute the transfer by polling the URB. This is a synchronous operation.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to execute\r
- @param TimeOut The time to wait before abort, in millisecond.\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to execute.\r
+ @param TimeOut The time to wait before abort, in millisecond.\r
\r
- @return EFI_DEVICE_ERROR : The transfer failed due to transfer error\r
- @return EFI_TIMEOUT : The transfer failed due to time out\r
- @return EFI_SUCCESS : The transfer finished OK\r
+ @return EFI_DEVICE_ERROR The transfer failed due to transfer error.\r
+ @return EFI_TIMEOUT The transfer failed due to time out.\r
+ @return EFI_SUCCESS The transfer finished OK.\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Delete a single asynchronous interrupt transfer for\r
- the device and endpoint\r
+ the device and endpoint.\r
\r
- @param Ehc The EHCI device\r
- @param DevAddr The address of the target device\r
- @param EpNum The endpoint of the target\r
- @param DataToggle Return the next data toggle to use\r
+ @param Ehc The EHCI device.\r
+ @param DevAddr The address of the target device.\r
+ @param EpNum The endpoint of the target.\r
+ @param DataToggle Return the next data toggle to use.\r
\r
- @retval EFI_SUCCESS An asynchronous transfer is removed\r
- @retval EFI_NOT_FOUND No transfer for the device is found\r
+ @retval EFI_SUCCESS An asynchronous transfer is removed.\r
+ @retval EFI_NOT_FOUND No transfer for the device is found.\r
\r
**/\r
EFI_STATUS\r
URB *Urb;\r
EFI_USB_DATA_DIRECTION Direction;\r
\r
- Direction = ((EpNum & 0x80) ? EfiUsbDataIn : EfiUsbDataOut);\r
+ Direction = (((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut);\r
EpNum &= 0x0F;\r
\r
EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) {\r
\r
\r
/**\r
- Remove all the asynchronous interrutp transfers\r
+ Remove all the asynchronous interrutp transfers.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
}\r
}\r
\r
-STATIC\r
-EFI_STATUS\r
-EhcFlushAsyncIntMap (\r
- IN USB2_HC_DEV *Ehc,\r
- IN URB *Urb\r
- )\r
-/*++\r
-\r
-Routine Description:\r
\r
+/**\r
Flush data from PCI controller specific address to mapped system\r
memory address.\r
\r
-Arguments:\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to unmap.\r
\r
- Ehc - The EHCI device\r
- Urb - The URB to unmap\r
+ @retval EFI_SUCCESS Success to flush data to mapped system memory.\r
+ @retval EFI_DEVICE_ERROR Fail to flush data to mapped system memory.\r
\r
-Returns:\r
-\r
- EFI_SUCCESS - Success to flush data to mapped system memory\r
- EFI_DEVICE_ERROR - Fail to flush data to mapped system memory\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+EhcFlushAsyncIntMap (\r
+ IN USB2_HC_DEV *Ehc,\r
+ IN URB *Urb\r
+ )\r
{\r
EFI_STATUS Status;\r
EFI_PHYSICAL_ADDRESS PhyAddr;\r
}\r
\r
\r
-\r
/**\r
- Update the queue head for next round of asynchronous transfer\r
+ Update the queue head for next round of asynchronous transfer.\r
\r
- @param Urb The URB to update\r
+ @param Urb The URB to update.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
EhcUpdateAsyncRequest (\r
IN URB *Urb\r
\r
\r
/**\r
- Interrupt transfer periodic check handler\r
+ Interrupt transfer periodic check handler.\r
\r
- @param Event Interrupt event\r
- @param Context Pointer to USB2_HC_DEV\r
+ @param Event Interrupt event.\r
+ @param Context Pointer to USB2_HC_DEV.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
/** @file\r
\r
+ This file contains the definination for host controller schedule routines.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
+**/\r
\r
- EhciSched.h\r
+#ifndef _EFI_EHCI_SCHED_H_\r
+#define _EFI_EHCI_SCHED_H_\r
\r
-Abstract:\r
\r
- This file contains the definination for host controller schedule routines\r
+/**\r
+ Initialize the schedule data structure such as frame list.\r
\r
-Revision History\r
+ @param Ehc The EHCI device to init schedule data for.\r
\r
-**/\r
-\r
-#ifndef _EFI_EHCI_SCHED_H_\r
-#define _EFI_EHCI_SCHED_H_\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data.\r
+ @retval EFI_SUCCESS The schedule data is initialized.\r
\r
+**/\r
EFI_STATUS\r
EhcInitSched (\r
IN USB2_HC_DEV *Ehc\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Initialize the schedule data structure such as frame list\r
-\r
-Arguments:\r
-\r
- Ehc - The EHCI device to init schedule data for\r
-\r
-Returns:\r
-\r
- EFI_OUT_OF_RESOURCES - Failed to allocate resource to init schedule data\r
- EFI_SUCCESS - The schedule data is initialized\r
-\r
---*/\r
;\r
\r
\r
-\r
/**\r
Free the schedule data. It may be partially initialized.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
@return None\r
\r
;\r
\r
\r
-\r
/**\r
Link the queue head to the asynchronous schedule list.\r
UEFI only supports one CTRL/BULK transfer at a time\r
management: A reclamation header is always linked to\r
the AsyncListAddr, the only active QH is appended to it.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to link\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to link.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
/**\r
Unlink a queue head from the asynchronous schedule list.\r
- Need to synchronize with hardware\r
+ Need to synchronize with hardware.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to unlink\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to unlink.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
schedule frame list. This code is very much the same as\r
that in UHCI.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to link\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to link.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
/**\r
Unlink an interrupt queue head from the periodic\r
- schedule frame list\r
+ schedule frame list.\r
\r
- @param Ehc The EHCI device\r
- @param Qh The queue head to unlink\r
+ @param Ehc The EHCI device.\r
+ @param Qh The queue head to unlink.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
/**\r
Execute the transfer by polling the URB. This is a synchronous operation.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to execute\r
- @param TimeOut The time to wait before abort, in millisecond.\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to execute.\r
+ @param TimeOut The time to wait before abort, in millisecond.\r
\r
- @return EFI_DEVICE_ERROR : The transfer failed due to transfer error\r
- @return EFI_TIMEOUT : The transfer failed due to time out\r
- @return EFI_SUCCESS : The transfer finished OK\r
+ @retval EFI_DEVICE_ERROR The transfer failed due to transfer error.\r
+ @retval EFI_TIMEOUT The transfer failed due to time out.\r
+ @retval EFI_SUCCESS The transfer finished OK.\r
\r
**/\r
EFI_STATUS\r
\r
/**\r
Delete a single asynchronous interrupt transfer for\r
- the device and endpoint\r
+ the device and endpoint.\r
\r
- @param Ehc The EHCI device\r
- @param DevAddr The address of the target device\r
- @param EpNum The endpoint of the target\r
- @param DataToggle Return the next data toggle to use\r
+ @param Ehc The EHCI device.\r
+ @param DevAddr The address of the target device.\r
+ @param EpNum The endpoint of the target.\r
+ @param DataToggle Return the next data toggle to use.\r
\r
- @retval EFI_SUCCESS An asynchronous transfer is removed\r
- @retval EFI_NOT_FOUND No transfer for the device is found\r
+ @retval EFI_SUCCESS An asynchronous transfer is removed.\r
+ @retval EFI_NOT_FOUND No transfer for the device is found.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Remove all the asynchronous interrutp transfers\r
+ Remove all the asynchronous interrutp transfers.\r
\r
- @param Ehc The EHCI device\r
+ @param Ehc The EHCI device.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
;\r
\r
\r
-\r
/**\r
- Interrupt transfer periodic check handler\r
+ Interrupt transfer periodic check handler.\r
\r
- @param Event Interrupt event\r
- @param Context Pointer to USB2_HC_DEV\r
+ @param Event Interrupt event.\r
+ @param Context Pointer to USB2_HC_DEV.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
/** @file\r
\r
+ This file contains URB request, each request is warpped in a\r
+ URB (Usb Request Block).\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciUrb.c\r
-\r
-Abstract:\r
-\r
- This file contains URB request, each request is warpped in a\r
- URB (Usb Request Block)\r
-\r
-Revision History\r
-\r
**/\r
\r
#include "Ehci.h"\r
\r
\r
/**\r
- Create a single QTD to hold the data\r
+ Create a single QTD to hold the data.\r
\r
- @param Ehc The EHCI device\r
- @param Data Current data not associated with a QTD\r
- @param DataLen The length of the data\r
- @param PktId Packet ID to use in the QTD\r
- @param Toggle Data toggle to use in the QTD\r
- @param MaxPacket Maximu packet length of the endpoint\r
+ @param Ehc The EHCI device.\r
+ @param Data Current data not associated with a QTD.\r
+ @param DataLen The length of the data.\r
+ @param PktId Packet ID to use in the QTD.\r
+ @param Toggle Data toggle to use in the QTD.\r
+ @param MaxPacket Maximu packet length of the endpoint.\r
\r
- @return Created QTD or NULL if failed to create one\r
+ @return Created QTD or NULL if failed to create one.\r
\r
**/\r
EHC_QTD *\r
2. Microframe S-mask\r
3. Microframe C-mask\r
\r
- @param Ep The queue head's related endpoint\r
- @param QhHw The queue head to initialize\r
+ @param Ep The queue head's related endpoint.\r
+ @param QhHw The queue head to initialize.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
EhcInitIntQh (\r
IN USB_ENDPOINT *Ep,\r
\r
\r
/**\r
- Allocate and initialize a EHCI queue head\r
+ Allocate and initialize a EHCI queue head.\r
\r
- @param Ehci The EHCI device\r
- @param Ep The endpoint to create queue head for\r
+ @param Ehci The EHCI device.\r
+ @param Ep The endpoint to create queue head for.\r
\r
- @return Created queue head or NULL if failed to create one\r
+ @return Created queue head or NULL if failed to create one.\r
\r
**/\r
EHC_QH *\r
}\r
\r
\r
-\r
/**\r
Convert the poll interval from application to that\r
be used by EHCI interface data structure. Only need\r
to get the max 2^n that is less than interval. UEFI\r
can't support high speed endpoint with a interval less\r
than 8 microframe because interval is specified in\r
- the unit of ms (millisecond)\r
+ the unit of ms (millisecond).\r
\r
- @param Interval The interval to convert\r
+ @param Interval The interval to convert.\r
\r
- @return The converted interval\r
+ @return The converted interval.\r
\r
**/\r
-STATIC\r
UINTN\r
EhcConvertPollRate (\r
IN UINTN Interval\r
}\r
\r
\r
-\r
/**\r
- Free a list of QTDs\r
+ Free a list of QTDs.\r
\r
- @param Ehc The EHCI device\r
- @param Qtds The list head of the QTD\r
+ @param Ehc The EHCI device.\r
+ @param Qtds The list head of the QTD.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
EhcFreeQtds (\r
IN USB2_HC_DEV *Ehc,\r
/**\r
Free an allocated URB. It is possible for it to be partially inited.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to free\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to free.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
}\r
\r
\r
-\r
/**\r
- Create a list of QTDs for the URB\r
+ Create a list of QTDs for the URB.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to create QTDs for\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to create QTDs for.\r
\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for QTD\r
- @retval EFI_SUCCESS The QTDs are allocated for the URB\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for QTD.\r
+ @retval EFI_SUCCESS The QTDs are allocated for the URB.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EhcCreateQtds (\r
IN USB2_HC_DEV *Ehc,\r
\r
\r
/**\r
- Create a new URB and its associated QTD\r
-\r
- @param Ehc The EHCI device\r
- @param DevAddr The device address\r
- @param EpAddr Endpoint addrress & its direction\r
- @param DevSpeed The device speed\r
- @param Toggle Initial data toggle to use\r
- @param MaxPacket The max packet length of the endpoint\r
- @param Hub The transaction translator to use\r
- @param Type The transaction type\r
- @param Request The standard USB request for control transfer\r
- @param Data The user data to transfer\r
- @param DataLen The length of data buffer\r
- @param Callback The function to call when data is transferred\r
- @param Context The context to the callback\r
- @param Interval The interval for interrupt transfer\r
-\r
- @return Created URB or NULL\r
+ Create a new URB and its associated QTD.\r
+\r
+ @param Ehc The EHCI device.\r
+ @param DevAddr The device address.\r
+ @param EpAddr Endpoint addrress & its direction.\r
+ @param DevSpeed The device speed.\r
+ @param Toggle Initial data toggle to use.\r
+ @param MaxPacket The max packet length of the endpoint.\r
+ @param Hub The transaction translator to use.\r
+ @param Type The transaction type.\r
+ @param Request The standard USB request for control transfer.\r
+ @param Data The user data to transfer.\r
+ @param DataLen The length of data buffer.\r
+ @param Callback The function to call when data is transferred.\r
+ @param Context The context to the callback.\r
+ @param Interval The interval for interrupt transfer.\r
+\r
+ @return Created URB or NULL.\r
\r
**/\r
URB *\r
Ep = &Urb->Ep;\r
Ep->DevAddr = DevAddr;\r
Ep->EpAddr = (UINT8) (EpAddr & 0x0F);\r
- Ep->Direction = ((EpAddr & 0x80) ? EfiUsbDataIn : EfiUsbDataOut);\r
+ Ep->Direction = (((EpAddr & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut);\r
Ep->DevSpeed = DevSpeed;\r
Ep->MaxPacket = MaxPacket;\r
\r
/** @file\r
\r
+ This file contains URB request, each request is warpped in a\r
+ URB (Usb Request Block).\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciUrb.h\r
-\r
-Abstract:\r
-\r
- This file contains URB request, each request is warpped in a\r
- URB (Usb Request Block)\r
-\r
-Revision History\r
-\r
**/\r
\r
#ifndef _EFI_EHCI_URB_H_\r
typedef struct _EHC_QH EHC_QH;\r
typedef struct _URB URB;\r
\r
-enum {\r
+typedef enum {\r
//\r
// Transfer types, used in URB to identify the transfer type\r
//\r
QH_MICROFRAME_7 = 0x80,\r
\r
USB_ERR_SHORT_PACKET = 0x200\r
-};\r
+}EHCI_URB_FLAG_VALUE;\r
\r
//\r
// Fill in the hardware link point: pass in a EHC_QH/QH_HW\r
\r
\r
/**\r
- Create a single QTD to hold the data\r
+ Create a single QTD to hold the data.\r
\r
- @param Ehc The EHCI device\r
- @param Data Current data not associated with a QTD\r
- @param DataLen The length of the data\r
- @param PktId Packet ID to use in the QTD\r
- @param Toggle Data toggle to use in the QTD\r
- @param MaxPacket Maximu packet length of the endpoint\r
+ @param Ehc The EHCI device.\r
+ @param Data Current data not associated with a QTD.\r
+ @param DataLen The length of the data.\r
+ @param PktId Packet ID to use in the QTD.\r
+ @param Toggle Data toggle to use in the QTD.\r
+ @param MaxPacket Maximu packet length of the endpoint.\r
\r
- @return Created QTD or NULL if failed to create one\r
+ @return Created QTD or NULL if failed to create one.\r
\r
**/\r
EHC_QTD *\r
\r
\r
/**\r
- Allocate and initialize a EHCI queue head\r
+ Allocate and initialize a EHCI queue head.\r
\r
- @param Ehci The EHCI device\r
- @param Ep The endpoint to create queue head for\r
+ @param Ehci The EHCI device.\r
+ @param Ep The endpoint to create queue head for.\r
\r
- @return Created queue head or NULL if failed to create one\r
+ @return Created queue head or NULL if failed to create one.\r
\r
**/\r
EHC_QH *\r
/**\r
Free an allocated URB. It is possible for it to be partially inited.\r
\r
- @param Ehc The EHCI device\r
- @param Urb The URB to free\r
+ @param Ehc The EHCI device.\r
+ @param Urb The URB to free.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
VOID\r
\r
\r
/**\r
- Create a new URB and its associated QTD\r
-\r
- @param Ehc The EHCI device\r
- @param DevAddr The device address\r
- @param EpAddr Endpoint addrress & its direction\r
- @param DevSpeed The device speed\r
- @param Toggle Initial data toggle to use\r
- @param MaxPacket The max packet length of the endpoint\r
- @param Hub The transaction translator to use\r
- @param Type The transaction type\r
- @param Request The standard USB request for control transfer\r
- @param Data The user data to transfer\r
- @param DataLen The length of data buffer\r
- @param Callback The function to call when data is transferred\r
- @param Context The context to the callback\r
- @param Interval The interval for interrupt transfer\r
-\r
- @return Created URB or NULL\r
+ Create a new URB and its associated QTD.\r
+\r
+ @param Ehc The EHCI device.\r
+ @param DevAddr The device address.\r
+ @param EpAddr Endpoint addrress & its direction.\r
+ @param DevSpeed The device speed.\r
+ @param Toggle Initial data toggle to use.\r
+ @param MaxPacket The max packet length of the endpoint.\r
+ @param Hub The transaction translator to use.\r
+ @param Type The transaction type.\r
+ @param Request The standard USB request for control transfer.\r
+ @param Data The user data to transfer.\r
+ @param DataLen The length of data buffer.\r
+ @param Callback The function to call when data is transferred.\r
+ @param Context The context to the callback.\r
+ @param Interval The interval for interrupt transfer.\r
+\r
+ @return Created URB or NULL.\r
\r
**/\r
URB *\r
/** @file\r
\r
+ Routine procedures for memory allocate/free.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciMem.c\r
-\r
-Abstract:\r
-\r
-\r
-Revision History\r
-\r
**/\r
\r
\r
\r
\r
/**\r
- Allocate a block of memory to be used by the buffer pool\r
+ Allocate a block of memory to be used by the buffer pool.\r
\r
- @param Pool The buffer pool to allocate memory for\r
- @param Pages How many pages to allocate\r
+ @param Pool The buffer pool to allocate memory for.\r
+ @param Pages How many pages to allocate.\r
\r
- @return The allocated memory block or NULL if failed\r
+ @return The allocated memory block or NULL if failed.\r
\r
**/\r
-STATIC\r
USBHC_MEM_BLOCK *\r
UsbHcAllocMemBlock (\r
IN USBHC_MEM_POOL *Pool,\r
\r
\r
/**\r
- Free the memory block from the memory pool\r
+ Free the memory block from the memory pool.\r
\r
- @param Pool The memory pool to free the block from\r
- @param Block The memory block to free\r
+ @param Pool The memory pool to free the block from.\r
+ @param Block The memory block to free.\r
\r
- @return VOID\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbHcFreeMemBlock (\r
IN USBHC_MEM_POOL *Pool,\r
\r
\r
/**\r
- Alloc some memory from the block\r
+ Alloc some memory from the block.\r
\r
- @param Block The memory block to allocate memory from\r
- @param Mem The variable to store the memory allocated\r
- @param Units Number of memory units to allocate\r
+ @param Block The memory block to allocate memory from.\r
+ @param Units Number of memory units to allocate.\r
\r
- @return EFI_SUCCESS : The needed memory is allocated\r
- @return EFI_NOT_FOUND : Can't find the free memory\r
+ @return The pointer to the allocated memory. If couldn't allocate the needed memory,\r
+ the return value is NULL.\r
\r
**/\r
-STATIC\r
VOID *\r
UsbHcAllocMemFromBlock (\r
IN USBHC_MEM_BLOCK *Block,\r
\r
\r
/**\r
- Insert the memory block to the pool's list of the blocks\r
+ Insert the memory block to the pool's list of the blocks.\r
\r
- @param Head The head of the memory pool's block list\r
- @param Block The memory block to insert\r
+ @param Head The head of the memory pool's block list.\r
+ @param Block The memory block to insert.\r
\r
- @return VOID\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbHcInsertMemBlockToPool (\r
IN USBHC_MEM_BLOCK *Head,\r
/**\r
Is the memory block empty?\r
\r
- @param Block The memory block to check\r
+ @param Block The memory block to check.\r
\r
- @return TRUE : The memory block is empty\r
- @return FALSE : The memory block isn't empty\r
+ @retval TRUE The memory block is empty.\r
+ @retval FALSE The memory block isn't empty.\r
\r
**/\r
-STATIC\r
BOOLEAN\r
UsbHcIsMemBlockEmpty (\r
IN USBHC_MEM_BLOCK *Block\r
\r
\r
/**\r
- Unlink the memory block from the pool's list\r
+ Unlink the memory block from the pool's list.\r
\r
- @param Head The block list head of the memory's pool\r
+ @param Head The block list head of the memory's pool.\r
@param BlockToUnlink The memory block to unlink.\r
\r
- @return VOID\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbHcUnlinkMemBlock (\r
IN USBHC_MEM_BLOCK *Head,\r
\r
\r
/**\r
- Initialize the memory management pool for the host controller\r
+ Initialize the memory management pool for the host controller.\r
\r
- @param Pool The USB memory pool to initialize\r
- @param PciIo The PciIo that can be used to access the host controller\r
- @param Check4G Whether the host controller requires allocated memory\r
- from one 4G address space.\r
- @param Which4G The 4G memory area each memory allocated should be from\r
+ @param PciIo The PciIo that can be used to access the host controller.\r
+ @param Check4G Whether the host controller requires allocated memory\r
+ from one 4G address space.\r
+ @param Which4G The 4G memory area each memory allocated should be from.\r
\r
- @return EFI_SUCCESS : The memory pool is initialized\r
- @return EFI_OUT_OF_RESOURCE : Fail to init the memory pool\r
+ @retval EFI_SUCCESS The memory pool is initialized.\r
+ @retval EFI_OUT_OF_RESOURCE Fail to init the memory pool.\r
\r
**/\r
USBHC_MEM_POOL *\r
\r
\r
/**\r
- Release the memory management pool\r
+ Release the memory management pool.\r
\r
- @param Pool The USB memory pool to free\r
+ @param Pool The USB memory pool to free.\r
\r
- @return EFI_SUCCESS : The memory pool is freed\r
- @return EFI_DEVICE_ERROR : Failed to free the memory pool\r
+ @retval EFI_SUCCESS The memory pool is freed.\r
+ @retval EFI_DEVICE_ERROR Failed to free the memory pool.\r
\r
**/\r
EFI_STATUS\r
Allocate some memory from the host controller's memory pool\r
which can be used to communicate with host controller.\r
\r
- @param Pool The host controller's memory pool\r
- @param Size Size of the memory to allocate\r
+ @param Pool The host controller's memory pool.\r
+ @param Size Size of the memory to allocate.\r
\r
- @return The allocated memory or NULL\r
+ @return The allocated memory or NULL.\r
\r
**/\r
VOID *\r
\r
\r
/**\r
- Free the allocated memory back to the memory pool\r
+ Free the allocated memory back to the memory pool.\r
\r
- @param Pool The memory pool of the host controller\r
- @param Mem The memory to free\r
- @param Size The size of the memory to free\r
+ @param Pool The memory pool of the host controller.\r
+ @param Mem The memory to free.\r
+ @param Size The size of the memory to free.\r
\r
- @return VOID\r
+ @return None.\r
\r
**/\r
VOID\r
/** @file\r
\r
+ This file contains the definination for host controller memory management routines.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- EhciMem.h\r
-\r
-Abstract:\r
-\r
- This file contains the definination for host controller memory management routines\r
-\r
-Revision History\r
-\r
**/\r
\r
#ifndef _EFI_EHCI_MEM_H_\r
USBHC_MEM_BLOCK *Head;\r
} USBHC_MEM_POOL;\r
\r
-enum {\r
+typedef enum {\r
USBHC_MEM_UNIT = 64, // Memory allocation unit, must be 2^n, n>4\r
\r
USBHC_MEM_UNIT_MASK = USBHC_MEM_UNIT - 1,\r
USBHC_MEM_DEFAULT_PAGES = 16\r
-};\r
+} USBHC_MEM_UNIT_DATA;\r
\r
#define USBHC_MEM_ROUND(Len) (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC_MEM_UNIT_MASK))\r
\r
\r
\r
\r
+/**\r
+ Initialize the memory management pool for the host controller.\r
+\r
+ @param PciIo The PciIo that can be used to access the host controller.\r
+ @param Check4G Whether the host controller requires allocated memory\r
+ from one 4G address space.\r
+ @param Which4G The 4G memory area each memory allocated should be from.\r
+\r
+ @retval EFI_SUCCESS The memory pool is initialized.\r
+ @retval EFI_OUT_OF_RESOURCE Fail to init the memory pool.\r
+\r
+**/\r
USBHC_MEM_POOL *\r
UsbHcInitMemPool (\r
IN EFI_PCI_IO_PROTOCOL *PciIo,\r
IN BOOLEAN Check4G,\r
IN UINT32 Which4G\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Initialize the memory management pool for the host controller\r
-\r
-Arguments:\r
-\r
- Pool - The USB memory pool to initialize\r
- PciIo - The PciIo that can be used to access the host controller\r
- Check4G - Whether the host controller requires allocated memory\r
- from one 4G address space.\r
- Which4G - The 4G memory area each memory allocated should be from\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS : The memory pool is initialized\r
- EFI_OUT_OF_RESOURCE : Fail to init the memory pool\r
-\r
---*/\r
;\r
\r
\r
-\r
/**\r
- Release the memory management pool\r
+ Release the memory management pool.\r
\r
- @param Pool The USB memory pool to free\r
+ @param Pool The USB memory pool to free.\r
\r
- @return EFI_SUCCESS : The memory pool is freed\r
- @return EFI_DEVICE_ERROR : Failed to free the memory pool\r
+ @retval EFI_SUCCESS The memory pool is freed.\r
+ @retval EFI_DEVICE_ERROR Failed to free the memory pool.\r
\r
**/\r
EFI_STATUS\r
;\r
\r
\r
-\r
/**\r
Allocate some memory from the host controller's memory pool\r
which can be used to communicate with host controller.\r
\r
- @param Pool The host controller's memory pool\r
- @param Size Size of the memory to allocate\r
+ @param Pool The host controller's memory pool.\r
+ @param Size Size of the memory to allocate.\r
\r
- @return The allocated memory or NULL\r
+ @return The allocated memory or NULL.\r
\r
**/\r
VOID *\r
;\r
\r
\r
-\r
/**\r
- Free the allocated memory back to the memory pool\r
+ Free the allocated memory back to the memory pool.\r
\r
- @param Pool The memory pool of the host controller\r
- @param Mem The memory to free\r
- @param Size The size of the memory to free\r
+ @param Pool The memory pool of the host controller.\r
+ @param Mem The memory to free.\r
+ @param Size The size of the memory to free.\r
\r
- @return VOID\r
+ @return None.\r
\r
**/\r
VOID\r