DM USB: introduce data structure and APIs for USB port mapper

Introduce the struct usb_dev which is used to abstract the physical USB
devices. And APIs for external call are also provided.

Change-Id: Ia25d52a6c670040da787f82b3bea34eee9f3d04d
Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Wu, Xiaoguang
2018-04-15 17:59:21 +08:00
committed by lijinxia
parent 51f7633f82
commit 1816d3e608
6 changed files with 338 additions and 1 deletions

View File

@@ -48,6 +48,7 @@
#include "pci_core.h"
#include "xhci.h"
#include "usb_core.h"
#include "usb_pmapper.h"
#undef LOG_TAG
#define LOG_TAG "xHCI: "
@@ -315,6 +316,18 @@ static void pci_xhci_update_ep_ring(struct pci_xhci_vdev *xdev,
uint32_t streamid, uint64_t ringaddr,
int ccs);
static int
pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data)
{
return 0;
}
static int
pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data)
{
return 0;
}
static void
pci_xhci_set_evtrb(struct xhci_trb *evtrb, uint64_t port, uint32_t errcode,
uint32_t evtype)
@@ -2842,6 +2855,19 @@ pci_xhci_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
else
error = 0;
/*
* TODO:
* Will add command line option in subsequent patches for calling
* usb_dev_sys_init if new parameters are used.
*/
if (xdev->ndevices == 0)
if (usb_dev_sys_init(pci_xhci_native_usb_dev_conn_cb,
pci_xhci_native_usb_dev_disconn_cb,
NULL, NULL, xdev,
usb_get_log_level()) < 0) {
goto done;
}
xdev->caplength = XHCI_SET_CAPLEN(XHCI_CAPLEN) |
XHCI_SET_HCIVERSION(0x0100);
xdev->hcsparams1 = XHCI_SET_HCSP1_MAXPORTS(XHCI_MAX_DEVS) |