render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0336-xhci-trace-cc-codes-in-cleartext.patch

Hans de Goede c8dfc6
From 530efbfebc3b33f6b109e52d57a25e9b7fe2b588 Mon Sep 17 00:00:00 2001
Hans de Goede c8dfc6
From: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede c8dfc6
Date: Mon, 27 Aug 2012 16:09:20 +0200
Hans de Goede c8dfc6
Subject: [PATCH 336/366] xhci: trace cc codes in cleartext
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede c8dfc6
---
Hans de Goede c8dfc6
 hw/usb/hcd-xhci.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
Hans de Goede c8dfc6
 trace-events      |  2 +-
Hans de Goede c8dfc6
 2 files changed, 48 insertions(+), 2 deletions(-)
Hans de Goede c8dfc6
Hans de Goede c8dfc6
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
Hans de Goede c8dfc6
index 3c61bb8..ab32a7b 100644
Hans de Goede c8dfc6
--- a/hw/usb/hcd-xhci.c
Hans de Goede c8dfc6
+++ b/hw/usb/hcd-xhci.c
Hans de Goede c8dfc6
@@ -465,6 +465,45 @@ static const char *TRBType_names[] = {
Hans de Goede c8dfc6
     [CR_VENDOR_NEC_CHALLENGE_RESPONSE] = "CR_VENDOR_NEC_CHALLENGE_RESPONSE",
Hans de Goede c8dfc6
 };
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
+static const char *TRBCCode_names[] = {
Hans de Goede c8dfc6
+    [CC_INVALID]                       = "CC_INVALID",
Hans de Goede c8dfc6
+    [CC_SUCCESS]                       = "CC_SUCCESS",
Hans de Goede c8dfc6
+    [CC_DATA_BUFFER_ERROR]             = "CC_DATA_BUFFER_ERROR",
Hans de Goede c8dfc6
+    [CC_BABBLE_DETECTED]               = "CC_BABBLE_DETECTED",
Hans de Goede c8dfc6
+    [CC_USB_TRANSACTION_ERROR]         = "CC_USB_TRANSACTION_ERROR",
Hans de Goede c8dfc6
+    [CC_TRB_ERROR]                     = "CC_TRB_ERROR",
Hans de Goede c8dfc6
+    [CC_STALL_ERROR]                   = "CC_STALL_ERROR",
Hans de Goede c8dfc6
+    [CC_RESOURCE_ERROR]                = "CC_RESOURCE_ERROR",
Hans de Goede c8dfc6
+    [CC_BANDWIDTH_ERROR]               = "CC_BANDWIDTH_ERROR",
Hans de Goede c8dfc6
+    [CC_NO_SLOTS_ERROR]                = "CC_NO_SLOTS_ERROR",
Hans de Goede c8dfc6
+    [CC_INVALID_STREAM_TYPE_ERROR]     = "CC_INVALID_STREAM_TYPE_ERROR",
Hans de Goede c8dfc6
+    [CC_SLOT_NOT_ENABLED_ERROR]        = "CC_SLOT_NOT_ENABLED_ERROR",
Hans de Goede c8dfc6
+    [CC_EP_NOT_ENABLED_ERROR]          = "CC_EP_NOT_ENABLED_ERROR",
Hans de Goede c8dfc6
+    [CC_SHORT_PACKET]                  = "CC_SHORT_PACKET",
Hans de Goede c8dfc6
+    [CC_RING_UNDERRUN]                 = "CC_RING_UNDERRUN",
Hans de Goede c8dfc6
+    [CC_RING_OVERRUN]                  = "CC_RING_OVERRUN",
Hans de Goede c8dfc6
+    [CC_VF_ER_FULL]                    = "CC_VF_ER_FULL",
Hans de Goede c8dfc6
+    [CC_PARAMETER_ERROR]               = "CC_PARAMETER_ERROR",
Hans de Goede c8dfc6
+    [CC_BANDWIDTH_OVERRUN]             = "CC_BANDWIDTH_OVERRUN",
Hans de Goede c8dfc6
+    [CC_CONTEXT_STATE_ERROR]           = "CC_CONTEXT_STATE_ERROR",
Hans de Goede c8dfc6
+    [CC_NO_PING_RESPONSE_ERROR]        = "CC_NO_PING_RESPONSE_ERROR",
Hans de Goede c8dfc6
+    [CC_EVENT_RING_FULL_ERROR]         = "CC_EVENT_RING_FULL_ERROR",
Hans de Goede c8dfc6
+    [CC_INCOMPATIBLE_DEVICE_ERROR]     = "CC_INCOMPATIBLE_DEVICE_ERROR",
Hans de Goede c8dfc6
+    [CC_MISSED_SERVICE_ERROR]          = "CC_MISSED_SERVICE_ERROR",
Hans de Goede c8dfc6
+    [CC_COMMAND_RING_STOPPED]          = "CC_COMMAND_RING_STOPPED",
Hans de Goede c8dfc6
+    [CC_COMMAND_ABORTED]               = "CC_COMMAND_ABORTED",
Hans de Goede c8dfc6
+    [CC_STOPPED]                       = "CC_STOPPED",
Hans de Goede c8dfc6
+    [CC_STOPPED_LENGTH_INVALID]        = "CC_STOPPED_LENGTH_INVALID",
Hans de Goede c8dfc6
+    [CC_MAX_EXIT_LATENCY_TOO_LARGE_ERROR]
Hans de Goede c8dfc6
+    = "CC_MAX_EXIT_LATENCY_TOO_LARGE_ERROR",
Hans de Goede c8dfc6
+    [CC_ISOCH_BUFFER_OVERRUN]          = "CC_ISOCH_BUFFER_OVERRUN",
Hans de Goede c8dfc6
+    [CC_EVENT_LOST_ERROR]              = "CC_EVENT_LOST_ERROR",
Hans de Goede c8dfc6
+    [CC_UNDEFINED_ERROR]               = "CC_UNDEFINED_ERROR",
Hans de Goede c8dfc6
+    [CC_INVALID_STREAM_ID_ERROR]       = "CC_INVALID_STREAM_ID_ERROR",
Hans de Goede c8dfc6
+    [CC_SECONDARY_BANDWIDTH_ERROR]     = "CC_SECONDARY_BANDWIDTH_ERROR",
Hans de Goede c8dfc6
+    [CC_SPLIT_TRANSACTION_ERROR]       = "CC_SPLIT_TRANSACTION_ERROR",
Hans de Goede c8dfc6
+};
Hans de Goede c8dfc6
+
Hans de Goede c8dfc6
 static const char *lookup_name(uint32_t index, const char **list, uint32_t llen)
