aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/aacraid/aachba.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index b864d3d4d133..44dbbe3dbe95 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -571,17 +571,43 @@ static char *container_types[] = {
571 * files instead of in OS dependant driver source. 571 * files instead of in OS dependant driver source.
572 */ 572 */
573 573
574static void setinqstr(int devtype, void *data, int tindex) 574static void setinqstr(struct aac_dev *dev, void *data, int tindex)
575{ 575{
576 struct scsi_inq *str; 576 struct scsi_inq *str;
577 struct aac_driver_ident *mp;
578 577
579 mp = aac_get_driver_ident(devtype);
580
581 str = (struct scsi_inq *)(data); /* cast data to scsi inq block */ 578 str = (struct scsi_inq *)(data); /* cast data to scsi inq block */
582 579 memset(str, ' ', sizeof(*str));
583 inqstrcpy (mp->vname, str->vid); 580
584 inqstrcpy (mp->model, str->pid); /* last six chars reserved for vol type */ 581 if (dev->supplement_adapter_info.AdapterTypeText[0]) {
582 char * cp = dev->supplement_adapter_info.AdapterTypeText;
583 int c = sizeof(str->vid);
584 while (*cp && *cp != ' ' && --c)
585 ++cp;
586 c = *cp;
587 *cp = '\0';
588 inqstrcpy (dev->supplement_adapter_info.AdapterTypeText,
589 str->vid);
590 *cp = c;
591 while (*cp && *cp != ' ')
592 ++cp;
593 while (*cp == ' ')
594 ++cp;
595 /* last six chars reserved for vol type */
596 c = 0;
597 if (strlen(cp) > sizeof(str->pid)) {
598 c = cp[sizeof(str->pid)];
599 cp[sizeof(str->pid)] = '\0';
600 }
601 inqstrcpy (cp, str->pid);
602 if (c)
603 cp[sizeof(str->pid)] = c;
604 } else {
605 struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype);
606
607 inqstrcpy (mp->vname, str->vid);
608 /* last six chars reserved for vol type */
609 inqstrcpy (mp->model, str->pid);
610 }
585 611
586 if (tindex < (sizeof(container_types)/sizeof(char *))){ 612 if (tindex < (sizeof(container_types)/sizeof(char *))){
587 char *findit = str->pid; 613 char *findit = str->pid;
@@ -590,7 +616,9 @@ static void setinqstr(int devtype, void *data, int tindex)
590 /* RAID is superfluous in the context of a RAID device */ 616 /* RAID is superfluous in the context of a RAID device */
591 if (memcmp(findit-4, "RAID", 4) == 0) 617 if (memcmp(findit-4, "RAID", 4) == 0)
592 *(findit -= 4) = ' '; 618 *(findit -= 4) = ' ';
593 inqstrcpy (container_types[tindex], findit + 1); 619 if (((findit - str->pid) + strlen(container_types[tindex]))
620 < (sizeof(str->pid) + sizeof(str->prl)))
621 inqstrcpy (container_types[tindex], findit + 1);
594 } 622 }
595 inqstrcpy ("V1.0", str->prl); 623 inqstrcpy ("V1.0", str->prl);
596} 624}
@@ -1287,7 +1315,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1287 struct Scsi_Host *host = scsicmd->device->host; 1315 struct Scsi_Host *host = scsicmd->device->host;
1288 struct aac_dev *dev = (struct aac_dev *)host->hostdata; 1316 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
1289 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; 1317 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
1290 int cardtype = dev->cardtype;
1291 int ret; 1318 int ret;
1292 1319
1293 /* 1320 /*
@@ -1385,14 +1412,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1385 * see: <vendor>.c i.e. aac.c 1412 * see: <vendor>.c i.e. aac.c
1386 */ 1413 */
1387 if (scsicmd->device->id == host->this_id) { 1414 if (scsicmd->device->id == host->this_id) {
1388 setinqstr(cardtype, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); 1415 setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *)));
1389 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ 1416 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */
1390 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1417 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1391 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 1418 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
1392 scsicmd->scsi_done(scsicmd); 1419 scsicmd->scsi_done(scsicmd);
1393 return 0; 1420 return 0;
1394 } 1421 }
1395 setinqstr(cardtype, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); 1422 setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type);
1396 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ 1423 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
1397 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1424 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1398 return aac_get_container_name(scsicmd, cid); 1425 return aac_get_container_name(scsicmd, cid);