diff options
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 8df4a0ea3761..642a3b4e5937 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -149,20 +149,20 @@ static int dacmode = -1; | |||
149 | 149 | ||
150 | static int commit = -1; | 150 | static int commit = -1; |
151 | 151 | ||
152 | module_param(nondasd, int, 0); | 152 | module_param(nondasd, int, S_IRUGO|S_IWUSR); |
153 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); | 153 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); |
154 | module_param(dacmode, int, 0); | 154 | module_param(dacmode, int, S_IRUGO|S_IWUSR); |
155 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); | 155 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); |
156 | module_param(commit, int, 0); | 156 | module_param(commit, int, S_IRUGO|S_IWUSR); |
157 | MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); | 157 | MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); |
158 | 158 | ||
159 | int numacb = -1; | 159 | int numacb = -1; |
160 | module_param(numacb, int, S_IRUGO|S_IWUSR); | 160 | module_param(numacb, int, S_IRUGO|S_IWUSR); |
161 | MODULE_PARM_DESC(numacb, "Request a limit to the number of adapter control blocks (FIB) allocated. Valid\nvalues are 512 and down. Default is to use suggestion from Firmware."); | 161 | MODULE_PARM_DESC(numacb, "Request a limit to the number of adapter control blocks (FIB) allocated. Valid values are 512 and down. Default is to use suggestion from Firmware."); |
162 | 162 | ||
163 | int acbsize = -1; | 163 | int acbsize = -1; |
164 | module_param(acbsize, int, S_IRUGO|S_IWUSR); | 164 | module_param(acbsize, int, S_IRUGO|S_IWUSR); |
165 | MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512,\n2048, 4096 and 8192. Default is to use suggestion from Firmware."); | 165 | MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512, 2048, 4096 and 8192. Default is to use suggestion from Firmware."); |
166 | /** | 166 | /** |
167 | * aac_get_config_status - check the adapter configuration | 167 | * aac_get_config_status - check the adapter configuration |
168 | * @common: adapter to query | 168 | * @common: adapter to query |
@@ -387,6 +387,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) | |||
387 | struct scsi_cmnd * scsicmd; | 387 | struct scsi_cmnd * scsicmd; |
388 | 388 | ||
389 | scsicmd = (struct scsi_cmnd *) context; | 389 | scsicmd = (struct scsi_cmnd *) context; |
390 | scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; | ||
390 | 391 | ||
391 | dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); | 392 | dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); |
392 | if (fibptr == NULL) | 393 | if (fibptr == NULL) |
@@ -453,8 +454,10 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) | |||
453 | /* | 454 | /* |
454 | * Check that the command queued to the controller | 455 | * Check that the command queued to the controller |
455 | */ | 456 | */ |
456 | if (status == -EINPROGRESS) | 457 | if (status == -EINPROGRESS) { |
458 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; | ||
457 | return 0; | 459 | return 0; |
460 | } | ||
458 | 461 | ||
459 | printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); | 462 | printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status); |
460 | aac_fib_complete(cmd_fibcontext); | 463 | aac_fib_complete(cmd_fibcontext); |
@@ -907,9 +910,10 @@ static void io_callback(void *context, struct fib * fibptr) | |||
907 | u32 cid; | 910 | u32 cid; |
908 | 911 | ||
909 | scsicmd = (struct scsi_cmnd *) context; | 912 | scsicmd = (struct scsi_cmnd *) context; |
913 | scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; | ||
910 | 914 | ||
911 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; | 915 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; |
912 | cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); | 916 | cid = scmd_id(scsicmd); |
913 | 917 | ||
914 | if (nblank(dprintk(x))) { | 918 | if (nblank(dprintk(x))) { |
915 | u64 lba; | 919 | u64 lba; |
@@ -1151,8 +1155,10 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1151 | /* | 1155 | /* |
1152 | * Check that the command queued to the controller | 1156 | * Check that the command queued to the controller |
1153 | */ | 1157 | */ |
1154 | if (status == -EINPROGRESS) | 1158 | if (status == -EINPROGRESS) { |
1159 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; | ||
1155 | return 0; | 1160 | return 0; |
1161 | } | ||
1156 | 1162 | ||
1157 | printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); | 1163 | printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status); |
1158 | /* | 1164 | /* |
@@ -1318,8 +1324,8 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1318 | /* | 1324 | /* |
1319 | * Check that the command queued to the controller | 1325 | * Check that the command queued to the controller |
1320 | */ | 1326 | */ |
1321 | if (status == -EINPROGRESS) | 1327 | if (status == -EINPROGRESS) { |
1322 | { | 1328 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; |
1323 | return 0; | 1329 | return 0; |
1324 | } | 1330 | } |
1325 | 1331 | ||
@@ -1341,6 +1347,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) | |||
1341 | struct scsi_cmnd *cmd; | 1347 | struct scsi_cmnd *cmd; |
1342 | 1348 | ||
1343 | cmd = context; | 1349 | cmd = context; |
1350 | cmd->SCp.phase = AAC_OWNER_MIDLEVEL; | ||
1344 | 1351 | ||
1345 | dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", | 1352 | dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", |
1346 | smp_processor_id(), jiffies)); | 1353 | smp_processor_id(), jiffies)); |
@@ -1354,7 +1361,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) | |||
1354 | else { | 1361 | else { |
1355 | struct scsi_device *sdev = cmd->device; | 1362 | struct scsi_device *sdev = cmd->device; |
1356 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; | 1363 | struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; |
1357 | u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun); | 1364 | u32 cid = sdev_id(sdev); |
1358 | printk(KERN_WARNING | 1365 | printk(KERN_WARNING |
1359 | "synchronize_callback: synchronize failed, status = %d\n", | 1366 | "synchronize_callback: synchronize failed, status = %d\n", |
1360 | le32_to_cpu(synchronizereply->status)); | 1367 | le32_to_cpu(synchronizereply->status)); |
@@ -1386,12 +1393,12 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) | |||
1386 | unsigned long flags; | 1393 | unsigned long flags; |
1387 | 1394 | ||
1388 | /* | 1395 | /* |
1389 | * Wait for all commands to complete to this specific | 1396 | * Wait for all outstanding queued commands to complete to this |
1390 | * target (block). | 1397 | * specific target (block). |
1391 | */ | 1398 | */ |
1392 | spin_lock_irqsave(&sdev->list_lock, flags); | 1399 | spin_lock_irqsave(&sdev->list_lock, flags); |
1393 | list_for_each_entry(cmd, &sdev->cmd_list, list) | 1400 | list_for_each_entry(cmd, &sdev->cmd_list, list) |
1394 | if (cmd != scsicmd && cmd->serial_number != 0) { | 1401 | if (cmd != scsicmd && cmd->SCp.phase == AAC_OWNER_FIRMWARE) { |
1395 | ++active; | 1402 | ++active; |
1396 | break; | 1403 | break; |
1397 | } | 1404 | } |
@@ -1434,8 +1441,10 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) | |||
1434 | /* | 1441 | /* |
1435 | * Check that the command queued to the controller | 1442 | * Check that the command queued to the controller |
1436 | */ | 1443 | */ |
1437 | if (status == -EINPROGRESS) | 1444 | if (status == -EINPROGRESS) { |
1445 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; | ||
1438 | return 0; | 1446 | return 0; |
1447 | } | ||
1439 | 1448 | ||
1440 | printk(KERN_WARNING | 1449 | printk(KERN_WARNING |
1441 | "aac_synchronize: aac_fib_send failed with status: %d.\n", status); | 1450 | "aac_synchronize: aac_fib_send failed with status: %d.\n", status); |
@@ -1458,7 +1467,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1458 | struct Scsi_Host *host = scsicmd->device->host; | 1467 | struct Scsi_Host *host = scsicmd->device->host; |
1459 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; | 1468 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; |
1460 | struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; | 1469 | struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; |
1461 | int ret; | ||
1462 | 1470 | ||
1463 | /* | 1471 | /* |
1464 | * If the bus, id or lun is out of range, return fail | 1472 | * If the bus, id or lun is out of range, return fail |
@@ -1466,13 +1474,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1466 | * itself. | 1474 | * itself. |
1467 | */ | 1475 | */ |
1468 | if (scmd_id(scsicmd) != host->this_id) { | 1476 | if (scmd_id(scsicmd) != host->this_id) { |
1469 | if ((scsicmd->device->channel == CONTAINER_CHANNEL)) { | 1477 | if ((scmd_channel(scsicmd) == CONTAINER_CHANNEL)) { |
1470 | if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ | 1478 | if((scmd_id(scsicmd) >= dev->maximum_num_containers) || |
1479 | (scsicmd->device->lun != 0)) { | ||
1471 | scsicmd->result = DID_NO_CONNECT << 16; | 1480 | scsicmd->result = DID_NO_CONNECT << 16; |
1472 | scsicmd->scsi_done(scsicmd); | 1481 | scsicmd->scsi_done(scsicmd); |
1473 | return 0; | 1482 | return 0; |
1474 | } | 1483 | } |
1475 | cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); | 1484 | cid = scmd_id(scsicmd); |
1476 | 1485 | ||
1477 | /* | 1486 | /* |
1478 | * If the target container doesn't exist, it may have | 1487 | * If the target container doesn't exist, it may have |
@@ -1548,7 +1557,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1548 | { | 1557 | { |
1549 | struct inquiry_data inq_data; | 1558 | struct inquiry_data inq_data; |
1550 | 1559 | ||
1551 | dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id)); | 1560 | dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scmd_id(scsicmd))); |
1552 | memset(&inq_data, 0, sizeof (struct inquiry_data)); | 1561 | memset(&inq_data, 0, sizeof (struct inquiry_data)); |
1553 | 1562 | ||
1554 | inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ | 1563 | inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ |
@@ -1598,13 +1607,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1598 | cp[11] = 0; | 1607 | cp[11] = 0; |
1599 | cp[12] = 0; | 1608 | cp[12] = 0; |
1600 | aac_internal_transfer(scsicmd, cp, 0, | 1609 | aac_internal_transfer(scsicmd, cp, 0, |
1601 | min((unsigned int)scsicmd->cmnd[13], sizeof(cp))); | 1610 | min_t(size_t, scsicmd->cmnd[13], sizeof(cp))); |
1602 | if (sizeof(cp) < scsicmd->cmnd[13]) { | 1611 | if (sizeof(cp) < scsicmd->cmnd[13]) { |
1603 | unsigned int len, offset = sizeof(cp); | 1612 | unsigned int len, offset = sizeof(cp); |
1604 | 1613 | ||
1605 | memset(cp, 0, offset); | 1614 | memset(cp, 0, offset); |
1606 | do { | 1615 | do { |
1607 | len = min(scsicmd->cmnd[13]-offset, sizeof(cp)); | 1616 | len = min_t(size_t, scsicmd->cmnd[13] - offset, |
1617 | sizeof(cp)); | ||
1608 | aac_internal_transfer(scsicmd, cp, offset, len); | 1618 | aac_internal_transfer(scsicmd, cp, offset, len); |
1609 | } while ((offset += len) < scsicmd->cmnd[13]); | 1619 | } while ((offset += len) < scsicmd->cmnd[13]); |
1610 | } | 1620 | } |
@@ -1728,24 +1738,19 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1728 | * containers to /dev/sd device names | 1738 | * containers to /dev/sd device names |
1729 | */ | 1739 | */ |
1730 | 1740 | ||
1731 | spin_unlock_irq(host->host_lock); | ||
1732 | if (scsicmd->request->rq_disk) | 1741 | if (scsicmd->request->rq_disk) |
1733 | strlcpy(fsa_dev_ptr[cid].devname, | 1742 | strlcpy(fsa_dev_ptr[cid].devname, |
1734 | scsicmd->request->rq_disk->disk_name, | 1743 | scsicmd->request->rq_disk->disk_name, |
1735 | min(sizeof(fsa_dev_ptr[cid].devname), | 1744 | min(sizeof(fsa_dev_ptr[cid].devname), |
1736 | sizeof(scsicmd->request->rq_disk->disk_name) + 1)); | 1745 | sizeof(scsicmd->request->rq_disk->disk_name) + 1)); |
1737 | ret = aac_read(scsicmd, cid); | 1746 | |
1738 | spin_lock_irq(host->host_lock); | 1747 | return aac_read(scsicmd, cid); |
1739 | return ret; | ||
1740 | 1748 | ||
1741 | case WRITE_6: | 1749 | case WRITE_6: |
1742 | case WRITE_10: | 1750 | case WRITE_10: |
1743 | case WRITE_12: | 1751 | case WRITE_12: |
1744 | case WRITE_16: | 1752 | case WRITE_16: |
1745 | spin_unlock_irq(host->host_lock); | 1753 | return aac_write(scsicmd, cid); |
1746 | ret = aac_write(scsicmd, cid); | ||
1747 | spin_lock_irq(host->host_lock); | ||
1748 | return ret; | ||
1749 | 1754 | ||
1750 | case SYNCHRONIZE_CACHE: | 1755 | case SYNCHRONIZE_CACHE: |
1751 | /* Issue FIB to tell Firmware to flush it's cache */ | 1756 | /* Issue FIB to tell Firmware to flush it's cache */ |
@@ -1778,7 +1783,7 @@ static int query_disk(struct aac_dev *dev, void __user *arg) | |||
1778 | if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk))) | 1783 | if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk))) |
1779 | return -EFAULT; | 1784 | return -EFAULT; |
1780 | if (qd.cnum == -1) | 1785 | if (qd.cnum == -1) |
1781 | qd.cnum = ID_LUN_TO_CONTAINER(qd.id, qd.lun); | 1786 | qd.cnum = qd.id; |
1782 | else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) | 1787 | else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) |
1783 | { | 1788 | { |
1784 | if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) | 1789 | if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers) |
@@ -1890,6 +1895,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
1890 | struct scsi_cmnd *scsicmd; | 1895 | struct scsi_cmnd *scsicmd; |
1891 | 1896 | ||
1892 | scsicmd = (struct scsi_cmnd *) context; | 1897 | scsicmd = (struct scsi_cmnd *) context; |
1898 | scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; | ||
1893 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; | 1899 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; |
1894 | 1900 | ||
1895 | if (fibptr == NULL) | 1901 | if (fibptr == NULL) |
@@ -2068,14 +2074,13 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2068 | u32 timeout; | 2074 | u32 timeout; |
2069 | 2075 | ||
2070 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; | 2076 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; |
2071 | if (scsicmd->device->id >= dev->maximum_num_physicals || | 2077 | if (scmd_id(scsicmd) >= dev->maximum_num_physicals || |
2072 | scsicmd->device->lun > 7) { | 2078 | scsicmd->device->lun > 7) { |
2073 | scsicmd->result = DID_NO_CONNECT << 16; | 2079 | scsicmd->result = DID_NO_CONNECT << 16; |
2074 | scsicmd->scsi_done(scsicmd); | 2080 | scsicmd->scsi_done(scsicmd); |
2075 | return 0; | 2081 | return 0; |
2076 | } | 2082 | } |
2077 | 2083 | ||
2078 | dev = (struct aac_dev *)scsicmd->device->host->hostdata; | ||
2079 | switch(scsicmd->sc_data_direction){ | 2084 | switch(scsicmd->sc_data_direction){ |
2080 | case DMA_TO_DEVICE: | 2085 | case DMA_TO_DEVICE: |
2081 | flag = SRB_DataOut; | 2086 | flag = SRB_DataOut; |
@@ -2103,8 +2108,8 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2103 | 2108 | ||
2104 | srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); | 2109 | srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext); |
2105 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); | 2110 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); |
2106 | srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->device->channel)); | 2111 | srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scmd_channel(scsicmd))); |
2107 | srbcmd->id = cpu_to_le32(scsicmd->device->id); | 2112 | srbcmd->id = cpu_to_le32(scmd_id(scsicmd)); |
2108 | srbcmd->lun = cpu_to_le32(scsicmd->device->lun); | 2113 | srbcmd->lun = cpu_to_le32(scsicmd->device->lun); |
2109 | srbcmd->flags = cpu_to_le32(flag); | 2114 | srbcmd->flags = cpu_to_le32(flag); |
2110 | timeout = scsicmd->timeout_per_command/HZ; | 2115 | timeout = scsicmd->timeout_per_command/HZ; |
@@ -2161,7 +2166,8 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd) | |||
2161 | /* | 2166 | /* |
2162 | * Check that the command queued to the controller | 2167 | * Check that the command queued to the controller |
2163 | */ | 2168 | */ |
2164 | if (status == -EINPROGRESS){ | 2169 | if (status == -EINPROGRESS) { |
2170 | scsicmd->SCp.phase = AAC_OWNER_FIRMWARE; | ||
2165 | return 0; | 2171 | return 0; |
2166 | } | 2172 | } |
2167 | 2173 | ||
@@ -2192,8 +2198,6 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg) | |||
2192 | scsicmd->sc_data_direction); | 2198 | scsicmd->sc_data_direction); |
2193 | psg->count = cpu_to_le32(sg_count); | 2199 | psg->count = cpu_to_le32(sg_count); |
2194 | 2200 | ||
2195 | byte_count = 0; | ||
2196 | |||
2197 | for (i = 0; i < sg_count; i++) { | 2201 | for (i = 0; i < sg_count; i++) { |
2198 | psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg)); | 2202 | psg->sg[i].addr = cpu_to_le32(sg_dma_address(sg)); |
2199 | psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); | 2203 | psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); |
@@ -2249,18 +2253,17 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p | |||
2249 | 2253 | ||
2250 | sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, | 2254 | sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg, |
2251 | scsicmd->sc_data_direction); | 2255 | scsicmd->sc_data_direction); |
2252 | psg->count = cpu_to_le32(sg_count); | ||
2253 | |||
2254 | byte_count = 0; | ||
2255 | 2256 | ||
2256 | for (i = 0; i < sg_count; i++) { | 2257 | for (i = 0; i < sg_count; i++) { |
2258 | int count = sg_dma_len(sg); | ||
2257 | addr = sg_dma_address(sg); | 2259 | addr = sg_dma_address(sg); |
2258 | psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); | 2260 | psg->sg[i].addr[0] = cpu_to_le32(addr & 0xffffffff); |
2259 | psg->sg[i].addr[1] = cpu_to_le32(addr>>32); | 2261 | psg->sg[i].addr[1] = cpu_to_le32(addr>>32); |
2260 | psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); | 2262 | psg->sg[i].count = cpu_to_le32(count); |
2261 | byte_count += sg_dma_len(sg); | 2263 | byte_count += count; |
2262 | sg++; | 2264 | sg++; |
2263 | } | 2265 | } |
2266 | psg->count = cpu_to_le32(sg_count); | ||
2264 | /* hba wants the size to be exact */ | 2267 | /* hba wants the size to be exact */ |
2265 | if(byte_count > scsicmd->request_bufflen){ | 2268 | if(byte_count > scsicmd->request_bufflen){ |
2266 | u32 temp = le32_to_cpu(psg->sg[i-1].count) - | 2269 | u32 temp = le32_to_cpu(psg->sg[i-1].count) - |
@@ -2275,16 +2278,15 @@ static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* p | |||
2275 | } | 2278 | } |
2276 | } | 2279 | } |
2277 | else if(scsicmd->request_bufflen) { | 2280 | else if(scsicmd->request_bufflen) { |
2278 | u64 addr; | 2281 | scsicmd->SCp.dma_handle = pci_map_single(dev->pdev, |
2279 | addr = pci_map_single(dev->pdev, | ||
2280 | scsicmd->request_buffer, | 2282 | scsicmd->request_buffer, |
2281 | scsicmd->request_bufflen, | 2283 | scsicmd->request_bufflen, |
2282 | scsicmd->sc_data_direction); | 2284 | scsicmd->sc_data_direction); |
2285 | addr = scsicmd->SCp.dma_handle; | ||
2283 | psg->count = cpu_to_le32(1); | 2286 | psg->count = cpu_to_le32(1); |
2284 | psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff); | 2287 | psg->sg[0].addr[0] = cpu_to_le32(addr & 0xffffffff); |
2285 | psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); | 2288 | psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); |
2286 | psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); | 2289 | psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); |
2287 | scsicmd->SCp.dma_handle = addr; | ||
2288 | byte_count = scsicmd->request_bufflen; | 2290 | byte_count = scsicmd->request_bufflen; |
2289 | } | 2291 | } |
2290 | return byte_count; | 2292 | return byte_count; |