cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From 6b9188baee63673ee4816b7bb994a7be3e164fce Mon Sep 17 00:00:00 2001
218e99
From: Gerd Hoffmann <kraxel@redhat.com>
218e99
Date: Wed, 7 Aug 2013 09:22:47 +0200
218e99
Subject: [PATCH 16/28] xhci: add xhci_init_epctx
218e99
218e99
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
218e99
Message-id: <1375867368-18979-5-git-send-email-kraxel@redhat.com>
218e99
Patchwork-id: 53037
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 4/5] xhci: add xhci_init_epctx
218e99
Bugzilla: 838170
218e99
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
218e99
218e99
Factor out endpoint context initialization to a separate function.
218e99
xhci live migration will need that too, in post_load.
218e99
218e99
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
218e99
(cherry picked from commit 003e15a180373048f0c1f4df0bfe303746eb2676)
218e99
---
218e99
 hw/usb/hcd-xhci.c |   43 +++++++++++++++++++++++++------------------
218e99
 1 file changed, 25 insertions(+), 18 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/usb/hcd-xhci.c |   43 +++++++++++++++++++++++++------------------
218e99
 1 files changed, 25 insertions(+), 18 deletions(-)
218e99
218e99
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
218e99
index 7f46ccc..8224465 100644
218e99
--- a/hw/usb/hcd-xhci.c
218e99
+++ b/hw/usb/hcd-xhci.c
218e99
@@ -1218,26 +1218,11 @@ static XHCIEPContext *xhci_alloc_epctx(XHCIState *xhci,
218e99
     return epctx;
218e99
 }
218e99
 
218e99
-static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
218e99
-                               unsigned int epid, dma_addr_t pctx,
218e99
-                               uint32_t *ctx)
218e99
+static void xhci_init_epctx(XHCIEPContext *epctx,
218e99
+                            dma_addr_t pctx, uint32_t *ctx)
218e99
 {
218e99
-    XHCISlot *slot;
218e99
-    XHCIEPContext *epctx;
218e99
     dma_addr_t dequeue;
218e99
 
218e99
-    trace_usb_xhci_ep_enable(slotid, epid);
218e99
-    assert(slotid >= 1 && slotid <= xhci->numslots);
218e99
-    assert(epid >= 1 && epid <= 31);
218e99
-
218e99
-    slot = &xhci->slots[slotid-1];
218e99
-    if (slot->eps[epid-1]) {
218e99
-        xhci_disable_ep(xhci, slotid, epid);
218e99
-    }
218e99
-
218e99
-    epctx = xhci_alloc_epctx(xhci, slotid, epid);
218e99
-    slot->eps[epid-1] = epctx;
218e99
-
218e99
     dequeue = xhci_addr64(ctx[2] & ~0xf, ctx[3]);
218e99
 
218e99
     epctx->type = (ctx[1] >> EP_TYPE_SHIFT) & EP_TYPE_MASK;
218e99
@@ -1252,11 +1237,33 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
218e99
     if (epctx->max_pstreams) {
218e99
         xhci_alloc_streams(epctx, dequeue);
218e99
     } else {
218e99
-        xhci_ring_init(xhci, &epctx->ring, dequeue);
218e99
+        xhci_ring_init(epctx->xhci, &epctx->ring, dequeue);
218e99
         epctx->ring.ccs = ctx[2] & 1;
218e99
     }
218e99
 
218e99
     epctx->interval = 1 << (ctx[0] >> 16) & 0xff;
218e99
+}
218e99
+
218e99
+static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
218e99
+                               unsigned int epid, dma_addr_t pctx,
218e99
+                               uint32_t *ctx)
218e99
+{
218e99
+    XHCISlot *slot;
218e99
+    XHCIEPContext *epctx;
218e99
+
218e99
+    trace_usb_xhci_ep_enable(slotid, epid);
218e99
+    assert(slotid >= 1 && slotid <= xhci->numslots);
218e99
+    assert(epid >= 1 && epid <= 31);
218e99
+
218e99
+    slot = &xhci->slots[slotid-1];
218e99
+    if (slot->eps[epid-1]) {
218e99
+        xhci_disable_ep(xhci, slotid, epid);
218e99
+    }
218e99
+
218e99
+    epctx = xhci_alloc_epctx(xhci, slotid, epid);
218e99
+    slot->eps[epid-1] = epctx;
218e99
+    xhci_init_epctx(epctx, pctx, ctx);
218e99
+
218e99
     epctx->mfindex_last = 0;
218e99
 
218e99
     epctx->state = EP_RUNNING;
218e99
-- 
218e99
1.7.1
218e99