Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/dev/ic Pull up following revision(s) (requested by it...
details: https://anonhg.NetBSD.org/src/rev/8b3a23208483
branches: netbsd-3
changeset: 577736:8b3a23208483
user: tron <tron%NetBSD.org@localhost>
date: Fri Jan 20 22:29:25 2006 +0000
description:
Pull up following revision(s) (requested by itohy in ticket #1117):
sys/dev/ic/ninjascsi32.c: revision 1.6
- Fix panic when the DMA buffer is not 4byte aligned.
In this case, the transfer count becomes larger than the reality,
and this fix works around it.
- Add missing bus_dmamap_unload() in attach failure path.
diffstat:
sys/dev/ic/ninjascsi32.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diffs (64 lines):
diff -r daad62e6562e -r 8b3a23208483 sys/dev/ic/ninjascsi32.c
--- a/sys/dev/ic/ninjascsi32.c Fri Jan 20 21:14:47 2006 +0000
+++ b/sys/dev/ic/ninjascsi32.c Fri Jan 20 22:29:25 2006 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: ninjascsi32.c,v 1.2 2004/08/26 18:38:19 thorpej Exp $ */
+/* $NetBSD: ninjascsi32.c,v 1.2.16.1 2006/01/20 22:29:25 tron Exp $ */
/*-
- * Copyright (c) 2004 The NetBSD Foundation, Inc.
+ * Copyright (c) 2004, 2006 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ninjascsi32.c,v 1.2 2004/08/26 18:38:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ninjascsi32.c,v 1.2.16.1 2006/01/20 22:29:25 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -526,6 +526,7 @@
if (i > 0)
return i;
+ bus_dmamap_unload(sc->sc_dmat, sc->sc_dmamap_cmdpg);
fail3: bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap_cmdpg);
fail2: bus_dmamem_unmap(sc->sc_dmat, (caddr_t)sc->sc_cmdpg,
sizeof(struct njsc32_dma_page));
@@ -2524,6 +2525,8 @@
if (auto_phase &
(NJSC32_XPHASE_DATA_IN | NJSC32_XPHASE_DATA_OUT)) {
+ u_int32_t sackcnt, cntoffset;
+
#ifdef NJSC32_TRACE
if (auto_phase & NJSC32_XPHASE_DATA_IN)
PRINTC(cmd, ("njsc32_intr: data in done\n"));
@@ -2593,8 +2596,22 @@
* data has been transferred, and current pointer
* is changed
*/
- njsc32_set_cur_ptr(cmd, cmd->c_dp_cur +
- njsc32_read_4(sc, NJSC32_REG_SACK_CNT));
+ sackcnt = njsc32_read_4(sc, NJSC32_REG_SACK_CNT);
+
+ /*
+ * The controller returns extra ACK count
+ * if the DMA buffer is not 4byte aligned.
+ */
+ cntoffset = le32toh(cmd->c_sgt[0].sg_addr) & 3;
+#ifdef NJSC32_DEBUG
+ if (cntoffset != 0) {
+ printf("sackcnt %u, cntoffset %u\n",
+ sackcnt, cntoffset);
+ }
+#endif
+ /* advance SCSI pointer */
+ njsc32_set_cur_ptr(cmd,
+ cmd->c_dp_cur + sackcnt - cntoffset);
}
if (auto_phase & NJSC32_XPHASE_MSGOUT) {
- Prev by Date:
[src/netbsd-3]: src/sys/arch/xen/i386 Pull up following revision(s) (requeste...
- Next by Date:
[src/netbsd-3]: src/doc Tickets 1108, 1113, 1116, 1118, 1120, 1121, 1122, 112...
- Previous by Thread:
[src/netbsd-3]: src/sys/arch/xen/i386 Pull up following revision(s) (requeste...
- Next by Thread:
[src/netbsd-3]: src/doc Tickets 1108, 1113, 1116, 1118, 1120, 1121, 1122, 112...
- Indexes:
Home |
Main Index |
Thread Index |
Old Index