Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2]: src/sys/dev/ic Pull up following revision(s) (requested by it...
details: https://anonhg.NetBSD.org/src/rev/ba40a2697e52
branches: netbsd-2
changeset: 564413:ba40a2697e52
user: tron <tron%NetBSD.org@localhost>
date: Fri Jan 20 22:17:12 2006 +0000
description:
Pull up following revision(s) (requested by itohy in ticket #10222):
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 c5bc70f063ce -r ba40a2697e52 sys/dev/ic/ninjascsi32.c
--- a/sys/dev/ic/ninjascsi32.c Thu Jan 19 21:39:56 2006 +0000
+++ b/sys/dev/ic/ninjascsi32.c Fri Jan 20 22:17:12 2006 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: ninjascsi32.c,v 1.2.2.3 2004/08/30 09:54:17 tron Exp $ */
+/* $NetBSD: ninjascsi32.c,v 1.2.2.3.2.1 2006/01/20 22:17:12 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.2.3 2004/08/30 09:54:17 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ninjascsi32.c,v 1.2.2.3.2.1 2006/01/20 22:17:12 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) {
Home |
Main Index |
Thread Index |
Old Index