diff options
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 88 |
1 files changed, 53 insertions, 35 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 93416f760e5a..2a128a156aa1 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -359,15 +359,6 @@ int aac_get_containers(struct aac_dev *dev) | |||
359 | return status; | 359 | return status; |
360 | } | 360 | } |
361 | 361 | ||
362 | static void aac_io_done(struct scsi_cmnd * scsicmd) | ||
363 | { | ||
364 | unsigned long cpu_flags; | ||
365 | struct Scsi_Host *host = scsicmd->device->host; | ||
366 | spin_lock_irqsave(host->host_lock, cpu_flags); | ||
367 | scsicmd->scsi_done(scsicmd); | ||
368 | spin_unlock_irqrestore(host->host_lock, cpu_flags); | ||
369 | } | ||
370 | |||
371 | static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) | 362 | static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) |
372 | { | 363 | { |
373 | void *buf; | 364 | void *buf; |
@@ -424,7 +415,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) | |||
424 | 415 | ||
425 | fib_complete(fibptr); | 416 | fib_complete(fibptr); |
426 | fib_free(fibptr); | 417 | fib_free(fibptr); |
427 | aac_io_done(scsicmd); | 418 | scsicmd->scsi_done(scsicmd); |
428 | } | 419 | } |
429 | 420 | ||
430 | /** | 421 | /** |
@@ -608,17 +599,43 @@ static char *container_types[] = { | |||
608 | * files instead of in OS dependant driver source. | 599 | * files instead of in OS dependant driver source. |
609 | */ | 600 | */ |
610 | 601 | ||
611 | static void setinqstr(int devtype, void *data, int tindex) | 602 | static void setinqstr(struct aac_dev *dev, void *data, int tindex) |
612 | { | 603 | { |
613 | struct scsi_inq *str; | 604 | struct scsi_inq *str; |
614 | struct aac_driver_ident *mp; | ||
615 | 605 | ||
616 | mp = aac_get_driver_ident(devtype); | ||
617 | |||
618 | str = (struct scsi_inq *)(data); /* cast data to scsi inq block */ | 606 | str = (struct scsi_inq *)(data); /* cast data to scsi inq block */ |
619 | 607 | memset(str, ' ', sizeof(*str)); | |
620 | inqstrcpy (mp->vname, str->vid); | 608 | |
621 | inqstrcpy (mp->model, str->pid); /* last six chars reserved for vol type */ | 609 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { |
610 | char * cp = dev->supplement_adapter_info.AdapterTypeText; | ||
611 | int c = sizeof(str->vid); | ||
612 | while (*cp && *cp != ' ' && --c) | ||
613 | ++cp; | ||
614 | c = *cp; | ||
615 | *cp = '\0'; | ||
616 | inqstrcpy (dev->supplement_adapter_info.AdapterTypeText, | ||
617 | str->vid); | ||
618 | *cp = c; | ||
619 | while (*cp && *cp != ' ') | ||
620 | ++cp; | ||
621 | while (*cp == ' ') | ||
622 | ++cp; | ||
623 | /* last six chars reserved for vol type */ | ||
624 | c = 0; | ||
625 | if (strlen(cp) > sizeof(str->pid)) { | ||
626 | c = cp[sizeof(str->pid)]; | ||
627 | cp[sizeof(str->pid)] = '\0'; | ||
628 | } | ||
629 | inqstrcpy (cp, str->pid); | ||
630 | if (c) | ||
631 | cp[sizeof(str->pid)] = c; | ||
632 | } else { | ||
633 | struct aac_driver_ident *mp = aac_get_driver_ident(dev->cardtype); | ||
634 | |||
635 | inqstrcpy (mp->vname, str->vid); | ||
636 | /* last six chars reserved for vol type */ | ||
637 | inqstrcpy (mp->model, str->pid); | ||
638 | } | ||
622 | 639 | ||
623 | if (tindex < (sizeof(container_types)/sizeof(char *))){ | 640 | if (tindex < (sizeof(container_types)/sizeof(char *))){ |
624 | char *findit = str->pid; | 641 | char *findit = str->pid; |
@@ -627,7 +644,9 @@ static void setinqstr(int devtype, void *data, int tindex) | |||
627 | /* RAID is superfluous in the context of a RAID device */ | 644 | /* RAID is superfluous in the context of a RAID device */ |
628 | if (memcmp(findit-4, "RAID", 4) == 0) | 645 | if (memcmp(findit-4, "RAID", 4) == 0) |
629 | *(findit -= 4) = ' '; | 646 | *(findit -= 4) = ' '; |
630 | inqstrcpy (container_types[tindex], findit + 1); | 647 | if (((findit - str->pid) + strlen(container_types[tindex])) |
648 | < (sizeof(str->pid) + sizeof(str->prl))) | ||
649 | inqstrcpy (container_types[tindex], findit + 1); | ||
631 | } | 650 | } |
632 | inqstrcpy ("V1.0", str->prl); | 651 | inqstrcpy ("V1.0", str->prl); |
633 | } | 652 | } |
@@ -822,12 +841,12 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
822 | dev->dac_support = (dacmode!=0); | 841 | dev->dac_support = (dacmode!=0); |
823 | } | 842 | } |
824 | if(dev->dac_support != 0) { | 843 | if(dev->dac_support != 0) { |
825 | if (!pci_set_dma_mask(dev->pdev, 0xFFFFFFFFFFFFFFFFULL) && | 844 | if (!pci_set_dma_mask(dev->pdev, DMA_64BIT_MASK) && |
826 | !pci_set_consistent_dma_mask(dev->pdev, 0xFFFFFFFFFFFFFFFFULL)) { | 845 | !pci_set_consistent_dma_mask(dev->pdev, DMA_64BIT_MASK)) { |
827 | printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n", | 846 | printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n", |
828 | dev->name, dev->id); | 847 | dev->name, dev->id); |
829 | } else if (!pci_set_dma_mask(dev->pdev, 0xFFFFFFFFULL) && | 848 | } else if (!pci_set_dma_mask(dev->pdev, DMA_32BIT_MASK) && |
830 | !pci_set_consistent_dma_mask(dev->pdev, 0xFFFFFFFFULL)) { | 849 | !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", | 850 | printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n", |
832 | dev->name, dev->id); | 851 | dev->name, dev->id); |
833 | dev->dac_support = 0; | 852 | dev->dac_support = 0; |
@@ -960,7 +979,7 @@ static void io_callback(void *context, struct fib * fibptr) | |||
960 | fib_complete(fibptr); | 979 | fib_complete(fibptr); |
961 | fib_free(fibptr); | 980 | fib_free(fibptr); |
962 | 981 | ||
963 | aac_io_done(scsicmd); | 982 | scsicmd->scsi_done(scsicmd); |
964 | } | 983 | } |
965 | 984 | ||
966 | static int aac_read(struct scsi_cmnd * scsicmd, int cid) | 985 | static int aac_read(struct scsi_cmnd * scsicmd, int cid) |
@@ -1139,7 +1158,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid) | |||
1139 | * For some reason, the Fib didn't queue, return QUEUE_FULL | 1158 | * For some reason, the Fib didn't queue, return QUEUE_FULL |
1140 | */ | 1159 | */ |
1141 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; | 1160 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; |
1142 | aac_io_done(scsicmd); | 1161 | scsicmd->scsi_done(scsicmd); |
1143 | fib_complete(cmd_fibcontext); | 1162 | fib_complete(cmd_fibcontext); |
1144 | fib_free(cmd_fibcontext); | 1163 | fib_free(cmd_fibcontext); |
1145 | return 0; | 1164 | return 0; |
@@ -1211,7 +1230,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1211 | */ | 1230 | */ |
1212 | if (!(cmd_fibcontext = fib_alloc(dev))) { | 1231 | if (!(cmd_fibcontext = fib_alloc(dev))) { |
1213 | scsicmd->result = DID_ERROR << 16; | 1232 | scsicmd->result = DID_ERROR << 16; |
1214 | aac_io_done(scsicmd); | 1233 | scsicmd->scsi_done(scsicmd); |
1215 | return 0; | 1234 | return 0; |
1216 | } | 1235 | } |
1217 | fib_init(cmd_fibcontext); | 1236 | fib_init(cmd_fibcontext); |
@@ -1308,7 +1327,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid) | |||
1308 | * For some reason, the Fib didn't queue, return QUEUE_FULL | 1327 | * For some reason, the Fib didn't queue, return QUEUE_FULL |
1309 | */ | 1328 | */ |
1310 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; | 1329 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_TASK_SET_FULL; |
1311 | aac_io_done(scsicmd); | 1330 | scsicmd->scsi_done(scsicmd); |
1312 | 1331 | ||
1313 | fib_complete(cmd_fibcontext); | 1332 | fib_complete(cmd_fibcontext); |
1314 | fib_free(cmd_fibcontext); | 1333 | fib_free(cmd_fibcontext); |
@@ -1352,7 +1371,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) | |||
1352 | 1371 | ||
1353 | fib_complete(fibptr); | 1372 | fib_complete(fibptr); |
1354 | fib_free(fibptr); | 1373 | fib_free(fibptr); |
1355 | aac_io_done(cmd); | 1374 | cmd->scsi_done(cmd); |
1356 | } | 1375 | } |
1357 | 1376 | ||
1358 | static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) | 1377 | static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) |
@@ -1438,7 +1457,6 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1438 | struct Scsi_Host *host = scsicmd->device->host; | 1457 | struct Scsi_Host *host = scsicmd->device->host; |
1439 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; | 1458 | struct aac_dev *dev = (struct aac_dev *)host->hostdata; |
1440 | struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; | 1459 | struct fsa_dev_info *fsa_dev_ptr = dev->fsa_dev; |
1441 | int cardtype = dev->cardtype; | ||
1442 | int ret; | 1460 | int ret; |
1443 | 1461 | ||
1444 | /* | 1462 | /* |
@@ -1446,7 +1464,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1446 | * Test does not apply to ID 16, the pseudo id for the controller | 1464 | * Test does not apply to ID 16, the pseudo id for the controller |
1447 | * itself. | 1465 | * itself. |
1448 | */ | 1466 | */ |
1449 | if (scsicmd->device->id != host->this_id) { | 1467 | if (scmd_id(scsicmd) != host->this_id) { |
1450 | if ((scsicmd->device->channel == 0) ){ | 1468 | if ((scsicmd->device->channel == 0) ){ |
1451 | if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ | 1469 | if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){ |
1452 | scsicmd->result = DID_NO_CONNECT << 16; | 1470 | scsicmd->result = DID_NO_CONNECT << 16; |
@@ -1541,15 +1559,15 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) | |||
1541 | * Set the Vendor, Product, and Revision Level | 1559 | * Set the Vendor, Product, and Revision Level |
1542 | * see: <vendor>.c i.e. aac.c | 1560 | * see: <vendor>.c i.e. aac.c |
1543 | */ | 1561 | */ |
1544 | if (scsicmd->device->id == host->this_id) { | 1562 | if (scmd_id(scsicmd) == host->this_id) { |
1545 | setinqstr(cardtype, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); | 1563 | setinqstr(dev, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); |
1546 | inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ | 1564 | inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */ |
1547 | aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); | 1565 | aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); |
1548 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; | 1566 | scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; |
1549 | scsicmd->scsi_done(scsicmd); | 1567 | scsicmd->scsi_done(scsicmd); |
1550 | return 0; | 1568 | return 0; |
1551 | } | 1569 | } |
1552 | setinqstr(cardtype, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); | 1570 | setinqstr(dev, (void *) (inq_data.inqd_vid), fsa_dev_ptr[cid].type); |
1553 | inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ | 1571 | inq_data.inqd_pdt = INQD_PDT_DA; /* Direct/random access device */ |
1554 | aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); | 1572 | aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data)); |
1555 | return aac_get_container_name(scsicmd, cid); | 1573 | return aac_get_container_name(scsicmd, cid); |
@@ -1931,7 +1949,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
1931 | * the channel is 2 | 1949 | * the channel is 2 |
1932 | */ | 1950 | */ |
1933 | } else if ((dev->raid_scsi_mode) && | 1951 | } else if ((dev->raid_scsi_mode) && |
1934 | (scsicmd->device->channel == 2)) { | 1952 | (scmd_channel(scsicmd) == 2)) { |
1935 | scsicmd->result = DID_OK << 16 | | 1953 | scsicmd->result = DID_OK << 16 | |
1936 | COMMAND_COMPLETE << 8; | 1954 | COMMAND_COMPLETE << 8; |
1937 | } else { | 1955 | } else { |
@@ -1975,7 +1993,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
1975 | * the channel is 2 | 1993 | * the channel is 2 |
1976 | */ | 1994 | */ |
1977 | } else if ((dev->raid_scsi_mode) && | 1995 | } else if ((dev->raid_scsi_mode) && |
1978 | (scsicmd->device->channel == 2)) { | 1996 | (scmd_channel(scsicmd) == 2)) { |
1979 | scsicmd->result = DID_OK << 16 | | 1997 | scsicmd->result = DID_OK << 16 | |
1980 | COMMAND_COMPLETE << 8; | 1998 | COMMAND_COMPLETE << 8; |
1981 | } else { | 1999 | } else { |
@@ -2070,7 +2088,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) | |||
2070 | 2088 | ||
2071 | fib_complete(fibptr); | 2089 | fib_complete(fibptr); |
2072 | fib_free(fibptr); | 2090 | fib_free(fibptr); |
2073 | aac_io_done(scsicmd); | 2091 | scsicmd->scsi_done(scsicmd); |
2074 | } | 2092 | } |
2075 | 2093 | ||
2076 | /** | 2094 | /** |