summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorabs <abs@NetBSD.org>2012-07-10 22:30:22 +0000
committerabs <abs@NetBSD.org>2012-07-10 22:30:22 +0000
commit386aa7d2da2b9569a700ab30d497496d291c492e (patch)
tree31f2624ca0534c71d227fbdd9aa34de6616c98e6 /sys/dev
parent489a99490844aace375013c2282005551573e322 (diff)
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 (limited to 'sys/dev')
-rw-r--r--sys/dev/mscp/mscp.c15
-rw-r--r--sys/dev/mscp/mscp.h4
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/mscp/mscp.c b/sys/dev/mscp/mscp.c
index 7d4b09b8ef5..ba80d12eea9 100644
--- a/sys/dev/mscp/mscp.c
+++ b/sys/dev/mscp/mscp.c
@@ -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 @@ mscp_dorsp(struct mscp_softc *mi)
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 @@ loop:
* 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 --git a/sys/dev/mscp/mscp.h b/sys/dev/mscp/mscp.h
index 940846bec71..e8a115f0a4f 100644
--- a/sys/dev/mscp/mscp.h
+++ b/sys/dev/mscp/mscp.h
@@ -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
*/