Hans de Goede c8dfc6
 {
Hans de Goede c8dfc6
     if (index >= llen || list[index] == NULL) {
Hans de Goede c8dfc6
@@ -479,6 +518,12 @@ static const char *trb_name(XHCITRB *trb)
Hans de Goede c8dfc6
                        ARRAY_SIZE(TRBType_names));
Hans de Goede c8dfc6
 }
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
+static const char *event_name(XHCIEvent *event)
Hans de Goede c8dfc6
+{
Hans de Goede c8dfc6
+    return lookup_name(event->ccode, TRBCCode_names,
Hans de Goede c8dfc6
+                       ARRAY_SIZE(TRBCCode_names));
Hans de Goede c8dfc6
+}
Hans de Goede c8dfc6
+
Hans de Goede c8dfc6
 static uint64_t xhci_mfindex_get(XHCIState *xhci)
Hans de Goede c8dfc6
 {
Hans de Goede c8dfc6
     int64_t now = qemu_get_clock_ns(vm_clock);
Hans de Goede c8dfc6
@@ -574,7 +619,8 @@ static void xhci_write_event(XHCIState *xhci, XHCIEvent *event)
Hans de Goede c8dfc6
     ev_trb.control = cpu_to_le32(ev_trb.control);
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
     trace_usb_xhci_queue_event(xhci->er_ep_idx, trb_name(&ev_trb),
Hans de Goede c8dfc6
-                               ev_trb.parameter, ev_trb.status, ev_trb.control);
Hans de Goede c8dfc6
+                               event_name(event), ev_trb.parameter,
Hans de Goede c8dfc6
+                               ev_trb.status, ev_trb.control);
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
     addr = xhci->er_start + TRB_SIZE*xhci->er_ep_idx;
Hans de Goede c8dfc6
     pci_dma_write(&xhci->pci_dev, addr, &ev_trb, TRB_SIZE);
Hans de Goede c8dfc6
diff --git a/trace-events b/trace-events
Hans de Goede c8dfc6
index c83d65e..27d59cd 100644
Hans de Goede c8dfc6
--- a/trace-events
Hans de Goede c8dfc6
+++ b/trace-events
Hans de Goede c8dfc6
@@ -313,7 +313,7 @@ usb_xhci_runtime_write(uint32_t off, uint32_t val) "off 0x%04x, val 0x%08x"
Hans de Goede c8dfc6
 usb_xhci_doorbell_write(uint32_t off, uint32_t val) "off 0x%04x, val 0x%08x"
Hans de Goede c8dfc6
 usb_xhci_irq_intx(uint32_t level) "level %d"
Hans de Goede c8dfc6
 usb_xhci_irq_msi(uint32_t nr) "nr %d"
Hans de Goede c8dfc6
-usb_xhci_queue_event(uint32_t idx, const char *name, uint64_t param, uint32_t status, uint32_t control) "idx %d, %s, p %016" PRIx64 ", s %08x, c 0x%08x"
Hans de Goede c8dfc6
+usb_xhci_queue_event(uint32_t idx, const char *trb, const char *evt, uint64_t param, uint32_t status, uint32_t control) "idx %d, %s, %s, p %016" PRIx64 ", s %08x, c 0x%08x"
Hans de Goede c8dfc6
 usb_xhci_fetch_trb(uint64_t addr, const char *name, uint64_t param, uint32_t status, uint32_t control) "addr %016" PRIx64 ", %s, p %016" PRIx64 ", s %08x, c 0x%08x"
Hans de Goede c8dfc6
 usb_xhci_slot_enable(uint32_t slotid) "slotid %d"
Hans de Goede c8dfc6
 usb_xhci_slot_disable(uint32_t slotid) "slotid %d"
Hans de Goede c8dfc6
-- 
Hans de Goede c8dfc6
1.7.12
Hans de Goede c8dfc6