]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.h
Fixed unexpected timeout in Usb MassStorage Driver.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / usbbus.h
index 09ae44533e15f5ca69343c8a6c5312e8f3677457..971e01b47ab12b4d40f93f88d83049ee953eaa20 100644 (file)
@@ -55,21 +55,77 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 #include "UsbEnumer.h"\r
 \r
 enum {\r
+  USB_MAX_LANG_ID           = 16,\r
+  USB_MAX_INTERFACE         = 16,\r
+  USB_MAX_DEVICES           = 128,\r
+\r
+  USB_BUS_1_MILLISECOND     = 1000,\r
+\r
   //\r
-  // Time definition\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 hub is 1ms, means 64ms as interval.\r
   //\r
-  USB_STALL_1_MS            = 1000,\r
-  TICKS_PER_MS              = 10000U,\r
-  USB_ROOTHUB_POLL_INTERVAL = 1000 * TICKS_PER_MS,\r
+  USB_ROOTHUB_POLL_INTERVAL = 1000 * 10000U,\r
   USB_HUB_POLL_INTERVAL     = 64,\r
 \r
   //\r
-  // Maximum definition\r
+  // Wait for port stable to work, refers to specification\r
+  // [USB20-9.1.2]\r
   //\r
-  USB_MAX_LANG_ID           = 16,\r
-  USB_MAX_INTERFACE         = 16,\r
-  USB_MAX_DEVICES           = 128,\r
+  USB_WAIT_PORT_STABLE_STALL     = 100 * USB_BUS_1_MILLISECOND,\r
+\r
+  // \r
+  // Wait for port statue reg change, set by experience\r
+  //\r
+  USB_WAIT_PORT_STS_CHANGE_STALL = 5 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Wait for set device address, refers to specification\r
+  // [USB20-9.2.6.3, it says 2ms]\r
+  //\r
+  USB_SET_DEVICE_ADDRESS_STALL   = 20 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Wait for retry max packet size, set by experience\r
+  //\r
+  USB_RETRY_MAX_PACK_SIZE_STALL  = 100 * USB_BUS_1_MILLISECOND,\r
 \r
+  //\r
+  // Wait for hub port power-on, refers to specification\r
+  // [USB20-11.23.2]\r
+  //\r
+  USB_SET_PORT_POWER_STALL       = 2 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Wait for port reset, refers to specification \r
+  // [USB20-7.1.7.5, it says 10ms for hub and 50ms for \r
+  // root hub]\r
+  //\r
+  USB_SET_PORT_RESET_STALL       = 20 * USB_BUS_1_MILLISECOND,\r
+  USB_SET_ROOT_PORT_RESET_STALL  = 50 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Wait for clear roothub port reset, set by experience\r
+  //\r
+  USB_CLR_ROOT_PORT_RESET_STALL  = 1 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Wait for set roothub port enable, set by experience\r
+  // \r
+  USB_SET_ROOT_PORT_ENABLE_STALL = 20 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Send general device request timeout, refers to \r
+  // specification[USB20-11.24.1]\r
+  //\r
+  USB_GENERAL_DEVICE_REQUEST_TIMEOUT = 50 * USB_BUS_1_MILLISECOND,\r
+\r
+  //\r
+  // Send clear feature request timeout, set by experience\r
+  //\r
+  USB_CLEAR_FEATURE_REQUEST_TIMEOUT  = 10 * USB_BUS_1_MILLISECOND,\r
+  \r
   //\r
   // Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
   // to protect shared data structures.\r
@@ -84,7 +140,7 @@ enum {
 #define USB_BIT_IS_SET(Data, Bit)   ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r
 \r
 #define EFI_USB_BUS_PROTOCOL_GUID \\r
-          {0x2B2F68CC, 0x0CD2, 0x44cf, 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75}\r
+          {0x2B2F68CC, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75}}\r
 \r
 #define USB_INTERFACE_FROM_USBIO(a) \\r
           CR(a, USB_INTERFACE, UsbIo, USB_INTERFACE_SIGNATURE)\r
@@ -197,8 +253,9 @@ struct _USB_BUS {
   USB_DEVICE                *Devices[USB_MAX_DEVICES];\r
 };\r
 \r
-extern EFI_USB_IO_PROTOCOL           mUsbIoProtocol;\r
-extern EFI_DRIVER_BINDING_PROTOCOL   mUsbBusDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL   mUsbBusComponentName;\r
+extern EFI_USB_IO_PROTOCOL            mUsbIoProtocol;\r
+extern EFI_DRIVER_BINDING_PROTOCOL    mUsbBusDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL    mUsbBusComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL   mUsbBusComponentName2;\r
 \r
 #endif\r