Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
[sfrench/cifs-2.6.git] / drivers / scsi / aacraid / linit.c
index 5ab733d4faf40b33dc9df73b31e976fc35a136b1..e80d2a0c46aff85eb839018d5e4d8f12e326372b 100644 (file)
@@ -404,6 +404,7 @@ static int aac_slave_configure(struct scsi_device *sdev)
        struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata;
        if ((sdev->type == TYPE_DISK) &&
                        (sdev_channel(sdev) != CONTAINER_CHANNEL) &&
+                       (!aac->jbod || sdev->inq_periph_qual) &&
                        (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2))) {
                if (expose_physicals == 0)
                        return -ENXIO;
@@ -411,7 +412,8 @@ static int aac_slave_configure(struct scsi_device *sdev)
                        sdev->no_uld_attach = 1;
        }
        if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
-                       (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
+                       (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) &&
+                       !sdev->no_uld_attach) {
                struct scsi_device * dev;
                struct Scsi_Host *host = sdev->host;
                unsigned num_lsu = 0;
@@ -430,8 +432,11 @@ static int aac_slave_configure(struct scsi_device *sdev)
                                ++num_lsu;
                __shost_for_each_device(dev, host) {
                        if (dev->tagged_supported && (dev->type == TYPE_DISK) &&
-                               (sdev_channel(dev) == CONTAINER_CHANNEL)) {
-                               if (!aac->fsa_dev[sdev_id(dev)].valid)
+                                       (!aac->raid_scsi_mode ||
+                                               (sdev_channel(sdev) != 2)) &&
+                                       !dev->no_uld_attach) {
+                               if ((sdev_channel(dev) != CONTAINER_CHANNEL)
+                                || !aac->fsa_dev[sdev_id(dev)].valid)
                                        ++num_lsu;
                        } else
                                ++num_one;
@@ -444,9 +449,6 @@ static int aac_slave_configure(struct scsi_device *sdev)
                else if (depth < 2)
                        depth = 2;
                scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
-               if (!(((struct aac_dev *)host->hostdata)->adapter_info.options &
-                               AAC_OPT_NEW_COMM))
-                       blk_queue_max_segment_size(sdev->request_queue, 65536);
        } else
                scsi_adjust_queue_depth(sdev, 0, 1);
 
@@ -804,6 +806,8 @@ static ssize_t aac_show_flags(struct class_device *class_dev, char *buf)
        if (dev->raw_io_interface && dev->raw_io_64)
                len += snprintf(buf + len, PAGE_SIZE - len,
                                "SAI_READ_CAPACITY_16\n");
+       if (dev->jbod)
+               len += snprintf(buf + len, PAGE_SIZE - len, "SUPPORTED_JBOD\n");
        return len;
 }
 
@@ -1025,7 +1029,6 @@ static struct scsi_host_template aac_driver_template = {
        .cmd_per_lun                    = AAC_NUM_IO_FIB,
 #endif
        .use_clustering                 = ENABLE_CLUSTERING,
-       .use_sg_chaining                = ENABLE_SG_CHAINING,
        .emulated                       = 1,
 };
 
@@ -1131,21 +1134,25 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
         * Lets override negotiations and drop the maximum SG limit to 34
         */
        if ((aac_drivers[index].quirks & AAC_QUIRK_34SG) &&
-                       (aac->scsi_host_ptr->sg_tablesize > 34)) {
-               aac->scsi_host_ptr->sg_tablesize = 34;
-               aac->scsi_host_ptr->max_sectors
-                 = (aac->scsi_host_ptr->sg_tablesize * 8) + 112;
+                       (shost->sg_tablesize > 34)) {
+               shost->sg_tablesize = 34;
+               shost->max_sectors = (shost->sg_tablesize * 8) + 112;
        }
 
        if ((aac_drivers[index].quirks & AAC_QUIRK_17SG) &&
-                       (aac->scsi_host_ptr->sg_tablesize > 17)) {
-               aac->scsi_host_ptr->sg_tablesize = 17;
-               aac->scsi_host_ptr->max_sectors
-                 = (aac->scsi_host_ptr->sg_tablesize * 8) + 112;
+                       (shost->sg_tablesize > 17)) {
+               shost->sg_tablesize = 17;
+               shost->max_sectors = (shost->sg_tablesize * 8) + 112;
        }
 
+       error = pci_set_dma_max_seg_size(pdev,
+               (aac->adapter_info.options & AAC_OPT_NEW_COMM) ?
+                       (shost->max_sectors << 9) : 65536);
+       if (error)
+               goto out_deinit;
+
        /*
-        * Firware printf works only with older firmware.
+        * Firmware printf works only with older firmware.
         */
        if (aac_drivers[index].quirks & AAC_QUIRK_34SG)
                aac->printf_enabled = 1;
@@ -1157,7 +1164,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
         * all containers are on the virtual channel 0 (CONTAINER_CHANNEL)
         * physical channels are address by their actual physical number+1
         */
-       if ((aac->nondasd_support == 1) || expose_physicals)
+       if (aac->nondasd_support || expose_physicals || aac->jbod)
                shost->max_channel = aac->maximum_num_channels;
        else
                shost->max_channel = 0;