aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/aachba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r--drivers/scsi/aacraid/aachba.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 83b5c7d085f2..37c55ddce214 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size.
175 * 175 *
176 * Query config status, and commit the configuration if needed. 176 * Query config status, and commit the configuration if needed.
177 */ 177 */
178int aac_get_config_status(struct aac_dev *dev) 178int aac_get_config_status(struct aac_dev *dev, int commit_flag)
179{ 179{
180 int status = 0; 180 int status = 0;
181 struct fib * fibptr; 181 struct fib * fibptr;
@@ -219,7 +219,7 @@ int aac_get_config_status(struct aac_dev *dev)
219 aac_fib_complete(fibptr); 219 aac_fib_complete(fibptr);
220 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ 220 /* Send a CT_COMMIT_CONFIG to enable discovery of devices */
221 if (status >= 0) { 221 if (status >= 0) {
222 if (commit == 1) { 222 if ((commit == 1) || commit_flag) {
223 struct aac_commit_config * dinfo; 223 struct aac_commit_config * dinfo;
224 aac_fib_init(fibptr); 224 aac_fib_init(fibptr);
225 dinfo = (struct aac_commit_config *) fib_data(fibptr); 225 dinfo = (struct aac_commit_config *) fib_data(fibptr);
@@ -489,6 +489,8 @@ int aac_probe_container(struct aac_dev *dev, int cid)
489 unsigned instance; 489 unsigned instance;
490 490
491 fsa_dev_ptr = dev->fsa_dev; 491 fsa_dev_ptr = dev->fsa_dev;
492 if (!fsa_dev_ptr)
493 return -ENOMEM;
492 instance = dev->scsi_host_ptr->unique_id; 494 instance = dev->scsi_host_ptr->unique_id;
493 495
494 if (!(fibptr = aac_fib_alloc(dev))) 496 if (!(fibptr = aac_fib_alloc(dev)))
@@ -782,8 +784,9 @@ int aac_get_adapter_info(struct aac_dev* dev)
782 dev->maximum_num_channels = le32_to_cpu(bus_info->BusCount); 784 dev->maximum_num_channels = le32_to_cpu(bus_info->BusCount);
783 } 785 }
784 786
785 tmp = le32_to_cpu(dev->adapter_info.kernelrev); 787 if (!dev->in_reset) {
786 printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", 788 tmp = le32_to_cpu(dev->adapter_info.kernelrev);
789 printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n",
787 dev->name, 790 dev->name,
788 dev->id, 791 dev->id,
789 tmp>>24, 792 tmp>>24,
@@ -792,20 +795,21 @@ int aac_get_adapter_info(struct aac_dev* dev)
792 le32_to_cpu(dev->adapter_info.kernelbuild), 795 le32_to_cpu(dev->adapter_info.kernelbuild),
793 (int)sizeof(dev->supplement_adapter_info.BuildDate), 796 (int)sizeof(dev->supplement_adapter_info.BuildDate),
794 dev->supplement_adapter_info.BuildDate); 797 dev->supplement_adapter_info.BuildDate);
795 tmp = le32_to_cpu(dev->adapter_info.monitorrev); 798 tmp = le32_to_cpu(dev->adapter_info.monitorrev);
796 printk(KERN_INFO "%s%d: monitor %d.%d-%d[%d]\n", 799 printk(KERN_INFO "%s%d: monitor %d.%d-%d[%d]\n",
797 dev->name, dev->id, 800 dev->name, dev->id,
798 tmp>>24,(tmp>>16)&0xff,tmp&0xff, 801 tmp>>24,(tmp>>16)&0xff,tmp&0xff,
799 le32_to_cpu(dev->adapter_info.monitorbuild)); 802 le32_to_cpu(dev->adapter_info.monitorbuild));
800 tmp = le32_to_cpu(dev->adapter_info.biosrev); 803 tmp = le32_to_cpu(dev->adapter_info.biosrev);
801 printk(KERN_INFO "%s%d: bios %d.%d-%d[%d]\n", 804 printk(KERN_INFO "%s%d: bios %d.%d-%d[%d]\n",
802 dev->name, dev->id, 805 dev->name, dev->id,
803 tmp>>24,(tmp>>16)&0xff,tmp&0xff, 806 tmp>>24,(tmp>>16)&0xff,tmp&0xff,
804 le32_to_cpu(dev->adapter_info.biosbuild)); 807 le32_to_cpu(dev->adapter_info.biosbuild));
805 if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) 808 if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0)
806 printk(KERN_INFO "%s%d: serial %x\n", 809 printk(KERN_INFO "%s%d: serial %x\n",
807 dev->name, dev->id, 810 dev->name, dev->id,
808 le32_to_cpu(dev->adapter_info.serial[0])); 811 le32_to_cpu(dev->adapter_info.serial[0]));
812 }
809 813
810 dev->nondasd_support = 0; 814 dev->nondasd_support = 0;
811 dev->raid_scsi_mode = 0; 815 dev->raid_scsi_mode = 0;
@@ -1392,6 +1396,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1392 struct scsi_cmnd *cmd; 1396 struct scsi_cmnd *cmd;
1393 struct scsi_device *sdev = scsicmd->device; 1397 struct scsi_device *sdev = scsicmd->device;
1394 int active = 0; 1398 int active = 0;
1399 struct aac_dev *aac;
1395 unsigned long flags; 1400 unsigned long flags;
1396 1401
1397 /* 1402 /*
@@ -1413,11 +1418,14 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid)
1413 if (active) 1418 if (active)
1414 return SCSI_MLQUEUE_DEVICE_BUSY; 1419 return SCSI_MLQUEUE_DEVICE_BUSY;
1415 1420
1421 aac = (struct aac_dev *)scsicmd->device->host->hostdata;
1422 if (aac->in_reset)
1423 return SCSI_MLQUEUE_HOST_BUSY;
1424
1416 /* 1425 /*
1417 * Allocate and initialize a Fib 1426 * Allocate and initialize a Fib
1418 */ 1427 */
1419 if (!(cmd_fibcontext = 1428 if (!(cmd_fibcontext = aac_fib_alloc(aac)))
1420 aac_fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata)))
1421 return SCSI_MLQUEUE_HOST_BUSY; 1429 return SCSI_MLQUEUE_HOST_BUSY;
1422 1430
1423 aac_fib_init(cmd_fibcontext); 1431 aac_fib_init(cmd_fibcontext);
@@ -1470,6 +1478,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1470 struct aac_dev *dev = (struct aac_dev *)host->hostdata; 1478 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
1471 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; 1479 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
1472 1480
1481 if (fsa_dev_ptr == NULL)
1482 return -1;
1473 /* 1483 /*
1474 * If the bus, id or lun is out of range, return fail 1484 * If the bus, id or lun is out of range, return fail
1475 * Test does not apply to ID 16, the pseudo id for the controller 1485 * Test does not apply to ID 16, the pseudo id for the controller
@@ -1499,6 +1509,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1499 case INQUIRY: 1509 case INQUIRY:
1500 case READ_CAPACITY: 1510 case READ_CAPACITY:
1501 case TEST_UNIT_READY: 1511 case TEST_UNIT_READY:
1512 if (dev->in_reset)
1513 return -1;
1502 spin_unlock_irq(host->host_lock); 1514 spin_unlock_irq(host->host_lock);
1503 aac_probe_container(dev, cid); 1515 aac_probe_container(dev, cid);
1504 if ((fsa_dev_ptr[cid].valid & 1) == 0) 1516 if ((fsa_dev_ptr[cid].valid & 1) == 0)
@@ -1524,6 +1536,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1524 } 1536 }
1525 } else { /* check for physical non-dasd devices */ 1537 } else { /* check for physical non-dasd devices */
1526 if(dev->nondasd_support == 1){ 1538 if(dev->nondasd_support == 1){
1539 if (dev->in_reset)
1540 return -1;
1527 return aac_send_srb_fib(scsicmd); 1541 return aac_send_srb_fib(scsicmd);
1528 } else { 1542 } else {
1529 scsicmd->result = DID_NO_CONNECT << 16; 1543 scsicmd->result = DID_NO_CONNECT << 16;
@@ -1579,6 +1593,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1579 scsicmd->scsi_done(scsicmd); 1593 scsicmd->scsi_done(scsicmd);
1580 return 0; 1594 return 0;
1581 } 1595 }
1596 if (dev->in_reset)
1597 return -1;
1582 setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); 1598 setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type);
1583 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ 1599 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
1584 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1600 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
@@ -1734,6 +1750,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1734 case READ_10: 1750 case READ_10:
1735 case READ_12: 1751 case READ_12:
1736 case READ_16: 1752 case READ_16:
1753 if (dev->in_reset)
1754 return -1;
1737 /* 1755 /*
1738 * Hack to keep track of ordinal number of the device that 1756 * Hack to keep track of ordinal number of the device that
1739 * corresponds to a container. Needed to convert 1757 * corresponds to a container. Needed to convert
@@ -1752,6 +1770,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1752 case WRITE_10: 1770 case WRITE_10:
1753 case WRITE_12: 1771 case WRITE_12:
1754 case WRITE_16: 1772 case WRITE_16:
1773 if (dev->in_reset)
1774 return -1;
1755 return aac_write(scsicmd, cid); 1775 return aac_write(scsicmd, cid);
1756 1776
1757 case SYNCHRONIZE_CACHE: 1777 case SYNCHRONIZE_CACHE:
@@ -1782,6 +1802,8 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
1782 struct fsa_dev_info *fsa_dev_ptr; 1802 struct fsa_dev_info *fsa_dev_ptr;
1783 1803
1784 fsa_dev_ptr = dev->fsa_dev; 1804 fsa_dev_ptr = dev->fsa_dev;
1805 if (!fsa_dev_ptr)
1806 return -ENODEV;
1785 if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk))) 1807 if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))
1786 return -EFAULT; 1808 return -EFAULT;
1787 if (qd.cnum == -1) 1809 if (qd.cnum == -1)
@@ -1843,6 +1865,10 @@ static int delete_disk(struct aac_dev *dev, void __user *arg)
1843 struct fsa_dev_info *fsa_dev_ptr; 1865 struct fsa_dev_info *fsa_dev_ptr;
1844 1866
1845 fsa_dev_ptr = dev->fsa_dev; 1867 fsa_dev_ptr = dev->fsa_dev;
1868 if (!fsa_dev_ptr)
1869 return -ENODEV;
1870 if (!fsa_dev_ptr)
1871 return -ENODEV;
1846 1872
1847 if (copy_from_user(&dd, arg, sizeof (struct aac_delete_disk))) 1873 if (copy_from_user(&dd, arg, sizeof (struct aac_delete_disk)))
1848 return -EFAULT; 1874 return -EFAULT;