DM USB: xHCI: enable Flat Mode Hub emulation support.

Flat Mode for hub emulation means DM emulates USB devices under hub but
hide hub itself. Under this design the Guest OS cannot see any emulated
hub. So in the perspective of Guest OS, all the emulated devices are
under root hub.

This patch is used to enable feature as mentioned above. And please NOTE,
it is the initial version of hub flat Mode hub emulation, there are one
limitation: only one physical hub is supported. If second physical hub is
connected, the connect and disconnect behavior in second hub may affect
the function of first emulated hub.

The USB HUB device model should be the final long term solution, but it is
very complex. Use flat mode HUB emulation as the short term solution first
to support some USB touch devices which integrated internal HUB.

Signed-off-by: Liang Yang <liang3.yang@intel.com>
Reviewed-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
Tracked-On: #1243
This commit is contained in:
Liang Yang
2018-08-20 11:17:35 +08:00
committed by lijinxia
parent d886375ee4
commit 612037e138
3 changed files with 139 additions and 7 deletions

View File

@@ -20,6 +20,9 @@
#define USB_EP_NR(d) (USB_EP_ADDR(d) & 0xF)
#define USB_EP_ERR_TYPE 0xFF
/* hub port start address */
#define PORT_HUB_BASE 0x0A
enum {
USB_INFO_VERSION,
USB_INFO_SPEED,
@@ -29,6 +32,15 @@ enum {
USB_INFO_PID
};
enum usb_native_dev_type {
ROOT_HUB,
USB_HUB,
USB_DEV,
USB_VALID_SUB_DEV,
USB_INVALID_SUB_DEV,
USB_TYPE_INVALID
};
struct usb_dev_ep {
uint8_t pid;
uint8_t type;
@@ -119,4 +131,7 @@ int usb_dev_info(void *pdata, int type, void *value, int size);
int usb_dev_request(void *pdata, struct usb_data_xfer *xfer);
int usb_dev_reset(void *pdata);
int usb_dev_data(void *pdata, struct usb_data_xfer *xfer, int dir, int epctx);
enum usb_native_dev_type usb_get_parent_dev_type(void *pdata, uint16_t *bus,
uint16_t *port);
int usb_dev_is_hub(void *pdata);
#endif