Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/mscp Adjust MSCP attach routines. The current code w...



details:   https://anonhg.NetBSD.org/src/rev/37280a4ddbb4
branches:  trunk
changeset: 780068:37280a4ddbb4
user:      abs <abs%NetBSD.org@localhost>
date:      Tue Jul 10 22:30:22 2012 +0000

description:
Adjust MSCP attach routines. The current code worked fine on simh-vax, but
unfortunately failed on at least one 'real' SCSI MSCP adaptor.
In the updated code mscp_attach() still iterates over each unit on a bus,
but mscp_dorsp() now detects if we have reached the last unit and does not
return a bogus additional unit. It also loses a few gotos and handles
noncontiguous unit numbers better.

diffstat:

 sys/dev/mscp/mscp.c |  15 ++++++++++-----
 sys/dev/mscp/mscp.h |   4 +++-
 2 files changed, 13 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 3e3bd6f09591 -r 37280a4ddbb4 sys/dev/mscp/mscp.c
--- a/sys/dev/mscp/mscp.c       Tue Jul 10 21:18:07 2012 +0000
+++ b/sys/dev/mscp/mscp.c       Tue Jul 10 22:30:22 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mscp.c,v 1.34 2009/05/12 14:37:59 cegger Exp $ */
+/*     $NetBSD: mscp.c,v 1.35 2012/07/10 22:30:23 abs Exp $    */
 
 /*
  * Copyright (c) 1988 Regents of the University of California.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mscp.c,v 1.34 2009/05/12 14:37:59 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp.c,v 1.35 2012/07/10 22:30:23 abs Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -173,7 +173,8 @@
        struct mscp_xi *mxi;
        int nextrsp;
        int st, error;
-       extern struct mscp slavereply;
+       extern struct mscp mscp_cold_reply;
+       extern int mscp_cold_unit;
 
        nextrsp = mi->mi_rsp.mri_next;
 loop:
@@ -287,8 +288,12 @@
                 * to set it up, otherwise it's just a "normal" unit
                 * status.
                 */
-               if (cold)
-                       memcpy(&slavereply, mp, sizeof(struct mscp));
+               if (cold) {
+                       memcpy(&mscp_cold_reply, mp, sizeof(struct mscp));
+                       /* Detect that we've reached the end of all units */
+                       if (mp->mscp_unit < mscp_cold_unit)
+                               break;
+               }
 
                if (mp->mscp_status == (M_ST_OFFLINE|M_OFFLINE_UNKNOWN))
                        break;
diff -r 3e3bd6f09591 -r 37280a4ddbb4 sys/dev/mscp/mscp.h
--- a/sys/dev/mscp/mscp.h       Tue Jul 10 21:18:07 2012 +0000
+++ b/sys/dev/mscp/mscp.h       Tue Jul 10 22:30:22 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mscp.h,v 1.8 2005/12/11 12:22:47 christos Exp $        */
+/*     $NetBSD: mscp.h,v 1.9 2012/07/10 22:30:23 abs Exp $     */
 
 /*
  * Copyright (c) 1988 Regents of the University of California.
@@ -40,6 +40,8 @@
  * IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
  */
 
+#define MSCP_MAX_UNIT  4095
+
 /*
  * Control message opcodes
  */



Home | Main Index | Thread Index | Old Index