Re: Compaq Fiber Channel Array RM4000 / 2.6.16 kernel patch

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

 



Hello James,

On Wed, 2006-03-29 at 20:54 +0200, Ingo Flaschberger wrote:
I need to avoid the return 1; and go on in the function.....

Oh, OK, then the third line should be (starget->scsi_level < SCSI_3 ||
starget->scsi_level == SCSI_UNKNOWN)

which should do it.  There are several other places for that ... a patch
was posted for some of them quite a while ago.

When you mean:
if ((bflags & BLIST_NOREPORTLUN) ||
             starget->scsi_level < SCSI_2 ||
            ((starget->scsi_level < SCSI_3 ||
             starget->scsi_level == SCSI_UNKNOWN) &&
             (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) )
		return 1;
That also hits return.

I'm also afraid the trigger other problems whith SCSI_UNKNOWN so I suggest this:

        if ((bflags & BLIST_NOREPORTLUN) ||
             ((starget->scsi_level < SCSI_2) &&
             !(bflags & BLIST_REPORTLUN0)) ||
            ((starget->scsi_level < SCSI_3) &&
             (!((bflags & BLIST_REPORTLUN2) || (bflags & BLIST_REPORTLUN0))
                 || shost->max_lun <= 8)) )
                return 1;

Attached the whole patch.

bye & hopeful,
	Ingo
diff -r -u linux-2.6.16_org/Documentation/scsi/RA4x00.txt linux-2.6.16/Documentation/scsi/RA4x00.txt
--- linux-2.6.16_org/Documentation/scsi/RA4x00.txt	2006-03-30 00:19:32.000000000 +0200
+++ linux-2.6.16/Documentation/scsi/RA4x00.txt	2006-03-29 20:35:17.000000000 +0200
@@ -0,0 +1,20 @@
+Compaq RA4x00 Fiber Channel Array support	if@xxxxxx 29.03.2006
+						crossip communications gmbh
+
+In 2.4.x linux kernels the cpqfc driver supported the Compaq RA4x00 Fiber 
+Channel Array. Limitation in 2.4.x kernels was that the RA4x00 only worked with
+a cpqfc supported fiber channel adapter (Tachyon chipset).
+
+In 2.6.x linux kernels the support for the cpqfc has been dropped because of
+very awful code and resulting porting problems from 2.4.x to 2.6.x.
+
+Support for the RA4x00 is now directly in the linux kernel but need some
+special configuration:
+*) Use a already supported fiber channel cards
+*) Update the RA4x00 to firmware version 2.60
+*) Load the scsi_mod modules with option: max_luns=4294967295
+
+
+More information about the RA4x00 could be found:
+http://hp.com
+http://ra4x00.xip.at
diff -r -u linux-2.6.16_org/drivers/scsi/scsi.c linux-2.6.16/drivers/scsi/scsi.c
--- linux-2.6.16_org/drivers/scsi/scsi.c	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/drivers/scsi/scsi.c	2006-03-29 20:02:53.000000000 +0200
@@ -35,6 +35,10 @@
  *  Jiffies wrap fixes (host->resetting), 3 Dec 1998 Andrea Arcangeli
  *
  *  out_of_space hacks, D. Gilbert (dpg) 990608
+ *
+ *  Added Compaq RA4x00 Fiber Channel Array support, 29.03.2006
+ *	crossip communications gmbh - Ingo Flaschberger <if@xxxxxx>
+ *
  */
 
 #include <linux/module.h>
@@ -567,7 +571,7 @@
 	/* 
 	 * If SCSI-2 or lower, store the LUN value in cmnd.
 	 */
