summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorskrll <skrll@NetBSD.org>2014-11-18 10:18:45 +0000
committerskrll <skrll@NetBSD.org>2014-11-18 10:18:45 +0000
commit3ccae4bdce5021082edd231d580caa0d648a92ac (patch)
tree89eb2140b53b3cde616703e28e5f55ba978361e4 /sys/dev
parent0fb8e5bfe5117d514b6fe46a1ff3d55c2c9df968 (diff)
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 (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/xhci.c12
-rw-r--r--sys/dev/usb/xhcireg.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index 095e2f3d70b..8d5fa6dac59 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -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_dma_t *dma, uint32_t size)
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 xfer)
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 xfer)
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 --git a/sys/dev/usb/xhcireg.h b/sys/dev/usb/xhcireg.h
index 480b93fb9d8..5910873992d 100644
--- a/sys/dev/usb/xhcireg.h
+++ b/sys/dev/usb/xhcireg.h
@@ -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