diff options
Diffstat (limited to 'drivers/scsi/aacraid')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 94 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 11 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commctrl.c | 12 | ||||
-rw-r--r-- | drivers/scsi/aacraid/commsup.c | 41 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 64 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rkt.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/sa.c | 2 |
8 files changed, 152 insertions, 80 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; |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 9ce7002bd070..f773b0dcfc95 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -10,6 +10,10 @@ | |||
10 | * D E F I N E S | 10 | * D E F I N E S |
11 | *----------------------------------------------------------------------------*/ | 11 | *----------------------------------------------------------------------------*/ |
12 | 12 | ||
13 | #ifndef AAC_DRIVER_BUILD | ||
14 | # define AAC_DRIVER_BUILD 2409 | ||
15 | # define AAC_DRIVER_BRANCH "-mh1" | ||
16 | #endif | ||
13 | #define MAXIMUM_NUM_CONTAINERS 32 | 17 | #define MAXIMUM_NUM_CONTAINERS 32 |
14 | 18 | ||
15 | #define AAC_NUM_MGT_FIB 8 | 19 | #define AAC_NUM_MGT_FIB 8 |
@@ -25,7 +29,6 @@ | |||
25 | * These macros convert from physical channels to virtual channels | 29 | * These macros convert from physical channels to virtual channels |
26 | */ | 30 | */ |
27 | #define CONTAINER_CHANNEL (0) | 31 | #define CONTAINER_CHANNEL (0) |
28 | #define ID_LUN_TO_CONTAINER(id, lun) (id) | ||
29 | #define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL) | 32 | #define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL) |
30 | #define CONTAINER_TO_ID(cont) (cont) | 33 | #define CONTAINER_TO_ID(cont) (cont) |
31 | #define CONTAINER_TO_LUN(cont) (0) | 34 | #define CONTAINER_TO_LUN(cont) (0) |
@@ -789,6 +792,7 @@ struct fsa_dev_info { | |||
789 | u64 size; | 792 | u64 size; |
790 | u32 type; | 793 | u32 type; |
791 | u32 config_waiting_on; | 794 | u32 config_waiting_on; |
795 | unsigned long config_waiting_stamp; | ||
792 | u16 queue_depth; | 796 | u16 queue_depth; |
793 | u8 config_needed; | 797 | u8 config_needed; |
794 | u8 valid; | 798 | u8 valid; |
@@ -1771,6 +1775,11 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor) | |||
1771 | } | 1775 | } |
1772 | 1776 | ||
1773 | struct scsi_cmnd; | 1777 | struct scsi_cmnd; |
1778 | /* SCp.phase values */ | ||
1779 | #define AAC_OWNER_MIDLEVEL 0x101 | ||
1780 | #define AAC_OWNER_LOWLEVEL 0x102 | ||
1781 | #define AAC_OWNER_ERROR_HANDLER 0x103 | ||
1782 | #define AAC_OWNER_FIRMWARE 0x106 | ||
1774 | 1783 | ||
1775 | const char *aac_driverinfo(struct Scsi_Host *); | 1784 | const char *aac_driverinfo(struct Scsi_Host *); |
1776 | struct fib *aac_fib_alloc(struct aac_dev *dev); | 1785 | struct fib *aac_fib_alloc(struct aac_dev *dev); |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 47fefca72695..9f75144e5247 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <linux/completion.h> | 38 | #include <linux/completion.h> |
39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
40 | #include <linux/blkdev.h> | 40 | #include <linux/blkdev.h> |
41 | #include <linux/delay.h> | ||
42 | #include <linux/kthread.h> | ||
41 | #include <asm/semaphore.h> | 43 | #include <asm/semaphore.h> |
42 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
43 | 45 | ||
@@ -293,6 +295,16 @@ return_fib: | |||
293 | status = 0; | 295 | status = 0; |
294 | } else { | 296 | } else { |
295 | spin_unlock_irqrestore(&dev->fib_lock, flags); | 297 | spin_unlock_irqrestore(&dev->fib_lock, flags); |
298 | /* If someone killed the AIF aacraid thread, restart it */ | ||
299 | status = !dev->aif_thread; | ||
300 | if (status && dev->queues && dev->fsa_dev) { | ||
301 | /* Be paranoid, be very paranoid! */ | ||
302 | kthread_stop(dev->thread); | ||
303 | ssleep(1); | ||
304 | dev->aif_thread = 0; | ||
305 | dev->thread = kthread_run(aac_command_thread, dev, dev->name); | ||
306 | ssleep(1); | ||
307 | } | ||
296 | if (f.wait) { | 308 | if (f.wait) { |
297 | if(down_interruptible(&fibctx->wait_sem) < 0) { | 309 | if(down_interruptible(&fibctx->wait_sem) < 0) { |
298 | status = -EINTR; | 310 | status = -EINTR; |
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index c7f80ec7abde..9f9f4aae23c0 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c | |||
@@ -767,9 +767,9 @@ void aac_printf(struct aac_dev *dev, u32 val) | |||
767 | if (cp[length] != 0) | 767 | if (cp[length] != 0) |
768 | cp[length] = 0; | 768 | cp[length] = 0; |
769 | if (level == LOG_AAC_HIGH_ERROR) | 769 | if (level == LOG_AAC_HIGH_ERROR) |
770 | printk(KERN_WARNING "aacraid:%s", cp); | 770 | printk(KERN_WARNING "%s:%s", dev->name, cp); |
771 | else | 771 | else |
772 | printk(KERN_INFO "aacraid:%s", cp); | 772 | printk(KERN_INFO "%s:%s", dev->name, cp); |
773 | } | 773 | } |
774 | memset(cp, 0, 256); | 774 | memset(cp, 0, 256); |
775 | } | 775 | } |
@@ -784,6 +784,7 @@ void aac_printf(struct aac_dev *dev, u32 val) | |||
784 | * dispatches it to the appropriate routine for handling. | 784 | * dispatches it to the appropriate routine for handling. |
785 | */ | 785 | */ |
786 | 786 | ||
787 | #define AIF_SNIFF_TIMEOUT (30*HZ) | ||
787 | static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | 788 | static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) |
788 | { | 789 | { |
789 | struct hw_fib * hw_fib = fibptr->hw_fib; | 790 | struct hw_fib * hw_fib = fibptr->hw_fib; |
@@ -837,6 +838,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
837 | if (device) { | 838 | if (device) { |
838 | dev->fsa_dev[container].config_needed = CHANGE; | 839 | dev->fsa_dev[container].config_needed = CHANGE; |
839 | dev->fsa_dev[container].config_waiting_on = AifEnConfigChange; | 840 | dev->fsa_dev[container].config_waiting_on = AifEnConfigChange; |
841 | dev->fsa_dev[container].config_waiting_stamp = jiffies; | ||
840 | scsi_device_put(device); | 842 | scsi_device_put(device); |
841 | } | 843 | } |
842 | } | 844 | } |
@@ -849,13 +851,15 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
849 | if (container != (u32)-1) { | 851 | if (container != (u32)-1) { |
850 | if (container >= dev->maximum_num_containers) | 852 | if (container >= dev->maximum_num_containers) |
851 | break; | 853 | break; |
852 | if (dev->fsa_dev[container].config_waiting_on == | 854 | if ((dev->fsa_dev[container].config_waiting_on == |
853 | le32_to_cpu(*(u32 *)aifcmd->data)) | 855 | le32_to_cpu(*(u32 *)aifcmd->data)) && |
856 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | ||
854 | dev->fsa_dev[container].config_waiting_on = 0; | 857 | dev->fsa_dev[container].config_waiting_on = 0; |
855 | } else for (container = 0; | 858 | } else for (container = 0; |
856 | container < dev->maximum_num_containers; ++container) { | 859 | container < dev->maximum_num_containers; ++container) { |
857 | if (dev->fsa_dev[container].config_waiting_on == | 860 | if ((dev->fsa_dev[container].config_waiting_on == |
858 | le32_to_cpu(*(u32 *)aifcmd->data)) | 861 | le32_to_cpu(*(u32 *)aifcmd->data)) && |
862 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | ||
859 | dev->fsa_dev[container].config_waiting_on = 0; | 863 | dev->fsa_dev[container].config_waiting_on = 0; |
860 | } | 864 | } |
861 | break; | 865 | break; |
@@ -872,6 +876,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
872 | dev->fsa_dev[container].config_needed = ADD; | 876 | dev->fsa_dev[container].config_needed = ADD; |
873 | dev->fsa_dev[container].config_waiting_on = | 877 | dev->fsa_dev[container].config_waiting_on = |
874 | AifEnConfigChange; | 878 | AifEnConfigChange; |
879 | dev->fsa_dev[container].config_waiting_stamp = jiffies; | ||
875 | break; | 880 | break; |
876 | 881 | ||
877 | /* | 882 | /* |
@@ -884,6 +889,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
884 | dev->fsa_dev[container].config_needed = DELETE; | 889 | dev->fsa_dev[container].config_needed = DELETE; |
885 | dev->fsa_dev[container].config_waiting_on = | 890 | dev->fsa_dev[container].config_waiting_on = |
886 | AifEnConfigChange; | 891 | AifEnConfigChange; |
892 | dev->fsa_dev[container].config_waiting_stamp = jiffies; | ||
887 | break; | 893 | break; |
888 | 894 | ||
889 | /* | 895 | /* |
@@ -894,11 +900,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
894 | container = le32_to_cpu(((u32 *)aifcmd->data)[1]); | 900 | container = le32_to_cpu(((u32 *)aifcmd->data)[1]); |
895 | if (container >= dev->maximum_num_containers) | 901 | if (container >= dev->maximum_num_containers) |
896 | break; | 902 | break; |
897 | if (dev->fsa_dev[container].config_waiting_on) | 903 | if (dev->fsa_dev[container].config_waiting_on && |
904 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | ||
898 | break; | 905 | break; |
899 | dev->fsa_dev[container].config_needed = CHANGE; | 906 | dev->fsa_dev[container].config_needed = CHANGE; |
900 | dev->fsa_dev[container].config_waiting_on = | 907 | dev->fsa_dev[container].config_waiting_on = |
901 | AifEnConfigChange; | 908 | AifEnConfigChange; |
909 | dev->fsa_dev[container].config_waiting_stamp = jiffies; | ||
902 | break; | 910 | break; |
903 | 911 | ||
904 | case AifEnConfigChange: | 912 | case AifEnConfigChange: |
@@ -913,13 +921,15 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
913 | if (container != (u32)-1) { | 921 | if (container != (u32)-1) { |
914 | if (container >= dev->maximum_num_containers) | 922 | if (container >= dev->maximum_num_containers) |
915 | break; | 923 | break; |
916 | if (dev->fsa_dev[container].config_waiting_on == | 924 | if ((dev->fsa_dev[container].config_waiting_on == |
917 | le32_to_cpu(*(u32 *)aifcmd->data)) | 925 | le32_to_cpu(*(u32 *)aifcmd->data)) && |
926 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | ||
918 | dev->fsa_dev[container].config_waiting_on = 0; | 927 | dev->fsa_dev[container].config_waiting_on = 0; |
919 | } else for (container = 0; | 928 | } else for (container = 0; |
920 | container < dev->maximum_num_containers; ++container) { | 929 | container < dev->maximum_num_containers; ++container) { |
921 | if (dev->fsa_dev[container].config_waiting_on == | 930 | if ((dev->fsa_dev[container].config_waiting_on == |
922 | le32_to_cpu(*(u32 *)aifcmd->data)) | 931 | le32_to_cpu(*(u32 *)aifcmd->data)) && |
932 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) | ||
923 | dev->fsa_dev[container].config_waiting_on = 0; | 933 | dev->fsa_dev[container].config_waiting_on = 0; |
924 | } | 934 | } |
925 | break; | 935 | break; |
@@ -946,6 +956,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
946 | dev->fsa_dev[container].config_waiting_on = | 956 | dev->fsa_dev[container].config_waiting_on = |
947 | AifEnContainerChange; | 957 | AifEnContainerChange; |
948 | dev->fsa_dev[container].config_needed = ADD; | 958 | dev->fsa_dev[container].config_needed = ADD; |
959 | dev->fsa_dev[container].config_waiting_stamp = | ||
960 | jiffies; | ||
949 | } | 961 | } |
950 | } | 962 | } |
951 | if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) | 963 | if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) |
@@ -961,6 +973,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
961 | dev->fsa_dev[container].config_waiting_on = | 973 | dev->fsa_dev[container].config_waiting_on = |
962 | AifEnContainerChange; | 974 | AifEnContainerChange; |
963 | dev->fsa_dev[container].config_needed = DELETE; | 975 | dev->fsa_dev[container].config_needed = DELETE; |
976 | dev->fsa_dev[container].config_waiting_stamp = | ||
977 | jiffies; | ||
964 | } | 978 | } |
965 | } | 979 | } |
966 | break; | 980 | break; |
@@ -969,8 +983,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) | |||
969 | device_config_needed = NOTHING; | 983 | device_config_needed = NOTHING; |
970 | for (container = 0; container < dev->maximum_num_containers; | 984 | for (container = 0; container < dev->maximum_num_containers; |
971 | ++container) { | 985 | ++container) { |
972 | if ((dev->fsa_dev[container].config_waiting_on == 0) | 986 | if ((dev->fsa_dev[container].config_waiting_on == 0) && |
973 | && (dev->fsa_dev[container].config_needed != NOTHING)) { | 987 | (dev->fsa_dev[container].config_needed != NOTHING) && |
988 | time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) { | ||
974 | device_config_needed = | 989 | device_config_needed = |
975 | dev->fsa_dev[container].config_needed; | 990 | dev->fsa_dev[container].config_needed; |
976 | dev->fsa_dev[container].config_needed = NOTHING; | 991 | dev->fsa_dev[container].config_needed = NOTHING; |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 720330778648..6ef89c99dd12 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -27,12 +27,6 @@ | |||
27 | * Abstract: Linux Driver entry module for Adaptec RAID Array Controller | 27 | * Abstract: Linux Driver entry module for Adaptec RAID Array Controller |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define AAC_DRIVER_VERSION "1.1-4" | ||
31 | #ifndef AAC_DRIVER_BRANCH | ||
32 | #define AAC_DRIVER_BRANCH "" | ||
33 | #endif | ||
34 | #define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__ | ||
35 | #define AAC_DRIVERNAME "aacraid" | ||
36 | 30 | ||
37 | #include <linux/compat.h> | 31 | #include <linux/compat.h> |
38 | #include <linux/blkdev.h> | 32 | #include <linux/blkdev.h> |
@@ -62,6 +56,13 @@ | |||
62 | 56 | ||
63 | #include "aacraid.h" | 57 | #include "aacraid.h" |
64 | 58 | ||
59 | #define AAC_DRIVER_VERSION "1.1-5" | ||
60 | #ifndef AAC_DRIVER_BRANCH | ||
61 | #define AAC_DRIVER_BRANCH "" | ||
62 | #endif | ||
63 | #define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__ | ||
64 | #define AAC_DRIVERNAME "aacraid" | ||
65 | |||
65 | #ifdef AAC_DRIVER_BUILD | 66 | #ifdef AAC_DRIVER_BUILD |
66 | #define _str(x) #x | 67 | #define _str(x) #x |
67 | #define str(x) _str(x) | 68 | #define str(x) _str(x) |
@@ -73,7 +74,7 @@ | |||
73 | MODULE_AUTHOR("Red Hat Inc and Adaptec"); | 74 | MODULE_AUTHOR("Red Hat Inc and Adaptec"); |
74 | MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " | 75 | MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " |
75 | "Adaptec Advanced Raid Products, " | 76 | "Adaptec Advanced Raid Products, " |
76 | "and HP NetRAID-4M SCSI driver"); | 77 | "HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver"); |
77 | MODULE_LICENSE("GPL"); | 78 | MODULE_LICENSE("GPL"); |
78 | MODULE_VERSION(AAC_DRIVER_FULL_VERSION); | 79 | MODULE_VERSION(AAC_DRIVER_FULL_VERSION); |
79 | 80 | ||
@@ -243,6 +244,7 @@ static struct aac_driver_ident aac_drivers[] = { | |||
243 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | 244 | static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) |
244 | { | 245 | { |
245 | cmd->scsi_done = done; | 246 | cmd->scsi_done = done; |
247 | cmd->SCp.phase = AAC_OWNER_LOWLEVEL; | ||
246 | return (aac_scsi_cmd(cmd) ? FAILED : 0); | 248 | return (aac_scsi_cmd(cmd) ? FAILED : 0); |
247 | } | 249 | } |
248 | 250 | ||
@@ -471,7 +473,8 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) | |||
471 | __shost_for_each_device(dev, host) { | 473 | __shost_for_each_device(dev, host) { |
472 | spin_lock_irqsave(&dev->list_lock, flags); | 474 | spin_lock_irqsave(&dev->list_lock, flags); |
473 | list_for_each_entry(command, &dev->cmd_list, list) { | 475 | list_for_each_entry(command, &dev->cmd_list, list) { |
474 | if (command->serial_number) { | 476 | if ((command != cmd) && |
477 | (command->SCp.phase == AAC_OWNER_FIRMWARE)) { | ||
475 | active++; | 478 | active++; |
476 | break; | 479 | break; |
477 | } | 480 | } |
@@ -569,12 +572,12 @@ static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long | |||
569 | 572 | ||
570 | f = compat_alloc_user_space(sizeof(*f)); | 573 | f = compat_alloc_user_space(sizeof(*f)); |
571 | ret = 0; | 574 | ret = 0; |
572 | if (clear_user(f, sizeof(*f) != sizeof(*f))) | 575 | if (clear_user(f, sizeof(*f)) != sizeof(*f)) |
573 | ret = -EFAULT; | 576 | ret = -EFAULT; |
574 | if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) | 577 | if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) |
575 | ret = -EFAULT; | 578 | ret = -EFAULT; |
576 | if (!ret) | 579 | if (!ret) |
577 | ret = aac_do_ioctl(dev, cmd, (void __user *)arg); | 580 | ret = aac_do_ioctl(dev, cmd, f); |
578 | break; | 581 | break; |
579 | } | 582 | } |
580 | 583 | ||
@@ -687,6 +690,18 @@ static ssize_t aac_show_serial_number(struct class_device *class_dev, | |||
687 | return len; | 690 | return len; |
688 | } | 691 | } |
689 | 692 | ||
693 | static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf) | ||
694 | { | ||
695 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
696 | class_to_shost(class_dev)->max_channel); | ||
697 | } | ||
698 | |||
699 | static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf) | ||
700 | { | ||
701 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
702 | class_to_shost(class_dev)->max_id); | ||
703 | } | ||
704 | |||
690 | 705 | ||
691 | static struct class_device_attribute aac_model = { | 706 | static struct class_device_attribute aac_model = { |
692 | .attr = { | 707 | .attr = { |
@@ -730,6 +745,20 @@ static struct class_device_attribute aac_serial_number = { | |||
730 | }, | 745 | }, |
731 | .show = aac_show_serial_number, | 746 | .show = aac_show_serial_number, |
732 | }; | 747 | }; |
748 | static struct class_device_attribute aac_max_channel = { | ||
749 | .attr = { | ||
750 | .name = "max_channel", | ||
751 | .mode = S_IRUGO, | ||
752 | }, | ||
753 | .show = aac_show_max_channel, | ||
754 | }; | ||
755 | static struct class_device_attribute aac_max_id = { | ||
756 | .attr = { | ||
757 | .name = "max_id", | ||
758 | .mode = S_IRUGO, | ||
759 | }, | ||
760 | .show = aac_show_max_id, | ||
761 | }; | ||
733 | 762 | ||
734 | static struct class_device_attribute *aac_attrs[] = { | 763 | static struct class_device_attribute *aac_attrs[] = { |
735 | &aac_model, | 764 | &aac_model, |
@@ -738,6 +767,8 @@ static struct class_device_attribute *aac_attrs[] = { | |||
738 | &aac_monitor_version, | 767 | &aac_monitor_version, |
739 | &aac_bios_version, | 768 | &aac_bios_version, |
740 | &aac_serial_number, | 769 | &aac_serial_number, |
770 | &aac_max_channel, | ||
771 | &aac_max_id, | ||
741 | NULL | 772 | NULL |
742 | }; | 773 | }; |
743 | 774 | ||
@@ -775,6 +806,7 @@ static struct scsi_host_template aac_driver_template = { | |||
775 | .cmd_per_lun = AAC_NUM_IO_FIB, | 806 | .cmd_per_lun = AAC_NUM_IO_FIB, |
776 | #endif | 807 | #endif |
777 | .use_clustering = ENABLE_CLUSTERING, | 808 | .use_clustering = ENABLE_CLUSTERING, |
809 | .emulated = 1, | ||
778 | }; | 810 | }; |
779 | 811 | ||
780 | 812 | ||
@@ -798,10 +830,11 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
798 | error = pci_enable_device(pdev); | 830 | error = pci_enable_device(pdev); |
799 | if (error) | 831 | if (error) |
800 | goto out; | 832 | goto out; |
833 | error = -ENODEV; | ||
801 | 834 | ||
802 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || | 835 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) || |
803 | pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) | 836 | pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) |
804 | goto out; | 837 | goto out_disable_pdev; |
805 | /* | 838 | /* |
806 | * If the quirk31 bit is set, the adapter needs adapter | 839 | * If the quirk31 bit is set, the adapter needs adapter |
807 | * to driver communication memory to be allocated below 2gig | 840 | * to driver communication memory to be allocated below 2gig |
@@ -809,7 +842,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
809 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) | 842 | if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) |
810 | if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || | 843 | if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) || |
811 | pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) | 844 | pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK)) |
812 | goto out; | 845 | goto out_disable_pdev; |
813 | 846 | ||
814 | pci_set_master(pdev); | 847 | pci_set_master(pdev); |
815 | 848 | ||
@@ -904,9 +937,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, | |||
904 | * physical channels are address by their actual physical number+1 | 937 | * physical channels are address by their actual physical number+1 |
905 | */ | 938 | */ |
906 | if (aac->nondasd_support == 1) | 939 | if (aac->nondasd_support == 1) |
907 | shost->max_channel = aac->maximum_num_channels + 1; | 940 | shost->max_channel = aac->maximum_num_channels; |
908 | else | 941 | else |
909 | shost->max_channel = 1; | 942 | shost->max_channel = 0; |
910 | 943 | ||
911 | aac_get_config_status(aac); | 944 | aac_get_config_status(aac); |
912 | aac_get_containers(aac); | 945 | aac_get_containers(aac); |
@@ -1020,7 +1053,8 @@ static int __init aac_init(void) | |||
1020 | 1053 | ||
1021 | static void __exit aac_exit(void) | 1054 | static void __exit aac_exit(void) |
1022 | { | 1055 | { |
1023 | unregister_chrdev(aac_cfg_major, "aac"); | 1056 | if (aac_cfg_major > -1) |
1057 | unregister_chrdev(aac_cfg_major, "aac"); | ||
1024 | pci_unregister_driver(&aac_pci_driver); | 1058 | pci_unregister_driver(&aac_pci_driver); |
1025 | } | 1059 | } |
1026 | 1060 | ||
diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c index e9b775d6bec9..7a23e027eb78 100644 --- a/drivers/scsi/aacraid/rkt.c +++ b/drivers/scsi/aacraid/rkt.c | |||
@@ -183,7 +183,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, | |||
183 | /* | 183 | /* |
184 | * Yield the processor in case we are slow | 184 | * Yield the processor in case we are slow |
185 | */ | 185 | */ |
186 | schedule_timeout_uninterruptible(1); | 186 | msleep(1); |
187 | } | 187 | } |
188 | if (ok != 1) { | 188 | if (ok != 1) { |
189 | /* | 189 | /* |
@@ -343,7 +343,7 @@ static int aac_rkt_check_health(struct aac_dev *dev) | |||
343 | NULL, NULL, NULL, NULL, NULL); | 343 | NULL, NULL, NULL, NULL, NULL); |
344 | pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), | 344 | pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), |
345 | post, paddr); | 345 | post, paddr); |
346 | if ((buffer[0] == '0') && (buffer[1] == 'x')) { | 346 | if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) { |
347 | ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); | 347 | ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); |
348 | ret <<= 4; | 348 | ret <<= 4; |
349 | ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); | 349 | ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); |
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 6998bc877dd6..729b9eb268c2 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -183,7 +183,7 @@ static int rx_sync_cmd(struct aac_dev *dev, u32 command, | |||
183 | /* | 183 | /* |
184 | * Yield the processor in case we are slow | 184 | * Yield the processor in case we are slow |
185 | */ | 185 | */ |
186 | schedule_timeout_uninterruptible(1); | 186 | msleep(1); |
187 | } | 187 | } |
188 | if (ok != 1) { | 188 | if (ok != 1) { |
189 | /* | 189 | /* |
@@ -342,7 +342,7 @@ static int aac_rx_check_health(struct aac_dev *dev) | |||
342 | NULL, NULL, NULL, NULL, NULL); | 342 | NULL, NULL, NULL, NULL, NULL); |
343 | pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), | 343 | pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), |
344 | post, paddr); | 344 | post, paddr); |
345 | if ((buffer[0] == '0') && (buffer[1] == 'x')) { | 345 | if ((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X'))) { |
346 | ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); | 346 | ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); |
347 | ret <<= 4; | 347 | ret <<= 4; |
348 | ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); | 348 | ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); |
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index 466f05cfbf0c..a53454908205 100644 --- a/drivers/scsi/aacraid/sa.c +++ b/drivers/scsi/aacraid/sa.c | |||
@@ -189,7 +189,7 @@ static int sa_sync_cmd(struct aac_dev *dev, u32 command, | |||
189 | ok = 1; | 189 | ok = 1; |
190 | break; | 190 | break; |
191 | } | 191 | } |
192 | schedule_timeout_uninterruptible(1); | 192 | msleep(1); |
193 | } | 193 | } |
194 | 194 | ||
195 | if (ok != 1) | 195 | if (ok != 1) |