-	if (cmd->device->scsi_level <= SCSI_2) {
+	if ((cmd->device->scsi_level <= SCSI_2) && (!cmd->device->nolun_in_cdb)) {
 		cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
 			       (cmd->device->lun << 5 & 0xe0);
 	}
diff -r -u linux-2.6.16_org/drivers/scsi/scsi_devinfo.c linux-2.6.16/drivers/scsi/scsi_devinfo.c
--- linux-2.6.16_org/drivers/scsi/scsi_devinfo.c	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/drivers/scsi/scsi_devinfo.c	2006-03-29 23:58:27.000000000 +0200
@@ -132,6 +132,10 @@
 	{"CMD", "CRA-7280", NULL, BLIST_SPARSELUN},	/* CMD RAID Controller */
 	{"CNSI", "G7324", NULL, BLIST_SPARSELUN},	/* Chaparral G7324 RAID */
 	{"CNSi", "G8324", NULL, BLIST_SPARSELUN},	/* Chaparral G8324 RAID */
+	{"COMPAQ", "ARRAY CONTROLLER", "2.60", BLIST_SPARSELUN | BLIST_REPORTLUN0 | 
+		BLIST_LARGELUN | BLIST_MAX_512K}, /* Compaq RA4x00 */
+	{"COMPAQ", "LOGICAL VOLUME", "2.60", BLIST_REPORTLUN0 | BLIST_NOLUN_IN_CDB |
+		BLIST_MAX_512K},	/* Compaq RA4x00 */
 	{"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN},
 	{"COMPAQ", "CR3500", NULL, BLIST_FORCELUN},
 	{"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
diff -r -u linux-2.6.16_org/drivers/scsi/scsi_scan.c linux-2.6.16/drivers/scsi/scsi_scan.c
--- linux-2.6.16_org/drivers/scsi/scsi_scan.c	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/drivers/scsi/scsi_scan.c	2006-03-30 00:15:53.000000000 +0200
@@ -23,6 +23,11 @@
  * 		all of the LUNs returned by the REPORT LUN; else,
  * 		sequentially scan LUNs up until some maximum is reached,
  * 		or a LUN is seen that cannot have a device attached to it.
+ * 
+ * Modification history:
+ * 	- Added Compaq RA4x00 Fiber Channel Array support, 29.03.2006
+ *		crossip communications gmbh - Ingo Flaschberger <if@xxxxxx>
+ *
  */
 
 #include <linux/config.h>
@@ -647,6 +652,7 @@
 	case TYPE_MEDIUM_CHANGER:
 	case TYPE_ENCLOSURE:
 	case TYPE_COMM:
+	case TYPE_RAID:
 	case TYPE_RBC:
 		sdev->writeable = 1;
 		break;
@@ -715,6 +721,22 @@
 	if (*bflags & BLIST_SELECT_NO_ATN)
 		sdev->select_no_atn = 1;
 
+        /*
+        * Maximum 512K cdb transfer length
+        * broken RA4x00 Compaq Disk Array
+        */
+        if (*bflags & BLIST_MAX_512K) {
+                sdev->max_512k = 1;
+        }
+
+        /*
+        * Do not send LUN in SCSI2 cdb
+        * broken RA4x00 Compaq Disk Array
+        */
+	if (*bflags & BLIST_NOLUN_IN_CDB) {
+        	sdev->nolun_in_cdb = 1;
+	}
+
 	/*
 	 * Some devices may not want to have a start command automatically
 	 * issued when a device is added.
@@ -1089,9 +1111,11 @@
 	 * support more than 8 LUNs.
 	 */
 	if ((bflags & BLIST_NOREPORTLUN) || 
-	     starget->scsi_level < SCSI_2 ||
-	    (starget->scsi_level < SCSI_3 && 
-	     (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) )
+	     ((starget->scsi_level < SCSI_2) && 
+	     !(bflags & BLIST_REPORTLUN0)) ||
+	    ((starget->scsi_level < SCSI_3) && 
+	     (!((bflags & BLIST_REPORTLUN2) || (bflags & BLIST_REPORTLUN0))
+		 || shost->max_lun <= 8)) )
 		return 1;
 	if (bflags & BLIST_NOLUN)
 		return 0;
diff -r -u linux-2.6.16_org/drivers/scsi/sd.c linux-2.6.16/drivers/scsi/sd.c
--- linux-2.6.16_org/drivers/scsi/sd.c	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/drivers/scsi/sd.c	2006-03-29 20:03:17.000000000 +0200
@@ -22,6 +22,8 @@
  *	 - Badari Pulavarty <pbadari@xxxxxxxxxx>, Matthew Wilcox 
  *	   <willy@xxxxxxxxxx>, Kurt Garloff <garloff@xxxxxxx>: 
  *	   Support 32k/1M disks.
+ *       - Added Compaq RA4x00 Fiber Channel Array support, 29.03.2006
+ *         crossip communications gmbh - Ingo Flaschberger <if@xxxxxx>
  *
  *	Logging policy (needs CONFIG_SCSI_LOGGING defined):
  *	 - setting up transfer: SCSI_LOG_HLQUEUE levels 1 and 2
@@ -344,8 +346,14 @@
 		SCpnt->cmnd[14] = SCpnt->cmnd[15] = 0;
 	} else if ((this_count > 0xff) || (block > 0x1fffff) ||
 		   SCpnt->device->use_10_for_rw) {
-		if (this_count > 0xffff)
-			this_count = 0xffff;
+		if (SCpnt->device->max_512k) {
+			if (this_count > 0x200) {
+				this_count = 0x200;
+			}
+		} else {
+			if (this_count > 0xffff)
+				this_count = 0xffff;
+		}
 
 		SCpnt->cmnd[0] += READ_10 - READ_6;
 		SCpnt->cmnd[1] |= blk_fua_rq(rq) ? 0x8 : 0;
diff -r -u linux-2.6.16_org/include/scsi/scsi_device.h linux-2.6.16/include/scsi/scsi_device.h
--- linux-2.6.16_org/include/scsi/scsi_device.h	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/include/scsi/scsi_device.h	2006-03-29 19:30:26.000000000 +0200
@@ -112,6 +112,8 @@
 				 * this device */
 	unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN
 				     * because we did a bus reset. */
+	unsigned max_512k:1;	/* maximum 512K cdb transfer length */
+	unsigned nolun_in_cdb:1; /* do not send LUN number in cdb */
 	unsigned use_10_for_rw:1; /* first try 10-byte read / write */
 	unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */
 	unsigned skip_ms_page_8:1;	/* do not use MODE SENSE page 0x08 */
diff -r -u linux-2.6.16_org/include/scsi/scsi_devinfo.h linux-2.6.16/include/scsi/scsi_devinfo.h
--- linux-2.6.16_org/include/scsi/scsi_devinfo.h	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.16/include/scsi/scsi_devinfo.h	2006-03-29 23:00:29.000000000 +0200
@@ -28,4 +28,8 @@
 #define BLIST_NO_ULD_ATTACH	0x100000 /* device is actually for RAID config */
 #define BLIST_SELECT_NO_ATN	0x200000 /* select without ATN */
 #define BLIST_RETRY_HWERROR	0x400000 /* retry HARDWARE_ERROR */
+#define BLIST_REPORTLUN0	0x800000 /* try REPORT_LUNS even for SCSI-UNKNOWN devs
+                			(if HBA supports more than 8 LUNs) */
+#define BLIST_MAX_512K          0x1000000 /* maximum 512K cdb transfer length */
+#define BLIST_NOLUN_IN_CDB	0x2000000 /* do not send LUN number in cdb */
 #endif

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux