On 18-08-14 23:17:02, Yu Wang wrote: On 18-08-14 21:39:14, Wu, Xiaoguang wrote:
This patch enable the support for SOS S3 from the perspective of USB xHCI.
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@...> Reviewed-by: Liang Yang <liang3.yang@...> --- devicemodel/hw/pci/xhci.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/devicemodel/hw/pci/xhci.c b/devicemodel/hw/pci/xhci.c index ec215a0..3509fbd 100644 --- a/devicemodel/hw/pci/xhci.c +++ b/devicemodel/hw/pci/xhci.c @@ -91,6 +91,7 @@ #include "pci_core.h" #include "xhci.h" #include "usb_pmapper.h" +#include "vmmapi.h" #undef LOG_TAG #define LOG_TAG "xHCI: " @@ -485,6 +486,7 @@ pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data) struct usb_native_devinfo *di; int vport_start, vport_end; int port; + int need_intr = 1; xdev = hci_data; @@ -534,8 +536,11 @@ pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data) xdev->port_map_tbl[di->bus][di->port] = PT_MAKE_STATE(PT_ASSIGNED_WITH_NEW_DEV, port); + if (vm_get_suspend_mode() != VM_SUSPEND_NONE) + need_intr = 0; + /* Trigger port change event for the arriving device */ - if (pci_xhci_connect_port(xdev, port, di->speed, 1)) + if (pci_xhci_connect_port(xdev, port, di->speed, need_intr)) UPRINTF(LFTL, "fail to report port event\n"); return 0; @@ -552,6 +557,7 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data) struct usb_dev *udev; uint8_t port, slot, native_port; uint8_t status; + int need_intr = 1; assert(hci_data); assert(dev_data); @@ -594,8 +600,18 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data) xdev->port_map_tbl[di.bus][di.port] = PT_MAKE_STATE( PT_ASSIGNED_WITH_NO_DEV, port); + if (vm_get_suspend_mode() != VM_SUSPEND_NONE) { + XHCI_PORTREG_PTR(xdev, port)->portsc &= ~(XHCI_PS_CSC | + XHCI_PS_CCS | XHCI_PS_PED | XHCI_PS_PP); + edev->dev_slotstate = XHCI_ST_DISABLED; + xdev->devices[port] = NULL; + xdev->slots[slot] = NULL; + pci_xhci_dev_destroy(edev); + need_intr = 0; + } Please add one TODO. We need revisit this logic in future. This patch is like one band-aid fix. xgwu: okey, will change, thanks.
+ UPRINTF(LDBG, "report virtual port %d status\r\n", port); - if (pci_xhci_disconnect_port(xdev, port, 1)) { + if (pci_xhci_disconnect_port(xdev, port, need_intr)) { UPRINTF(LFTL, "fail to report event\r\n"); return -1; } -- 2.7.4
|