From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpLJ2-0007vG-SO for qemu-devel@nongnu.org; Mon, 23 Jan 2012 09:55:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpLIy-0004WX-Fd for qemu-devel@nongnu.org; Mon, 23 Jan 2012 09:55:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpLIx-0004WE-IM for qemu-devel@nongnu.org; Mon, 23 Jan 2012 09:55:31 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0NEtU8W012738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Jan 2012 09:55:30 -0500 From: Gerd Hoffmann Date: Mon, 23 Jan 2012 15:55:10 +0100 Message-Id: <1327330511-16307-25-git-send-email-kraxel@redhat.com> In-Reply-To: <1327330511-16307-1-git-send-email-kraxel@redhat.com> References: <1327330511-16307-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 24/25] xhci: remote wakeup support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/usb-xhci.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/hw/usb-xhci.c b/hw/usb-xhci.c index cd88c76..a42bb96 100644 --- a/hw/usb-xhci.c +++ b/hw/usb-xhci.c @@ -2696,6 +2696,26 @@ static void xhci_detach(USBPort *usbport) xhci_update_port(xhci, port, 1); } +static void xhci_wakeup(USBPort *usbport) +{ + XHCIState *xhci = usbport->opaque; + XHCIPort *port = &xhci->ports[usbport->index]; + int nr = port->port.index + 1; + XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS, nr << 24}; + uint32_t pls; + + pls = (port->portsc >> PORTSC_PLS_SHIFT) & PORTSC_PLS_MASK; + if (pls != 3) { + return; + } + port->portsc |= 0xf << PORTSC_PLS_SHIFT; + if (port->portsc & PORTSC_PLC) { + return; + } + port->portsc |= PORTSC_PLC; + xhci_event(xhci, &ev); +} + static void xhci_complete(USBPort *port, USBPacket *packet) { XHCITransfer *xfer = container_of(packet, XHCITransfer, packet); @@ -2712,6 +2732,7 @@ static void xhci_child_detach(USBPort *port, USBDevice *child) static USBPortOps xhci_port_ops = { .attach = xhci_attach, .detach = xhci_detach, + .wakeup = xhci_wakeup, .complete = xhci_complete, .child_detach = xhci_child_detach, }; -- 1.7.1