Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb kern/49391: Fixes to XHCI driver command ring an...



details:   https://anonhg.NetBSD.org/src/rev/af9e0c04cd97
branches:  trunk
changeset: 333842:af9e0c04cd97
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Nov 18 10:18:45 2014 +0000

description:
kern/49391: Fixes to XHCI driver command ring and status TRB

CRCR needs 64byte aligned address

Use usb_allocmem instead of usb_allocmem_flags(..., 0)

Correct status stage TRB in xhci_device_ctrl_start - direction logic was
wrong.

Correct a typo in a comment

diffstat:

 sys/dev/usb/xhci.c    |  12 ++++++------
 sys/dev/usb/xhcireg.h |   4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (66 lines):

diff -r bd2737d3b3d4 -r af9e0c04cd97 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Nov 18 09:28:36 2014 +0000
+++ b/sys/dev/usb/xhci.c        Tue Nov 18 10:18:45 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.27 2014/10/03 11:05:36 skrll Exp $  */
+/*     $NetBSD: xhci.c,v 1.28 2014/11/18 10:18:45 skrll Exp $  */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.27 2014/10/03 11:05:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28 2014/11/18 10:18:45 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1384,7 +1384,7 @@
 
        XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
-       err = usb_allocmem_flags(&sc->sc_bus, size, 0, dma, 0);
+       err = usb_allocmem(&sc->sc_bus, size, 0, dma);
 #if 0
        if (err == USBD_NOMEM)
                err = usb_reserve_allocm(&sc->sc_dma_reserve, dma, size);
@@ -2491,7 +2491,7 @@
        xfer->hcpriv = NULL;
 }
 
-/* root hub intrerrupt */
+/* root hub interrupt */
 
 static usbd_status
 xhci_root_intr_transfer(usbd_xfer_handle xfer)
@@ -2657,9 +2657,9 @@
 
 no_data:
        parameter = 0;
-       status = XHCI_TRB_2_IRQ_SET(0) | XHCI_TRB_2_TDSZ_SET(1);
+       status = XHCI_TRB_2_IRQ_SET(0);
        /* the status stage has inverted direction */
-       control = (isread ? 0 : XHCI_TRB_3_DIR_IN) |
+       control = ((isread && (len > 0)) ? 0 : XHCI_TRB_3_DIR_IN) |
            XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) |
            XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_ENT_BIT;
        xhci_trb_put(&xx->xx_trb[i++], parameter, status, control);
diff -r bd2737d3b3d4 -r af9e0c04cd97 sys/dev/usb/xhcireg.h
--- a/sys/dev/usb/xhcireg.h     Tue Nov 18 09:28:36 2014 +0000
+++ b/sys/dev/usb/xhcireg.h     Tue Nov 18 10:18:45 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.1 2013/09/14 00:40:31 jakllsch Exp $ */
+/* $NetBSD: xhcireg.h,v 1.2 2014/11/18 10:18:45 skrll Exp $ */
 /* $FreeBSD$ */
 
 /*-
@@ -212,7 +212,7 @@
 #define XHCI_STREAM_CONTEXT_ALIGN 16
 #define XHCI_STREAM_ARRAY_ALIGN 16
 #define XHCI_TRANSFER_RING_SEGMENTS_ALIGN 16
-#define XHCI_COMMAND_RING_SEGMENTS_ALIGN 16
+#define XHCI_COMMAND_RING_SEGMENTS_ALIGN 64
 #define XHCI_EVENT_RING_SEGMENTS_ALIGN 64
 #define XHCI_EVENT_RING_SEGMENT_TABLE_ALIGN 64
 #define XHCI_SCRATCHPAD_BUFFER_ARRAY_ALIGN 64



Home | Main Index | Thread Index | Old Index