mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 18:14:53 +00:00
DM USB: xHCI: remove old hub support code.
Previous design use bus and port(root hub port) for the identification to the native USB device. It cannot work properly under the multi-hub situation due to external USB hub is introduced. This patch removes old hub implementation code, and subsequent patches will be add support for mutiple hubs. Tracked-On: #1434 Signed-off-by: Liang Yang <liang3.yang@intel.com> Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
101
devicemodel/hw/platform/usb_pmapper.c
Normal file → Executable file
101
devicemodel/hw/platform/usb_pmapper.c
Normal file → Executable file
@@ -38,36 +38,6 @@ usb_dev_scan_dev()
|
||||
if (num_devs < 0)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < num_devs; ++i) {
|
||||
ldev = devlist[i];
|
||||
|
||||
memset(&di, 0, sizeof(di));
|
||||
|
||||
di.bus = libusb_get_bus_number(ldev);
|
||||
di.port = libusb_get_port_number(ldev);
|
||||
di.speed = libusb_get_device_speed(ldev);
|
||||
|
||||
rc = libusb_get_device_descriptor(ldev, &d);
|
||||
if (rc) {
|
||||
UPRINTF(LWRN, "fail to get descriptor for %d-%d\r\n",
|
||||
di.bus, di.port);
|
||||
continue;
|
||||
}
|
||||
|
||||
di.pid = d.idProduct;
|
||||
di.vid = d.idVendor;
|
||||
di.bcd = d.bcdUSB;
|
||||
di.priv_data = ldev;
|
||||
|
||||
if (di.port == 0)
|
||||
continue;
|
||||
if (d.bDeviceClass != LIBUSB_CLASS_HUB)
|
||||
continue;
|
||||
|
||||
if (g_ctx.conn_cb)
|
||||
g_ctx.conn_cb(g_ctx.hci_data, &di);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_devs; ++i) {
|
||||
ldev = devlist[i];
|
||||
|
||||
@@ -934,65 +904,6 @@ out:
|
||||
return xfer->status;
|
||||
}
|
||||
|
||||
int
|
||||
usb_dev_is_hub(void *pdata)
|
||||
{
|
||||
struct libusb_device *ldev;
|
||||
struct libusb_device_descriptor desc;
|
||||
int rc;
|
||||
|
||||
assert(pdata);
|
||||
|
||||
ldev = pdata;
|
||||
rc = libusb_get_device_descriptor(ldev, &desc);
|
||||
|
||||
if (rc)
|
||||
return USB_TYPE_INVALID;
|
||||
|
||||
if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
|
||||
return USB_HUB;
|
||||
else
|
||||
return USB_DEV;
|
||||
|
||||
}
|
||||
|
||||
enum usb_native_dev_type
|
||||
usb_get_parent_dev_type(void *pdata, uint16_t *bus, uint16_t *port)
|
||||
{
|
||||
struct libusb_device *ldev;
|
||||
struct libusb_device *libdev;
|
||||
struct libusb_device_descriptor desc;
|
||||
int rc;
|
||||
|
||||
assert(pdata);
|
||||
assert(bus);
|
||||
assert(port);
|
||||
|
||||
ldev = pdata;
|
||||
libdev = libusb_get_parent(ldev);
|
||||
|
||||
if (libdev == NULL) {
|
||||
UPRINTF(LWRN, "libusb_get_parent return NULL\r\n");
|
||||
return USB_TYPE_INVALID;
|
||||
}
|
||||
|
||||
*bus = libusb_get_bus_number(libdev);
|
||||
*port = libusb_get_port_number(libdev);
|
||||
|
||||
rc = libusb_get_device_descriptor(libdev, &desc);
|
||||
if (rc) {
|
||||
UPRINTF(LWRN, "libusb_get_device_descriptor error %d\r\n", rc);
|
||||
return USB_TYPE_INVALID;
|
||||
}
|
||||
|
||||
if (*port == 0)
|
||||
return ROOT_HUB;
|
||||
if (desc.bDeviceClass == LIBUSB_CLASS_HUB)
|
||||
return USB_HUB;
|
||||
|
||||
return USB_TYPE_INVALID;
|
||||
}
|
||||
|
||||
void *
|
||||
usb_dev_init(void *pdata, char *opt)
|
||||
{
|
||||
@@ -1166,6 +1077,9 @@ usb_dev_native_sys_conn_cb(struct libusb_context *ctx, struct libusb_device
|
||||
di.bcd = d.bcdUSB;
|
||||
di.priv_data = ldev;
|
||||
|
||||
if (d.bDeviceClass == LIBUSB_CLASS_HUB)
|
||||
return 0;
|
||||
|
||||
if (g_ctx.conn_cb)
|
||||
g_ctx.conn_cb(g_ctx.hci_data, &di);
|
||||
|
||||
@@ -1178,9 +1092,6 @@ usb_dev_native_sys_disconn_cb(struct libusb_context *ctx, struct libusb_device
|
||||
{
|
||||
struct libusb_device_descriptor d;
|
||||
struct usb_native_devinfo di;
|
||||
uint16_t pport;
|
||||
uint16_t pbus;
|
||||
int rc;
|
||||
|
||||
UPRINTF(LDBG, "disconnect event\r\n");
|
||||
|
||||
@@ -1200,12 +1111,8 @@ usb_dev_native_sys_disconn_cb(struct libusb_context *ctx, struct libusb_device
|
||||
di.bcd = d.bcdUSB;
|
||||
di.priv_data = ldev;
|
||||
|
||||
rc = usb_get_parent_dev_type(ldev, &pbus, &pport);
|
||||
if (rc == USB_TYPE_INVALID) {
|
||||
UPRINTF(LWRN, "usb_get_parent_dev_type return %d\r\n", rc);
|
||||
if (d.bDeviceClass == LIBUSB_CLASS_HUB)
|
||||
return 0;
|
||||
} else if (rc == USB_HUB)
|
||||
di.port += PORT_HUB_BASE;
|
||||
|
||||
if (g_ctx.disconn_cb)
|
||||
g_ctx.disconn_cb(g_ctx.hci_data, &di);
|
||||
|
||||
Reference in New Issue
Block a user