Merge ../scsi-rc-fixes-2.6
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>
Fri, 14 Apr 2006 20:47:45 +0000 (15:47 -0500)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Fri, 14 Apr 2006 20:47:45 +0000 (15:47 -0500)
Conflicts:

include/scsi/scsi_devinfo.h

Same number for two BLIST flags:  BLIST_MAX_512 and BLIST_ATTACH_PQ3

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1  2 
drivers/scsi/Makefile
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_scan.c
include/scsi/scsi_devinfo.h

diff --combined drivers/scsi/Makefile
index efdff61c58080f78f632c97115603c3b2be07049,81803a16f986d13d7b0aab7419e2bf0cd11d2477..3ce80ab4824a39312557d0805ce7660a78b644b9
@@@ -33,7 -33,7 +33,7 @@@ obj-$(CONFIG_SCSI_FC_ATTRS)   += scsi_tr
  obj-$(CONFIG_SCSI_ISCSI_ATTRS)        += scsi_transport_iscsi.o
  obj-$(CONFIG_SCSI_SAS_ATTRS)  += scsi_transport_sas.o
  
 -obj-$(CONFIG_ISCSI_TCP)       += iscsi_tcp.o
 +obj-$(CONFIG_ISCSI_TCP)       += libiscsi.o   iscsi_tcp.o
  obj-$(CONFIG_SCSI_AMIGA7XX)   += amiga7xx.o   53c7xx.o
  obj-$(CONFIG_A3000_SCSI)      += a3000.o      wd33c93.o
  obj-$(CONFIG_A2091_SCSI)      += a2091.o      wd33c93.o
@@@ -78,7 -78,6 +78,6 @@@ obj-$(CONFIG_SCSI_NCR_Q720)   += NCR_Q720
  obj-$(CONFIG_SCSI_SYM53C416)  += sym53c416.o
  obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o       qlogicfas.o
  obj-$(CONFIG_PCMCIA_QLOGIC)   += qlogicfas408.o
- obj-$(CONFIG_SCSI_QLOGIC_FC)  += qlogicfc.o 
  obj-$(CONFIG_SCSI_QLOGIC_1280)        += qla1280.o 
  obj-$(CONFIG_SCSI_QLA_FC)     += qla2xxx/
  obj-$(CONFIG_SCSI_LPFC)               += lpfc/
index 6f46b338c991a99bd1640edeaa251f69cab47ee3,c750d3399a97835bbf774a6a2ab5e3dece5f330f..ae13e4a78d515205b37aedc406484cb40f8aef9c
@@@ -132,7 -132,9 +132,9 @@@ static struct 
        {"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", "LOGICAL VOLUME", NULL, BLIST_FORCELUN},
