[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-scsi
Subject:    [Patch] SCSI scanning code and PQ bit
From:       Mike Anderson <mike.anderson () us ! ibm ! com>
Date:       2001-08-21 6:17:55
[Download RAW message or body]

This is a patch that tries to address the previous problem of the PQ bit and
online true / false.
 
The current code detects and attaches sd's, but then they cannot be used
because online is not set. This patch is similar to one Doug Ledford
posted a while back.
(http://marc.theaimsgroup.com/?t=98462330100001&w=2&r=1)

This patch keeps online true, stops sd's from attaching, and allows sg
access if the PQ is "Not Connected".

This patch is against 2.4.8-ac7. I did a quick check and it should apply
cleanly to 2.4.8 (YMMV).

I tested this on a 2-way SMP system. I had the aic7xxx configured into the
kernel and a Emulex FC HA driver loaded in as a module.

The storage config was as follows:

3 SCSI, 1 CDROM off the aic
20 luns of LSI FC Storage off the Emulex FC HA
4 FC JBOD Disks off the Emulex FC HA

The non owned LSI luns where configured to returned "Not Connected".

Sd attached to all disks except the "Not Connected" ones. Sg still had
access to these devices.

An output of a couple sg utils is provided below.

Output of sg_map:

/dev/sg0  /dev/sda
/dev/sg1  /dev/sdb
/dev/sg2  /dev/sdc
/dev/sg3  /dev/scd0
/dev/sg4  /dev/sdd
/dev/sg5
/dev/sg6  /dev/sde
.....

Output of sg_inq:
# ./sg_inq /dev/sg5
standard INQUIRY:
PQual=1, Device type=0, RMB=0, ANSI version=3, [full version=0x03]
AERC=0, TrmTsk=0, NormACA=1, HiSUP=1, Resp data format=2, SCCS=0
BQue=0, EncServ=1, MultiP=0, MChngr=0, ACKREQQ=0, Addr16=0
RelAdr=0, WBus16=1, Sync=1, Linked=0, TranDis=0, CmdQue=1
length=36 (0x24)
Vendor identification: IBM
Product identification: 3542
Product revision level: 0400
Product serial number: 1T05078656

# ./sg_inq /dev/sg6
standard INQUIRY:
PQual=0, Device type=0, RMB=0, ANSI version=3, [full version=0x03]
AERC=0, TrmTsk=0, NormACA=1, HiSUP=1, Resp data format=2, SCCS=0
BQue=0, EncServ=1, MultiP=0, MChngr=0, ACKREQQ=0, Addr16=0
RelAdr=0, WBus16=1, Sync=1, Linked=0, TranDis=0, CmdQue=1
length=36 (0x24)
Vendor identification: IBM
Product identification: 3542
Product revision level: 0400
Product serial number: 1T05078656

I will do some more testing tomorrow

Thanks,

-Mike
-- 
Michael Anderson
mike.anderson@us.ibm.com

diff -u --new-file --recursive --exclude-from /home/mikeand/views/dontdiff \
                linux-2.4.8-ac7/drivers/scsi/scsi.h \
                linux-2.4.8-ac7-pq/drivers/scsi/scsi.h
--- linux-2.4.8-ac7/drivers/scsi/scsi.h	Mon Aug 20 09:36:58 2001
+++ linux-2.4.8-ac7-pq/drivers/scsi/scsi.h	Mon Aug 20 14:41:51 2001
@@ -581,6 +581,7 @@
 
 	void *hostdata;		/* available to low-level driver */
 	devfs_handle_t de;      /* directory for the device      */
+	char sdev_periph_qual;
 	char type;
 	char scsi_level;
 	char vendor[8], model[16], rev[4];
diff -u --new-file --recursive --exclude-from /home/mikeand/views/dontdiff \
                linux-2.4.8-ac7/drivers/scsi/scsi_scan.c \
                linux-2.4.8-ac7-pq/drivers/scsi/scsi_scan.c
--- linux-2.4.8-ac7/drivers/scsi/scsi_scan.c	Thu Aug  9 17:15:25 2001
+++ linux-2.4.8-ac7-pq/drivers/scsi/scsi_scan.c	Mon Aug 20 22:06:47 2001
@@ -600,9 +600,6 @@
 	memcpy(SDpnt->rev, scsi_result + 32, 4);
 
 	SDpnt->removable = (0x80 & scsi_result[1]) >> 7;
-	/* Use the peripheral qualifier field to determine online/offline */
-	if (((scsi_result[0] >> 5) & 7) == 1) 	SDpnt->online = FALSE;
-	else SDpnt->online = TRUE;
 	SDpnt->lockable = SDpnt->removable;
 	SDpnt->changed = 0;
 	SDpnt->access_count = 0;
@@ -639,6 +636,7 @@
 	    (scsi_result[7] & 1) && ((scsi_result[3] & 7) == 2);
 	SDpnt->random = (type == TYPE_TAPE) ? 0 : 1;
 	SDpnt->type = (type & 0x1f);
+	SDpnt->sdev_periph_qual = (scsi_result[0] & 0xe0) >> 5;
 
 	print_inquiry(scsi_result);
 
diff -u --new-file --recursive --exclude-from /home/mikeand/views/dontdiff \
                linux-2.4.8-ac7/drivers/scsi/sd.c \
                linux-2.4.8-ac7-pq/drivers/scsi/sd.c
--- linux-2.4.8-ac7/drivers/scsi/sd.c	Wed Aug 15 23:07:02 2001
+++ linux-2.4.8-ac7-pq/drivers/scsi/sd.c	Mon Aug 20 16:27:36 2001
@@ -1224,7 +1224,8 @@
 
 static int sd_detect(Scsi_Device * SDp)
 {
-	if (SDp->type != TYPE_DISK && SDp->type != TYPE_MOD)
+	if (SDp->sdev_periph_qual != SCSI_INQ_PQ_CON ||
+		(SDp->type != TYPE_DISK && SDp->type != TYPE_MOD))
 		return 0;
 	sd_template.dev_noticed++;
 	return 1;
@@ -1237,7 +1238,8 @@
 	int i;
 	char nbuff[6];
 
-	if (SDp->type != TYPE_DISK && SDp->type != TYPE_MOD)
+	if (SDp->sdev_periph_qual != SCSI_INQ_PQ_CON ||
+		(SDp->type != TYPE_DISK && SDp->type != TYPE_MOD))
 		return 0;
 
 	if (sd_template.nr_dev >= sd_template.dev_max) {
diff -u --new-file --recursive --exclude-from /home/mikeand/views/dontdiff \
                linux-2.4.8-ac7/include/scsi/scsi.h \
                linux-2.4.8-ac7-pq/include/scsi/scsi.h
--- linux-2.4.8-ac7/include/scsi/scsi.h	Mon Aug 20 09:24:03 2001
+++ linux-2.4.8-ac7-pq/include/scsi/scsi.h	Mon Aug 20 22:10:46 2001
@@ -142,6 +142,13 @@
 #define TYPE_NO_LUN         0x7f
 
 /*
+ * INQ PERIPHERAL QUALIFIERS
+ */
+#define SCSI_INQ_PQ_CON         0x00
+#define SCSI_INQ_PQ_NOT_CON     0x01
+#define SCSI_INQ_PQ_NOT_CAP     0x03
+
+/*
  * standard mode-select header prepended to all mode-select commands
  *
  * moved here from cdrom.h -- kraxel
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic