Module Name:    src
Committed By:   skrll
Date:           Tue Nov 18 10:18:45 UTC 2014

Modified Files:
        src/sys/dev/usb: xhci.c xhcireg.h

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/usb/xhcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.27 src/sys/dev/usb/xhci.c:1.28
--- src/sys/dev/usb/xhci.c:1.27	Fri Oct  3 11:05:36 2014
+++ src/sys/dev/usb/xhci.c	Tue Nov 18 10:18:45 2014
@@ -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 @@ xhci_allocm(struct usbd_bus *bus, usb_dm
 
 	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 @@ xhci_root_ctrl_done(usbd_xfer_handle xfe
 	xfer->hcpriv = NULL;
 }
 
-/* root hub intrerrupt */
+/* root hub interrupt */
 
 static usbd_status
 xhci_root_intr_transfer(usbd_xfer_handle xfer)
@@ -2657,9 +2657,9 @@ xhci_device_ctrl_start(usbd_xfer_handle 
 
 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);

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.1 src/sys/dev/usb/xhcireg.h:1.2
--- src/sys/dev/usb/xhcireg.h:1.1	Sat Sep 14 00:40:31 2013
+++ src/sys/dev/usb/xhcireg.h	Tue Nov 18 10:18:45 2014
@@ -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

Reply via email to