[PATCH 6/6] DM USB: xHCI: enable xHCI SOS S3 support


Wu, Xiaoguang
 

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 | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/devicemodel/hw/pci/xhci.c b/devicemodel/hw/pci/xhci.c
index 579021a..501de01 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: "
@@ -550,6 +551,8 @@ pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data)

xdev->native_assign_ports[di->bus][di->port] = port;
xdev->native_assign_info[di->bus][di->port] = *di;
+ if (vm_get_suspend_mode() != VM_SUSPEND_NONE)
+ intr = 0;

/* Trigger port change event for the arriving device */
if (pci_xhci_port_connect(xdev, port, di->speed, intr))
@@ -614,6 +617,17 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data)
}
assert(i < USB_NATIVE_NUM_BUS);
xdev->native_assign_ports[i][j] = -1;
+
+ 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);
+ intr = 0;
+ }
+
UPRINTF(LDBG, "report virtual port %d status\r\n", port);
if (pci_xhci_port_disconnect(xdev, port, intr)) {
UPRINTF(LFTL, "fail to report event\r\n");
--
2.7.4

Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.