\r
EHCI transfer scheduling routines.\r
\r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
BOOLEAN InfiniteLoop;\r
\r
Status = EFI_SUCCESS;\r
- Loop = (TimeOut * EHC_1_MILLISECOND / EHC_SYNC_POLL_INTERVAL) + 1;\r
+ Loop = TimeOut * EHC_1_MILLISECOND;\r
Finished = FALSE;\r
InfiniteLoop = FALSE;\r
\r
break;\r
}\r
\r
- gBS->Stall (EHC_SYNC_POLL_INTERVAL);\r
+ gBS->Stall (EHC_1_MICROSECOND);\r
}\r
\r
if (!Finished) {\r
PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid\r
which is used to enable recovery function from USB Drivers.\r
\r
-Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
the subsequent bulk transfer.\r
@param TimeOut Indicates the maximum time, in millisecond, which the\r
transfer is allowed to complete.\r
+ If Timeout is 0, then the caller must wait for the function\r
+ to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\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
@param Data Data buffer to be transmitted or received from USB device.\r
@param DataLength The size (in bytes) of the data buffer.\r
@param TimeOut Indicates the maximum timeout, in millisecond.\r
+ If Timeout is 0, then the caller must wait for the function\r
+ to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
@param Translator Transaction translator to be used by this device.\r
@param TransferResult Return the result of this control transfer.\r
\r
PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid\r
which is used to enable recovery function from USB Drivers.\r
\r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
UINTN Index;\r
UINTN Loop;\r
BOOLEAN Finished;\r
+ BOOLEAN InfiniteLoop;\r
\r
Status = EFI_SUCCESS;\r
- Loop = (TimeOut * EHC_1_MILLISECOND / EHC_SYNC_POLL_INTERVAL) + 1;\r
- Finished = FALSE;\r
+ Loop = TimeOut * EHC_1_MILLISECOND;\r
+ Finished = FALSE;\r
+ InfiniteLoop = FALSE;\r
\r
- for (Index = 0; Index < Loop; Index++) {\r
+ //\r
+ // If Timeout is 0, then the caller must wait for the function to be completed\r
+ // until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
+ //\r
+ if (TimeOut == 0) {\r
+ InfiniteLoop = TRUE;\r
+ }\r
+\r
+ for (Index = 0; InfiniteLoop || (Index < Loop); Index++) {\r
Finished = EhcCheckUrbResult (Ehc, Urb);\r
\r
if (Finished) {\r
break;\r
}\r
\r
- MicroSecondDelay (EHC_SYNC_POLL_INTERVAL);\r
+ MicroSecondDelay (EHC_1_MICROSECOND);\r
}\r
\r
if (!Finished) {\r
\r
The EHCI register operation routines.\r
\r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
Finished = FALSE;\r
Status = EFI_SUCCESS;\r
- Delay = (TimeOut * UHC_1_MILLISECOND / UHC_SYNC_POLL_INTERVAL) + 1;\r
+ Delay = TimeOut * UHC_1_MILLISECOND;\r
InfiniteLoop = FALSE;\r
\r
//\r
break;\r
}\r
\r
- gBS->Stall (UHC_SYNC_POLL_INTERVAL);\r
+ gBS->Stall (UHC_1_MICROSECOND);\r
}\r
\r
if (!Finished) {\r
PEIM to produce gPeiUsbHostControllerPpiGuid based on gPeiUsbControllerPpiGuid\r
which is used to enable recovery function from USB Drivers.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved. <BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
@param Data Data buffer to be transmitted or received from USB device.\r
@param DataLength The size (in bytes) of the data buffer.\r
@param TimeOut Indicates the maximum timeout, in millisecond.\r
+ If Timeout is 0, then the caller must wait for the function\r
+ to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
@param TransferResult Return the result of this control transfer.\r
\r
@retval EFI_SUCCESS Transfer was completed successfully.\r
the subsequent bulk transfer.\r
@param TimeOut Indicates the maximum time, in millisecond, which the\r
transfer is allowed to complete.\r
+ If Timeout is 0, then the caller must wait for the function\r
+ to be completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
@param TransferResult A pointer to the detailed result information of the\r
bulk transfer.\r
\r
{\r
UINTN ErrTDPos;\r
UINTN Delay;\r
+ BOOLEAN InfiniteLoop;\r
\r
ErrTDPos = 0;\r
*TransferResult = EFI_USB_NOERROR;\r
*ActualLen = 0;\r
+ InfiniteLoop = FALSE;\r
\r
- Delay = (TimeOut * STALL_1_MILLI_SECOND / 200) + 1;\r
+ Delay = TimeOut * STALL_1_MILLI_SECOND;\r
+ //\r
+ // If Timeout is 0, then the caller must wait for the function to be completed\r
+ // until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
+ //\r
+ if (TimeOut == 0) {\r
+ InfiniteLoop = TRUE;\r
+ }\r
\r
do {\r
\r
if ((*TransferResult & EFI_USB_ERR_NOTEXECUTE) != EFI_USB_ERR_NOTEXECUTE) {\r
break;\r
}\r
- MicroSecondDelay (200);\r
+ MicroSecondDelay (STALL_1_MICRO_SECOND);\r
Delay--;\r
\r
- } while (Delay != 0);\r
-\r
+ } while (InfiniteLoop || (Delay != 0));\r
\r
if (*TransferResult != EFI_USB_NOERROR) {\r
return EFI_DEVICE_ERROR;\r
UINTN ErrTDPos;\r
UINTN ScrollNum;\r
UINTN Delay;\r
+ BOOLEAN InfiniteLoop;\r
\r
ErrTDPos = 0;\r
*TransferResult = EFI_USB_NOERROR;\r
*ActualLen = 0;\r
+ InfiniteLoop = FALSE;\r
\r
- Delay = (TimeOut * STALL_1_MILLI_SECOND / 200) + 1;\r
+ Delay = TimeOut * STALL_1_MILLI_SECOND;\r
+ //\r
+ // If Timeout is 0, then the caller must wait for the function to be completed\r
+ // until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
+ //\r
+ if (TimeOut == 0) {\r
+ InfiniteLoop = TRUE;\r
+ }\r
\r
do {\r
\r
if ((*TransferResult & EFI_USB_ERR_NOTEXECUTE) != EFI_USB_ERR_NOTEXECUTE) {\r
break;\r
}\r
- MicroSecondDelay (200);\r
+ MicroSecondDelay (STALL_1_MICRO_SECOND);\r
Delay--;\r
\r
- } while (Delay != 0);\r
+ } while (InfiniteLoop || (Delay != 0));\r
\r
//\r
// has error\r
/** @file\r
Private Header file for Usb Host Controller PEIM\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
#define OUTPUT_PACKET_ID 0xE1\r
#define ERROR_PACKET_ID 0x55\r
\r
+#define STALL_1_MICRO_SECOND 1\r
#define STALL_1_MILLI_SECOND 1000\r
\r
\r
\r
Provides some data structure definitions used by the XHCI host controller driver.\r
\r
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include "XhciSched.h"\r
#include "ComponentName.h"\r
\r
+//\r
+// The unit is microsecond, setting it as 1us.\r
+//\r
+#define XHC_1_MICROSECOND (1)\r
//\r
// Convert millisecond to microsecond.\r
//\r
\r
XHCI transfer scheduling routines.\r
\r
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
}\r
\r
Status = EFI_SUCCESS;\r
- Loop = (Timeout * XHC_1_MILLISECOND / XHC_POLL_DELAY) + 1;\r
+ Loop = Timeout * XHC_1_MILLISECOND;\r
if (Timeout == 0) {\r
Loop = 0xFFFFFFFF;\r
}\r
if (Urb->Finished) {\r
break;\r
}\r
- gBS->Stall (XHC_POLL_DELAY);\r
+ gBS->Stall (XHC_1_MICROSECOND);\r
}\r
\r
if (Index == Loop) {\r
/** @file\r
The module is used to implement Usb Io PPI interfaces.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved. <BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
@param This The pointer of PEI_USB_IO_PPI.\r
@param Request USB device request to send.\r
@param Direction Specifies the data direction for the data stage.\r
- @param Timeout Indicates the maximum timeout, in millisecond.\r
+ @param Timeout Indicates the maximum timeout, in millisecond. If Timeout\r
+ is 0, then the caller must wait for the function to be\r
+ completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
@param Data Data buffer to be transmitted or received from USB device.\r
@param DataLength The size (in bytes) of the data buffer.\r
\r
from or receive into.\r
@param DataLength The lenght of the data buffer.\r
@param Timeout Indicates the maximum time, in millisecond, which the\r
- transfer is allowed to complete.\r
+ transfer is allowed to complete. If Timeout is 0, then\r
+ the caller must wait for the function to be completed\r
+ until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\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
/** @file\r
Usb Peim definition.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved. <BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
@param This The pointer of PEI_USB_IO_PPI.\r
@param Request USB device request to send.\r
@param Direction Specifies the data direction for the data stage.\r
- @param Timeout Indicates the maximum timeout, in millisecond.\r
+ @param Timeout Indicates the maximum timeout, in millisecond. If Timeout\r
+ is 0, then the caller must wait for the function to be\r
+ completed until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
@param Data Data buffer to be transmitted or received from USB device.\r
@param DataLength The size (in bytes) of the data buffer.\r
\r
from or receive into.\r
@param DataLength The lenght of the data buffer.\r
@param Timeout Indicates the maximum time, in millisecond, which the\r
- transfer is allowed to complete.\r
+ transfer is allowed to complete. If Timeout is 0, then\r
+ the caller must wait for the function to be completed\r
+ until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\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
Refer to section 16.1 of the UEFI 2.3 Specification for more information on \r
these interfaces.\r
\r
-Copyright (c) 2010, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved. <BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
actually transferred.\r
@param[in] TimeOut Indicates the maximum time, in milliseconds, \r
that the transfer is allowed to complete.\r
+ If Timeout is 0, then the caller must wait for\r
+ the function to be completed until EFI_SUCCESS\r
+ or EFI_DEVICE_ERROR is returned.\r
@param[in] Translator A pointer to the transaction translator data.\r
@param[out] TransferResult A pointer to the detailed result information \r
generated by this control transfer.\r
@param[in,out] DataToggle A pointer to the data toggle value.\r
@param[in] TimeOut Indicates the maximum time, in milliseconds,\r
in which the transfer is allowed to complete.\r
+ If Timeout is 0, then the caller must wait for\r
+ the function to be completed until EFI_SUCCESS\r
+ or EFI_DEVICE_ERROR is returned.\r
@param[in] Translator A pointer to the transaction translator data.\r
@param[out] TransferResult A pointer to the detailed result information \r
of the bulk transfer.\r
Refer to section 16.1 of the UEFI 2.3 Specification for more information on \r
these interfaces.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
On output, indicates the amount of data \r
actually transferred.\r
@param[in] TimeOut Indicates the maximum time, in milliseconds, \r
- that the transfer is allowed to complete.\r
+ that the transfer is allowed to complete. \r
+ If Timeout is 0, then the caller must wait for\r
+ the function to be completed until EFI_SUCCESS\r
+ or EFI_DEVICE_ERROR is returned.\r
@param[out] TransferResult A pointer to the detailed result information \r
generated by this control transfer.\r
\r
@param[in,out] DataToggle A pointer to the data toggle value.\r
@param[in] TimeOut Indicates the maximum time, in milliseconds,\r
in which the transfer is allowed to complete.\r
+ If Timeout is 0, then the caller must wait for\r
+ the function to be completed until EFI_SUCCESS\r
+ or EFI_DEVICE_ERROR is returned.\r
@param[out] TransferResult A pointer to the detailed result information \r
of the bulk transfer.\r
\r
Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on \r
these interfaces.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
@param[in] Direction Specifies the data direction for the transfer. There \r
are three values available: \r
EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
- @param[in] TimeOut Indicates the maximum time, in milliseconds, that \r
+ @param[in] Timeout Indicates the maximum time, in milliseconds, that \r
the transfer is allowed to complete.\r
+ If Timeout is 0, then the caller must wait for the\r
+ function to be completed until EFI_SUCCESS or\r
+ EFI_DEVICE_ERROR is returned.\r
@param[in,out] Data A pointer to the buffer of data that will be \r
transmitted to or received from the USB device.\r
@param[in] DataLength On input, indicates the size, in bytes, of the data \r
\r
@param[in] PeiServices The pointer to the PEI Services Table.\r
@param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
- @param[in] EndPointAddress The endpoint address.\r
+ @param[in] DeviceEndpoint The endpoint address.\r
@param[in] Data The data buffer to be transfered.\r
@param[in] DataLength The length of data buffer.\r
- @param[in] TimeOut The timeout for the transfer, in milliseconds.\r
+ @param[in] Timeout The timeout for the transfer, in milliseconds.\r
+ If Timeout is 0, then the caller must wait for the\r
+ function to be completed until EFI_SUCCESS or\r
+ EFI_DEVICE_ERROR is returned.\r
\r
@retval EFI_SUCCESS The bulk transfer completed successfully.\r
@retval EFI_INVALID_PARAMETER Some parameters are invalid.\r