+       {"COMPAQ", "ARRAY CONTROLLER", NULL, BLIST_SPARSELUN | BLIST_LARGELUN |
+               BLIST_MAX_512 | BLIST_REPORTLUN2},      /* Compaq RA4x00 */
+       {"COMPAQ", "LOGICAL VOLUME", NULL, BLIST_FORCELUN | BLIST_MAX_512}, /* Compaq RA4x00 */
        {"COMPAQ", "CR3500", NULL, BLIST_FORCELUN},
        {"COMPAQ", "MSA1000", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
        {"COMPAQ", "MSA1000 VOLUME", NULL, BLIST_SPARSELUN | BLIST_NOSTARTONADD},
        {"HITACHI", "DF400", "*", BLIST_SPARSELUN},
        {"HITACHI", "DF500", "*", BLIST_SPARSELUN},
        {"HITACHI", "DF600", "*", BLIST_SPARSELUN},
 +      {"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
 +      {"HITACHI", "OPEN-E", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
        {"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN},       /* HP VA7400 */
        {"HP", "OPEN-", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP XP Arrays */
        {"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
diff --combined drivers/scsi/scsi_scan.c
index 7d31a4b0f8023402ed0bfa34c657700275a87e4c,1a5474bd11a19d0eb32f434d2556ee64b1bb3c52..5c7e51f9efed6501d5e0bf52a2bd41e5576f26ea
@@@ -673,6 -673,7 +673,7 @@@ static int scsi_add_lun(struct scsi_dev
        case TYPE_MEDIUM_CHANGER:
        case TYPE_ENCLOSURE:
        case TYPE_COMM:
+       case TYPE_RAID:
        case TYPE_RBC:
                sdev->writeable = 1;
                break;
        if (*bflags & BLIST_SELECT_NO_ATN)
                sdev->select_no_atn = 1;
  
+       /*
+        * Maximum 512 sector transfer length
+        * broken RA4x00 Compaq Disk Array
+        */
+       if (*bflags & BLIST_MAX_512)
+               blk_queue_max_sectors(sdev->request_queue, 512);
        /*
         * Some devices may not want to have a start command automatically
         * issued when a device is added.
@@@ -808,29 -816,6 +816,29 @@@ static inline void scsi_destroy_sdev(st
        put_device(&sdev->sdev_gendev);
  }
  
 +/** 
 + * scsi_inq_str - print INQUIRY data from min to max index,
 + * strip trailing whitespace
 + * @buf:   Output buffer with at least end-first+1 bytes of space
 + * @inq:   Inquiry buffer (input)
 + * @first: Offset of string into inq
 + * @end:   Index after last character in inq
 + */
 +static unsigned char* scsi_inq_str(unsigned char* buf, unsigned char *inq,
 +                                 unsigned first, unsigned end)
 +{
 +      unsigned term = 0, idx;
 +      for (idx = 0; idx+first < end && idx+first < inq[4]+5; ++idx) {
 +              if (inq[idx+first] > 0x20) {
 +                      buf[idx] = inq[idx+first];
 +                      term = idx+1;
 +              } else {
 +                      buf[idx] = ' ';
 +              }
 +      }
 +      buf[term] = 0;
 +      return buf;
 +}
  
  /**
   * scsi_probe_and_add_lun - probe a LUN, if a LUN is found add it
@@@ -895,12 -880,10 +903,12 @@@ static int scsi_probe_and_add_lun(struc
        if (scsi_probe_lun(sdev, result, result_len, &bflags))
                goto out_free_result;
  
 +      if (bflagsp)
 +              *bflagsp = bflags;
        /*
         * result contains valid SCSI INQUIRY data.
         */
 -      if ((result[0] >> 5) == 3) {
 +      if (((result[0] >> 5) == 3) && !(bflags & BLIST_ATTACH_PQ3)) {
                /*
                 * For a Peripheral qualifier 3 (011b), the SCSI
                 * spec says: The device server is not capable of
                 * logical disk configured at sdev->lun, but there
                 * is a target id responding.
                 */
 -              SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
 -                                      "scsi scan: peripheral qualifier of 3,"
 -                                      " no device added\n"));
 +              SCSI_LOG_SCAN_BUS(2, sdev_printk(KERN_INFO, sdev, "scsi scan:"
 +                                 " peripheral qualifier of 3, device not"
 +                                 " added\n"))
 +              if (lun == 0) {
 +                      unsigned char vend[9], mod[17];
 +                      SCSI_LOG_SCAN_BUS(1, sdev_printk(KERN_INFO, sdev,
 +                                      "scsi scan: consider passing scsi_mod."
 +                                      "dev_flags=%s:%s:0x240 or 0x800240\n",
 +                                      scsi_inq_str(vend, result, 8, 16),
 +                                      scsi_inq_str(mod, result, 16, 32)));
 +              }
 +              
                res = SCSI_SCAN_TARGET_PRESENT;
                goto out_free_result;
        }
                        sdev->lockable = 0;
                        scsi_unlock_floptical(sdev, result);
                }
 -              if (bflagsp)
 -                      *bflagsp = bflags;
        }
  
   out_free_result:
   * scsi_sequential_lun_scan - sequentially scan a SCSI target
   * @starget:  pointer to target structure to scan
   * @bflags:   black/white list flag for LUN 0
 - * @lun0_res: result of scanning LUN 0
   *
   * Description:
   *     Generally, scan from LUN 1 (LUN 0 is assumed to already have been
   *     Modifies sdevscan->lun.
   **/
  static void scsi_sequential_lun_scan(struct scsi_target *starget,
 -                                   int bflags, int lun0_res, int scsi_level,
 -                                   int rescan)
 +                                   int bflags, int scsi_level, int rescan)
  {
        unsigned int sparse_lun, lun, max_dev_lun;
        struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
        } else
                sparse_lun = 0;
  
 -      /*
 -       * If not sparse lun and no device attached at LUN 0 do not scan
 -       * any further.
 -       */
 -      if (!sparse_lun && (lun0_res != SCSI_SCAN_LUN_PRESENT))
 -              return;
 -
        /*
         * If less than SCSI_1_CSS, and no special lun scaning, stop
         * scanning; this matches 2.4 behaviour, but could just be a bug
@@@ -1146,10 -1131,13 +1154,13 @@@ static int scsi_report_lun_scan(struct 
         * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does
         * 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)) )
+       if (bflags & BLIST_NOREPORTLUN)
+               return 1;
+       if (starget->scsi_level < SCSI_2 &&
+           starget->scsi_level != SCSI_UNKNOWN)
+               return 1;
+       if (starget->scsi_level < SCSI_3 &&
+           (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8))
                return 1;
        if (bflags & BLIST_NOLUN)
                return 0;
@@@ -1407,7 -1395,7 +1418,7 @@@ static void __scsi_scan_target(struct d
                         * do a sequential scan.
                         */
                        scsi_sequential_lun_scan(starget, bflags,
 -                                      res, starget->scsi_level, rescan);
 +                                               starget->scsi_level, rescan);
        }
  
   out_reap:
index 599966898208a489ef9014d0cc869def7f8b772b,d31b16d25a09f0c0980f7ce824a890a70c86f605..b4ddd3b18b4c1619fb7c7d9b4c484ed0bca89b2b
@@@ -28,5 -28,5 +28,6 @@@
  #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_ATTACH_PQ3      0x800000 /* Scan: Attach to PQ3 devices */
+ #define BLIST_MAX_512         0x800000 /* maximum 512 sector cdb length */
++#define BLIST_ATTACH_PQ3      0x1000000 /* Scan: Attach to PQ3 devices */
  #endif