]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aacraid/aachba.c
[ACPI] merge 3549 4320 4485 4588 4980 5483 5651 acpica asus fops pnpacpi branches...
[linux-2.6-omap-h63xx.git] / drivers / scsi / aacraid / aachba.c
index acc3d920987938396042559f9e4dea030b5f8a2d..7139659dd952e4cf36eb971c8491a5dcd4b42136 100644 (file)
@@ -1464,7 +1464,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
         *      Test does not apply to ID 16, the pseudo id for the controller
         *      itself.
         */
-       if (scsicmd->device->id != host->this_id) {
+       if (scmd_id(scsicmd) != host->this_id) {
                if ((scsicmd->device->channel == 0) ){
                        if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ 
                                scsicmd->result = DID_NO_CONNECT << 16;
@@ -1559,7 +1559,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                 *      Set the Vendor, Product, and Revision Level
                 *      see: <vendor>.c i.e. aac.c
                 */
-               if (scsicmd->device->id == host->this_id) {
+               if (scmd_id(scsicmd) == host->this_id) {
                        setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *)));
                        inq_data.inqd_pdt = INQD_PDT_PROC;      /* Processor device */
                        aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
@@ -1579,18 +1579,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                        break;
        {
                u64 capacity;
-               char cp[12];
-               unsigned int offset = 0;
+               char cp[13];
 
                dprintk((KERN_DEBUG "READ CAPACITY_16 command.\n"));
                capacity = fsa_dev_ptr[cid].size - 1;
-               if (scsicmd->cmnd[13] > 12) {
-                       offset = scsicmd->cmnd[13] - 12;
-                       if (offset > sizeof(cp))
-                               break;
-                       memset(cp, 0, offset);
-                       aac_internal_transfer(scsicmd, cp, 0, offset);
-               }
                cp[0] = (capacity >> 56) & 0xff;
                cp[1] = (capacity >> 48) & 0xff;
                cp[2] = (capacity >> 40) & 0xff;
@@ -1603,7 +1595,18 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
                cp[9] = 0;
                cp[10] = 2;
                cp[11] = 0;
-               aac_internal_transfer(scsicmd, cp, offset, sizeof(cp));
+               cp[12] = 0;
+               aac_internal_transfer(scsicmd, cp, 0,
+                 min((unsigned int)scsicmd->cmnd[13], sizeof(cp)));
+               if (sizeof(cp) < scsicmd->cmnd[13]) {
+                       unsigned int len, offset = sizeof(cp);
+
+                       memset(cp, 0, offset);
+                       do {
+                               len = min(scsicmd->cmnd[13]-offset, sizeof(cp));
+                               aac_internal_transfer(scsicmd, cp, offset, len);
+                       } while ((offset += len) < scsicmd->cmnd[13]);
+               }
 
                /* Do not cache partition table for arrays */
                scsicmd->device->removable = 1;
@@ -1949,7 +1952,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
                         * the channel is 2
                         */
                        } else if ((dev->raid_scsi_mode) &&
-                                       (scsicmd->device->channel == 2)) {
+                                       (scmd_channel(scsicmd) == 2)) {
                                scsicmd->result = DID_OK << 16 | 
                                                COMMAND_COMPLETE << 8;
                        } else {
@@ -1993,7 +1996,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
                         * the channel is 2
                         */
                        } else if ((dev->raid_scsi_mode) &&
-                                       (scsicmd->device->channel == 2)) {
+                                       (scmd_channel(scsicmd) == 2)) {
                                scsicmd->result = DID_OK << 16 | 
                                                COMMAND_COMPLETE << 8;
                        } else {