Module Name:    src
Committed By:   martin
Date:           Thu Jan 10 09:12:47 UTC 2019

Modified Files:
        src/sys/dev/ic: isp_library.c

Log Message:
When handles returned by the device do not match our expectations,
log more details.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/isp_library.c

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/ic/isp_library.c
diff -u src/sys/dev/ic/isp_library.c:1.7 src/sys/dev/ic/isp_library.c:1.8
--- src/sys/dev/ic/isp_library.c:1.7	Mon Feb 28 17:17:55 2011
+++ src/sys/dev/ic/isp_library.c	Thu Jan 10 09:12:47 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_library.c,v 1.7 2011/02/28 17:17:55 mjacob Exp $ */
+/* $NetBSD: isp_library.c,v 1.8 2019/01/10 09:12:47 martin Exp $ */
 /*
  * Copyright (c) 2006-2007 by Matthew Jacob
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 #ifdef	__NetBSD__
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_library.c,v 1.7 2011/02/28 17:17:55 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_library.c,v 1.8 2019/01/10 09:12:47 martin Exp $");
 #include <dev/ic/isp_netbsd.h>
 #endif
 #ifdef	__FreeBSD__
@@ -294,7 +294,12 @@ uint32_t
 isp_handle_index(ispsoftc_t *isp, uint32_t handle)
 {
 	if (!ISP_VALID_HANDLE(isp, handle)) {
-		isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle);
+		int cmd = handle & ISP_HANDLE_CMD_MASK;
+		if (cmd > isp->isp_maxcmds)
+			cmd = 0;
+		isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x (isp_seqno: %d,"
+		    " isp_xflist[%d].handle = 0x%x)", __func__,
+		    handle, isp->isp_seqno, cmd, isp->isp_xflist[cmd].handle);
 		return (ISP_BAD_HANDLE_INDEX);
 	} else {
 		return (handle & ISP_HANDLE_CMD_MASK);

Reply via email to