Subject: port-alpha/25829: Mylex (DAC960) raid drives not recognized as boot devices
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mhitch@NetBSD.org>
List: netbsd-bugs
Date: 06/05/2004 12:13:00
>Number:         25829
>Category:       port-alpha
>Synopsis:       Logical drives on Mylex (DAC960) raid controller not found as boot device
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-alpha-maintainer
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 05 18:14:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Michael L. Hitch
>Release:        NetBSD 2.0E, NetBSD 2.0_BETA, and earlier
>Organization:
	
>Environment:
	
	
System: NetBSD 2.0_BETA (GENERIC.MP) #3: Fri Jun  4 11:07:29 MDT 2004
        mhitch@neverland.msu.montana.edu:/usr/home/mhitch/NetBSD-2-0/OBJ/alpha/sys/arch/al
	pha/compile.alpha/GENERIC.MP
Architecture: alpha
Machine: alpha
>Description:
	The Mylex (DAC960) raid controller card is a common raid controller
	provided by Digital/Compaq/HP on many alpha systems.  There is no
	support for detecting a raid boot device in the alpha port where the
	SRM identifies the boot device as using the "RAID" protocol (as
	opposed to "SCSI" or "IDE").
>How-To-Repeat:
	Install NetBSD on a logical raid drive and boot from that drive.  The
	kernel will complain about not being able to find a device matching
	the boot string provided by SRM.

NetBSD 2.0_BETA (GENERIC.MP) #3: Fri Jun  4 11:07:29 MDT 2004
	mhitch@neverland.msu.montana.edu:/usr/home/mhitch/NetBSD-2-0/OBJ/alpha/sys/arch/alpha/compile.alpha/GENERIC.MP
AlphaServer 4X00 5/466 4MB, 467MHz, s/n GA12000000
8192 byte page size, 2 processors.
total memory = 512 MB
(2064 KB reserved for PROM, 509 MB used by NetBSD)
avail memory = 493 MB
...
mlx0 at pci1 dev 3 function 0: Mylex RAID (v2 interface)
mlx0: interrupting at kn300 irq 12
mlx0: DAC960P/PD, 1 channel, firmware 2.42-0-00, 4MB RAM
ld0 at mlx0 unit 0: JBOD, online
ld0: 8678 MB, 4407 cyl, 64 head, 63 sec, 512 bytes/sect x 17772544 sectors
mlx1 at pci1 dev 4 function 0: Mylex RAID (v2 interface)
mlx1: interrupting at kn300 irq 16
mlx1: DAC960P/PD, 1 channel, firmware 2.42-0-00, 4MB RAM
ld1 at mlx1 unit 0: RAID0, online
ld1: 31997 MB, 8126 cyl, 128 head, 63 sec, 512 bytes/sect x 65529856 sectors
ld2 at mlx1 unit 1: RAID0, online
ld2: 28749 MB, 7301 cyl, 128 head, 63 sec, 512 bytes/sect x 58877952 sectors
...
scsibus0: waiting 2 seconds for devices to settle...
cd0 at scsibus0 target 5 lun 0: <DEC, RRD45   (C) DEC, 0436> cdrom removable
cd0: async, 8-bit transfers
WARNING: can't figure what device matches "RAID 0 3 0 0 0 6000 11069"
root device: ld0a
dump device (default ld0b): 
file system (default generic): ffs
root on ld0a dumps on ld0b
>Fix:
	Add code to recognize the "RAID" type in the SRM boot information,
	and to match against logical drives ("ld").

	Duplicating the matching code for "SCSI" and matching "ld" devices
	would be one way.  This would duplicate quite a bit of code though.
	Since a raid logical drive is treated essentially the same as a
	SCSI drive, it can easily be combined with the SCSI matching code.
	The major difference is that a SCSI drive is attached to a scsibus
	which is attached to the PCI HBA, while a raid logical drive is
	attached directly to the PCI raid controller.

	I seem to recall that there are also EISA controllers as well, but
	I could be mistaken.  I'm also not sure of which alpha models support
	the Mylex raid controller, so I don't know all the model-specific
	files that need to be changed.

	An example on an AlphaServer 4x00 would be as follows:

Index: dec_kn300.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/alpha/dec_kn300.c,v
retrieving revision 1.28
diff -u -b -r1.28 dec_kn300.c
--- dec_kn300.c	14 Jun 2003 17:01:08 -0000	1.28
+++ dec_kn300.c	5 Jun 2004 17:32:40 -0000
@@ -233,7 +233,8 @@
 		return;
 
 	if (!initted) {
-		scsiboot = (strcmp(b->protocol, "SCSI") == 0);
+		scsiboot = (strcmp(b->protocol, "SCSI") == 0) |
+		    (strcmp(b->protocol, "RAID") == 0);
 		netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
 		    (strcmp(b->protocol, "MOP") == 0);
 #ifdef BDEBUG
@@ -319,6 +320,22 @@
 		found = 1;
 	}
 
+	if (scsiboot && !strcmp(name, "ld")) {
+		struct scsipibus_attach_args *sa = aux;
+
+		if (parent != scsidev)
+			return;
+
+		if (b->unit / 100 != sa->sa_periph->periph_target)
+			return;
+
+		/* XXX LUN! */
+
+		/* we've found it! */
+		booted_device = dev;
+		found = 1;
+	}
+
 	if (netboot) {
 		if (parent != pcidev)
 			return;

That can be done in an alternate way that doesn't duplicate as much code
by combining the drive attachment check:


Index: dec_kn300.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/alpha/dec_kn300.c,v
retrieving revision 1.23
diff -u -b -r1.23 dec_kn300.c
--- dec_kn300.c	20 Aug 2001 12:20:04 -0000	1.23
+++ dec_kn300.c	5 Jun 2004 17:29:30 -0000
@@ -232,7 +232,8 @@
 		return;
 
 	if (!initted) {
-		scsiboot = (strcmp(b->protocol, "SCSI") == 0);
+		scsiboot = (strcmp(b->protocol, "SCSI") == 0) |
+		    (strcmp(b->protocol, "RAID") == 0);
 		netboot = (strcmp(b->protocol, "BOOTP") == 0) ||
 		    (strcmp(b->protocol, "MOP") == 0);
 #ifdef BDEBUG
@@ -289,11 +290,13 @@
 
 	if (scsiboot &&
 	    (!strcmp(cd->cd_name, "sd") ||
+	     !strcmp(cd->cd_name, "ld") ||
 	     !strcmp(cd->cd_name, "st") ||
 	     !strcmp(cd->cd_name, "cd"))) {
 		struct scsipibus_attach_args *sa = aux;
 
-		if (parent->dv_parent != scsidev)
+		if (parent->dv_parent != scsidev &&
+		    parent != scsidev)		/* XXX ld device -> mlx */
 			return;
 
 		if (b->unit / 100 != sa->sa_periph->periph_target)
@@ -306,6 +309,7 @@
 		 * XXX: Only support SD booting for now.
 		 */
 		if (strcmp(cd->cd_name, "sd") &&
+		    strcmp(cd->cd_name, "ld") &&
 		    strcmp(cd->cd_name, "cd") &&
 		    strcmp(cd->cd_name, "st"))
 			return;
>Release-Note:
>Audit-Trail:
>Unformatted: