Subject: kern/1169: MI SCSI doesn't handle Emulex MD21 properly
To: None <gnats-admin@sun-lamp.pc.cs.cmu.edu>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: netbsd-bugs
Date: 06/28/1995 12:50:05
>Number:         1169
>Category:       kern
>Synopsis:       MI SCSI doesn't handle Emulex MD21 properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 28 12:50:03 1995
>Originator:     Jason Thorpe
>Organization:
Numerical Aerodynamic Simulation Project - NASA Ames
>Release:        -current, updated June 27
>Environment:
	
Both NetBSD/sun3 and NetBSD/sparc (a 3/60 and a 4/260).  Doesn't paricularly
matter.  That's just what I happen to have MD21s on.

>Description:
	Because the Emulex MD21 is so ancient, the MI SCSI code, based
	on a SCSI version rule, assumes that it cannot handle LUNs.
	However, the MD21 can indeed deal with LUNs correctly, and
	many old Sun machines (such as the 4/260) hang two ESDI disks
	off of one MD21 (LUN 0 and LUN 1).

>How-To-Repeat:
	Boot NetBSD on a machine with 2 ESDI disks behind an MD21.  Only
	the disk at LUN 0 will be configured.
>Fix:
	My fix adds Yet Another Quirk to scsiconf.{c,h}, amounting to,
	essentially, the opposite of SDEV_NOLUNS.  The SDEV_FORCELUNS
	quirk can be used to force the probing of LUNs on ancient
	SCSI devices that handle LUNs correctly.

	This patch also includes a quirk entry for a QIC-36 tape
	behind a different Emulex board; this device cannot handle LUNs.
	Note that this device also does not report _any_ id strings.
	This tape device is found in many Sun `shoeboxes' and is
	also the internal tape drive used on some Sun 4/260s.
	(Thanks for the pointer, Gordon!)

===================================================================
RCS file: /mastersrc/netbsd/src/sys/scsi/scsiconf.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 scsiconf.c
*** scsiconf.c	1995/06/24 21:06:53	1.1.1.4
--- scsiconf.c	1995/06/27 17:43:13
***************
*** 311,322 ****
--- 311,328 ----
  	{T_DIRECT, T_FIXED,
  	 "QUANTUM ", "PD1225S         ", "3110", SDEV_NOLUNS},
  
+ 	{T_DIRECT, T_FIXED,
+ 	 "EMULEX  ", "MD21/S2     ESDI", "A00",  SDEV_FORCELUNS},
+ 
  	{T_SEQUENTIAL, T_REMOV,
  	 "EXABYTE ", "EXB-8200        ", "",     SDEV_NOLUNS},
  	{T_SEQUENTIAL, T_REMOV,
  	 "SONY    ", "SDT-2000        ", "2.09", SDEV_NOLUNS},
  	{T_SEQUENTIAL, T_REMOV,
  	 "TANDBERG", " TDC 3600       ", "",     SDEV_NOLUNS},
+ 	/* XXX: QIC-36 tape behind Emulex adapter. */
+ 	{T_SEQUENTIAL, T_REMOV,
+ 	 "        ", "                ", "    ", SDEV_NOLUNS},
  
  	{T_SEQUENTIAL, T_REMOV,
  	 "SONY    ", "SDT-5000        ", "3.17", SDEV_NOSYNCWIDE},
***************
*** 395,401 ****
  	    sizeof(scsi_quirk_patterns[0]), &priority);
  	if (priority != 0)
  		sc_link->quirks |= finger->quirks;
! 	if ((inqbuf.version & SID_ANSII) == 0)
  		sc_link->quirks |= SDEV_NOLUNS;
  
  	if ((sc_link->quirks & SDEV_NOLUNS) == 0)
--- 401,408 ----
  	    sizeof(scsi_quirk_patterns[0]), &priority);
  	if (priority != 0)
  		sc_link->quirks |= finger->quirks;
! 	if ((inqbuf.version & SID_ANSII) == 0 &&
! 	    (sc_link->quirks & SDEV_FORCELUNS) == 0)
  		sc_link->quirks |= SDEV_NOLUNS;
  
  	if ((sc_link->quirks & SDEV_NOLUNS) == 0)
Index: scsiconf.h
===================================================================
RCS file: /mastersrc/netbsd/src/sys/scsi/scsiconf.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 scsiconf.h
*** scsiconf.h	1995/05/02 22:56:48	1.1.1.1
--- scsiconf.h	1995/06/26 23:47:19
***************
*** 140,145 ****
--- 140,146 ----
  #define	SDEV_AUTOSAVE		0x01	/* do implicit SAVEDATAPOINTER on disconnect */
  #define	SDEV_NOSYNCWIDE		0x02	/* does not grok SDTR or WDTR */
  #define	SDEV_NOLUNS		0x04	/* does not grok LUNs */
+ #define	SDEV_FORCELUNS		0x08	/* force LUNs on pre-SID_ANSII */
  /* 12*/	struct	scsi_device *device;	/* device entry points etc. */
  /* 16*/	void	*device_softc;		/* needed for call to foo_start */
  /* 20*/	struct	scsi_adapter *adapter;	/* adapter entry points etc. */
>Audit-Trail:
>Unformatted: