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.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 642a3b4e5937..83b5c7d085f2 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -148,6 +148,8 @@ static int nondasd = -1;
148static int dacmode = -1; 148static int dacmode = -1;
149 149
150static int commit = -1; 150static int commit = -1;
151int startup_timeout = 180;
152int aif_timeout = 120;
151 153
152module_param(nondasd, int, S_IRUGO|S_IWUSR); 154module_param(nondasd, int, S_IRUGO|S_IWUSR);
153MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); 155MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on");
@@ -155,6 +157,10 @@ module_param(dacmode, int, S_IRUGO|S_IWUSR);
155MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); 157MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on");
156module_param(commit, int, S_IRUGO|S_IWUSR); 158module_param(commit, int, S_IRUGO|S_IWUSR);
157MODULE_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"); 159MODULE_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");
160module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
161MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS.");
162module_param(aif_timeout, int, S_IRUGO|S_IWUSR);
163MODULE_PARM_DESC(aif_timeout, "The duration of time in seconds to wait for applications to pick up AIFs before\nderegistering them. This is typically adjusted for heavily burdened systems.");
158 164
159int numacb = -1; 165int numacb = -1;
160module_param(numacb, int, S_IRUGO|S_IWUSR); 166module_param(numacb, int, S_IRUGO|S_IWUSR);
@@ -390,8 +396,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
390 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; 396 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
391 397
392 dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); 398 dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies));
393 if (fibptr == NULL) 399 BUG_ON(fibptr == NULL);
394 BUG();
395 400
396 get_name_reply = (struct aac_get_name_resp *) fib_data(fibptr); 401 get_name_reply = (struct aac_get_name_resp *) fib_data(fibptr);
397 /* Failure is irrelevant, using default value instead */ 402 /* Failure is irrelevant, using default value instead */
@@ -635,13 +640,13 @@ static void setinqstr(struct aac_dev *dev, void *data, int tindex)
635 cp[sizeof(str->pid)] = c; 640 cp[sizeof(str->pid)] = c;
636 } else { 641 } else {
637 struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype); 642 struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype);
638 643
639 inqstrcpy (mp->vname, str->vid); 644 inqstrcpy (mp->vname, str->vid);
640 /* last six chars reserved for vol type */ 645 /* last six chars reserved for vol type */
641 inqstrcpy (mp->model, str->pid); 646 inqstrcpy (mp->model, str->pid);
642 } 647 }
643 648
644 if (tindex < (sizeof(container_types)/sizeof(char *))){ 649 if (tindex < ARRAY_SIZE(container_types)){
645 char *findit = str->pid; 650 char *findit = str->pid;
646 651
647 for ( ; *findit != ' '; findit++); /* walk till we find a space */ 652 for ( ; *findit != ' '; findit++); /* walk till we find a space */
@@ -950,12 +955,11 @@ static void io_callback(void *context, struct fib * fibptr)
950 smp_processor_id(), (unsigned long long)lba, jiffies); 955 smp_processor_id(), (unsigned long long)lba, jiffies);
951 } 956 }
952 957
953 if (fibptr == NULL) 958 BUG_ON(fibptr == NULL);
954 BUG();
955 959
956 if(scsicmd->use_sg) 960 if(scsicmd->use_sg)
957 pci_unmap_sg(dev->pdev, 961 pci_unmap_sg(dev->pdev,
958 (struct scatterlist *)scsicmd->buffer, 962 (struct scatterlist *)scsicmd->request_buffer,
959 scsicmd->use_sg, 963 scsicmd->use_sg,
960 scsicmd->sc_data_direction); 964 scsicmd->sc_data_direction);
961 else if(scsicmd->request_bufflen) 965 else if(scsicmd->request_bufflen)
@@ -1086,8 +1090,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
1086 1090
1087 aac_build_sgraw(scsicmd, &readcmd->sg); 1091 aac_build_sgraw(scsicmd, &readcmd->sg);
1088 fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw)); 1092 fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw));
1089 if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))) 1093 BUG_ON(fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)));
1090 BUG();
1091 /* 1094 /*
1092 * Now send the Fib to the adapter 1095 * Now send the Fib to the adapter
1093 */ 1096 */
@@ -1255,8 +1258,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
1255 1258
1256 aac_build_sgraw(scsicmd, &writecmd->sg); 1259 aac_build_sgraw(scsicmd, &writecmd->sg);
1257 fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(writecmd->sg.count) - 1) * sizeof (struct sgentryraw)); 1260 fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(writecmd->sg.count) - 1) * sizeof (struct sgentryraw));
1258 if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))) 1261 BUG_ON(fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)));
1259 BUG();
1260 /* 1262 /*
1261 * Now send the Fib to the adapter 1263 * Now send the Fib to the adapter
1262 */ 1264 */
@@ -1570,7 +1572,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1570 * see: <vendor>.c i.e. aac.c 1572 * see: <vendor>.c i.e. aac.c
1571 */ 1573 */
1572 if (scmd_id(scsicmd) == host->this_id) { 1574 if (scmd_id(scsicmd) == host->this_id) {
1573 setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); 1575 setinqstr(dev, (void *) (inq_data.inqd_vid), ARRAY_SIZE(container_types));
1574 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ 1576 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */
1575 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1577 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1576 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 1578 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
@@ -1898,8 +1900,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1898 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; 1900 scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
1899 dev = (struct aac_dev *)scsicmd->device->host->hostdata; 1901 dev = (struct aac_dev *)scsicmd->device->host->hostdata;
1900 1902
1901 if (fibptr == NULL) 1903 BUG_ON(fibptr == NULL);
1902 BUG();
1903 1904
1904 srbreply = (struct aac_srb_reply *) fib_data(fibptr); 1905 srbreply = (struct aac_srb_reply *) fib_data(fibptr);
1905 1906
@@ -1913,7 +1914,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
1913 1914
1914 if(scsicmd->use_sg) 1915 if(scsicmd->use_sg)
1915 pci_unmap_sg(dev->pdev, 1916 pci_unmap_sg(dev->pdev,
1916 (struct scatterlist *)scsicmd->buffer, 1917 (struct scatterlist *)scsicmd->request_buffer,
1917 scsicmd->use_sg, 1918 scsicmd->use_sg,
1918 scsicmd->sc_data_direction); 1919 scsicmd->sc_data_direction);
1919 else if(scsicmd->request_bufflen) 1920 else if(scsicmd->request_bufflen)
@@ -2218,15 +2219,15 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* psg)
2218 } 2219 }
2219 } 2220 }
2220 else if(scsicmd->request_bufflen) { 2221 else if(scsicmd->request_bufflen) {
2221 dma_addr_t addr; 2222 u32 addr;
2222 addr = pci_map_single(dev->pdev, 2223 scsicmd->SCp.dma_handle = pci_map_single(dev->pdev,
2223 scsicmd->request_buffer, 2224 scsicmd->request_buffer,
2224 scsicmd->request_bufflen, 2225 scsicmd->request_bufflen,
2225 scsicmd->sc_data_direction); 2226 scsicmd->sc_data_direction);
2227 addr = scsicmd->SCp.dma_handle;
2226 psg->count = cpu_to_le32(1); 2228 psg->count = cpu_to_le32(1);
2227 psg->sg[0].addr = cpu_to_le32(addr); 2229 psg->sg[0].addr = cpu_to_le32(addr);
2228 psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); 2230 psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
2229 scsicmd->SCp.dma_handle = addr;
2230 byte_count = scsicmd->request_bufflen; 2231 byte_count = scsicmd->request_bufflen;
2231 } 2232 }
2232 return byte_count; 2233 return byte_count;
@@ -2375,7 +2376,7 @@ static struct aac_srb_status_info srb_status_info[] = {
2375 { SRB_STATUS_SUCCESS, "Success"}, 2376 { SRB_STATUS_SUCCESS, "Success"},
2376 { SRB_STATUS_ABORTED, "Aborted Command"}, 2377 { SRB_STATUS_ABORTED, "Aborted Command"},
2377 { SRB_STATUS_ABORT_FAILED, "Abort Failed"}, 2378 { SRB_STATUS_ABORT_FAILED, "Abort Failed"},
2378 { SRB_STATUS_ERROR, "Error Event"}, 2379 { SRB_STATUS_ERROR, "Error Event"},
2379 { SRB_STATUS_BUSY, "Device Busy"}, 2380 { SRB_STATUS_BUSY, "Device Busy"},
2380 { SRB_STATUS_INVALID_REQUEST, "Invalid Request"}, 2381 { SRB_STATUS_INVALID_REQUEST, "Invalid Request"},
2381 { SRB_STATUS_INVALID_PATH_ID, "Invalid Path ID"}, 2382 { SRB_STATUS_INVALID_PATH_ID, "Invalid Path ID"},
@@ -2394,7 +2395,7 @@ static struct aac_srb_status_info srb_status_info[] = {
2394 { SRB_STATUS_BAD_SRB_BLOCK_LENGTH,"Bad Srb Block Length"}, 2395 { SRB_STATUS_BAD_SRB_BLOCK_LENGTH,"Bad Srb Block Length"},
2395 { SRB_STATUS_REQUEST_FLUSHED, "Request Flushed"}, 2396 { SRB_STATUS_REQUEST_FLUSHED, "Request Flushed"},
2396 { SRB_STATUS_DELAYED_RETRY, "Delayed Retry"}, 2397 { SRB_STATUS_DELAYED_RETRY, "Delayed Retry"},
2397 { SRB_STATUS_INVALID_LUN, "Invalid LUN"}, 2398 { SRB_STATUS_INVALID_LUN, "Invalid LUN"},
2398 { SRB_STATUS_INVALID_TARGET_ID, "Invalid TARGET ID"}, 2399 { SRB_STATUS_INVALID_TARGET_ID, "Invalid TARGET ID"},
2399 { SRB_STATUS_BAD_FUNCTION, "Bad Function"}, 2400 { SRB_STATUS_BAD_FUNCTION, "Bad Function"},
2400 { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"}, 2401 { SRB_STATUS_ERROR_RECOVERY, "Error Recovery"},
@@ -2409,11 +2410,9 @@ char *aac_get_status_string(u32 status)
2409{ 2410{
2410 int i; 2411 int i;
2411 2412
2412 for(i=0; i < (sizeof(srb_status_info)/sizeof(struct aac_srb_status_info)); i++ ){ 2413 for (i = 0; i < ARRAY_SIZE(srb_status_info); i++)
2413 if(srb_status_info[i].status == status){ 2414 if (srb_status_info[i].status == status)
2414 return srb_status_info[i].str; 2415 return srb_status_info[i].str;
2415 }
2416 }
2417 2416
2418 return "Bad Status Code"; 2417 return "Bad Status Code";
2419} 2418}