]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
MdeModulePkg: Change OPTIONAL keyword usage style
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbBus.h
index f6e323239a46fe5223c2c983e2b5b83a1dc21311..40bc5f130e03f5354f0f8b82de6a17b51fb4e007 100644 (file)
@@ -2,14 +2,8 @@
 \r
     Usb Bus Driver Binding and Bus IO Protocol.\r
 \r
-Copyright (c) 2004 - 2011, 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
-http://opensource.org/licenses/bsd-license.php\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
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -60,10 +54,10 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 \r
 //\r
 // Roothub and hub's polling interval, set by experience,\r
-// The unit of roothub is 100us, means 1s as interval, and\r
+// The unit of roothub is 100us, means 100ms as interval, and\r
 // the unit of hub is 1ms, means 64ms as interval.\r
 //\r
-#define USB_ROOTHUB_POLL_INTERVAL (1000 * 10000U)\r
+#define USB_ROOTHUB_POLL_INTERVAL (100 * 10000U)\r
 #define USB_HUB_POLL_INTERVAL     64\r
 \r
 //\r
@@ -75,13 +69,13 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 //\r
 // Wait for port statue reg change, set by experience\r
 //\r
-#define USB_WAIT_PORT_STS_CHANGE_STALL (5 * USB_BUS_1_MILLISECOND)\r
+#define USB_WAIT_PORT_STS_CHANGE_STALL (100)\r
 \r
 //\r
 // Wait for set device address, refers to specification\r
 // [USB20-9.2.6.3, it says 2ms]\r
 //\r
-#define USB_SET_DEVICE_ADDRESS_STALL   (20 * USB_BUS_1_MILLISECOND)\r
+#define USB_SET_DEVICE_ADDRESS_STALL   (2 * USB_BUS_1_MILLISECOND)\r
 \r
 //\r
 // Wait for retry max packet size, set by experience\r
@@ -99,9 +93,18 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 // [USB20-7.1.7.5, it says 10ms for hub and 50ms for\r
 // root hub]\r
 //\r
+// According to USB2.0, Chapter 11.5.1.5 Resetting,\r
+// the worst case for TDRST is 20ms\r
+//\r
 #define USB_SET_PORT_RESET_STALL       (20 * USB_BUS_1_MILLISECOND)\r
 #define USB_SET_ROOT_PORT_RESET_STALL  (50 * USB_BUS_1_MILLISECOND)\r
 \r
+//\r
+// Wait for port recovery to accept SetAddress, refers to specification\r
+// [USB20-7.1.7.5, it says 10 ms for TRSTRCY]\r
+//\r
+#define USB_SET_PORT_RECOVERY_STALL    (10 * USB_BUS_1_MILLISECOND)\r
+\r
 //\r
 // Wait for clear roothub port reset, set by experience\r
 //\r
@@ -114,12 +117,12 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 \r
 //\r
 // Send general device request timeout.\r
-// \r
+//\r
 // The USB Specification 2.0, section 11.24.1 recommends a value of\r
-// 50 milliseconds.  We use a value of 100 milliseconds to work\r
+// 50 milliseconds.  We use a value of 500 milliseconds to work\r
 // around slower hubs and devices.\r
 //\r
-#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 100\r
+#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 500\r
 \r
 //\r
 // Send clear feature request timeout, set by experience\r
@@ -156,7 +159,7 @@ typedef struct _EFI_USB_BUS_PROTOCOL {
 \r
 //\r
 // Stands for the real USB device. Each device may\r
-// has several seperately working interfaces.\r
+// has several separately working interfaces.\r
 //\r
 struct _USB_DEVICE {\r
   USB_BUS                   *Bus;\r
@@ -189,6 +192,7 @@ struct _USB_DEVICE {
   USB_INTERFACE             *ParentIf;\r
   UINT8                     ParentPort;       // Start at 0\r
   UINT8                     Tier;\r
+  BOOLEAN                   DisconnectFail;\r
 };\r
 \r
 //\r
@@ -261,8 +265,8 @@ struct _USB_BUS {
   // USB Bus driver need to control the recursive connect policy of the bus, only those wanted\r
   // usb child device will be recursively connected.\r
   //\r
-  // WantedUsbIoDPList tracks the Usb child devices which user want to recursivly fully connecte,\r
-  // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structrure is\r
+  // WantedUsbIoDPList tracks the Usb child devices which user want to recursively fully connecte,\r
+  // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structure is\r
   // DEVICE_PATH_LIST_ITEM\r
   //\r
   LIST_ENTRY                WantedUsbIoDPList;\r
@@ -333,7 +337,7 @@ UsbBusAddWantedUsbIoDP (
   Check whether a usb child device is the wanted device in a bus.\r
 \r
   @param  Bus     The Usb bus's private data pointer.\r
-  @param  UsbIf   The usb child device inferface.\r
+  @param  UsbIf   The usb child device interface.\r
 \r
   @retval True    If a usb child device is the wanted device in a bus.\r
   @retval False   If a usb child device is *NOT* the wanted device in a bus.\r
@@ -347,7 +351,7 @@ UsbBusIsWantedUsbIO (
   );\r
 \r
 /**\r
-  Recursively connnect every wanted usb child device to ensure they all fully connected.\r
+  Recursively connect every wanted usb child device to ensure they all fully connected.\r
   Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
 \r
   @param  UsbBusId                  Point to EFI_USB_BUS_PROTOCOL interface.\r
@@ -388,8 +392,8 @@ UsbIoControlTransfer (
   IN  EFI_USB_DEVICE_REQUEST  *Request,\r
   IN  EFI_USB_DATA_DIRECTION  Direction,\r
   IN  UINT32                  Timeout,\r
-  IN  OUT VOID                *Data,      OPTIONAL\r
-  IN  UINTN                   DataLength, OPTIONAL\r
+  IN  OUT VOID                *Data       OPTIONAL,\r
+  IN  UINTN                   DataLength  OPTIONAL,\r
   OUT UINT32                  *UsbStatus\r
   );\r
 \r
@@ -457,7 +461,7 @@ UsbIoSyncInterruptTransfer (
                                  the request.\r
   @param  PollInterval           The interval to poll the transfer result, (in ms).\r
   @param  DataLength             The length of perodic data transfer.\r
-  @param  Callback               The function to call periodicaly when transfer is\r
+  @param  Callback               The function to call periodically when transfer is\r
                                  ready.\r
   @param  Context                The context to the callback.\r
 \r
@@ -473,9 +477,9 @@ UsbIoAsyncInterruptTransfer (
   IN EFI_USB_IO_PROTOCOL              *This,\r
   IN UINT8                            Endpoint,\r
   IN BOOLEAN                          IsNewTransfer,\r
-  IN UINTN                            PollInterval,       OPTIONAL\r
-  IN UINTN                            DataLength,         OPTIONAL\r
-  IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,           OPTIONAL\r
+  IN UINTN                            PollInterval        OPTIONAL,\r
+  IN UINTN                            DataLength          OPTIONAL,\r
+  IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback            OPTIONAL,\r
   IN VOID                             *Context            OPTIONAL\r
   );\r
 \r
@@ -508,7 +512,7 @@ UsbIoIsochronousTransfer (
   @param  DeviceEndpoint         The device endpoint.\r
   @param  Data                   The data to transfer.\r
   @param  DataLength             The length of perodic data transfer.\r
-  @param  IsochronousCallBack    The function to call periodicaly when transfer is\r
+  @param  IsochronousCallBack    The function to call periodically when transfer is\r
                                  ready.\r
   @param  Context                The context to the callback.\r
 \r