]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.h
Enhance the Usb bus driver to support Star with Remaining device path.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / usbbus.h
index 971e01b47ab12b4d40f93f88d83049ee953eaa20..e85fc84fe8f816b93cc7f860ac80109c9bc00a27 100644 (file)
@@ -32,6 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/UsbIo.h>\r
 #include <Protocol/DevicePath.h>\r
 \r
+#include <library/BaseLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -75,7 +76,7 @@ enum {
   //\r
   USB_WAIT_PORT_STABLE_STALL     = 100 * USB_BUS_1_MILLISECOND,\r
 \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
@@ -98,8 +99,8 @@ enum {
   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
+  // 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
@@ -112,11 +113,11 @@ enum {
 \r
   //\r
   // Wait for set roothub port enable, set by experience\r
-  // \r
+  //\r
   USB_SET_ROOT_PORT_ENABLE_STALL = 20 * USB_BUS_1_MILLISECOND,\r
 \r
   //\r
-  // Send general device request timeout, refers to \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
@@ -125,7 +126,7 @@ enum {
   // Send clear feature request timeout, set by experience\r
   //\r
   USB_CLEAR_FEATURE_REQUEST_TIMEOUT  = 10 * USB_BUS_1_MILLISECOND,\r
-  \r
+\r
   //\r
   // Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
   // to protect shared data structures.\r
@@ -251,8 +252,59 @@ struct _USB_BUS {
   // for root hub. Device with address i is at Devices[i].\r
   //\r
   USB_DEVICE                *Devices[USB_MAX_DEVICES];\r
+\r
+  //\r
+  // 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
+  // DEVICE_PATH_LIST_ITEM\r
+  //\r
+  LIST_ENTRY                WantedUsbIoDPList;\r
+\r
 };\r
 \r
+#define USB_US_LAND_ID   0x0409\r
+\r
+#define DEVICE_PATH_LIST_ITEM_SIGNATURE     EFI_SIGNATURE_32('d','p','l','i')\r
+typedef struct _DEVICE_PATH_LIST_ITEM{\r
+  UINTN                                 Signature;\r
+  LIST_ENTRY                            Link;\r
+  EFI_DEVICE_PATH_PROTOCOL              *DevicePath;\r
+} DEVICE_PATH_LIST_ITEM;\r
+\r
+typedef struct {\r
+  USB_CLASS_DEVICE_PATH           UsbClass;\r
+  EFI_DEVICE_PATH_PROTOCOL        End;\r
+} USB_CLASS_FORMAT_DEVICE_PATH;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusFreeUsbDPList (\r
+  IN     LIST_ENTRY                                 *UsbIoDPList\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusAddWantedUsbIoDP (\r
+  IN EFI_USB_BUS_PROTOCOL         *UsbBusId,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+BOOLEAN\r
+EFIAPI\r
+UsbBusIsWantedUsbIO (\r
+  IN USB_BUS                 *Bus,\r
+  IN USB_INTERFACE           *UsbIf\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+UsbBusRecursivelyConnectWantedUsbIo (\r
+  IN EFI_USB_BUS_PROTOCOL         *UsbBusId\r
+  );\r
+\r
 extern EFI_USB_IO_PROTOCOL            mUsbIoProtocol;\r
 extern EFI_DRIVER_BINDING_PROTOCOL    mUsbBusDriverBinding;\r
 extern EFI_COMPONENT_NAME_PROTOCOL    mUsbBusComponentName;\r