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.c57
1 files changed, 42 insertions, 15 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 93416f760e5a..a913196459d5 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -608,17 +608,43 @@ static char *container_types[] = {
608 * files instead of in OS dependant driver source. 608 * files instead of in OS dependant driver source.
609 */ 609 */
610 610
611static void setinqstr(int devtype, void *data, int tindex) 611static void setinqstr(struct aac_dev *dev, void *data, int tindex)
612{ 612{
613 struct scsi_inq *str; 613 struct scsi_inq *str;
614 struct aac_driver_ident *mp;
615 614
616 mp = aac_get_driver_ident(devtype);
617
618 str = (struct scsi_inq *)(data); /* cast data to scsi inq block */ 615 str = (struct scsi_inq *)(data); /* cast data to scsi inq block */
619 616 memset(str, ' ', sizeof(*str));
620 inqstrcpy (mp->vname, str->vid); 617
621 inqstrcpy (mp->model, str->pid); /* last six chars reserved for vol type */ 618 if (dev->supplement_adapter_info.AdapterTypeText[0]) {
619 char * cp = dev->supplement_adapter_info.AdapterTypeText;
620 int c = sizeof(str->vid);
621 while (*cp && *cp != ' ' && --c)
622 ++cp;
623 c = *cp;
624 *cp = '\0';
625 inqstrcpy (dev->supplement_adapter_info.AdapterTypeText,
626 str->vid);
627 *cp = c;
628 while (*cp && *cp != ' ')
629 ++cp;
630 while (*cp == ' ')
631 ++cp;
632 /* last six chars reserved for vol type */
633 c = 0;
634 if (strlen(cp) > sizeof(str->pid)) {
635 c = cp[sizeof(str->pid)];
636 cp[sizeof(str->pid)] = '\0';
637 }
638 inqstrcpy (cp, str->pid);
639 if (c)
640 cp[sizeof(str->pid)] = c;
641 } else {
642 struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype);
643
644 inqstrcpy (mp->vname, str->vid);
645 /* last six chars reserved for vol type */
646 inqstrcpy (mp->model, str->pid);
647 }
622 648
623 if (tindex < (sizeof(container_types)/sizeof(char *))){ 649 if (tindex < (sizeof(container_types)/sizeof(char *))){
624 char *findit = str->pid; 650 char *findit = str->pid;
@@ -627,7 +653,9 @@ static void setinqstr(int devtype, void *data, int tindex)
627 /* RAID is superfluous in the context of a RAID device */ 653 /* RAID is superfluous in the context of a RAID device */
628 if (memcmp(findit-4, "RAID", 4) == 0) 654 if (memcmp(findit-4, "RAID", 4) == 0)
629 *(findit -= 4) = ' '; 655 *(findit -= 4) = ' ';
630 inqstrcpy (container_types[tindex], findit + 1); 656 if (((findit - str->pid) + strlen(container_types[tindex]))
657 < (sizeof(str->pid) + sizeof(str->prl)))
658 inqstrcpy (container_types[tindex], findit + 1);
631 } 659 }
632 inqstrcpy ("V1.0", str->prl); 660 inqstrcpy ("V1.0", str->prl);
633} 661}
@@ -822,12 +850,12 @@ int aac_get_adapter_info(struct aac_dev* dev)
822 dev->dac_support = (dacmode!=0); 850 dev->dac_support = (dacmode!=0);
823 } 851 }
824 if(dev->dac_support != 0) { 852 if(dev->dac_support != 0) {
825 if (!pci_set_dma_mask(dev->pdev, 0xFFFFFFFFFFFFFFFFULL) && 853 if (!pci_set_dma_mask(dev->pdev, DMA_64BIT_MASK) &&
826 !pci_set_consistent_dma_mask(dev->pdev, 0xFFFFFFFFFFFFFFFFULL)) { 854 !pci_set_consistent_dma_mask(dev->pdev, DMA_64BIT_MASK)) {
827 printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n", 855 printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n",
828 dev->name, dev->id); 856 dev->name, dev->id);
829 } else if (!pci_set_dma_mask(dev->pdev, 0xFFFFFFFFULL) && 857 } else if (!pci_set_dma_mask(dev->pdev, DMA_32BIT_MASK) &&
830 !pci_set_consistent_dma_mask(dev->pdev, 0xFFFFFFFFULL)) { 858 !pci_set_consistent_dma_mask(dev->pdev, DMA_32BIT_MASK)) {
831 printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n", 859 printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n",
832 dev->name, dev->id); 860 dev->name, dev->id);
833 dev->dac_support = 0; 861 dev->dac_support = 0;
@@ -1438,7 +1466,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1438 struct Scsi_Host *host = scsicmd->device->host; 1466 struct Scsi_Host *host = scsicmd->device->host;
1439 struct aac_dev *dev = (struct aac_dev *)host->hostdata; 1467 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
1440 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; 1468 struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev;
1441 int cardtype = dev->cardtype;
1442 int ret; 1469 int ret;
1443 1470
1444 /* 1471 /*
@@ -1542,14 +1569,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1542 * see: <vendor>.c i.e. aac.c 1569 * see: <vendor>.c i.e. aac.c
1543 */ 1570 */
1544 if (scsicmd->device->id == host->this_id) { 1571 if (scsicmd->device->id == host->this_id) {
1545 setinqstr(cardtype, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); 1572 setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *)));
1546 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ 1573 inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */
1547 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1574 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1548 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; 1575 scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
1549 scsicmd->scsi_done(scsicmd); 1576 scsicmd->scsi_done(scsicmd);
1550 return 0; 1577 return 0;
1551 } 1578 }
1552 setinqstr(cardtype, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); 1579 setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type);
1553 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ 1580 inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
1554 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); 1581 aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
1555 return aac_get_container_name(scsicmd, cid); 1582 return aac_get_container_name(scsicmd, cid);