diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-11-22 13:06:44 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-11-22 13:06:44 -0500 |
commit | 0bd2af46839ad6262d25714a6ec0365db9d6b98f (patch) | |
tree | dcced72d230d69fd0c5816ac6dd03ab84799a93e /drivers/scsi | |
parent | e138a5d2356729b8752e88520cc1525fae9794ac (diff) | |
parent | f26b90440cd74c78fe10c9bd5160809704a9627c (diff) |
Merge ../scsi-rc-fixes-2.6
Diffstat (limited to 'drivers/scsi')
86 files changed, 1247 insertions, 1045 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 5f8c26cd66ca..b091a0fc4eb0 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -66,6 +66,9 @@ | |||
66 | 2.26.02.006 - Fix 9550SX pchip reset timeout. | 66 | 2.26.02.006 - Fix 9550SX pchip reset timeout. |
67 | Add big endian support. | 67 | Add big endian support. |
68 | 2.26.02.007 - Disable local interrupts during kmap/unmap_atomic(). | 68 | 2.26.02.007 - Disable local interrupts during kmap/unmap_atomic(). |
69 | 2.26.02.008 - Free irq handler in __twa_shutdown(). | ||
70 | Serialize reset code. | ||
71 | Add support for 9650SE controllers. | ||
69 | */ | 72 | */ |
70 | 73 | ||
71 | #include <linux/module.h> | 74 | #include <linux/module.h> |
@@ -89,7 +92,7 @@ | |||
89 | #include "3w-9xxx.h" | 92 | #include "3w-9xxx.h" |
90 | 93 | ||
91 | /* Globals */ | 94 | /* Globals */ |
92 | #define TW_DRIVER_VERSION "2.26.02.007" | 95 | #define TW_DRIVER_VERSION "2.26.02.008" |
93 | static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; | 96 | static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; |
94 | static unsigned int twa_device_extension_count; | 97 | static unsigned int twa_device_extension_count; |
95 | static int twa_major = -1; | 98 | static int twa_major = -1; |
@@ -566,9 +569,9 @@ static int twa_check_srl(TW_Device_Extension *tw_dev, int *flashed) | |||
566 | goto out; | 569 | goto out; |
567 | } | 570 | } |
568 | 571 | ||
569 | tw_dev->working_srl = fw_on_ctlr_srl; | 572 | tw_dev->tw_compat_info.working_srl = fw_on_ctlr_srl; |
570 | tw_dev->working_branch = fw_on_ctlr_branch; | 573 | tw_dev->tw_compat_info.working_branch = fw_on_ctlr_branch; |
571 | tw_dev->working_build = fw_on_ctlr_build; | 574 | tw_dev->tw_compat_info.working_build = fw_on_ctlr_build; |
572 | 575 | ||
573 | /* Try base mode compatibility */ | 576 | /* Try base mode compatibility */ |
574 | if (!(init_connect_result & TW_CTLR_FW_COMPATIBLE)) { | 577 | if (!(init_connect_result & TW_CTLR_FW_COMPATIBLE)) { |
@@ -590,10 +593,23 @@ static int twa_check_srl(TW_Device_Extension *tw_dev, int *flashed) | |||
590 | } | 593 | } |
591 | goto out; | 594 | goto out; |
592 | } | 595 | } |
593 | tw_dev->working_srl = TW_BASE_FW_SRL; | 596 | tw_dev->tw_compat_info.working_srl = TW_BASE_FW_SRL; |
594 | tw_dev->working_branch = TW_BASE_FW_BRANCH; | 597 | tw_dev->tw_compat_info.working_branch = TW_BASE_FW_BRANCH; |
595 | tw_dev->working_build = TW_BASE_FW_BUILD; | 598 | tw_dev->tw_compat_info.working_build = TW_BASE_FW_BUILD; |
596 | } | 599 | } |
600 | |||
601 | /* Load rest of compatibility struct */ | ||
602 | strncpy(tw_dev->tw_compat_info.driver_version, TW_DRIVER_VERSION, strlen(TW_DRIVER_VERSION)); | ||
603 | tw_dev->tw_compat_info.driver_srl_high = TW_CURRENT_DRIVER_SRL; | ||
604 | tw_dev->tw_compat_info.driver_branch_high = TW_CURRENT_DRIVER_BRANCH; | ||
605 | tw_dev->tw_compat_info.driver_build_high = TW_CURRENT_DRIVER_BUILD; | ||
606 | tw_dev->tw_compat_info.driver_srl_low = TW_BASE_FW_SRL; | ||
607 | tw_dev->tw_compat_info.driver_branch_low = TW_BASE_FW_BRANCH; | ||
608 | tw_dev->tw_compat_info.driver_build_low = TW_BASE_FW_BUILD; | ||
609 | tw_dev->tw_compat_info.fw_on_ctlr_srl = fw_on_ctlr_srl; | ||
610 | tw_dev->tw_compat_info.fw_on_ctlr_branch = fw_on_ctlr_branch; | ||
611 | tw_dev->tw_compat_info.fw_on_ctlr_build = fw_on_ctlr_build; | ||
612 | |||
597 | retval = 0; | 613 | retval = 0; |
598 | out: | 614 | out: |
599 | return retval; | 615 | return retval; |
@@ -631,7 +647,7 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
631 | goto out2; | 647 | goto out2; |
632 | 648 | ||
633 | /* Check data buffer size */ | 649 | /* Check data buffer size */ |
634 | if (driver_command.buffer_length > TW_MAX_SECTORS * 512) { | 650 | if (driver_command.buffer_length > TW_MAX_SECTORS * 2048) { |
635 | retval = TW_IOCTL_ERROR_OS_EINVAL; | 651 | retval = TW_IOCTL_ERROR_OS_EINVAL; |
636 | goto out2; | 652 | goto out2; |
637 | } | 653 | } |
@@ -680,13 +696,6 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
680 | /* Now wait for command to complete */ | 696 | /* Now wait for command to complete */ |
681 | timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); | 697 | timeout = wait_event_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout); |
682 | 698 | ||
683 | /* See if we reset while waiting for the ioctl to complete */ | ||
684 | if (test_bit(TW_IN_RESET, &tw_dev->flags)) { | ||
685 | clear_bit(TW_IN_RESET, &tw_dev->flags); | ||
686 | retval = TW_IOCTL_ERROR_OS_ERESTARTSYS; | ||
687 | goto out3; | ||
688 | } | ||
689 | |||
690 | /* We timed out, and didn't get an interrupt */ | 699 | /* We timed out, and didn't get an interrupt */ |
691 | if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { | 700 | if (tw_dev->chrdev_request_id != TW_IOCTL_CHRDEV_FREE) { |
692 | /* Now we need to reset the board */ | 701 | /* Now we need to reset the board */ |
@@ -694,11 +703,6 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
694 | tw_dev->host->host_no, TW_DRIVER, 0xc, | 703 | tw_dev->host->host_no, TW_DRIVER, 0xc, |
695 | cmd); | 704 | cmd); |
696 | retval = TW_IOCTL_ERROR_OS_EIO; | 705 | retval = TW_IOCTL_ERROR_OS_EIO; |
697 | spin_lock_irqsave(tw_dev->host->host_lock, flags); | ||
698 | tw_dev->state[request_id] = TW_S_COMPLETED; | ||
699 | twa_free_request_id(tw_dev, request_id); | ||
700 | tw_dev->posted_request_count--; | ||
701 | spin_unlock_irqrestore(tw_dev->host->host_lock, flags); | ||
702 | twa_reset_device_extension(tw_dev, 1); | 706 | twa_reset_device_extension(tw_dev, 1); |
703 | goto out3; | 707 | goto out3; |
704 | } | 708 | } |
@@ -717,16 +721,7 @@ static int twa_chrdev_ioctl(struct inode *inode, struct file *file, unsigned int | |||
717 | tw_ioctl->driver_command.status = 0; | 721 | tw_ioctl->driver_command.status = 0; |
718 | /* Copy compatiblity struct into ioctl data buffer */ | 722 | /* Copy compatiblity struct into ioctl data buffer */ |
719 | tw_compat_info = (TW_Compatibility_Info *)tw_ioctl->data_buffer; | 723 | tw_compat_info = (TW_Compatibility_Info *)tw_ioctl->data_buffer; |
720 | strncpy(tw_compat_info->driver_version, TW_DRIVER_VERSION, strlen(TW_DRIVER_VERSION)); | 724 | memcpy(tw_compat_info, &tw_dev->tw_compat_info, sizeof(TW_Compatibility_Info)); |
721 | tw_compat_info->working_srl = tw_dev->working_srl; | ||
722 | tw_compat_info->working_branch = tw_dev->working_branch; | ||
723 | tw_compat_info->working_build = tw_dev->working_build; | ||
724 | tw_compat_info->driver_srl_high = TW_CURRENT_DRIVER_SRL; | ||
725 | tw_compat_info->driver_branch_high = TW_CURRENT_DRIVER_BRANCH; | ||
726 | tw_compat_info->driver_build_high = TW_CURRENT_DRIVER_BUILD; | ||
727 | tw_compat_info->driver_srl_low = TW_BASE_FW_SRL; | ||
728 | tw_compat_info->driver_branch_low = TW_BASE_FW_BRANCH; | ||
729 | tw_compat_info->driver_build_low = TW_BASE_FW_BUILD; | ||
730 | break; | 725 | break; |
731 | case TW_IOCTL_GET_LAST_EVENT: | 726 | case TW_IOCTL_GET_LAST_EVENT: |
732 | if (tw_dev->event_queue_wrapped) { | 727 | if (tw_dev->event_queue_wrapped) { |
@@ -895,7 +890,8 @@ static int twa_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value) | |||
895 | } | 890 | } |
896 | 891 | ||
897 | if (status_reg_value & TW_STATUS_QUEUE_ERROR) { | 892 | if (status_reg_value & TW_STATUS_QUEUE_ERROR) { |
898 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0xe, "Controller Queue Error: clearing"); | 893 | if ((tw_dev->tw_pci_dev->device != PCI_DEVICE_ID_3WARE_9650SE) || (!test_bit(TW_IN_RESET, &tw_dev->flags))) |
894 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0xe, "Controller Queue Error: clearing"); | ||
899 | writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); | 895 | writel(TW_CONTROL_CLEAR_QUEUE_ERROR, TW_CONTROL_REG_ADDR(tw_dev)); |
900 | } | 896 | } |
901 | 897 | ||
@@ -939,10 +935,12 @@ static int twa_empty_response_queue_large(TW_Device_Extension *tw_dev) | |||
939 | unsigned long before; | 935 | unsigned long before; |
940 | int retval = 1; | 936 | int retval = 1; |
941 | 937 | ||
942 | if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9550SX) { | 938 | if ((tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9550SX) || |
939 | (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE)) { | ||
943 | before = jiffies; | 940 | before = jiffies; |
944 | while ((response_que_value & TW_9550SX_DRAIN_COMPLETED) != TW_9550SX_DRAIN_COMPLETED) { | 941 | while ((response_que_value & TW_9550SX_DRAIN_COMPLETED) != TW_9550SX_DRAIN_COMPLETED) { |
945 | response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR_LARGE(tw_dev)); | 942 | response_que_value = readl(TW_RESPONSE_QUEUE_REG_ADDR_LARGE(tw_dev)); |
943 | msleep(1); | ||
946 | if (time_after(jiffies, before + HZ * 30)) | 944 | if (time_after(jiffies, before + HZ * 30)) |
947 | goto out; | 945 | goto out; |
948 | } | 946 | } |
@@ -1214,6 +1212,10 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1214 | 1212 | ||
1215 | handled = 1; | 1213 | handled = 1; |
1216 | 1214 | ||
1215 | /* If we are resetting, bail */ | ||
1216 | if (test_bit(TW_IN_RESET, &tw_dev->flags)) | ||
1217 | goto twa_interrupt_bail; | ||
1218 | |||
1217 | /* Check controller for errors */ | 1219 | /* Check controller for errors */ |
1218 | if (twa_check_bits(status_reg_value)) { | 1220 | if (twa_check_bits(status_reg_value)) { |
1219 | if (twa_decode_bits(tw_dev, status_reg_value)) { | 1221 | if (twa_decode_bits(tw_dev, status_reg_value)) { |
@@ -1355,8 +1357,8 @@ static void twa_load_sgl(TW_Command_Full *full_command_packet, int request_id, d | |||
1355 | 1357 | ||
1356 | if (TW_OP_OUT(full_command_packet->command.newcommand.opcode__reserved) == TW_OP_EXECUTE_SCSI) { | 1358 | if (TW_OP_OUT(full_command_packet->command.newcommand.opcode__reserved) == TW_OP_EXECUTE_SCSI) { |
1357 | newcommand = &full_command_packet->command.newcommand; | 1359 | newcommand = &full_command_packet->command.newcommand; |
1358 | newcommand->request_id__lunl = | 1360 | newcommand->request_id__lunl = |
1359 | TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id); | 1361 | cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id)); |
1360 | newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1); | 1362 | newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1); |
1361 | newcommand->sg_list[0].length = cpu_to_le32(length); | 1363 | newcommand->sg_list[0].length = cpu_to_le32(length); |
1362 | newcommand->sgl_entries__lunh = | 1364 | newcommand->sgl_entries__lunh = |
@@ -1531,6 +1533,13 @@ static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, | |||
1531 | int retval = 1; | 1533 | int retval = 1; |
1532 | 1534 | ||
1533 | command_que_value = tw_dev->command_packet_phys[request_id]; | 1535 | command_que_value = tw_dev->command_packet_phys[request_id]; |
1536 | |||
1537 | /* For 9650SE write low 4 bytes first */ | ||
1538 | if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) { | ||
1539 | command_que_value += TW_COMMAND_OFFSET; | ||
1540 | writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR_LARGE(tw_dev)); | ||
1541 | } | ||
1542 | |||
1534 | status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); | 1543 | status_reg_value = readl(TW_STATUS_REG_ADDR(tw_dev)); |
1535 | 1544 | ||
1536 | if (twa_check_bits(status_reg_value)) | 1545 | if (twa_check_bits(status_reg_value)) |
@@ -1557,13 +1566,17 @@ static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, | |||
1557 | TW_UNMASK_COMMAND_INTERRUPT(tw_dev); | 1566 | TW_UNMASK_COMMAND_INTERRUPT(tw_dev); |
1558 | goto out; | 1567 | goto out; |
1559 | } else { | 1568 | } else { |
1560 | /* We successfully posted the command packet */ | 1569 | if (tw_dev->tw_pci_dev->device == PCI_DEVICE_ID_3WARE_9650SE) { |
1561 | if (sizeof(dma_addr_t) > 4) { | 1570 | /* Now write upper 4 bytes */ |
1562 | command_que_value += TW_COMMAND_OFFSET; | 1571 | writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR_LARGE(tw_dev) + 0x4); |
1563 | writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); | ||
1564 | writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR(tw_dev) + 0x4); | ||
1565 | } else { | 1572 | } else { |
1566 | writel(TW_COMMAND_OFFSET + command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); | 1573 | if (sizeof(dma_addr_t) > 4) { |
1574 | command_que_value += TW_COMMAND_OFFSET; | ||
1575 | writel((u32)command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); | ||
1576 | writel((u32)((u64)command_que_value >> 32), TW_COMMAND_QUEUE_REG_ADDR(tw_dev) + 0x4); | ||
1577 | } else { | ||
1578 | writel(TW_COMMAND_OFFSET + command_que_value, TW_COMMAND_QUEUE_REG_ADDR(tw_dev)); | ||
1579 | } | ||
1567 | } | 1580 | } |
1568 | tw_dev->state[request_id] = TW_S_POSTED; | 1581 | tw_dev->state[request_id] = TW_S_POSTED; |
1569 | tw_dev->posted_request_count++; | 1582 | tw_dev->posted_request_count++; |
@@ -1620,14 +1633,9 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res | |||
1620 | goto out; | 1633 | goto out; |
1621 | 1634 | ||
1622 | TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); | 1635 | TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev); |
1636 | clear_bit(TW_IN_RESET, &tw_dev->flags); | ||
1637 | tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; | ||
1623 | 1638 | ||
1624 | /* Wake up any ioctl that was pending before the reset */ | ||
1625 | if ((tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE) || (ioctl_reset)) { | ||
1626 | clear_bit(TW_IN_RESET, &tw_dev->flags); | ||
1627 | } else { | ||
1628 | tw_dev->chrdev_request_id = TW_IOCTL_CHRDEV_FREE; | ||
1629 | wake_up(&tw_dev->ioctl_wqueue); | ||
1630 | } | ||
1631 | retval = 0; | 1639 | retval = 0; |
1632 | out: | 1640 | out: |
1633 | return retval; | 1641 | return retval; |
@@ -1736,6 +1744,9 @@ static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt) | |||
1736 | "WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n", | 1744 | "WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n", |
1737 | TW_DRIVER, 0x2c, SCpnt->cmnd[0]); | 1745 | TW_DRIVER, 0x2c, SCpnt->cmnd[0]); |
1738 | 1746 | ||
1747 | /* Make sure we are not issuing an ioctl or resetting from ioctl */ | ||
1748 | mutex_lock(&tw_dev->ioctl_lock); | ||
1749 | |||
1739 | /* Now reset the card and some of the device extension data */ | 1750 | /* Now reset the card and some of the device extension data */ |
1740 | if (twa_reset_device_extension(tw_dev, 0)) { | 1751 | if (twa_reset_device_extension(tw_dev, 0)) { |
1741 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2b, "Controller reset failed during scsi host reset"); | 1752 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2b, "Controller reset failed during scsi host reset"); |
@@ -1744,6 +1755,7 @@ static int twa_scsi_eh_reset(struct scsi_cmnd *SCpnt) | |||
1744 | 1755 | ||
1745 | retval = SUCCESS; | 1756 | retval = SUCCESS; |
1746 | out: | 1757 | out: |
1758 | mutex_unlock(&tw_dev->ioctl_lock); | ||
1747 | return retval; | 1759 | return retval; |
1748 | } /* End twa_scsi_eh_reset() */ | 1760 | } /* End twa_scsi_eh_reset() */ |
1749 | 1761 | ||
@@ -1753,8 +1765,14 @@ static int twa_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd | |||
1753 | int request_id, retval; | 1765 | int request_id, retval; |
1754 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; | 1766 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; |
1755 | 1767 | ||
1768 | /* If we are resetting due to timed out ioctl, report as busy */ | ||
1769 | if (test_bit(TW_IN_RESET, &tw_dev->flags)) { | ||
1770 | retval = SCSI_MLQUEUE_HOST_BUSY; | ||
1771 | goto out; | ||
1772 | } | ||
1773 | |||
1756 | /* Check if this FW supports luns */ | 1774 | /* Check if this FW supports luns */ |
1757 | if ((SCpnt->device->lun != 0) && (tw_dev->working_srl < TW_FW_SRL_LUNS_SUPPORTED)) { | 1775 | if ((SCpnt->device->lun != 0) && (tw_dev->tw_compat_info.working_srl < TW_FW_SRL_LUNS_SUPPORTED)) { |
1758 | SCpnt->result = (DID_BAD_TARGET << 16); | 1776 | SCpnt->result = (DID_BAD_TARGET << 16); |
1759 | done(SCpnt); | 1777 | done(SCpnt); |
1760 | retval = 0; | 1778 | retval = 0; |
@@ -1960,6 +1978,9 @@ static void __twa_shutdown(TW_Device_Extension *tw_dev) | |||
1960 | /* Disable interrupts */ | 1978 | /* Disable interrupts */ |
1961 | TW_DISABLE_INTERRUPTS(tw_dev); | 1979 | TW_DISABLE_INTERRUPTS(tw_dev); |
1962 | 1980 | ||
1981 | /* Free up the IRQ */ | ||
1982 | free_irq(tw_dev->tw_pci_dev->irq, tw_dev); | ||
1983 | |||
1963 | printk(KERN_WARNING "3w-9xxx: Shutting down host %d.\n", tw_dev->host->host_no); | 1984 | printk(KERN_WARNING "3w-9xxx: Shutting down host %d.\n", tw_dev->host->host_no); |
1964 | 1985 | ||
1965 | /* Tell the card we are shutting down */ | 1986 | /* Tell the card we are shutting down */ |
@@ -2091,21 +2112,25 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id | |||
2091 | 2112 | ||
2092 | /* Initialize the card */ | 2113 | /* Initialize the card */ |
2093 | if (twa_reset_sequence(tw_dev, 0)) | 2114 | if (twa_reset_sequence(tw_dev, 0)) |
2094 | goto out_release_mem_region; | 2115 | goto out_iounmap; |
2095 | 2116 | ||
2096 | /* Set host specific parameters */ | 2117 | /* Set host specific parameters */ |
2097 | host->max_id = TW_MAX_UNITS; | 2118 | if (pdev->device == PCI_DEVICE_ID_3WARE_9650SE) |
2119 | host->max_id = TW_MAX_UNITS_9650SE; | ||
2120 | else | ||
2121 | host->max_id = TW_MAX_UNITS; | ||
2122 | |||
2098 | host->max_cmd_len = TW_MAX_CDB_LEN; | 2123 | host->max_cmd_len = TW_MAX_CDB_LEN; |
2099 | 2124 | ||
2100 | /* Channels aren't supported by adapter */ | 2125 | /* Channels aren't supported by adapter */ |
2101 | host->max_lun = TW_MAX_LUNS(tw_dev->working_srl); | 2126 | host->max_lun = TW_MAX_LUNS(tw_dev->tw_compat_info.working_srl); |
2102 | host->max_channel = 0; | 2127 | host->max_channel = 0; |
2103 | 2128 | ||
2104 | /* Register the card with the kernel SCSI layer */ | 2129 | /* Register the card with the kernel SCSI layer */ |
2105 | retval = scsi_add_host(host, &pdev->dev); | 2130 | retval = scsi_add_host(host, &pdev->dev); |
2106 | if (retval) { | 2131 | if (retval) { |
2107 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x27, "scsi add host failed"); | 2132 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x27, "scsi add host failed"); |
2108 | goto out_release_mem_region; | 2133 | goto out_iounmap; |
2109 | } | 2134 | } |
2110 | 2135 | ||
2111 | pci_set_drvdata(pdev, host); | 2136 | pci_set_drvdata(pdev, host); |
@@ -2145,6 +2170,8 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id | |||
2145 | 2170 | ||
2146 | out_remove_host: | 2171 | out_remove_host: |
2147 | scsi_remove_host(host); | 2172 | scsi_remove_host(host); |
2173 | out_iounmap: | ||
2174 | iounmap(tw_dev->base_addr); | ||
2148 | out_release_mem_region: | 2175 | out_release_mem_region: |
2149 | pci_release_regions(pdev); | 2176 | pci_release_regions(pdev); |
2150 | out_free_device_extension: | 2177 | out_free_device_extension: |
@@ -2170,12 +2197,12 @@ static void twa_remove(struct pci_dev *pdev) | |||
2170 | twa_major = -1; | 2197 | twa_major = -1; |
2171 | } | 2198 | } |
2172 | 2199 | ||
2173 | /* Free up the IRQ */ | ||
2174 | free_irq(tw_dev->tw_pci_dev->irq, tw_dev); | ||
2175 | |||
2176 | /* Shutdown the card */ | 2200 | /* Shutdown the card */ |
2177 | __twa_shutdown(tw_dev); | 2201 | __twa_shutdown(tw_dev); |
2178 | 2202 | ||
2203 | /* Free IO remapping */ | ||
2204 | iounmap(tw_dev->base_addr); | ||
2205 | |||
2179 | /* Free up the mem region */ | 2206 | /* Free up the mem region */ |
2180 | pci_release_regions(pdev); | 2207 | pci_release_regions(pdev); |
2181 | 2208 | ||
@@ -2193,6 +2220,8 @@ static struct pci_device_id twa_pci_tbl[] __devinitdata = { | |||
2193 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2220 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
2194 | { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX, | 2221 | { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX, |
2195 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 2222 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
2223 | { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9650SE, | ||
2224 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
2196 | { } | 2225 | { } |
2197 | }; | 2226 | }; |
2198 | MODULE_DEVICE_TABLE(pci, twa_pci_tbl); | 2227 | MODULE_DEVICE_TABLE(pci, twa_pci_tbl); |
diff --git a/drivers/scsi/3w-9xxx.h b/drivers/scsi/3w-9xxx.h index e5685be96f45..7901517d4513 100644 --- a/drivers/scsi/3w-9xxx.h +++ b/drivers/scsi/3w-9xxx.h | |||
@@ -289,7 +289,6 @@ static twa_message_type twa_error_table[] = { | |||
289 | #define TW_STATUS_VALID_INTERRUPT 0x00DF0000 | 289 | #define TW_STATUS_VALID_INTERRUPT 0x00DF0000 |
290 | 290 | ||
291 | /* PCI related defines */ | 291 | /* PCI related defines */ |
292 | #define TW_NUMDEVICES 1 | ||
293 | #define TW_PCI_CLEAR_PARITY_ERRORS 0xc100 | 292 | #define TW_PCI_CLEAR_PARITY_ERRORS 0xc100 |
294 | #define TW_PCI_CLEAR_PCI_ABORT 0x2000 | 293 | #define TW_PCI_CLEAR_PCI_ABORT 0x2000 |
295 | 294 | ||
@@ -335,6 +334,7 @@ static twa_message_type twa_error_table[] = { | |||
335 | #define TW_ALIGNMENT_9000 4 /* 4 bytes */ | 334 | #define TW_ALIGNMENT_9000 4 /* 4 bytes */ |
336 | #define TW_ALIGNMENT_9000_SGL 0x3 | 335 | #define TW_ALIGNMENT_9000_SGL 0x3 |
337 | #define TW_MAX_UNITS 16 | 336 | #define TW_MAX_UNITS 16 |
337 | #define TW_MAX_UNITS_9650SE 32 | ||
338 | #define TW_INIT_MESSAGE_CREDITS 0x100 | 338 | #define TW_INIT_MESSAGE_CREDITS 0x100 |
339 | #define TW_INIT_COMMAND_PACKET_SIZE 0x3 | 339 | #define TW_INIT_COMMAND_PACKET_SIZE 0x3 |
340 | #define TW_INIT_COMMAND_PACKET_SIZE_EXTENDED 0x6 | 340 | #define TW_INIT_COMMAND_PACKET_SIZE_EXTENDED 0x6 |
@@ -354,7 +354,6 @@ static twa_message_type twa_error_table[] = { | |||
354 | #define TW_MAX_RESPONSE_DRAIN 256 | 354 | #define TW_MAX_RESPONSE_DRAIN 256 |
355 | #define TW_MAX_AEN_DRAIN 40 | 355 | #define TW_MAX_AEN_DRAIN 40 |
356 | #define TW_IN_RESET 2 | 356 | #define TW_IN_RESET 2 |
357 | #define TW_IN_CHRDEV_IOCTL 3 | ||
358 | #define TW_IN_ATTENTION_LOOP 4 | 357 | #define TW_IN_ATTENTION_LOOP 4 |
359 | #define TW_MAX_SECTORS 256 | 358 | #define TW_MAX_SECTORS 256 |
360 | #define TW_AEN_WAIT_TIME 1000 | 359 | #define TW_AEN_WAIT_TIME 1000 |
@@ -417,6 +416,9 @@ static twa_message_type twa_error_table[] = { | |||
417 | #ifndef PCI_DEVICE_ID_3WARE_9550SX | 416 | #ifndef PCI_DEVICE_ID_3WARE_9550SX |
418 | #define PCI_DEVICE_ID_3WARE_9550SX 0x1003 | 417 | #define PCI_DEVICE_ID_3WARE_9550SX 0x1003 |
419 | #endif | 418 | #endif |
419 | #ifndef PCI_DEVICE_ID_3WARE_9650SE | ||
420 | #define PCI_DEVICE_ID_3WARE_9650SE 0x1004 | ||
421 | #endif | ||
420 | 422 | ||
421 | /* Bitmask macros to eliminate bitfields */ | 423 | /* Bitmask macros to eliminate bitfields */ |
422 | 424 | ||
@@ -442,6 +444,7 @@ static twa_message_type twa_error_table[] = { | |||
442 | #define TW_CONTROL_REG_ADDR(x) (x->base_addr) | 444 | #define TW_CONTROL_REG_ADDR(x) (x->base_addr) |
443 | #define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4) | 445 | #define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4) |
444 | #define TW_COMMAND_QUEUE_REG_ADDR(x) (sizeof(dma_addr_t) > 4 ? ((unsigned char __iomem *)x->base_addr + 0x20) : ((unsigned char __iomem *)x->base_addr + 0x8)) | 446 | #define TW_COMMAND_QUEUE_REG_ADDR(x) (sizeof(dma_addr_t) > 4 ? ((unsigned char __iomem *)x->base_addr + 0x20) : ((unsigned char __iomem *)x->base_addr + 0x8)) |
447 | #define TW_COMMAND_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x20) | ||
445 | #define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC) | 448 | #define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC) |
446 | #define TW_RESPONSE_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x30) | 449 | #define TW_RESPONSE_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x30) |
447 | #define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x))) | 450 | #define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x))) |
@@ -626,6 +629,9 @@ typedef struct TAG_TW_Compatibility_Info | |||
626 | unsigned short driver_srl_low; | 629 | unsigned short driver_srl_low; |
627 | unsigned short driver_branch_low; | 630 | unsigned short driver_branch_low; |
628 | unsigned short driver_build_low; | 631 | unsigned short driver_build_low; |
632 | unsigned short fw_on_ctlr_srl; | ||
633 | unsigned short fw_on_ctlr_branch; | ||
634 | unsigned short fw_on_ctlr_build; | ||
629 | } TW_Compatibility_Info; | 635 | } TW_Compatibility_Info; |
630 | 636 | ||
631 | #pragma pack() | 637 | #pragma pack() |
@@ -668,9 +674,7 @@ typedef struct TAG_TW_Device_Extension { | |||
668 | wait_queue_head_t ioctl_wqueue; | 674 | wait_queue_head_t ioctl_wqueue; |
669 | struct mutex ioctl_lock; | 675 | struct mutex ioctl_lock; |
670 | char aen_clobber; | 676 | char aen_clobber; |
671 | unsigned short working_srl; | 677 | TW_Compatibility_Info tw_compat_info; |
672 | unsigned short working_branch; | ||
673 | unsigned short working_build; | ||
674 | } TW_Device_Extension; | 678 | } TW_Device_Extension; |
675 | 679 | ||
676 | #endif /* _3W_9XXX_H */ | 680 | #endif /* _3W_9XXX_H */ |
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index 689dc4cc789c..3075204915c8 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -3600,5 +3600,16 @@ static void __exit BusLogic_exit(void) | |||
3600 | 3600 | ||
3601 | __setup("BusLogic=", BusLogic_Setup); | 3601 | __setup("BusLogic=", BusLogic_Setup); |
3602 | 3602 | ||
3603 | static struct pci_device_id BusLogic_pci_tbl[] __devinitdata = { | ||
3604 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, | ||
3605 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
3606 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, | ||
3607 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
3608 | { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, | ||
3609 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
3610 | { } | ||
3611 | }; | ||
3612 | MODULE_DEVICE_TABLE(pci, BusLogic_pci_tbl); | ||
3613 | |||
3603 | module_init(BusLogic_init); | 3614 | module_init(BusLogic_init); |
3604 | module_exit(BusLogic_exit); | 3615 | module_exit(BusLogic_exit); |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index a0d1cee0be77..306f46b85a55 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -238,7 +238,7 @@ | |||
238 | #include <linux/module.h> | 238 | #include <linux/module.h> |
239 | #include <linux/sched.h> | 239 | #include <linux/sched.h> |
240 | #include <asm/irq.h> | 240 | #include <asm/irq.h> |
241 | #include <asm/io.h> | 241 | #include <linux/io.h> |
242 | #include <linux/blkdev.h> | 242 | #include <linux/blkdev.h> |
243 | #include <asm/system.h> | 243 | #include <asm/system.h> |
244 | #include <linux/errno.h> | 244 | #include <linux/errno.h> |
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index df3346b5caf8..170a4344cbb2 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h | |||
@@ -53,14 +53,6 @@ struct ahd_platform_data; | |||
53 | struct scb_platform_data; | 53 | struct scb_platform_data; |
54 | 54 | ||
55 | /****************************** Useful Macros *********************************/ | 55 | /****************************** Useful Macros *********************************/ |
56 | #ifndef MAX | ||
57 | #define MAX(a,b) (((a) > (b)) ? (a) : (b)) | ||
58 | #endif | ||
59 | |||
60 | #ifndef MIN | ||
61 | #define MIN(a,b) (((a) < (b)) ? (a) : (b)) | ||
62 | #endif | ||
63 | |||
64 | #ifndef TRUE | 56 | #ifndef TRUE |
65 | #define TRUE 1 | 57 | #define TRUE 1 |
66 | #endif | 58 | #endif |
@@ -972,8 +964,6 @@ int ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf, | |||
972 | 964 | ||
973 | int ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf, | 965 | int ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf, |
974 | u_int start_addr, u_int count); | 966 | u_int start_addr, u_int count); |
975 | int ahd_wait_seeprom(struct ahd_softc *ahd); | ||
976 | int ahd_verify_vpd_cksum(struct vpd_config *vpd); | ||
977 | int ahd_verify_cksum(struct seeprom_config *sc); | 967 | int ahd_verify_cksum(struct seeprom_config *sc); |
978 | int ahd_acquire_seeprom(struct ahd_softc *ahd); | 968 | int ahd_acquire_seeprom(struct ahd_softc *ahd); |
979 | void ahd_release_seeprom(struct ahd_softc *ahd); | 969 | void ahd_release_seeprom(struct ahd_softc *ahd); |
@@ -1320,8 +1310,6 @@ struct ahd_pci_identity { | |||
1320 | char *name; | 1310 | char *name; |
1321 | ahd_device_setup_t *setup; | 1311 | ahd_device_setup_t *setup; |
1322 | }; | 1312 | }; |
1323 | extern struct ahd_pci_identity ahd_pci_ident_table []; | ||
1324 | extern const u_int ahd_num_pci_devs; | ||
1325 | 1313 | ||
1326 | /***************************** VL/EISA Declarations ***************************/ | 1314 | /***************************** VL/EISA Declarations ***************************/ |
1327 | struct aic7770_identity { | 1315 | struct aic7770_identity { |
@@ -1339,15 +1327,6 @@ extern const int ahd_num_aic7770_devs; | |||
1339 | /*************************** Function Declarations ****************************/ | 1327 | /*************************** Function Declarations ****************************/ |
1340 | /******************************************************************************/ | 1328 | /******************************************************************************/ |
1341 | void ahd_reset_cmds_pending(struct ahd_softc *ahd); | 1329 | void ahd_reset_cmds_pending(struct ahd_softc *ahd); |
1342 | u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl); | ||
1343 | void ahd_busy_tcl(struct ahd_softc *ahd, | ||
1344 | u_int tcl, u_int busyid); | ||
1345 | static __inline void ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl); | ||
1346 | static __inline void | ||
1347 | ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl) | ||
1348 | { | ||
1349 | ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL); | ||
1350 | } | ||
1351 | 1330 | ||
1352 | /***************************** PCI Front End *********************************/ | 1331 | /***************************** PCI Front End *********************************/ |
1353 | struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t); | 1332 | struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t); |
@@ -1356,7 +1335,6 @@ int ahd_pci_config(struct ahd_softc *, | |||
1356 | int ahd_pci_test_register_access(struct ahd_softc *); | 1335 | int ahd_pci_test_register_access(struct ahd_softc *); |
1357 | 1336 | ||
1358 | /************************** SCB and SCB queue management **********************/ | 1337 | /************************** SCB and SCB queue management **********************/ |
1359 | int ahd_probe_scbs(struct ahd_softc *); | ||
1360 | void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, | 1338 | void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, |
1361 | struct scb *scb); | 1339 | struct scb *scb); |
1362 | int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, | 1340 | int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, |
@@ -1374,33 +1352,20 @@ int ahd_parse_vpddata(struct ahd_softc *ahd, | |||
1374 | int ahd_parse_cfgdata(struct ahd_softc *ahd, | 1352 | int ahd_parse_cfgdata(struct ahd_softc *ahd, |
1375 | struct seeprom_config *sc); | 1353 | struct seeprom_config *sc); |
1376 | void ahd_intr_enable(struct ahd_softc *ahd, int enable); | 1354 | void ahd_intr_enable(struct ahd_softc *ahd, int enable); |
1377 | void ahd_update_coalescing_values(struct ahd_softc *ahd, | ||
1378 | u_int timer, | ||
1379 | u_int maxcmds, | ||
1380 | u_int mincmds); | ||
1381 | void ahd_enable_coalescing(struct ahd_softc *ahd, | ||
1382 | int enable); | ||
1383 | void ahd_pause_and_flushwork(struct ahd_softc *ahd); | 1355 | void ahd_pause_and_flushwork(struct ahd_softc *ahd); |
1384 | int ahd_suspend(struct ahd_softc *ahd); | 1356 | int ahd_suspend(struct ahd_softc *ahd); |
1385 | int ahd_resume(struct ahd_softc *ahd); | ||
1386 | void ahd_set_unit(struct ahd_softc *, int); | 1357 | void ahd_set_unit(struct ahd_softc *, int); |
1387 | void ahd_set_name(struct ahd_softc *, char *); | 1358 | void ahd_set_name(struct ahd_softc *, char *); |
1388 | struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx); | 1359 | struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx); |
1389 | void ahd_free_scb(struct ahd_softc *ahd, struct scb *scb); | 1360 | void ahd_free_scb(struct ahd_softc *ahd, struct scb *scb); |
1390 | void ahd_alloc_scbs(struct ahd_softc *ahd); | ||
1391 | void ahd_free(struct ahd_softc *ahd); | 1361 | void ahd_free(struct ahd_softc *ahd); |
1392 | int ahd_reset(struct ahd_softc *ahd, int reinit); | 1362 | int ahd_reset(struct ahd_softc *ahd, int reinit); |
1393 | void ahd_shutdown(void *arg); | ||
1394 | int ahd_write_flexport(struct ahd_softc *ahd, | 1363 | int ahd_write_flexport(struct ahd_softc *ahd, |
1395 | u_int addr, u_int value); | 1364 | u_int addr, u_int value); |
1396 | int ahd_read_flexport(struct ahd_softc *ahd, u_int addr, | 1365 | int ahd_read_flexport(struct ahd_softc *ahd, u_int addr, |
1397 | uint8_t *value); | 1366 | uint8_t *value); |
1398 | int ahd_wait_flexport(struct ahd_softc *ahd); | ||
1399 | 1367 | ||
1400 | /*************************** Interrupt Services *******************************/ | 1368 | /*************************** Interrupt Services *******************************/ |
1401 | void ahd_pci_intr(struct ahd_softc *ahd); | ||
1402 | void ahd_clear_intstat(struct ahd_softc *ahd); | ||
1403 | void ahd_flush_qoutfifo(struct ahd_softc *ahd); | ||
1404 | void ahd_run_qoutfifo(struct ahd_softc *ahd); | 1369 | void ahd_run_qoutfifo(struct ahd_softc *ahd); |
1405 | #ifdef AHD_TARGET_MODE | 1370 | #ifdef AHD_TARGET_MODE |
1406 | void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused); | 1371 | void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused); |
@@ -1409,7 +1374,6 @@ void ahd_handle_hwerrint(struct ahd_softc *ahd); | |||
1409 | void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat); | 1374 | void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat); |
1410 | void ahd_handle_scsiint(struct ahd_softc *ahd, | 1375 | void ahd_handle_scsiint(struct ahd_softc *ahd, |
1411 | u_int intstat); | 1376 | u_int intstat); |
1412 | void ahd_clear_critical_section(struct ahd_softc *ahd); | ||
1413 | 1377 | ||
1414 | /***************************** Error Recovery *********************************/ | 1378 | /***************************** Error Recovery *********************************/ |
1415 | typedef enum { | 1379 | typedef enum { |
@@ -1426,23 +1390,9 @@ int ahd_search_disc_list(struct ahd_softc *ahd, int target, | |||
1426 | char channel, int lun, u_int tag, | 1390 | char channel, int lun, u_int tag, |
1427 | int stop_on_first, int remove, | 1391 | int stop_on_first, int remove, |
1428 | int save_state); | 1392 | int save_state); |
1429 | void ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb); | ||
1430 | int ahd_reset_channel(struct ahd_softc *ahd, char channel, | 1393 | int ahd_reset_channel(struct ahd_softc *ahd, char channel, |
1431 | int initiate_reset); | 1394 | int initiate_reset); |
1432 | int ahd_abort_scbs(struct ahd_softc *ahd, int target, | ||
1433 | char channel, int lun, u_int tag, | ||
1434 | role_t role, uint32_t status); | ||
1435 | void ahd_restart(struct ahd_softc *ahd); | ||
1436 | void ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo); | ||
1437 | void ahd_handle_scb_status(struct ahd_softc *ahd, | ||
1438 | struct scb *scb); | ||
1439 | void ahd_handle_scsi_status(struct ahd_softc *ahd, | ||
1440 | struct scb *scb); | ||
1441 | void ahd_calc_residual(struct ahd_softc *ahd, | ||
1442 | struct scb *scb); | ||
1443 | /*************************** Utility Functions ********************************/ | 1395 | /*************************** Utility Functions ********************************/ |
1444 | struct ahd_phase_table_entry* | ||
1445 | ahd_lookup_phase_entry(int phase); | ||
1446 | void ahd_compile_devinfo(struct ahd_devinfo *devinfo, | 1396 | void ahd_compile_devinfo(struct ahd_devinfo *devinfo, |
1447 | u_int our_id, u_int target, | 1397 | u_int our_id, u_int target, |
1448 | u_int lun, char channel, | 1398 | u_int lun, char channel, |
@@ -1450,14 +1400,6 @@ void ahd_compile_devinfo(struct ahd_devinfo *devinfo, | |||
1450 | /************************** Transfer Negotiation ******************************/ | 1400 | /************************** Transfer Negotiation ******************************/ |
1451 | void ahd_find_syncrate(struct ahd_softc *ahd, u_int *period, | 1401 | void ahd_find_syncrate(struct ahd_softc *ahd, u_int *period, |
1452 | u_int *ppr_options, u_int maxsync); | 1402 | u_int *ppr_options, u_int maxsync); |
1453 | void ahd_validate_offset(struct ahd_softc *ahd, | ||
1454 | struct ahd_initiator_tinfo *tinfo, | ||
1455 | u_int period, u_int *offset, | ||
1456 | int wide, role_t role); | ||
1457 | void ahd_validate_width(struct ahd_softc *ahd, | ||
1458 | struct ahd_initiator_tinfo *tinfo, | ||
1459 | u_int *bus_width, | ||
1460 | role_t role); | ||
1461 | /* | 1403 | /* |
1462 | * Negotiation types. These are used to qualify if we should renegotiate | 1404 | * Negotiation types. These are used to qualify if we should renegotiate |
1463 | * even if our goal and current transport parameters are identical. | 1405 | * even if our goal and current transport parameters are identical. |
@@ -1486,11 +1428,6 @@ typedef enum { | |||
1486 | AHD_QUEUE_TAGGED | 1428 | AHD_QUEUE_TAGGED |
1487 | } ahd_queue_alg; | 1429 | } ahd_queue_alg; |
1488 | 1430 | ||
1489 | void ahd_set_tags(struct ahd_softc *ahd, | ||
1490 | struct scsi_cmnd *cmd, | ||
1491 | struct ahd_devinfo *devinfo, | ||
1492 | ahd_queue_alg alg); | ||
1493 | |||
1494 | /**************************** Target Mode *************************************/ | 1431 | /**************************** Target Mode *************************************/ |
1495 | #ifdef AHD_TARGET_MODE | 1432 | #ifdef AHD_TARGET_MODE |
1496 | void ahd_send_lstate_events(struct ahd_softc *, | 1433 | void ahd_send_lstate_events(struct ahd_softc *, |
@@ -1528,10 +1465,8 @@ extern uint32_t ahd_debug; | |||
1528 | #define AHD_SHOW_INT_COALESCING 0x10000 | 1465 | #define AHD_SHOW_INT_COALESCING 0x10000 |
1529 | #define AHD_DEBUG_SEQUENCER 0x20000 | 1466 | #define AHD_DEBUG_SEQUENCER 0x20000 |
1530 | #endif | 1467 | #endif |
1531 | void ahd_print_scb(struct scb *scb); | ||
1532 | void ahd_print_devinfo(struct ahd_softc *ahd, | 1468 | void ahd_print_devinfo(struct ahd_softc *ahd, |
1533 | struct ahd_devinfo *devinfo); | 1469 | struct ahd_devinfo *devinfo); |
1534 | void ahd_dump_sglist(struct scb *scb); | ||
1535 | void ahd_dump_card_state(struct ahd_softc *ahd); | 1470 | void ahd_dump_card_state(struct ahd_softc *ahd); |
1536 | int ahd_print_register(ahd_reg_parse_entry_t *table, | 1471 | int ahd_print_register(ahd_reg_parse_entry_t *table, |
1537 | u_int num_entries, | 1472 | u_int num_entries, |
@@ -1540,5 +1475,4 @@ int ahd_print_register(ahd_reg_parse_entry_t *table, | |||
1540 | u_int value, | 1475 | u_int value, |
1541 | u_int *cur_column, | 1476 | u_int *cur_column, |
1542 | u_int wrap_point); | 1477 | u_int wrap_point); |
1543 | void ahd_dump_scbs(struct ahd_softc *ahd); | ||
1544 | #endif /* _AIC79XX_H_ */ | 1478 | #endif /* _AIC79XX_H_ */ |
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 653818d2f802..07a86a30f676 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | 53 | ||
54 | /***************************** Lookup Tables **********************************/ | 54 | /***************************** Lookup Tables **********************************/ |
55 | char *ahd_chip_names[] = | 55 | static char *ahd_chip_names[] = |
56 | { | 56 | { |
57 | "NONE", | 57 | "NONE", |
58 | "aic7901", | 58 | "aic7901", |
@@ -237,10 +237,33 @@ static int ahd_handle_target_cmd(struct ahd_softc *ahd, | |||
237 | struct target_cmd *cmd); | 237 | struct target_cmd *cmd); |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | static int ahd_abort_scbs(struct ahd_softc *ahd, int target, | ||
241 | char channel, int lun, u_int tag, | ||
242 | role_t role, uint32_t status); | ||
243 | static void ahd_alloc_scbs(struct ahd_softc *ahd); | ||
244 | static void ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, | ||
245 | u_int scbid); | ||
246 | static void ahd_calc_residual(struct ahd_softc *ahd, | ||
247 | struct scb *scb); | ||
248 | static void ahd_clear_critical_section(struct ahd_softc *ahd); | ||
249 | static void ahd_clear_intstat(struct ahd_softc *ahd); | ||
250 | static void ahd_enable_coalescing(struct ahd_softc *ahd, | ||
251 | int enable); | ||
252 | static u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl); | ||
253 | static void ahd_freeze_devq(struct ahd_softc *ahd, | ||
254 | struct scb *scb); | ||
255 | static void ahd_handle_scb_status(struct ahd_softc *ahd, | ||
256 | struct scb *scb); | ||
257 | static struct ahd_phase_table_entry* ahd_lookup_phase_entry(int phase); | ||
258 | static void ahd_shutdown(void *arg); | ||
259 | static void ahd_update_coalescing_values(struct ahd_softc *ahd, | ||
260 | u_int timer, | ||
261 | u_int maxcmds, | ||
262 | u_int mincmds); | ||
263 | static int ahd_verify_vpd_cksum(struct vpd_config *vpd); | ||
264 | static int ahd_wait_seeprom(struct ahd_softc *ahd); | ||
265 | |||
240 | /******************************** Private Inlines *****************************/ | 266 | /******************************** Private Inlines *****************************/ |
241 | static __inline void ahd_assert_atn(struct ahd_softc *ahd); | ||
242 | static __inline int ahd_currently_packetized(struct ahd_softc *ahd); | ||
243 | static __inline int ahd_set_active_fifo(struct ahd_softc *ahd); | ||
244 | 267 | ||
245 | static __inline void | 268 | static __inline void |
246 | ahd_assert_atn(struct ahd_softc *ahd) | 269 | ahd_assert_atn(struct ahd_softc *ahd) |
@@ -294,11 +317,44 @@ ahd_set_active_fifo(struct ahd_softc *ahd) | |||
294 | } | 317 | } |
295 | } | 318 | } |
296 | 319 | ||
320 | static __inline void | ||
321 | ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl) | ||
322 | { | ||
323 | ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL); | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | * Determine whether the sequencer reported a residual | ||
328 | * for this SCB/transaction. | ||
329 | */ | ||
330 | static __inline void | ||
331 | ahd_update_residual(struct ahd_softc *ahd, struct scb *scb) | ||
332 | { | ||
333 | uint32_t sgptr; | ||
334 | |||
335 | sgptr = ahd_le32toh(scb->hscb->sgptr); | ||
336 | if ((sgptr & SG_STATUS_VALID) != 0) | ||
337 | ahd_calc_residual(ahd, scb); | ||
338 | } | ||
339 | |||
340 | static __inline void | ||
341 | ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb) | ||
342 | { | ||
343 | uint32_t sgptr; | ||
344 | |||
345 | sgptr = ahd_le32toh(scb->hscb->sgptr); | ||
346 | if ((sgptr & SG_STATUS_VALID) != 0) | ||
347 | ahd_handle_scb_status(ahd, scb); | ||
348 | else | ||
349 | ahd_done(ahd, scb); | ||
350 | } | ||
351 | |||
352 | |||
297 | /************************* Sequencer Execution Control ************************/ | 353 | /************************* Sequencer Execution Control ************************/ |
298 | /* | 354 | /* |
299 | * Restart the sequencer program from address zero | 355 | * Restart the sequencer program from address zero |
300 | */ | 356 | */ |
301 | void | 357 | static void |
302 | ahd_restart(struct ahd_softc *ahd) | 358 | ahd_restart(struct ahd_softc *ahd) |
303 | { | 359 | { |
304 | 360 | ||
@@ -342,7 +398,7 @@ ahd_restart(struct ahd_softc *ahd) | |||
342 | ahd_unpause(ahd); | 398 | ahd_unpause(ahd); |
343 | } | 399 | } |
344 | 400 | ||
345 | void | 401 | static void |
346 | ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo) | 402 | ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo) |
347 | { | 403 | { |
348 | ahd_mode_state saved_modes; | 404 | ahd_mode_state saved_modes; |
@@ -366,7 +422,7 @@ ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo) | |||
366 | * Flush and completed commands that are sitting in the command | 422 | * Flush and completed commands that are sitting in the command |
367 | * complete queues down on the chip but have yet to be dma'ed back up. | 423 | * complete queues down on the chip but have yet to be dma'ed back up. |
368 | */ | 424 | */ |
369 | void | 425 | static void |
370 | ahd_flush_qoutfifo(struct ahd_softc *ahd) | 426 | ahd_flush_qoutfifo(struct ahd_softc *ahd) |
371 | { | 427 | { |
372 | struct scb *scb; | 428 | struct scb *scb; |
@@ -905,6 +961,51 @@ ahd_handle_hwerrint(struct ahd_softc *ahd) | |||
905 | ahd_free(ahd); | 961 | ahd_free(ahd); |
906 | } | 962 | } |
907 | 963 | ||
964 | #ifdef AHD_DEBUG | ||
965 | static void | ||
966 | ahd_dump_sglist(struct scb *scb) | ||
967 | { | ||
968 | int i; | ||
969 | |||
970 | if (scb->sg_count > 0) { | ||
971 | if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) { | ||
972 | struct ahd_dma64_seg *sg_list; | ||
973 | |||
974 | sg_list = (struct ahd_dma64_seg*)scb->sg_list; | ||
975 | for (i = 0; i < scb->sg_count; i++) { | ||
976 | uint64_t addr; | ||
977 | uint32_t len; | ||
978 | |||
979 | addr = ahd_le64toh(sg_list[i].addr); | ||
980 | len = ahd_le32toh(sg_list[i].len); | ||
981 | printf("sg[%d] - Addr 0x%x%x : Length %d%s\n", | ||
982 | i, | ||
983 | (uint32_t)((addr >> 32) & 0xFFFFFFFF), | ||
984 | (uint32_t)(addr & 0xFFFFFFFF), | ||
985 | sg_list[i].len & AHD_SG_LEN_MASK, | ||
986 | (sg_list[i].len & AHD_DMA_LAST_SEG) | ||
987 | ? " Last" : ""); | ||
988 | } | ||
989 | } else { | ||
990 | struct ahd_dma_seg *sg_list; | ||
991 | |||
992 | sg_list = (struct ahd_dma_seg*)scb->sg_list; | ||
993 | for (i = 0; i < scb->sg_count; i++) { | ||
994 | uint32_t len; | ||
995 | |||
996 | len = ahd_le32toh(sg_list[i].len); | ||
997 | printf("sg[%d] - Addr 0x%x%x : Length %d%s\n", | ||
998 | i, | ||
999 | (len & AHD_SG_HIGH_ADDR_MASK) >> 24, | ||
1000 | ahd_le32toh(sg_list[i].addr), | ||
1001 | len & AHD_SG_LEN_MASK, | ||
1002 | len & AHD_DMA_LAST_SEG ? " Last" : ""); | ||
1003 | } | ||
1004 | } | ||
1005 | } | ||
1006 | } | ||
1007 | #endif /* AHD_DEBUG */ | ||
1008 | |||
908 | void | 1009 | void |
909 | ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) | 1010 | ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) |
910 | { | 1011 | { |
@@ -1053,10 +1154,12 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) | |||
1053 | * If a target takes us into the command phase | 1154 | * If a target takes us into the command phase |
1054 | * assume that it has been externally reset and | 1155 | * assume that it has been externally reset and |
1055 | * has thus lost our previous packetized negotiation | 1156 | * has thus lost our previous packetized negotiation |
1056 | * agreement. | 1157 | * agreement. Since we have not sent an identify |
1057 | * Revert to async/narrow transfers until we | 1158 | * message and may not have fully qualified the |
1058 | * can renegotiate with the device and notify | 1159 | * connection, we change our command to TUR, assert |
1059 | * the OSM about the reset. | 1160 | * ATN and ABORT the task when we go to message in |
1161 | * phase. The OSM will see the REQUEUE_REQUEST | ||
1162 | * status and retry the command. | ||
1060 | */ | 1163 | */ |
1061 | scbid = ahd_get_scbptr(ahd); | 1164 | scbid = ahd_get_scbptr(ahd); |
1062 | scb = ahd_lookup_scb(ahd, scbid); | 1165 | scb = ahd_lookup_scb(ahd, scbid); |
@@ -1083,7 +1186,28 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) | |||
1083 | ahd_set_syncrate(ahd, &devinfo, /*period*/0, | 1186 | ahd_set_syncrate(ahd, &devinfo, /*period*/0, |
1084 | /*offset*/0, /*ppr_options*/0, | 1187 | /*offset*/0, /*ppr_options*/0, |
1085 | AHD_TRANS_ACTIVE, /*paused*/TRUE); | 1188 | AHD_TRANS_ACTIVE, /*paused*/TRUE); |
1086 | scb->flags |= SCB_EXTERNAL_RESET; | 1189 | /* Hand-craft TUR command */ |
1190 | ahd_outb(ahd, SCB_CDB_STORE, 0); | ||
1191 | ahd_outb(ahd, SCB_CDB_STORE+1, 0); | ||
1192 | ahd_outb(ahd, SCB_CDB_STORE+2, 0); | ||
1193 | ahd_outb(ahd, SCB_CDB_STORE+3, 0); | ||
1194 | ahd_outb(ahd, SCB_CDB_STORE+4, 0); | ||
1195 | ahd_outb(ahd, SCB_CDB_STORE+5, 0); | ||
1196 | ahd_outb(ahd, SCB_CDB_LEN, 6); | ||
1197 | scb->hscb->control &= ~(TAG_ENB|SCB_TAG_TYPE); | ||
1198 | scb->hscb->control |= MK_MESSAGE; | ||
1199 | ahd_outb(ahd, SCB_CONTROL, scb->hscb->control); | ||
1200 | ahd_outb(ahd, MSG_OUT, HOST_MSG); | ||
1201 | ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid); | ||
1202 | /* | ||
1203 | * The lun is 0, regardless of the SCB's lun | ||
1204 | * as we have not sent an identify message. | ||
1205 | */ | ||
1206 | ahd_outb(ahd, SAVED_LUN, 0); | ||
1207 | ahd_outb(ahd, SEQ_FLAGS, 0); | ||
1208 | ahd_assert_atn(ahd); | ||
1209 | scb->flags &= ~SCB_PACKETIZED; | ||
1210 | scb->flags |= SCB_ABORT|SCB_EXTERNAL_RESET; | ||
1087 | ahd_freeze_devq(ahd, scb); | 1211 | ahd_freeze_devq(ahd, scb); |
1088 | ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); | 1212 | ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); |
1089 | ahd_freeze_scb(scb); | 1213 | ahd_freeze_scb(scb); |
@@ -1519,8 +1643,10 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat) | |||
1519 | /* | 1643 | /* |
1520 | * Ignore external resets after a bus reset. | 1644 | * Ignore external resets after a bus reset. |
1521 | */ | 1645 | */ |
1522 | if (((status & SCSIRSTI) != 0) && (ahd->flags & AHD_BUS_RESET_ACTIVE)) | 1646 | if (((status & SCSIRSTI) != 0) && (ahd->flags & AHD_BUS_RESET_ACTIVE)) { |
1647 | ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI); | ||
1523 | return; | 1648 | return; |
1649 | } | ||
1524 | 1650 | ||
1525 | /* | 1651 | /* |
1526 | * Clear bus reset flag | 1652 | * Clear bus reset flag |
@@ -2200,6 +2326,22 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2200 | if (sent_msg == MSG_ABORT_TAG) | 2326 | if (sent_msg == MSG_ABORT_TAG) |
2201 | tag = SCB_GET_TAG(scb); | 2327 | tag = SCB_GET_TAG(scb); |
2202 | 2328 | ||
2329 | if ((scb->flags & SCB_EXTERNAL_RESET) != 0) { | ||
2330 | /* | ||
2331 | * This abort is in response to an | ||
2332 | * unexpected switch to command phase | ||
2333 | * for a packetized connection. Since | ||
2334 | * the identify message was never sent, | ||
2335 | * "saved lun" is 0. We really want to | ||
2336 | * abort only the SCB that encountered | ||
2337 | * this error, which could have a different | ||
2338 | * lun. The SCB will be retried so the OS | ||
2339 | * will see the UA after renegotiating to | ||
2340 | * packetized. | ||
2341 | */ | ||
2342 | tag = SCB_GET_TAG(scb); | ||
2343 | saved_lun = scb->hscb->lun; | ||
2344 | } | ||
2203 | found = ahd_abort_scbs(ahd, target, 'A', saved_lun, | 2345 | found = ahd_abort_scbs(ahd, target, 'A', saved_lun, |
2204 | tag, ROLE_INITIATOR, | 2346 | tag, ROLE_INITIATOR, |
2205 | CAM_REQ_ABORTED); | 2347 | CAM_REQ_ABORTED); |
@@ -2523,7 +2665,7 @@ ahd_force_renegotiation(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) | |||
2523 | } | 2665 | } |
2524 | 2666 | ||
2525 | #define AHD_MAX_STEPS 2000 | 2667 | #define AHD_MAX_STEPS 2000 |
2526 | void | 2668 | static void |
2527 | ahd_clear_critical_section(struct ahd_softc *ahd) | 2669 | ahd_clear_critical_section(struct ahd_softc *ahd) |
2528 | { | 2670 | { |
2529 | ahd_mode_state saved_modes; | 2671 | ahd_mode_state saved_modes; |
@@ -2646,7 +2788,7 @@ ahd_clear_critical_section(struct ahd_softc *ahd) | |||
2646 | /* | 2788 | /* |
2647 | * Clear any pending interrupt status. | 2789 | * Clear any pending interrupt status. |
2648 | */ | 2790 | */ |
2649 | void | 2791 | static void |
2650 | ahd_clear_intstat(struct ahd_softc *ahd) | 2792 | ahd_clear_intstat(struct ahd_softc *ahd) |
2651 | { | 2793 | { |
2652 | AHD_ASSERT_MODES(ahd, ~(AHD_MODE_UNKNOWN_MSK|AHD_MODE_CFG_MSK), | 2794 | AHD_ASSERT_MODES(ahd, ~(AHD_MODE_UNKNOWN_MSK|AHD_MODE_CFG_MSK), |
@@ -2677,6 +2819,8 @@ ahd_clear_intstat(struct ahd_softc *ahd) | |||
2677 | #ifdef AHD_DEBUG | 2819 | #ifdef AHD_DEBUG |
2678 | uint32_t ahd_debug = AHD_DEBUG_OPTS; | 2820 | uint32_t ahd_debug = AHD_DEBUG_OPTS; |
2679 | #endif | 2821 | #endif |
2822 | |||
2823 | #if 0 | ||
2680 | void | 2824 | void |
2681 | ahd_print_scb(struct scb *scb) | 2825 | ahd_print_scb(struct scb *scb) |
2682 | { | 2826 | { |
@@ -2701,49 +2845,7 @@ ahd_print_scb(struct scb *scb) | |||
2701 | SCB_GET_TAG(scb)); | 2845 | SCB_GET_TAG(scb)); |
2702 | ahd_dump_sglist(scb); | 2846 | ahd_dump_sglist(scb); |
2703 | } | 2847 | } |
2704 | 2848 | #endif /* 0 */ | |
2705 | void | ||
2706 | ahd_dump_sglist(struct scb *scb) | ||
2707 | { | ||
2708 | int i; | ||
2709 | |||
2710 | if (scb->sg_count > 0) { | ||
2711 | if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) { | ||
2712 | struct ahd_dma64_seg *sg_list; | ||
2713 | |||
2714 | sg_list = (struct ahd_dma64_seg*)scb->sg_list; | ||
2715 | for (i = 0; i < scb->sg_count; i++) { | ||
2716 | uint64_t addr; | ||
2717 | uint32_t len; | ||
2718 | |||
2719 | addr = ahd_le64toh(sg_list[i].addr); | ||
2720 | len = ahd_le32toh(sg_list[i].len); | ||
2721 | printf("sg[%d] - Addr 0x%x%x : Length %d%s\n", | ||
2722 | i, | ||
2723 | (uint32_t)((addr >> 32) & 0xFFFFFFFF), | ||
2724 | (uint32_t)(addr & 0xFFFFFFFF), | ||
2725 | sg_list[i].len & AHD_SG_LEN_MASK, | ||
2726 | (sg_list[i].len & AHD_DMA_LAST_SEG) | ||
2727 | ? " Last" : ""); | ||
2728 | } | ||
2729 | } else { | ||
2730 | struct ahd_dma_seg *sg_list; | ||
2731 | |||
2732 | sg_list = (struct ahd_dma_seg*)scb->sg_list; | ||
2733 | for (i = 0; i < scb->sg_count; i++) { | ||
2734 | uint32_t len; | ||
2735 | |||
2736 | len = ahd_le32toh(sg_list[i].len); | ||
2737 | printf("sg[%d] - Addr 0x%x%x : Length %d%s\n", | ||
2738 | i, | ||
2739 | (len & AHD_SG_HIGH_ADDR_MASK) >> 24, | ||
2740 | ahd_le32toh(sg_list[i].addr), | ||
2741 | len & AHD_SG_LEN_MASK, | ||
2742 | len & AHD_DMA_LAST_SEG ? " Last" : ""); | ||
2743 | } | ||
2744 | } | ||
2745 | } | ||
2746 | } | ||
2747 | 2849 | ||
2748 | /************************* Transfer Negotiation *******************************/ | 2850 | /************************* Transfer Negotiation *******************************/ |
2749 | /* | 2851 | /* |
@@ -2850,14 +2952,14 @@ ahd_devlimited_syncrate(struct ahd_softc *ahd, | |||
2850 | transinfo = &tinfo->goal; | 2952 | transinfo = &tinfo->goal; |
2851 | *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN); | 2953 | *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN); |
2852 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { | 2954 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { |
2853 | maxsync = MAX(maxsync, AHD_SYNCRATE_ULTRA2); | 2955 | maxsync = max(maxsync, (u_int)AHD_SYNCRATE_ULTRA2); |
2854 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; | 2956 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; |
2855 | } | 2957 | } |
2856 | if (transinfo->period == 0) { | 2958 | if (transinfo->period == 0) { |
2857 | *period = 0; | 2959 | *period = 0; |
2858 | *ppr_options = 0; | 2960 | *ppr_options = 0; |
2859 | } else { | 2961 | } else { |
2860 | *period = MAX(*period, transinfo->period); | 2962 | *period = max(*period, (u_int)transinfo->period); |
2861 | ahd_find_syncrate(ahd, period, ppr_options, maxsync); | 2963 | ahd_find_syncrate(ahd, period, ppr_options, maxsync); |
2862 | } | 2964 | } |
2863 | } | 2965 | } |
@@ -2906,7 +3008,7 @@ ahd_find_syncrate(struct ahd_softc *ahd, u_int *period, | |||
2906 | * Truncate the given synchronous offset to a value the | 3008 | * Truncate the given synchronous offset to a value the |
2907 | * current adapter type and syncrate are capable of. | 3009 | * current adapter type and syncrate are capable of. |
2908 | */ | 3010 | */ |
2909 | void | 3011 | static void |
2910 | ahd_validate_offset(struct ahd_softc *ahd, | 3012 | ahd_validate_offset(struct ahd_softc *ahd, |
2911 | struct ahd_initiator_tinfo *tinfo, | 3013 | struct ahd_initiator_tinfo *tinfo, |
2912 | u_int period, u_int *offset, int wide, | 3014 | u_int period, u_int *offset, int wide, |
@@ -2924,12 +3026,12 @@ ahd_validate_offset(struct ahd_softc *ahd, | |||
2924 | maxoffset = MAX_OFFSET_PACED; | 3026 | maxoffset = MAX_OFFSET_PACED; |
2925 | } else | 3027 | } else |
2926 | maxoffset = MAX_OFFSET_NON_PACED; | 3028 | maxoffset = MAX_OFFSET_NON_PACED; |
2927 | *offset = MIN(*offset, maxoffset); | 3029 | *offset = min(*offset, maxoffset); |
2928 | if (tinfo != NULL) { | 3030 | if (tinfo != NULL) { |
2929 | if (role == ROLE_TARGET) | 3031 | if (role == ROLE_TARGET) |
2930 | *offset = MIN(*offset, tinfo->user.offset); | 3032 | *offset = min(*offset, (u_int)tinfo->user.offset); |
2931 | else | 3033 | else |
2932 | *offset = MIN(*offset, tinfo->goal.offset); | 3034 | *offset = min(*offset, (u_int)tinfo->goal.offset); |
2933 | } | 3035 | } |
2934 | } | 3036 | } |
2935 | 3037 | ||
@@ -2937,7 +3039,7 @@ ahd_validate_offset(struct ahd_softc *ahd, | |||
2937 | * Truncate the given transfer width parameter to a value the | 3039 | * Truncate the given transfer width parameter to a value the |
2938 | * current adapter type is capable of. | 3040 | * current adapter type is capable of. |
2939 | */ | 3041 | */ |
2940 | void | 3042 | static void |
2941 | ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, | 3043 | ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, |
2942 | u_int *bus_width, role_t role) | 3044 | u_int *bus_width, role_t role) |
2943 | { | 3045 | { |
@@ -2955,9 +3057,9 @@ ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, | |||
2955 | } | 3057 | } |
2956 | if (tinfo != NULL) { | 3058 | if (tinfo != NULL) { |
2957 | if (role == ROLE_TARGET) | 3059 | if (role == ROLE_TARGET) |
2958 | *bus_width = MIN(tinfo->user.width, *bus_width); | 3060 | *bus_width = min((u_int)tinfo->user.width, *bus_width); |
2959 | else | 3061 | else |
2960 | *bus_width = MIN(tinfo->goal.width, *bus_width); | 3062 | *bus_width = min((u_int)tinfo->goal.width, *bus_width); |
2961 | } | 3063 | } |
2962 | } | 3064 | } |
2963 | 3065 | ||
@@ -3210,7 +3312,7 @@ ahd_set_width(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, | |||
3210 | /* | 3312 | /* |
3211 | * Update the current state of tagged queuing for a given target. | 3313 | * Update the current state of tagged queuing for a given target. |
3212 | */ | 3314 | */ |
3213 | void | 3315 | static void |
3214 | ahd_set_tags(struct ahd_softc *ahd, struct scsi_cmnd *cmd, | 3316 | ahd_set_tags(struct ahd_softc *ahd, struct scsi_cmnd *cmd, |
3215 | struct ahd_devinfo *devinfo, ahd_queue_alg alg) | 3317 | struct ahd_devinfo *devinfo, ahd_queue_alg alg) |
3216 | { | 3318 | { |
@@ -3466,7 +3568,7 @@ ahd_print_devinfo(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) | |||
3466 | devinfo->target, devinfo->lun); | 3568 | devinfo->target, devinfo->lun); |
3467 | } | 3569 | } |
3468 | 3570 | ||
3469 | struct ahd_phase_table_entry* | 3571 | static struct ahd_phase_table_entry* |
3470 | ahd_lookup_phase_entry(int phase) | 3572 | ahd_lookup_phase_entry(int phase) |
3471 | { | 3573 | { |
3472 | struct ahd_phase_table_entry *entry; | 3574 | struct ahd_phase_table_entry *entry; |
@@ -5351,7 +5453,7 @@ ahd_free(struct ahd_softc *ahd) | |||
5351 | return; | 5453 | return; |
5352 | } | 5454 | } |
5353 | 5455 | ||
5354 | void | 5456 | static void |
5355 | ahd_shutdown(void *arg) | 5457 | ahd_shutdown(void *arg) |
5356 | { | 5458 | { |
5357 | struct ahd_softc *ahd; | 5459 | struct ahd_softc *ahd; |
@@ -5480,7 +5582,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit) | |||
5480 | /* | 5582 | /* |
5481 | * Determine the number of SCBs available on the controller | 5583 | * Determine the number of SCBs available on the controller |
5482 | */ | 5584 | */ |
5483 | int | 5585 | static int |
5484 | ahd_probe_scbs(struct ahd_softc *ahd) { | 5586 | ahd_probe_scbs(struct ahd_softc *ahd) { |
5485 | int i; | 5587 | int i; |
5486 | 5588 | ||
@@ -5929,7 +6031,7 @@ ahd_free_scb(struct ahd_softc *ahd, struct scb *scb) | |||
5929 | ahd_platform_scb_free(ahd, scb); | 6031 | ahd_platform_scb_free(ahd, scb); |
5930 | } | 6032 | } |
5931 | 6033 | ||
5932 | void | 6034 | static void |
5933 | ahd_alloc_scbs(struct ahd_softc *ahd) | 6035 | ahd_alloc_scbs(struct ahd_softc *ahd) |
5934 | { | 6036 | { |
5935 | struct scb_data *scb_data; | 6037 | struct scb_data *scb_data; |
@@ -6057,9 +6159,9 @@ ahd_alloc_scbs(struct ahd_softc *ahd) | |||
6057 | #endif | 6159 | #endif |
6058 | } | 6160 | } |
6059 | 6161 | ||
6060 | newcount = MIN(scb_data->sense_left, scb_data->scbs_left); | 6162 | newcount = min(scb_data->sense_left, scb_data->scbs_left); |
6061 | newcount = MIN(newcount, scb_data->sgs_left); | 6163 | newcount = min(newcount, scb_data->sgs_left); |
6062 | newcount = MIN(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs)); | 6164 | newcount = min(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs)); |
6063 | for (i = 0; i < newcount; i++) { | 6165 | for (i = 0; i < newcount; i++) { |
6064 | struct scb_platform_data *pdata; | 6166 | struct scb_platform_data *pdata; |
6065 | u_int col_tag; | 6167 | u_int col_tag; |
@@ -6982,7 +7084,7 @@ ahd_intr_enable(struct ahd_softc *ahd, int enable) | |||
6982 | ahd_outb(ahd, HCNTRL, hcntrl); | 7084 | ahd_outb(ahd, HCNTRL, hcntrl); |
6983 | } | 7085 | } |
6984 | 7086 | ||
6985 | void | 7087 | static void |
6986 | ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer, u_int maxcmds, | 7088 | ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer, u_int maxcmds, |
6987 | u_int mincmds) | 7089 | u_int mincmds) |
6988 | { | 7090 | { |
@@ -7000,7 +7102,7 @@ ahd_update_coalescing_values(struct ahd_softc *ahd, u_int timer, u_int maxcmds, | |||
7000 | ahd_outb(ahd, INT_COALESCING_MINCMDS, -mincmds); | 7102 | ahd_outb(ahd, INT_COALESCING_MINCMDS, -mincmds); |
7001 | } | 7103 | } |
7002 | 7104 | ||
7003 | void | 7105 | static void |
7004 | ahd_enable_coalescing(struct ahd_softc *ahd, int enable) | 7106 | ahd_enable_coalescing(struct ahd_softc *ahd, int enable) |
7005 | { | 7107 | { |
7006 | 7108 | ||
@@ -7070,6 +7172,7 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) | |||
7070 | ahd->flags &= ~AHD_ALL_INTERRUPTS; | 7172 | ahd->flags &= ~AHD_ALL_INTERRUPTS; |
7071 | } | 7173 | } |
7072 | 7174 | ||
7175 | #if 0 | ||
7073 | int | 7176 | int |
7074 | ahd_suspend(struct ahd_softc *ahd) | 7177 | ahd_suspend(struct ahd_softc *ahd) |
7075 | { | 7178 | { |
@@ -7083,7 +7186,9 @@ ahd_suspend(struct ahd_softc *ahd) | |||
7083 | ahd_shutdown(ahd); | 7186 | ahd_shutdown(ahd); |
7084 | return (0); | 7187 | return (0); |
7085 | } | 7188 | } |
7189 | #endif /* 0 */ | ||
7086 | 7190 | ||
7191 | #if 0 | ||
7087 | int | 7192 | int |
7088 | ahd_resume(struct ahd_softc *ahd) | 7193 | ahd_resume(struct ahd_softc *ahd) |
7089 | { | 7194 | { |
@@ -7093,6 +7198,7 @@ ahd_resume(struct ahd_softc *ahd) | |||
7093 | ahd_restart(ahd); | 7198 | ahd_restart(ahd); |
7094 | return (0); | 7199 | return (0); |
7095 | } | 7200 | } |
7201 | #endif /* 0 */ | ||
7096 | 7202 | ||
7097 | /************************** Busy Target Table *********************************/ | 7203 | /************************** Busy Target Table *********************************/ |
7098 | /* | 7204 | /* |
@@ -7125,7 +7231,7 @@ ahd_index_busy_tcl(struct ahd_softc *ahd, u_int *saved_scbid, u_int tcl) | |||
7125 | /* | 7231 | /* |
7126 | * Return the untagged transaction id for a given target/channel lun. | 7232 | * Return the untagged transaction id for a given target/channel lun. |
7127 | */ | 7233 | */ |
7128 | u_int | 7234 | static u_int |
7129 | ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl) | 7235 | ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl) |
7130 | { | 7236 | { |
7131 | u_int scbid; | 7237 | u_int scbid; |
@@ -7138,7 +7244,7 @@ ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl) | |||
7138 | return (scbid); | 7244 | return (scbid); |
7139 | } | 7245 | } |
7140 | 7246 | ||
7141 | void | 7247 | static void |
7142 | ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, u_int scbid) | 7248 | ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, u_int scbid) |
7143 | { | 7249 | { |
7144 | u_int scb_offset; | 7250 | u_int scb_offset; |
@@ -7186,7 +7292,7 @@ ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, int target, | |||
7186 | return match; | 7292 | return match; |
7187 | } | 7293 | } |
7188 | 7294 | ||
7189 | void | 7295 | static void |
7190 | ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb) | 7296 | ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb) |
7191 | { | 7297 | { |
7192 | int target; | 7298 | int target; |
@@ -7690,7 +7796,7 @@ ahd_add_scb_to_free_list(struct ahd_softc *ahd, u_int scbid) | |||
7690 | * been modified from CAM_REQ_INPROG. This routine assumes that the sequencer | 7796 | * been modified from CAM_REQ_INPROG. This routine assumes that the sequencer |
7691 | * is paused before it is called. | 7797 | * is paused before it is called. |
7692 | */ | 7798 | */ |
7693 | int | 7799 | static int |
7694 | ahd_abort_scbs(struct ahd_softc *ahd, int target, char channel, | 7800 | ahd_abort_scbs(struct ahd_softc *ahd, int target, char channel, |
7695 | int lun, u_int tag, role_t role, uint32_t status) | 7801 | int lun, u_int tag, role_t role, uint32_t status) |
7696 | { | 7802 | { |
@@ -7920,6 +8026,11 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) | |||
7920 | ahd_clear_fifo(ahd, 1); | 8026 | ahd_clear_fifo(ahd, 1); |
7921 | 8027 | ||
7922 | /* | 8028 | /* |
8029 | * Clear SCSI interrupt status | ||
8030 | */ | ||
8031 | ahd_outb(ahd, CLRSINT1, CLRSCSIRSTI); | ||
8032 | |||
8033 | /* | ||
7923 | * Reenable selections | 8034 | * Reenable selections |
7924 | */ | 8035 | */ |
7925 | ahd_outb(ahd, SIMODE1, ahd_inb(ahd, SIMODE1) | ENSCSIRST); | 8036 | ahd_outb(ahd, SIMODE1, ahd_inb(ahd, SIMODE1) | ENSCSIRST); |
@@ -7952,10 +8063,6 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) | |||
7952 | } | 8063 | } |
7953 | } | 8064 | } |
7954 | #endif | 8065 | #endif |
7955 | /* Notify the XPT that a bus reset occurred */ | ||
7956 | ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD, | ||
7957 | CAM_LUN_WILDCARD, AC_BUS_RESET); | ||
7958 | |||
7959 | /* | 8066 | /* |
7960 | * Revert to async/narrow transfers until we renegotiate. | 8067 | * Revert to async/narrow transfers until we renegotiate. |
7961 | */ | 8068 | */ |
@@ -7977,6 +8084,10 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset) | |||
7977 | } | 8084 | } |
7978 | } | 8085 | } |
7979 | 8086 | ||
8087 | /* Notify the XPT that a bus reset occurred */ | ||
8088 | ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD, | ||
8089 | CAM_LUN_WILDCARD, AC_BUS_RESET); | ||
8090 | |||
7980 | ahd_restart(ahd); | 8091 | ahd_restart(ahd); |
7981 | 8092 | ||
7982 | return (found); | 8093 | return (found); |
@@ -8019,18 +8130,8 @@ ahd_stat_timer(void *arg) | |||
8019 | } | 8130 | } |
8020 | 8131 | ||
8021 | /****************************** Status Processing *****************************/ | 8132 | /****************************** Status Processing *****************************/ |
8022 | void | ||
8023 | ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb) | ||
8024 | { | ||
8025 | if (scb->hscb->shared_data.istatus.scsi_status != 0) { | ||
8026 | ahd_handle_scsi_status(ahd, scb); | ||
8027 | } else { | ||
8028 | ahd_calc_residual(ahd, scb); | ||
8029 | ahd_done(ahd, scb); | ||
8030 | } | ||
8031 | } | ||
8032 | 8133 | ||
8033 | void | 8134 | static void |
8034 | ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) | 8135 | ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) |
8035 | { | 8136 | { |
8036 | struct hardware_scb *hscb; | 8137 | struct hardware_scb *hscb; |
@@ -8238,10 +8339,21 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) | |||
8238 | } | 8339 | } |
8239 | } | 8340 | } |
8240 | 8341 | ||
8342 | static void | ||
8343 | ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb) | ||
8344 | { | ||
8345 | if (scb->hscb->shared_data.istatus.scsi_status != 0) { | ||
8346 | ahd_handle_scsi_status(ahd, scb); | ||
8347 | } else { | ||
8348 | ahd_calc_residual(ahd, scb); | ||
8349 | ahd_done(ahd, scb); | ||
8350 | } | ||
8351 | } | ||
8352 | |||
8241 | /* | 8353 | /* |
8242 | * Calculate the residual for a just completed SCB. | 8354 | * Calculate the residual for a just completed SCB. |
8243 | */ | 8355 | */ |
8244 | void | 8356 | static void |
8245 | ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb) | 8357 | ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb) |
8246 | { | 8358 | { |
8247 | struct hardware_scb *hscb; | 8359 | struct hardware_scb *hscb; |
@@ -8668,7 +8780,7 @@ ahd_resolve_seqaddr(struct ahd_softc *ahd, u_int address) | |||
8668 | if (skip_addr > i) { | 8780 | if (skip_addr > i) { |
8669 | int end_addr; | 8781 | int end_addr; |
8670 | 8782 | ||
8671 | end_addr = MIN(address, skip_addr); | 8783 | end_addr = min(address, skip_addr); |
8672 | address_offset += end_addr - i; | 8784 | address_offset += end_addr - i; |
8673 | i = skip_addr; | 8785 | i = skip_addr; |
8674 | } else { | 8786 | } else { |
@@ -9092,6 +9204,7 @@ ahd_dump_card_state(struct ahd_softc *ahd) | |||
9092 | ahd_unpause(ahd); | 9204 | ahd_unpause(ahd); |
9093 | } | 9205 | } |
9094 | 9206 | ||
9207 | #if 0 | ||
9095 | void | 9208 | void |
9096 | ahd_dump_scbs(struct ahd_softc *ahd) | 9209 | ahd_dump_scbs(struct ahd_softc *ahd) |
9097 | { | 9210 | { |
@@ -9117,6 +9230,7 @@ ahd_dump_scbs(struct ahd_softc *ahd) | |||
9117 | ahd_set_scbptr(ahd, saved_scb_index); | 9230 | ahd_set_scbptr(ahd, saved_scb_index); |
9118 | ahd_restore_modes(ahd, saved_modes); | 9231 | ahd_restore_modes(ahd, saved_modes); |
9119 | } | 9232 | } |
9233 | #endif /* 0 */ | ||
9120 | 9234 | ||
9121 | /**************************** Flexport Logic **********************************/ | 9235 | /**************************** Flexport Logic **********************************/ |
9122 | /* | 9236 | /* |
@@ -9219,7 +9333,7 @@ ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf, | |||
9219 | /* | 9333 | /* |
9220 | * Wait ~100us for the serial eeprom to satisfy our request. | 9334 | * Wait ~100us for the serial eeprom to satisfy our request. |
9221 | */ | 9335 | */ |
9222 | int | 9336 | static int |
9223 | ahd_wait_seeprom(struct ahd_softc *ahd) | 9337 | ahd_wait_seeprom(struct ahd_softc *ahd) |
9224 | { | 9338 | { |
9225 | int cnt; | 9339 | int cnt; |
@@ -9237,7 +9351,7 @@ ahd_wait_seeprom(struct ahd_softc *ahd) | |||
9237 | * Validate the two checksums in the per_channel | 9351 | * Validate the two checksums in the per_channel |
9238 | * vital product data struct. | 9352 | * vital product data struct. |
9239 | */ | 9353 | */ |
9240 | int | 9354 | static int |
9241 | ahd_verify_vpd_cksum(struct vpd_config *vpd) | 9355 | ahd_verify_vpd_cksum(struct vpd_config *vpd) |
9242 | { | 9356 | { |
9243 | int i; | 9357 | int i; |
@@ -9316,6 +9430,24 @@ ahd_release_seeprom(struct ahd_softc *ahd) | |||
9316 | /* Currently a no-op */ | 9430 | /* Currently a no-op */ |
9317 | } | 9431 | } |
9318 | 9432 | ||
9433 | /* | ||
9434 | * Wait at most 2 seconds for flexport arbitration to succeed. | ||
9435 | */ | ||
9436 | static int | ||
9437 | ahd_wait_flexport(struct ahd_softc *ahd) | ||
9438 | { | ||
9439 | int cnt; | ||
9440 | |||
9441 | AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK); | ||
9442 | cnt = 1000000 * 2 / 5; | ||
9443 | while ((ahd_inb(ahd, BRDCTL) & FLXARBACK) == 0 && --cnt) | ||
9444 | ahd_delay(5); | ||
9445 | |||
9446 | if (cnt == 0) | ||
9447 | return (ETIMEDOUT); | ||
9448 | return (0); | ||
9449 | } | ||
9450 | |||
9319 | int | 9451 | int |
9320 | ahd_write_flexport(struct ahd_softc *ahd, u_int addr, u_int value) | 9452 | ahd_write_flexport(struct ahd_softc *ahd, u_int addr, u_int value) |
9321 | { | 9453 | { |
@@ -9357,24 +9489,6 @@ ahd_read_flexport(struct ahd_softc *ahd, u_int addr, uint8_t *value) | |||
9357 | return (0); | 9489 | return (0); |
9358 | } | 9490 | } |
9359 | 9491 | ||
9360 | /* | ||
9361 | * Wait at most 2 seconds for flexport arbitration to succeed. | ||
9362 | */ | ||
9363 | int | ||
9364 | ahd_wait_flexport(struct ahd_softc *ahd) | ||
9365 | { | ||
9366 | int cnt; | ||
9367 | |||
9368 | AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK); | ||
9369 | cnt = 1000000 * 2 / 5; | ||
9370 | while ((ahd_inb(ahd, BRDCTL) & FLXARBACK) == 0 && --cnt) | ||
9371 | ahd_delay(5); | ||
9372 | |||
9373 | if (cnt == 0) | ||
9374 | return (ETIMEDOUT); | ||
9375 | return (0); | ||
9376 | } | ||
9377 | |||
9378 | /************************* Target Mode ****************************************/ | 9492 | /************************* Target Mode ****************************************/ |
9379 | #ifdef AHD_TARGET_MODE | 9493 | #ifdef AHD_TARGET_MODE |
9380 | cam_status | 9494 | cam_status |
diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h index a3266e066c00..2ceb67f4af2a 100644 --- a/drivers/scsi/aic7xxx/aic79xx_inline.h +++ b/drivers/scsi/aic7xxx/aic79xx_inline.h | |||
@@ -418,10 +418,6 @@ ahd_targetcmd_offset(struct ahd_softc *ahd, u_int index) | |||
418 | } | 418 | } |
419 | 419 | ||
420 | /*********************** Miscelaneous Support Functions ***********************/ | 420 | /*********************** Miscelaneous Support Functions ***********************/ |
421 | static __inline void ahd_complete_scb(struct ahd_softc *ahd, | ||
422 | struct scb *scb); | ||
423 | static __inline void ahd_update_residual(struct ahd_softc *ahd, | ||
424 | struct scb *scb); | ||
425 | static __inline struct ahd_initiator_tinfo * | 421 | static __inline struct ahd_initiator_tinfo * |
426 | ahd_fetch_transinfo(struct ahd_softc *ahd, | 422 | ahd_fetch_transinfo(struct ahd_softc *ahd, |
427 | char channel, u_int our_id, | 423 | char channel, u_int our_id, |
@@ -467,32 +463,6 @@ static __inline uint32_t | |||
467 | ahd_get_sense_bufaddr(struct ahd_softc *ahd, | 463 | ahd_get_sense_bufaddr(struct ahd_softc *ahd, |
468 | struct scb *scb); | 464 | struct scb *scb); |
469 | 465 | ||
470 | static __inline void | ||
471 | ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb) | ||
472 | { | ||
473 | uint32_t sgptr; | ||
474 | |||
475 | sgptr = ahd_le32toh(scb->hscb->sgptr); | ||
476 | if ((sgptr & SG_STATUS_VALID) != 0) | ||
477 | ahd_handle_scb_status(ahd, scb); | ||
478 | else | ||
479 | ahd_done(ahd, scb); | ||
480 | } | ||
481 | |||
482 | /* | ||
483 | * Determine whether the sequencer reported a residual | ||
484 | * for this SCB/transaction. | ||
485 | */ | ||
486 | static __inline void | ||
487 | ahd_update_residual(struct ahd_softc *ahd, struct scb *scb) | ||
488 | { | ||
489 | uint32_t sgptr; | ||
490 | |||
491 | sgptr = ahd_le32toh(scb->hscb->sgptr); | ||
492 | if ((sgptr & SG_STATUS_VALID) != 0) | ||
493 | ahd_calc_residual(ahd, scb); | ||
494 | } | ||
495 | |||
496 | /* | 466 | /* |
497 | * Return pointers to the transfer negotiation information | 467 | * Return pointers to the transfer negotiation information |
498 | * for the specified our_id/remote_id pair. | 468 | * for the specified our_id/remote_id pair. |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index f8e60486167d..9bfcca5ede08 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -293,7 +293,7 @@ static uint32_t aic79xx_seltime; | |||
293 | * force all outstanding transactions to be serviced prior to a new | 293 | * force all outstanding transactions to be serviced prior to a new |
294 | * transaction. | 294 | * transaction. |
295 | */ | 295 | */ |
296 | uint32_t aic79xx_periodic_otag; | 296 | static uint32_t aic79xx_periodic_otag; |
297 | 297 | ||
298 | /* Some storage boxes are using an LSI chip which has a bug making it | 298 | /* Some storage boxes are using an LSI chip which has a bug making it |
299 | * impossible to use aic79xx Rev B chip in 320 speeds. The following | 299 | * impossible to use aic79xx Rev B chip in 320 speeds. The following |
@@ -773,6 +773,7 @@ struct scsi_host_template aic79xx_driver_template = { | |||
773 | #endif | 773 | #endif |
774 | .can_queue = AHD_MAX_QUEUE, | 774 | .can_queue = AHD_MAX_QUEUE, |
775 | .this_id = -1, | 775 | .this_id = -1, |
776 | .max_sectors = 8192, | ||
776 | .cmd_per_lun = 2, | 777 | .cmd_per_lun = 2, |
777 | .use_clustering = ENABLE_CLUSTERING, | 778 | .use_clustering = ENABLE_CLUSTERING, |
778 | .slave_alloc = ahd_linux_slave_alloc, | 779 | .slave_alloc = ahd_linux_slave_alloc, |
@@ -1813,9 +1814,9 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, | |||
1813 | u_int sense_offset; | 1814 | u_int sense_offset; |
1814 | 1815 | ||
1815 | if (scb->flags & SCB_SENSE) { | 1816 | if (scb->flags & SCB_SENSE) { |
1816 | sense_size = MIN(sizeof(struct scsi_sense_data) | 1817 | sense_size = min(sizeof(struct scsi_sense_data) |
1817 | - ahd_get_sense_residual(scb), | 1818 | - ahd_get_sense_residual(scb), |
1818 | sizeof(cmd->sense_buffer)); | 1819 | (u_long)sizeof(cmd->sense_buffer)); |
1819 | sense_offset = 0; | 1820 | sense_offset = 0; |
1820 | } else { | 1821 | } else { |
1821 | /* | 1822 | /* |
@@ -1824,7 +1825,8 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, | |||
1824 | */ | 1825 | */ |
1825 | siu = (struct scsi_status_iu_header *) | 1826 | siu = (struct scsi_status_iu_header *) |
1826 | scb->sense_data; | 1827 | scb->sense_data; |
1827 | sense_size = MIN(scsi_4btoul(siu->sense_length), | 1828 | sense_size = min_t(size_t, |
1829 | scsi_4btoul(siu->sense_length), | ||
1828 | sizeof(cmd->sense_buffer)); | 1830 | sizeof(cmd->sense_buffer)); |
1829 | sense_offset = SIU_SENSE_OFFSET(siu); | 1831 | sense_offset = SIU_SENSE_OFFSET(siu); |
1830 | } | 1832 | } |
@@ -2634,8 +2636,22 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp) | |||
2634 | pcomp ? "Enable" : "Disable"); | 2636 | pcomp ? "Enable" : "Disable"); |
2635 | #endif | 2637 | #endif |
2636 | 2638 | ||
2637 | if (pcomp) | 2639 | if (pcomp) { |
2640 | uint8_t precomp; | ||
2641 | |||
2642 | if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { | ||
2643 | struct ahd_linux_iocell_opts *iocell_opts; | ||
2644 | |||
2645 | iocell_opts = &aic79xx_iocell_info[ahd->unit]; | ||
2646 | precomp = iocell_opts->precomp; | ||
2647 | } else { | ||
2648 | precomp = AIC79XX_DEFAULT_PRECOMP; | ||
2649 | } | ||
2638 | ppr_options |= MSG_EXT_PPR_PCOMP_EN; | 2650 | ppr_options |= MSG_EXT_PPR_PCOMP_EN; |
2651 | AHD_SET_PRECOMP(ahd, precomp); | ||
2652 | } else { | ||
2653 | AHD_SET_PRECOMP(ahd, 0); | ||
2654 | } | ||
2639 | 2655 | ||
2640 | ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, | 2656 | ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, |
2641 | starget->channel + 'A', ROLE_INITIATOR); | 2657 | starget->channel + 'A', ROLE_INITIATOR); |
@@ -2678,7 +2694,25 @@ static void ahd_linux_set_hold_mcs(struct scsi_target *starget, int hold) | |||
2678 | ahd_unlock(ahd, &flags); | 2694 | ahd_unlock(ahd, &flags); |
2679 | } | 2695 | } |
2680 | 2696 | ||
2697 | static void ahd_linux_get_signalling(struct Scsi_Host *shost) | ||
2698 | { | ||
2699 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; | ||
2700 | unsigned long flags; | ||
2701 | u8 mode; | ||
2702 | |||
2703 | ahd_lock(ahd, &flags); | ||
2704 | ahd_pause(ahd); | ||
2705 | mode = ahd_inb(ahd, SBLKCTL); | ||
2706 | ahd_unpause(ahd); | ||
2707 | ahd_unlock(ahd, &flags); | ||
2681 | 2708 | ||
2709 | if (mode & ENAB40) | ||
2710 | spi_signalling(shost) = SPI_SIGNAL_LVD; | ||
2711 | else if (mode & ENAB20) | ||
2712 | spi_signalling(shost) = SPI_SIGNAL_SE; | ||
2713 | else | ||
2714 | spi_signalling(shost) = SPI_SIGNAL_UNKNOWN; | ||
2715 | } | ||
2682 | 2716 | ||
2683 | static struct spi_function_template ahd_linux_transport_functions = { | 2717 | static struct spi_function_template ahd_linux_transport_functions = { |
2684 | .set_offset = ahd_linux_set_offset, | 2718 | .set_offset = ahd_linux_set_offset, |
@@ -2703,6 +2737,7 @@ static struct spi_function_template ahd_linux_transport_functions = { | |||
2703 | .show_pcomp_en = 1, | 2737 | .show_pcomp_en = 1, |
2704 | .set_hold_mcs = ahd_linux_set_hold_mcs, | 2738 | .set_hold_mcs = ahd_linux_set_hold_mcs, |
2705 | .show_hold_mcs = 1, | 2739 | .show_hold_mcs = 1, |
2740 | .get_signalling = ahd_linux_get_signalling, | ||
2706 | }; | 2741 | }; |
2707 | 2742 | ||
2708 | static int __init | 2743 | static int __init |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index fb3d4dd54413..3a67fc578d78 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h | |||
@@ -506,9 +506,6 @@ struct info_str { | |||
506 | int pos; | 506 | int pos; |
507 | }; | 507 | }; |
508 | 508 | ||
509 | void ahd_format_transinfo(struct info_str *info, | ||
510 | struct ahd_transinfo *tinfo); | ||
511 | |||
512 | /******************************** Locking *************************************/ | 509 | /******************************** Locking *************************************/ |
513 | static __inline void | 510 | static __inline void |
514 | ahd_lockinit(struct ahd_softc *ahd) | 511 | ahd_lockinit(struct ahd_softc *ahd) |
@@ -582,8 +579,6 @@ ahd_unlock(struct ahd_softc *ahd, unsigned long *flags) | |||
582 | #define PCIXM_STATUS_MAXCRDS 0x1C00 /* Maximum Cumulative Read Size */ | 579 | #define PCIXM_STATUS_MAXCRDS 0x1C00 /* Maximum Cumulative Read Size */ |
583 | #define PCIXM_STATUS_RCVDSCEM 0x2000 /* Received a Split Comp w/Error msg */ | 580 | #define PCIXM_STATUS_RCVDSCEM 0x2000 /* Received a Split Comp w/Error msg */ |
584 | 581 | ||
585 | extern struct pci_driver aic79xx_pci_driver; | ||
586 | |||
587 | typedef enum | 582 | typedef enum |
588 | { | 583 | { |
589 | AHD_POWER_STATE_D0, | 584 | AHD_POWER_STATE_D0, |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index 4b5354201807..2001fe890e71 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c | |||
@@ -82,7 +82,7 @@ static struct pci_device_id ahd_linux_pci_id_table[] = { | |||
82 | 82 | ||
83 | MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table); | 83 | MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table); |
84 | 84 | ||
85 | struct pci_driver aic79xx_pci_driver = { | 85 | static struct pci_driver aic79xx_pci_driver = { |
86 | .name = "aic79xx", | 86 | .name = "aic79xx", |
87 | .probe = ahd_linux_pci_dev_probe, | 87 | .probe = ahd_linux_pci_dev_probe, |
88 | .remove = ahd_linux_pci_dev_remove, | 88 | .remove = ahd_linux_pci_dev_remove, |
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index 14850f31aafa..c07735819cd1 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c | |||
@@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_setup; | |||
97 | static ahd_device_setup_t ahd_aic7902_setup; | 97 | static ahd_device_setup_t ahd_aic7902_setup; |
98 | static ahd_device_setup_t ahd_aic790X_setup; | 98 | static ahd_device_setup_t ahd_aic790X_setup; |
99 | 99 | ||
100 | struct ahd_pci_identity ahd_pci_ident_table [] = | 100 | static struct ahd_pci_identity ahd_pci_ident_table [] = |
101 | { | 101 | { |
102 | /* aic7901 based controllers */ | 102 | /* aic7901 based controllers */ |
103 | { | 103 | { |
@@ -201,7 +201,7 @@ struct ahd_pci_identity ahd_pci_ident_table [] = | |||
201 | } | 201 | } |
202 | }; | 202 | }; |
203 | 203 | ||
204 | const u_int ahd_num_pci_devs = ARRAY_SIZE(ahd_pci_ident_table); | 204 | static const u_int ahd_num_pci_devs = ARRAY_SIZE(ahd_pci_ident_table); |
205 | 205 | ||
206 | #define DEVCONFIG 0x40 | 206 | #define DEVCONFIG 0x40 |
207 | #define PCIXINITPAT 0x0000E000ul | 207 | #define PCIXINITPAT 0x0000E000ul |
@@ -245,6 +245,7 @@ static int ahd_check_extport(struct ahd_softc *ahd); | |||
245 | static void ahd_configure_termination(struct ahd_softc *ahd, | 245 | static void ahd_configure_termination(struct ahd_softc *ahd, |
246 | u_int adapter_control); | 246 | u_int adapter_control); |
247 | static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat); | 247 | static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat); |
248 | static void ahd_pci_intr(struct ahd_softc *ahd); | ||
248 | 249 | ||
249 | struct ahd_pci_identity * | 250 | struct ahd_pci_identity * |
250 | ahd_find_pci_device(ahd_dev_softc_t pci) | 251 | ahd_find_pci_device(ahd_dev_softc_t pci) |
@@ -757,7 +758,7 @@ static const char *pci_status_strings[] = | |||
757 | "%s: Address or Write Phase Parity Error Detected in %s.\n" | 758 | "%s: Address or Write Phase Parity Error Detected in %s.\n" |
758 | }; | 759 | }; |
759 | 760 | ||
760 | void | 761 | static void |
761 | ahd_pci_intr(struct ahd_softc *ahd) | 762 | ahd_pci_intr(struct ahd_softc *ahd) |
762 | { | 763 | { |
763 | uint8_t pci_status[8]; | 764 | uint8_t pci_status[8]; |
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c index c5f0ee591509..6b28bebcbca0 100644 --- a/drivers/scsi/aic7xxx/aic79xx_proc.c +++ b/drivers/scsi/aic7xxx/aic79xx_proc.c | |||
@@ -136,7 +136,7 @@ copy_info(struct info_str *info, char *fmt, ...) | |||
136 | return (len); | 136 | return (len); |
137 | } | 137 | } |
138 | 138 | ||
139 | void | 139 | static void |
140 | ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | 140 | ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) |
141 | { | 141 | { |
142 | u_int speed; | 142 | u_int speed; |
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 62ff8c3dc2bb..954c7c24501d 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h | |||
@@ -54,14 +54,6 @@ struct scb_platform_data; | |||
54 | struct seeprom_descriptor; | 54 | struct seeprom_descriptor; |
55 | 55 | ||
56 | /****************************** Useful Macros *********************************/ | 56 | /****************************** Useful Macros *********************************/ |
57 | #ifndef MAX | ||
58 | #define MAX(a,b) (((a) > (b)) ? (a) : (b)) | ||
59 | #endif | ||
60 | |||
61 | #ifndef MIN | ||
62 | #define MIN(a,b) (((a) < (b)) ? (a) : (b)) | ||
63 | #endif | ||
64 | |||
65 | #ifndef TRUE | 57 | #ifndef TRUE |
66 | #define TRUE 1 | 58 | #define TRUE 1 |
67 | #endif | 59 | #endif |
@@ -1135,8 +1127,6 @@ struct ahc_pci_identity { | |||
1135 | char *name; | 1127 | char *name; |
1136 | ahc_device_setup_t *setup; | 1128 | ahc_device_setup_t *setup; |
1137 | }; | 1129 | }; |
1138 | extern struct ahc_pci_identity ahc_pci_ident_table[]; | ||
1139 | extern const u_int ahc_num_pci_devs; | ||
1140 | 1130 | ||
1141 | /***************************** VL/EISA Declarations ***************************/ | 1131 | /***************************** VL/EISA Declarations ***************************/ |
1142 | struct aic7770_identity { | 1132 | struct aic7770_identity { |
@@ -1289,6 +1279,7 @@ typedef enum { | |||
1289 | } ahc_queue_alg; | 1279 | } ahc_queue_alg; |
1290 | 1280 | ||
1291 | void ahc_set_tags(struct ahc_softc *ahc, | 1281 | void ahc_set_tags(struct ahc_softc *ahc, |
1282 | struct scsi_cmnd *cmd, | ||
1292 | struct ahc_devinfo *devinfo, | 1283 | struct ahc_devinfo *devinfo, |
1293 | ahc_queue_alg alg); | 1284 | ahc_queue_alg alg); |
1294 | 1285 | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 93e4e40944b6..50ef785224de 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -1671,7 +1671,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc, | |||
1671 | transinfo = &tinfo->goal; | 1671 | transinfo = &tinfo->goal; |
1672 | *ppr_options &= transinfo->ppr_options; | 1672 | *ppr_options &= transinfo->ppr_options; |
1673 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { | 1673 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { |
1674 | maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2); | 1674 | maxsync = max(maxsync, (u_int)AHC_SYNCRATE_ULTRA2); |
1675 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; | 1675 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; |
1676 | } | 1676 | } |
1677 | if (transinfo->period == 0) { | 1677 | if (transinfo->period == 0) { |
@@ -1679,7 +1679,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc, | |||
1679 | *ppr_options = 0; | 1679 | *ppr_options = 0; |
1680 | return (NULL); | 1680 | return (NULL); |
1681 | } | 1681 | } |
1682 | *period = MAX(*period, transinfo->period); | 1682 | *period = max(*period, (u_int)transinfo->period); |
1683 | return (ahc_find_syncrate(ahc, period, ppr_options, maxsync)); | 1683 | return (ahc_find_syncrate(ahc, period, ppr_options, maxsync)); |
1684 | } | 1684 | } |
1685 | 1685 | ||
@@ -1804,12 +1804,12 @@ ahc_validate_offset(struct ahc_softc *ahc, | |||
1804 | else | 1804 | else |
1805 | maxoffset = MAX_OFFSET_8BIT; | 1805 | maxoffset = MAX_OFFSET_8BIT; |
1806 | } | 1806 | } |
1807 | *offset = MIN(*offset, maxoffset); | 1807 | *offset = min(*offset, maxoffset); |
1808 | if (tinfo != NULL) { | 1808 | if (tinfo != NULL) { |
1809 | if (role == ROLE_TARGET) | 1809 | if (role == ROLE_TARGET) |
1810 | *offset = MIN(*offset, tinfo->user.offset); | 1810 | *offset = min(*offset, (u_int)tinfo->user.offset); |
1811 | else | 1811 | else |
1812 | *offset = MIN(*offset, tinfo->goal.offset); | 1812 | *offset = min(*offset, (u_int)tinfo->goal.offset); |
1813 | } | 1813 | } |
1814 | } | 1814 | } |
1815 | 1815 | ||
@@ -1835,9 +1835,9 @@ ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo, | |||
1835 | } | 1835 | } |
1836 | if (tinfo != NULL) { | 1836 | if (tinfo != NULL) { |
1837 | if (role == ROLE_TARGET) | 1837 | if (role == ROLE_TARGET) |
1838 | *bus_width = MIN(tinfo->user.width, *bus_width); | 1838 | *bus_width = min((u_int)tinfo->user.width, *bus_width); |
1839 | else | 1839 | else |
1840 | *bus_width = MIN(tinfo->goal.width, *bus_width); | 1840 | *bus_width = min((u_int)tinfo->goal.width, *bus_width); |
1841 | } | 1841 | } |
1842 | } | 1842 | } |
1843 | 1843 | ||
@@ -1986,7 +1986,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
1986 | tinfo->curr.ppr_options = ppr_options; | 1986 | tinfo->curr.ppr_options = ppr_options; |
1987 | 1987 | ||
1988 | ahc_send_async(ahc, devinfo->channel, devinfo->target, | 1988 | ahc_send_async(ahc, devinfo->channel, devinfo->target, |
1989 | CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); | 1989 | CAM_LUN_WILDCARD, AC_TRANSFER_NEG); |
1990 | if (bootverbose) { | 1990 | if (bootverbose) { |
1991 | if (offset != 0) { | 1991 | if (offset != 0) { |
1992 | printf("%s: target %d synchronous at %sMHz%s, " | 1992 | printf("%s: target %d synchronous at %sMHz%s, " |
@@ -2056,7 +2056,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
2056 | tinfo->curr.width = width; | 2056 | tinfo->curr.width = width; |
2057 | 2057 | ||
2058 | ahc_send_async(ahc, devinfo->channel, devinfo->target, | 2058 | ahc_send_async(ahc, devinfo->channel, devinfo->target, |
2059 | CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); | 2059 | CAM_LUN_WILDCARD, AC_TRANSFER_NEG); |
2060 | if (bootverbose) { | 2060 | if (bootverbose) { |
2061 | printf("%s: target %d using %dbit transfers\n", | 2061 | printf("%s: target %d using %dbit transfers\n", |
2062 | ahc_name(ahc), devinfo->target, | 2062 | ahc_name(ahc), devinfo->target, |
@@ -2074,12 +2074,14 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
2074 | * Update the current state of tagged queuing for a given target. | 2074 | * Update the current state of tagged queuing for a given target. |
2075 | */ | 2075 | */ |
2076 | void | 2076 | void |
2077 | ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | 2077 | ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd, |
2078 | ahc_queue_alg alg) | 2078 | struct ahc_devinfo *devinfo, ahc_queue_alg alg) |
2079 | { | 2079 | { |
2080 | ahc_platform_set_tags(ahc, devinfo, alg); | 2080 | struct scsi_device *sdev = cmd->device; |
2081 | |||
2082 | ahc_platform_set_tags(ahc, sdev, devinfo, alg); | ||
2081 | ahc_send_async(ahc, devinfo->channel, devinfo->target, | 2083 | ahc_send_async(ahc, devinfo->channel, devinfo->target, |
2082 | devinfo->lun, AC_TRANSFER_NEG, &alg); | 2084 | devinfo->lun, AC_TRANSFER_NEG); |
2083 | } | 2085 | } |
2084 | 2086 | ||
2085 | /* | 2087 | /* |
@@ -3489,7 +3491,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) | |||
3489 | printf("(%s:%c:%d:%d): refuses tagged commands. " | 3491 | printf("(%s:%c:%d:%d): refuses tagged commands. " |
3490 | "Performing non-tagged I/O\n", ahc_name(ahc), | 3492 | "Performing non-tagged I/O\n", ahc_name(ahc), |
3491 | devinfo->channel, devinfo->target, devinfo->lun); | 3493 | devinfo->channel, devinfo->target, devinfo->lun); |
3492 | ahc_set_tags(ahc, devinfo, AHC_QUEUE_NONE); | 3494 | ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_NONE); |
3493 | mask = ~0x23; | 3495 | mask = ~0x23; |
3494 | } else { | 3496 | } else { |
3495 | printf("(%s:%c:%d:%d): refuses %s tagged commands. " | 3497 | printf("(%s:%c:%d:%d): refuses %s tagged commands. " |
@@ -3497,7 +3499,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) | |||
3497 | ahc_name(ahc), devinfo->channel, devinfo->target, | 3499 | ahc_name(ahc), devinfo->channel, devinfo->target, |
3498 | devinfo->lun, tag_type == MSG_ORDERED_TASK | 3500 | devinfo->lun, tag_type == MSG_ORDERED_TASK |
3499 | ? "ordered" : "head of queue"); | 3501 | ? "ordered" : "head of queue"); |
3500 | ahc_set_tags(ahc, devinfo, AHC_QUEUE_BASIC); | 3502 | ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_BASIC); |
3501 | mask = ~0x03; | 3503 | mask = ~0x03; |
3502 | } | 3504 | } |
3503 | 3505 | ||
@@ -3763,7 +3765,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
3763 | 3765 | ||
3764 | if (status != CAM_SEL_TIMEOUT) | 3766 | if (status != CAM_SEL_TIMEOUT) |
3765 | ahc_send_async(ahc, devinfo->channel, devinfo->target, | 3767 | ahc_send_async(ahc, devinfo->channel, devinfo->target, |
3766 | CAM_LUN_WILDCARD, AC_SENT_BDR, NULL); | 3768 | CAM_LUN_WILDCARD, AC_SENT_BDR); |
3767 | 3769 | ||
3768 | if (message != NULL | 3770 | if (message != NULL |
3769 | && (verbose_level <= bootverbose)) | 3771 | && (verbose_level <= bootverbose)) |
@@ -4406,7 +4408,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) | |||
4406 | physaddr = sg_map->sg_physaddr; | 4408 | physaddr = sg_map->sg_physaddr; |
4407 | 4409 | ||
4408 | newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg))); | 4410 | newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg))); |
4409 | newcount = MIN(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs)); | 4411 | newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs)); |
4410 | for (i = 0; i < newcount; i++) { | 4412 | for (i = 0; i < newcount; i++) { |
4411 | struct scb_platform_data *pdata; | 4413 | struct scb_platform_data *pdata; |
4412 | #ifndef __linux__ | 4414 | #ifndef __linux__ |
@@ -6018,7 +6020,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset) | |||
6018 | #endif | 6020 | #endif |
6019 | /* Notify the XPT that a bus reset occurred */ | 6021 | /* Notify the XPT that a bus reset occurred */ |
6020 | ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD, | 6022 | ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD, |
6021 | CAM_LUN_WILDCARD, AC_BUS_RESET, NULL); | 6023 | CAM_LUN_WILDCARD, AC_BUS_RESET); |
6022 | 6024 | ||
6023 | /* | 6025 | /* |
6024 | * Revert to async/narrow transfers until we renegotiate. | 6026 | * Revert to async/narrow transfers until we renegotiate. |
@@ -6442,7 +6444,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts) | |||
6442 | if (skip_addr > i) { | 6444 | if (skip_addr > i) { |
6443 | int end_addr; | 6445 | int end_addr; |
6444 | 6446 | ||
6445 | end_addr = MIN(address, skip_addr); | 6447 | end_addr = min(address, skip_addr); |
6446 | address_offset += end_addr - i; | 6448 | address_offset += end_addr - i; |
6447 | i = skip_addr; | 6449 | i = skip_addr; |
6448 | } else { | 6450 | } else { |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 43ab753d2739..660f26e23a38 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -328,7 +328,7 @@ static uint32_t aic7xxx_seltime; | |||
328 | * force all outstanding transactions to be serviced prior to a new | 328 | * force all outstanding transactions to be serviced prior to a new |
329 | * transaction. | 329 | * transaction. |
330 | */ | 330 | */ |
331 | uint32_t aic7xxx_periodic_otag; | 331 | static uint32_t aic7xxx_periodic_otag; |
332 | 332 | ||
333 | /* | 333 | /* |
334 | * Module information and settable options. | 334 | * Module information and settable options. |
@@ -512,7 +512,6 @@ ahc_linux_target_alloc(struct scsi_target *starget) | |||
512 | struct seeprom_config *sc = ahc->seep_config; | 512 | struct seeprom_config *sc = ahc->seep_config; |
513 | unsigned long flags; | 513 | unsigned long flags; |
514 | struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); | 514 | struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); |
515 | struct ahc_linux_target *targ = scsi_transport_target_data(starget); | ||
516 | unsigned short scsirate; | 515 | unsigned short scsirate; |
517 | struct ahc_devinfo devinfo; | 516 | struct ahc_devinfo devinfo; |
518 | struct ahc_initiator_tinfo *tinfo; | 517 | struct ahc_initiator_tinfo *tinfo; |
@@ -533,7 +532,6 @@ ahc_linux_target_alloc(struct scsi_target *starget) | |||
533 | BUG_ON(*ahc_targp != NULL); | 532 | BUG_ON(*ahc_targp != NULL); |
534 | 533 | ||
535 | *ahc_targp = starget; | 534 | *ahc_targp = starget; |
536 | memset(targ, 0, sizeof(*targ)); | ||
537 | 535 | ||
538 | if (sc) { | 536 | if (sc) { |
539 | int maxsync = AHC_SYNCRATE_DT; | 537 | int maxsync = AHC_SYNCRATE_DT; |
@@ -594,14 +592,11 @@ ahc_linux_slave_alloc(struct scsi_device *sdev) | |||
594 | struct ahc_softc *ahc = | 592 | struct ahc_softc *ahc = |
595 | *((struct ahc_softc **)sdev->host->hostdata); | 593 | *((struct ahc_softc **)sdev->host->hostdata); |
596 | struct scsi_target *starget = sdev->sdev_target; | 594 | struct scsi_target *starget = sdev->sdev_target; |
597 | struct ahc_linux_target *targ = scsi_transport_target_data(starget); | ||
598 | struct ahc_linux_device *dev; | 595 | struct ahc_linux_device *dev; |
599 | 596 | ||
600 | if (bootverbose) | 597 | if (bootverbose) |
601 | printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); | 598 | printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); |
602 | 599 | ||
603 | BUG_ON(targ->sdev[sdev->lun] != NULL); | ||
604 | |||
605 | dev = scsi_transport_device_data(sdev); | 600 | dev = scsi_transport_device_data(sdev); |
606 | memset(dev, 0, sizeof(*dev)); | 601 | memset(dev, 0, sizeof(*dev)); |
607 | 602 | ||
@@ -618,8 +613,6 @@ ahc_linux_slave_alloc(struct scsi_device *sdev) | |||
618 | */ | 613 | */ |
619 | dev->maxtags = 0; | 614 | dev->maxtags = 0; |
620 | 615 | ||
621 | targ->sdev[sdev->lun] = sdev; | ||
622 | |||
623 | spi_period(starget) = 0; | 616 | spi_period(starget) = 0; |
624 | 617 | ||
625 | return 0; | 618 | return 0; |
@@ -644,22 +637,6 @@ ahc_linux_slave_configure(struct scsi_device *sdev) | |||
644 | return 0; | 637 | return 0; |
645 | } | 638 | } |
646 | 639 | ||
647 | static void | ||
648 | ahc_linux_slave_destroy(struct scsi_device *sdev) | ||
649 | { | ||
650 | struct ahc_softc *ahc; | ||
651 | struct ahc_linux_device *dev = scsi_transport_device_data(sdev); | ||
652 | struct ahc_linux_target *targ = scsi_transport_target_data(sdev->sdev_target); | ||
653 | |||
654 | ahc = *((struct ahc_softc **)sdev->host->hostdata); | ||
655 | if (bootverbose) | ||
656 | printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id); | ||
657 | |||
658 | BUG_ON(dev->active); | ||
659 | |||
660 | targ->sdev[sdev->lun] = NULL; | ||
661 | } | ||
662 | |||
663 | #if defined(__i386__) | 640 | #if defined(__i386__) |
664 | /* | 641 | /* |
665 | * Return the disk geometry for the given SCSI device. | 642 | * Return the disk geometry for the given SCSI device. |
@@ -777,11 +754,11 @@ struct scsi_host_template aic7xxx_driver_template = { | |||
777 | #endif | 754 | #endif |
778 | .can_queue = AHC_MAX_QUEUE, | 755 | .can_queue = AHC_MAX_QUEUE, |
779 | .this_id = -1, | 756 | .this_id = -1, |
757 | .max_sectors = 8192, | ||
780 | .cmd_per_lun = 2, | 758 | .cmd_per_lun = 2, |
781 | .use_clustering = ENABLE_CLUSTERING, | 759 | .use_clustering = ENABLE_CLUSTERING, |
782 | .slave_alloc = ahc_linux_slave_alloc, | 760 | .slave_alloc = ahc_linux_slave_alloc, |
783 | .slave_configure = ahc_linux_slave_configure, | 761 | .slave_configure = ahc_linux_slave_configure, |
784 | .slave_destroy = ahc_linux_slave_destroy, | ||
785 | .target_alloc = ahc_linux_target_alloc, | 762 | .target_alloc = ahc_linux_target_alloc, |
786 | .target_destroy = ahc_linux_target_destroy, | 763 | .target_destroy = ahc_linux_target_destroy, |
787 | }; | 764 | }; |
@@ -1203,21 +1180,13 @@ void | |||
1203 | ahc_platform_free(struct ahc_softc *ahc) | 1180 | ahc_platform_free(struct ahc_softc *ahc) |
1204 | { | 1181 | { |
1205 | struct scsi_target *starget; | 1182 | struct scsi_target *starget; |
1206 | int i, j; | 1183 | int i; |
1207 | 1184 | ||
1208 | if (ahc->platform_data != NULL) { | 1185 | if (ahc->platform_data != NULL) { |
1209 | /* destroy all of the device and target objects */ | 1186 | /* destroy all of the device and target objects */ |
1210 | for (i = 0; i < AHC_NUM_TARGETS; i++) { | 1187 | for (i = 0; i < AHC_NUM_TARGETS; i++) { |
1211 | starget = ahc->platform_data->starget[i]; | 1188 | starget = ahc->platform_data->starget[i]; |
1212 | if (starget != NULL) { | 1189 | if (starget != NULL) { |
1213 | for (j = 0; j < AHC_NUM_LUNS; j++) { | ||
1214 | struct ahc_linux_target *targ = | ||
1215 | scsi_transport_target_data(starget); | ||
1216 | |||
1217 | if (targ->sdev[j] == NULL) | ||
1218 | continue; | ||
1219 | targ->sdev[j] = NULL; | ||
1220 | } | ||
1221 | ahc->platform_data->starget[i] = NULL; | 1190 | ahc->platform_data->starget[i] = NULL; |
1222 | } | 1191 | } |
1223 | } | 1192 | } |
@@ -1251,24 +1220,13 @@ ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb) | |||
1251 | } | 1220 | } |
1252 | 1221 | ||
1253 | void | 1222 | void |
1254 | ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | 1223 | ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev, |
1255 | ahc_queue_alg alg) | 1224 | struct ahc_devinfo *devinfo, ahc_queue_alg alg) |
1256 | { | 1225 | { |
1257 | struct scsi_target *starget; | ||
1258 | struct ahc_linux_target *targ; | ||
1259 | struct ahc_linux_device *dev; | 1226 | struct ahc_linux_device *dev; |
1260 | struct scsi_device *sdev; | ||
1261 | u_int target_offset; | ||
1262 | int was_queuing; | 1227 | int was_queuing; |
1263 | int now_queuing; | 1228 | int now_queuing; |
1264 | 1229 | ||
1265 | target_offset = devinfo->target; | ||
1266 | if (devinfo->channel != 'A') | ||
1267 | target_offset += 8; | ||
1268 | starget = ahc->platform_data->starget[target_offset]; | ||
1269 | targ = scsi_transport_target_data(starget); | ||
1270 | BUG_ON(targ == NULL); | ||
1271 | sdev = targ->sdev[devinfo->lun]; | ||
1272 | if (sdev == NULL) | 1230 | if (sdev == NULL) |
1273 | return; | 1231 | return; |
1274 | dev = scsi_transport_device_data(sdev); | 1232 | dev = scsi_transport_device_data(sdev); |
@@ -1401,11 +1359,15 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev) | |||
1401 | tags = ahc_linux_user_tagdepth(ahc, &devinfo); | 1359 | tags = ahc_linux_user_tagdepth(ahc, &devinfo); |
1402 | if (tags != 0 && sdev->tagged_supported != 0) { | 1360 | if (tags != 0 && sdev->tagged_supported != 0) { |
1403 | 1361 | ||
1404 | ahc_set_tags(ahc, &devinfo, AHC_QUEUE_TAGGED); | 1362 | ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_TAGGED); |
1363 | ahc_send_async(ahc, devinfo.channel, devinfo.target, | ||
1364 | devinfo.lun, AC_TRANSFER_NEG); | ||
1405 | ahc_print_devinfo(ahc, &devinfo); | 1365 | ahc_print_devinfo(ahc, &devinfo); |
1406 | printf("Tagged Queuing enabled. Depth %d\n", tags); | 1366 | printf("Tagged Queuing enabled. Depth %d\n", tags); |
1407 | } else { | 1367 | } else { |
1408 | ahc_set_tags(ahc, &devinfo, AHC_QUEUE_NONE); | 1368 | ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE); |
1369 | ahc_send_async(ahc, devinfo.channel, devinfo.target, | ||
1370 | devinfo.lun, AC_TRANSFER_NEG); | ||
1409 | } | 1371 | } |
1410 | } | 1372 | } |
1411 | 1373 | ||
@@ -1629,7 +1591,7 @@ ahc_platform_flushwork(struct ahc_softc *ahc) | |||
1629 | 1591 | ||
1630 | void | 1592 | void |
1631 | ahc_send_async(struct ahc_softc *ahc, char channel, | 1593 | ahc_send_async(struct ahc_softc *ahc, char channel, |
1632 | u_int target, u_int lun, ac_code code, void *arg) | 1594 | u_int target, u_int lun, ac_code code) |
1633 | { | 1595 | { |
1634 | switch (code) { | 1596 | switch (code) { |
1635 | case AC_TRANSFER_NEG: | 1597 | case AC_TRANSFER_NEG: |
@@ -1875,9 +1837,9 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, | |||
1875 | if (scb->flags & SCB_SENSE) { | 1837 | if (scb->flags & SCB_SENSE) { |
1876 | u_int sense_size; | 1838 | u_int sense_size; |
1877 | 1839 | ||
1878 | sense_size = MIN(sizeof(struct scsi_sense_data) | 1840 | sense_size = min(sizeof(struct scsi_sense_data) |
1879 | - ahc_get_sense_residual(scb), | 1841 | - ahc_get_sense_residual(scb), |
1880 | sizeof(cmd->sense_buffer)); | 1842 | (u_long)sizeof(cmd->sense_buffer)); |
1881 | memcpy(cmd->sense_buffer, | 1843 | memcpy(cmd->sense_buffer, |
1882 | ahc_get_sense_buf(ahc, scb), sense_size); | 1844 | ahc_get_sense_buf(ahc, scb), sense_size); |
1883 | if (sense_size < sizeof(cmd->sense_buffer)) | 1845 | if (sense_size < sizeof(cmd->sense_buffer)) |
@@ -1946,7 +1908,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, | |||
1946 | } | 1908 | } |
1947 | ahc_set_transaction_status(scb, CAM_REQUEUE_REQ); | 1909 | ahc_set_transaction_status(scb, CAM_REQUEUE_REQ); |
1948 | ahc_set_scsi_status(scb, SCSI_STATUS_OK); | 1910 | ahc_set_scsi_status(scb, SCSI_STATUS_OK); |
1949 | ahc_platform_set_tags(ahc, &devinfo, | 1911 | ahc_platform_set_tags(ahc, sdev, &devinfo, |
1950 | (dev->flags & AHC_DEV_Q_BASIC) | 1912 | (dev->flags & AHC_DEV_Q_BASIC) |
1951 | ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); | 1913 | ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); |
1952 | break; | 1914 | break; |
@@ -1957,7 +1919,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, | |||
1957 | */ | 1919 | */ |
1958 | dev->openings = 1; | 1920 | dev->openings = 1; |
1959 | ahc_set_scsi_status(scb, SCSI_STATUS_BUSY); | 1921 | ahc_set_scsi_status(scb, SCSI_STATUS_BUSY); |
1960 | ahc_platform_set_tags(ahc, &devinfo, | 1922 | ahc_platform_set_tags(ahc, sdev, &devinfo, |
1961 | (dev->flags & AHC_DEV_Q_BASIC) | 1923 | (dev->flags & AHC_DEV_Q_BASIC) |
1962 | ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); | 1924 | ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); |
1963 | break; | 1925 | break; |
@@ -2599,8 +2561,6 @@ ahc_linux_init(void) | |||
2599 | if (!ahc_linux_transport_template) | 2561 | if (!ahc_linux_transport_template) |
2600 | return -ENODEV; | 2562 | return -ENODEV; |
2601 | 2563 | ||
2602 | scsi_transport_reserve_target(ahc_linux_transport_template, | ||
2603 | sizeof(struct ahc_linux_target)); | ||
2604 | scsi_transport_reserve_device(ahc_linux_transport_template, | 2564 | scsi_transport_reserve_device(ahc_linux_transport_template, |
2605 | sizeof(struct ahc_linux_device)); | 2565 | sizeof(struct ahc_linux_device)); |
2606 | 2566 | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index a87a4ce090df..85ae5d836fa4 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h | |||
@@ -256,7 +256,6 @@ typedef enum { | |||
256 | AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ | 256 | AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ |
257 | } ahc_linux_dev_flags; | 257 | } ahc_linux_dev_flags; |
258 | 258 | ||
259 | struct ahc_linux_target; | ||
260 | struct ahc_linux_device { | 259 | struct ahc_linux_device { |
261 | /* | 260 | /* |
262 | * The number of transactions currently | 261 | * The number of transactions currently |
@@ -329,12 +328,6 @@ struct ahc_linux_device { | |||
329 | #define AHC_OTAG_THRESH 500 | 328 | #define AHC_OTAG_THRESH 500 |
330 | }; | 329 | }; |
331 | 330 | ||
332 | struct ahc_linux_target { | ||
333 | struct scsi_device *sdev[AHC_NUM_LUNS]; | ||
334 | struct ahc_transinfo last_tinfo; | ||
335 | struct ahc_softc *ahc; | ||
336 | }; | ||
337 | |||
338 | /********************* Definitions Required by the Core ***********************/ | 331 | /********************* Definitions Required by the Core ***********************/ |
339 | /* | 332 | /* |
340 | * Number of SG segments we require. So long as the S/G segments for | 333 | * Number of SG segments we require. So long as the S/G segments for |
@@ -533,8 +526,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags) | |||
533 | #define PCIR_SUBVEND_0 0x2c | 526 | #define PCIR_SUBVEND_0 0x2c |
534 | #define PCIR_SUBDEV_0 0x2e | 527 | #define PCIR_SUBDEV_0 0x2e |
535 | 528 | ||
536 | extern struct pci_driver aic7xxx_pci_driver; | ||
537 | |||
538 | typedef enum | 529 | typedef enum |
539 | { | 530 | { |
540 | AHC_POWER_STATE_D0, | 531 | AHC_POWER_STATE_D0, |
@@ -824,7 +815,7 @@ ahc_freeze_scb(struct scb *scb) | |||
824 | } | 815 | } |
825 | } | 816 | } |
826 | 817 | ||
827 | void ahc_platform_set_tags(struct ahc_softc *ahc, | 818 | void ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev, |
828 | struct ahc_devinfo *devinfo, ahc_queue_alg); | 819 | struct ahc_devinfo *devinfo, ahc_queue_alg); |
829 | int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, | 820 | int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, |
830 | char channel, int lun, u_int tag, | 821 | char channel, int lun, u_int tag, |
@@ -834,7 +825,7 @@ irqreturn_t | |||
834 | void ahc_platform_flushwork(struct ahc_softc *ahc); | 825 | void ahc_platform_flushwork(struct ahc_softc *ahc); |
835 | void ahc_done(struct ahc_softc*, struct scb*); | 826 | void ahc_done(struct ahc_softc*, struct scb*); |
836 | void ahc_send_async(struct ahc_softc *, char channel, | 827 | void ahc_send_async(struct ahc_softc *, char channel, |
837 | u_int target, u_int lun, ac_code, void *); | 828 | u_int target, u_int lun, ac_code); |
838 | void ahc_print_path(struct ahc_softc *, struct scb *); | 829 | void ahc_print_path(struct ahc_softc *, struct scb *); |
839 | void ahc_platform_dump_card_state(struct ahc_softc *ahc); | 830 | void ahc_platform_dump_card_state(struct ahc_softc *ahc); |
840 | 831 | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index d20ca514e9f3..ea5687df732d 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
@@ -130,7 +130,7 @@ static struct pci_device_id ahc_linux_pci_id_table[] = { | |||
130 | 130 | ||
131 | MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table); | 131 | MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table); |
132 | 132 | ||
133 | struct pci_driver aic7xxx_pci_driver = { | 133 | static struct pci_driver aic7xxx_pci_driver = { |
134 | .name = "aic7xxx", | 134 | .name = "aic7xxx", |
135 | .probe = ahc_linux_pci_dev_probe, | 135 | .probe = ahc_linux_pci_dev_probe, |
136 | .remove = ahc_linux_pci_dev_remove, | 136 | .remove = ahc_linux_pci_dev_remove, |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c index 63cab2d74552..09c8172c9e5e 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c | |||
@@ -168,7 +168,7 @@ static ahc_device_setup_t ahc_aha394XX_setup; | |||
168 | static ahc_device_setup_t ahc_aha494XX_setup; | 168 | static ahc_device_setup_t ahc_aha494XX_setup; |
169 | static ahc_device_setup_t ahc_aha398XX_setup; | 169 | static ahc_device_setup_t ahc_aha398XX_setup; |
170 | 170 | ||
171 | struct ahc_pci_identity ahc_pci_ident_table [] = | 171 | static struct ahc_pci_identity ahc_pci_ident_table [] = |
172 | { | 172 | { |
173 | /* aic7850 based controllers */ | 173 | /* aic7850 based controllers */ |
174 | { | 174 | { |
@@ -559,7 +559,7 @@ struct ahc_pci_identity ahc_pci_ident_table [] = | |||
559 | } | 559 | } |
560 | }; | 560 | }; |
561 | 561 | ||
562 | const u_int ahc_num_pci_devs = ARRAY_SIZE(ahc_pci_ident_table); | 562 | static const u_int ahc_num_pci_devs = ARRAY_SIZE(ahc_pci_ident_table); |
563 | 563 | ||
564 | #define AHC_394X_SLOT_CHANNEL_A 4 | 564 | #define AHC_394X_SLOT_CHANNEL_A 4 |
565 | #define AHC_394X_SLOT_CHANNEL_B 5 | 565 | #define AHC_394X_SLOT_CHANNEL_B 5 |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 5914b4aa4a8f..99e5443e7535 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
@@ -182,7 +182,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
182 | u_int our_id, char channel, u_int target_id, | 182 | u_int our_id, char channel, u_int target_id, |
183 | u_int target_offset) | 183 | u_int target_offset) |
184 | { | 184 | { |
185 | struct ahc_linux_target *targ; | ||
186 | struct scsi_target *starget; | 185 | struct scsi_target *starget; |
187 | struct ahc_initiator_tinfo *tinfo; | 186 | struct ahc_initiator_tinfo *tinfo; |
188 | struct ahc_tmode_tstate *tstate; | 187 | struct ahc_tmode_tstate *tstate; |
@@ -198,7 +197,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
198 | starget = ahc->platform_data->starget[target_offset]; | 197 | starget = ahc->platform_data->starget[target_offset]; |
199 | if (!starget) | 198 | if (!starget) |
200 | return; | 199 | return; |
201 | targ = scsi_transport_target_data(starget); | ||
202 | 200 | ||
203 | copy_info(info, "\tGoal: "); | 201 | copy_info(info, "\tGoal: "); |
204 | ahc_format_transinfo(info, &tinfo->goal); | 202 | ahc_format_transinfo(info, &tinfo->goal); |
@@ -208,7 +206,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
208 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { | 206 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { |
209 | struct scsi_device *sdev; | 207 | struct scsi_device *sdev; |
210 | 208 | ||
211 | sdev = targ->sdev[lun]; | 209 | sdev = scsi_device_lookup_by_target(starget, lun); |
212 | 210 | ||
213 | if (sdev == NULL) | 211 | if (sdev == NULL) |
214 | continue; | 212 | continue; |
@@ -383,11 +381,11 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
383 | } | 381 | } |
384 | copy_info(&info, "\n"); | 382 | copy_info(&info, "\n"); |
385 | 383 | ||
386 | max_targ = 15; | 384 | max_targ = 16; |
387 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) | 385 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) |
388 | max_targ = 7; | 386 | max_targ = 8; |
389 | 387 | ||
390 | for (i = 0; i <= max_targ; i++) { | 388 | for (i = 0; i < max_targ; i++) { |
391 | u_int our_id; | 389 | u_int our_id; |
392 | u_int target_id; | 390 | u_int target_id; |
393 | char channel; | 391 | char channel; |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index bcd7fffab907..46eed10b25d9 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -2646,7 +2646,7 @@ static void aic7xxx_done_cmds_complete(struct aic7xxx_host *p) | |||
2646 | 2646 | ||
2647 | while (p->completeq.head != NULL) { | 2647 | while (p->completeq.head != NULL) { |
2648 | cmd = p->completeq.head; | 2648 | cmd = p->completeq.head; |
2649 | p->completeq.head = (struct scsi_Cmnd *) cmd->host_scribble; | 2649 | p->completeq.head = (struct scsi_cmnd *) cmd->host_scribble; |
2650 | cmd->host_scribble = NULL; | 2650 | cmd->host_scribble = NULL; |
2651 | cmd->scsi_done(cmd); | 2651 | cmd->scsi_done(cmd); |
2652 | } | 2652 | } |
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c index 3c2d7a379931..af7e01134364 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.c +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c | |||
@@ -112,6 +112,21 @@ static int asd_init_phy(struct asd_phy *phy) | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void asd_init_ports(struct asd_ha_struct *asd_ha) | ||
116 | { | ||
117 | int i; | ||
118 | |||
119 | spin_lock_init(&asd_ha->asd_ports_lock); | ||
120 | for (i = 0; i < ASD_MAX_PHYS; i++) { | ||
121 | struct asd_port *asd_port = &asd_ha->asd_ports[i]; | ||
122 | |||
123 | memset(asd_port->sas_addr, 0, SAS_ADDR_SIZE); | ||
124 | memset(asd_port->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
125 | asd_port->phy_mask = 0; | ||
126 | asd_port->num_phys = 0; | ||
127 | } | ||
128 | } | ||
129 | |||
115 | static int asd_init_phys(struct asd_ha_struct *asd_ha) | 130 | static int asd_init_phys(struct asd_ha_struct *asd_ha) |
116 | { | 131 | { |
117 | u8 i; | 132 | u8 i; |
@@ -121,6 +136,7 @@ static int asd_init_phys(struct asd_ha_struct *asd_ha) | |||
121 | struct asd_phy *phy = &asd_ha->phys[i]; | 136 | struct asd_phy *phy = &asd_ha->phys[i]; |
122 | 137 | ||
123 | phy->phy_desc = &asd_ha->hw_prof.phy_desc[i]; | 138 | phy->phy_desc = &asd_ha->hw_prof.phy_desc[i]; |
139 | phy->asd_port = NULL; | ||
124 | 140 | ||
125 | phy->sas_phy.enabled = 0; | 141 | phy->sas_phy.enabled = 0; |
126 | phy->sas_phy.id = i; | 142 | phy->sas_phy.id = i; |
@@ -658,6 +674,8 @@ int asd_init_hw(struct asd_ha_struct *asd_ha) | |||
658 | goto Out; | 674 | goto Out; |
659 | } | 675 | } |
660 | 676 | ||
677 | asd_init_ports(asd_ha); | ||
678 | |||
661 | err = asd_init_scbs(asd_ha); | 679 | err = asd_init_scbs(asd_ha); |
662 | if (err) { | 680 | if (err) { |
663 | asd_printk("couldn't initialize scbs for %s\n", | 681 | asd_printk("couldn't initialize scbs for %s\n", |
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.h b/drivers/scsi/aic94xx/aic94xx_hwi.h index 14319d1d6804..c6c3d18222fa 100644 --- a/drivers/scsi/aic94xx/aic94xx_hwi.h +++ b/drivers/scsi/aic94xx/aic94xx_hwi.h | |||
@@ -46,6 +46,7 @@ | |||
46 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR10 0x410 | 46 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR10 0x410 |
47 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR12 0x412 | 47 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR12 0x412 |
48 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR1E 0x41E | 48 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR1E 0x41E |
49 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR1F 0x41F | ||
49 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR30 0x430 | 50 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR30 0x430 |
50 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR32 0x432 | 51 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR32 0x432 |
51 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR3E 0x43E | 52 | #define PCI_DEVICE_ID_ADAPTEC2_RAZOR3E 0x43E |
@@ -192,6 +193,16 @@ struct asd_seq_data { | |||
192 | struct asd_ascb **escb_arr; /* array of pointers to escbs */ | 193 | struct asd_ascb **escb_arr; /* array of pointers to escbs */ |
193 | }; | 194 | }; |
194 | 195 | ||
196 | /* This is an internal port structure. These are used to get accurate | ||
197 | * phy_mask for updating DDB 0. | ||
198 | */ | ||
199 | struct asd_port { | ||
200 | u8 sas_addr[SAS_ADDR_SIZE]; | ||
201 | u8 attached_sas_addr[SAS_ADDR_SIZE]; | ||
202 | u32 phy_mask; | ||
203 | int num_phys; | ||
204 | }; | ||
205 | |||
195 | /* This is the Host Adapter structure. It describes the hardware | 206 | /* This is the Host Adapter structure. It describes the hardware |
196 | * SAS adapter. | 207 | * SAS adapter. |
197 | */ | 208 | */ |
@@ -210,6 +221,8 @@ struct asd_ha_struct { | |||
210 | struct hw_profile hw_prof; | 221 | struct hw_profile hw_prof; |
211 | 222 | ||
212 | struct asd_phy phys[ASD_MAX_PHYS]; | 223 | struct asd_phy phys[ASD_MAX_PHYS]; |
224 | spinlock_t asd_ports_lock; | ||
225 | struct asd_port asd_ports[ASD_MAX_PHYS]; | ||
213 | struct asd_sas_port ports[ASD_MAX_PHYS]; | 226 | struct asd_sas_port ports[ASD_MAX_PHYS]; |
214 | 227 | ||
215 | struct dma_pool *scb_pool; | 228 | struct dma_pool *scb_pool; |
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 3a5bbba3976e..42302ef05ee5 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c | |||
@@ -795,8 +795,6 @@ static void asd_remove_driver_attrs(struct device_driver *driver) | |||
795 | } | 795 | } |
796 | 796 | ||
797 | static struct sas_domain_function_template aic94xx_transport_functions = { | 797 | static struct sas_domain_function_template aic94xx_transport_functions = { |
798 | .lldd_port_formed = asd_update_port_links, | ||
799 | |||
800 | .lldd_dev_found = asd_dev_found, | 798 | .lldd_dev_found = asd_dev_found, |
801 | .lldd_dev_gone = asd_dev_gone, | 799 | .lldd_dev_gone = asd_dev_gone, |
802 | 800 | ||
@@ -823,6 +821,8 @@ static const struct pci_device_id aic94xx_pci_table[] __devinitdata = { | |||
823 | 0, 0, 1}, | 821 | 0, 0, 1}, |
824 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1E), | 822 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1E), |
825 | 0, 0, 1}, | 823 | 0, 0, 1}, |
824 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR1F), | ||
825 | 0, 0, 1}, | ||
826 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR30), | 826 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR30), |
827 | 0, 0, 2}, | 827 | 0, 0, 2}, |
828 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR32), | 828 | {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, PCI_DEVICE_ID_ADAPTEC2_RAZOR32), |
diff --git a/drivers/scsi/aic94xx/aic94xx_sas.h b/drivers/scsi/aic94xx/aic94xx_sas.h index 64d231712345..9050e93bfd5e 100644 --- a/drivers/scsi/aic94xx/aic94xx_sas.h +++ b/drivers/scsi/aic94xx/aic94xx_sas.h | |||
@@ -733,6 +733,7 @@ struct asd_phy { | |||
733 | 733 | ||
734 | struct sas_identify_frame *identify_frame; | 734 | struct sas_identify_frame *identify_frame; |
735 | struct asd_dma_tok *id_frm_tok; | 735 | struct asd_dma_tok *id_frm_tok; |
736 | struct asd_port *asd_port; | ||
736 | 737 | ||
737 | u8 frame_rcvd[ASD_EDB_SIZE]; | 738 | u8 frame_rcvd[ASD_EDB_SIZE]; |
738 | }; | 739 | }; |
diff --git a/drivers/scsi/aic94xx/aic94xx_scb.c b/drivers/scsi/aic94xx/aic94xx_scb.c index 52c6ea4fbf71..14d5d8c2ee13 100644 --- a/drivers/scsi/aic94xx/aic94xx_scb.c +++ b/drivers/scsi/aic94xx/aic94xx_scb.c | |||
@@ -169,6 +169,70 @@ static inline void asd_get_attached_sas_addr(struct asd_phy *phy, u8 *sas_addr) | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | static void asd_form_port(struct asd_ha_struct *asd_ha, struct asd_phy *phy) | ||
173 | { | ||
174 | int i; | ||
175 | struct asd_port *free_port = NULL; | ||
176 | struct asd_port *port; | ||
177 | struct asd_sas_phy *sas_phy = &phy->sas_phy; | ||
178 | unsigned long flags; | ||
179 | |||
180 | spin_lock_irqsave(&asd_ha->asd_ports_lock, flags); | ||
181 | if (!phy->asd_port) { | ||
182 | for (i = 0; i < ASD_MAX_PHYS; i++) { | ||
183 | port = &asd_ha->asd_ports[i]; | ||
184 | |||
185 | /* Check for wide port */ | ||
186 | if (port->num_phys > 0 && | ||
187 | memcmp(port->sas_addr, sas_phy->sas_addr, | ||
188 | SAS_ADDR_SIZE) == 0 && | ||
189 | memcmp(port->attached_sas_addr, | ||
190 | sas_phy->attached_sas_addr, | ||
191 | SAS_ADDR_SIZE) == 0) { | ||
192 | break; | ||
193 | } | ||
194 | |||
195 | /* Find a free port */ | ||
196 | if (port->num_phys == 0 && free_port == NULL) { | ||
197 | free_port = port; | ||
198 | } | ||
199 | } | ||
200 | |||
201 | /* Use a free port if this doesn't form a wide port */ | ||
202 | if (i >= ASD_MAX_PHYS) { | ||
203 | port = free_port; | ||
204 | BUG_ON(!port); | ||
205 | memcpy(port->sas_addr, sas_phy->sas_addr, | ||
206 | SAS_ADDR_SIZE); | ||
207 | memcpy(port->attached_sas_addr, | ||
208 | sas_phy->attached_sas_addr, | ||
209 | SAS_ADDR_SIZE); | ||
210 | } | ||
211 | port->num_phys++; | ||
212 | port->phy_mask |= (1U << sas_phy->id); | ||
213 | phy->asd_port = port; | ||
214 | } | ||
215 | ASD_DPRINTK("%s: updating phy_mask 0x%x for phy%d\n", | ||
216 | __FUNCTION__, phy->asd_port->phy_mask, sas_phy->id); | ||
217 | asd_update_port_links(asd_ha, phy); | ||
218 | spin_unlock_irqrestore(&asd_ha->asd_ports_lock, flags); | ||
219 | } | ||
220 | |||
221 | static void asd_deform_port(struct asd_ha_struct *asd_ha, struct asd_phy *phy) | ||
222 | { | ||
223 | struct asd_port *port = phy->asd_port; | ||
224 | struct asd_sas_phy *sas_phy = &phy->sas_phy; | ||
225 | unsigned long flags; | ||
226 | |||
227 | spin_lock_irqsave(&asd_ha->asd_ports_lock, flags); | ||
228 | if (port) { | ||
229 | port->num_phys--; | ||
230 | port->phy_mask &= ~(1U << sas_phy->id); | ||
231 | phy->asd_port = NULL; | ||
232 | } | ||
233 | spin_unlock_irqrestore(&asd_ha->asd_ports_lock, flags); | ||
234 | } | ||
235 | |||
172 | static inline void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb, | 236 | static inline void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb, |
173 | struct done_list_struct *dl, | 237 | struct done_list_struct *dl, |
174 | int edb_id, int phy_id) | 238 | int edb_id, int phy_id) |
@@ -188,6 +252,7 @@ static inline void asd_bytes_dmaed_tasklet(struct asd_ascb *ascb, | |||
188 | asd_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); | 252 | asd_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); |
189 | spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); | 253 | spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); |
190 | asd_dump_frame_rcvd(phy, dl); | 254 | asd_dump_frame_rcvd(phy, dl); |
255 | asd_form_port(ascb->ha, phy); | ||
191 | sas_ha->notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED); | 256 | sas_ha->notify_port_event(&phy->sas_phy, PORTE_BYTES_DMAED); |
192 | } | 257 | } |
193 | 258 | ||
@@ -198,6 +263,7 @@ static inline void asd_link_reset_err_tasklet(struct asd_ascb *ascb, | |||
198 | struct asd_ha_struct *asd_ha = ascb->ha; | 263 | struct asd_ha_struct *asd_ha = ascb->ha; |
199 | struct sas_ha_struct *sas_ha = &asd_ha->sas_ha; | 264 | struct sas_ha_struct *sas_ha = &asd_ha->sas_ha; |
200 | struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; | 265 | struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; |
266 | struct asd_phy *phy = &asd_ha->phys[phy_id]; | ||
201 | u8 lr_error = dl->status_block[1]; | 267 | u8 lr_error = dl->status_block[1]; |
202 | u8 retries_left = dl->status_block[2]; | 268 | u8 retries_left = dl->status_block[2]; |
203 | 269 | ||
@@ -222,6 +288,7 @@ static inline void asd_link_reset_err_tasklet(struct asd_ascb *ascb, | |||
222 | 288 | ||
223 | asd_turn_led(asd_ha, phy_id, 0); | 289 | asd_turn_led(asd_ha, phy_id, 0); |
224 | sas_phy_disconnected(sas_phy); | 290 | sas_phy_disconnected(sas_phy); |
291 | asd_deform_port(asd_ha, phy); | ||
225 | sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); | 292 | sas_ha->notify_port_event(sas_phy, PORTE_LINK_RESET_ERR); |
226 | 293 | ||
227 | if (retries_left == 0) { | 294 | if (retries_left == 0) { |
@@ -249,6 +316,8 @@ static inline void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb, | |||
249 | unsigned long flags; | 316 | unsigned long flags; |
250 | struct sas_ha_struct *sas_ha = &ascb->ha->sas_ha; | 317 | struct sas_ha_struct *sas_ha = &ascb->ha->sas_ha; |
251 | struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; | 318 | struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; |
319 | struct asd_ha_struct *asd_ha = ascb->ha; | ||
320 | struct asd_phy *phy = &asd_ha->phys[phy_id]; | ||
252 | u8 reg = dl->status_block[1]; | 321 | u8 reg = dl->status_block[1]; |
253 | u32 cont = dl->status_block[2] << ((reg & 3)*8); | 322 | u32 cont = dl->status_block[2] << ((reg & 3)*8); |
254 | 323 | ||
@@ -285,6 +354,7 @@ static inline void asd_primitive_rcvd_tasklet(struct asd_ascb *ascb, | |||
285 | phy_id); | 354 | phy_id); |
286 | /* The sequencer disables all phys on that port. | 355 | /* The sequencer disables all phys on that port. |
287 | * We have to re-enable the phys ourselves. */ | 356 | * We have to re-enable the phys ourselves. */ |
357 | asd_deform_port(asd_ha, phy); | ||
288 | sas_ha->notify_port_event(sas_phy, PORTE_HARD_RESET); | 358 | sas_ha->notify_port_event(sas_phy, PORTE_HARD_RESET); |
289 | break; | 359 | break; |
290 | 360 | ||
@@ -385,6 +455,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb, | |||
385 | u8 sb_opcode = dl->status_block[0]; | 455 | u8 sb_opcode = dl->status_block[0]; |
386 | int phy_id = sb_opcode & DL_PHY_MASK; | 456 | int phy_id = sb_opcode & DL_PHY_MASK; |
387 | struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; | 457 | struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; |
458 | struct asd_phy *phy = &asd_ha->phys[phy_id]; | ||
388 | 459 | ||
389 | if (edb > 6 || edb < 0) { | 460 | if (edb > 6 || edb < 0) { |
390 | ASD_DPRINTK("edb is 0x%x! dl->opcode is 0x%x\n", | 461 | ASD_DPRINTK("edb is 0x%x! dl->opcode is 0x%x\n", |
@@ -497,6 +568,7 @@ static void escb_tasklet_complete(struct asd_ascb *ascb, | |||
497 | asd_turn_led(asd_ha, phy_id, 0); | 568 | asd_turn_led(asd_ha, phy_id, 0); |
498 | /* the device is gone */ | 569 | /* the device is gone */ |
499 | sas_phy_disconnected(sas_phy); | 570 | sas_phy_disconnected(sas_phy); |
571 | asd_deform_port(asd_ha, phy); | ||
500 | sas_ha->notify_port_event(sas_phy, PORTE_TIMER_EVENT); | 572 | sas_ha->notify_port_event(sas_phy, PORTE_TIMER_EVENT); |
501 | break; | 573 | break; |
502 | default: | 574 | default: |
diff --git a/drivers/scsi/aic94xx/aic94xx_sds.c b/drivers/scsi/aic94xx/aic94xx_sds.c index 83574b5b4e69..de7c04d4254d 100644 --- a/drivers/scsi/aic94xx/aic94xx_sds.c +++ b/drivers/scsi/aic94xx/aic94xx_sds.c | |||
@@ -630,10 +630,6 @@ static int asd_flash_getid(struct asd_ha_struct *asd_ha) | |||
630 | 630 | ||
631 | reg = asd_read_reg_dword(asd_ha, EXSICNFGR); | 631 | reg = asd_read_reg_dword(asd_ha, EXSICNFGR); |
632 | 632 | ||
633 | if (!(reg & FLASHEX)) { | ||
634 | ASD_DPRINTK("flash doesn't exist\n"); | ||
635 | return -ENOENT; | ||
636 | } | ||
637 | if (pci_read_config_dword(asd_ha->pcidev, PCI_CONF_FLSH_BAR, | 633 | if (pci_read_config_dword(asd_ha->pcidev, PCI_CONF_FLSH_BAR, |
638 | &asd_ha->hw_prof.flash.bar)) { | 634 | &asd_ha->hw_prof.flash.bar)) { |
639 | asd_printk("couldn't read PCI_CONF_FLSH_BAR of %s\n", | 635 | asd_printk("couldn't read PCI_CONF_FLSH_BAR of %s\n", |
diff --git a/drivers/scsi/aic94xx/aic94xx_seq.c b/drivers/scsi/aic94xx/aic94xx_seq.c index 56e4b3ba6a08..845112539d05 100644 --- a/drivers/scsi/aic94xx/aic94xx_seq.c +++ b/drivers/scsi/aic94xx/aic94xx_seq.c | |||
@@ -1369,10 +1369,9 @@ int asd_start_seqs(struct asd_ha_struct *asd_ha) | |||
1369 | * port_map_by_links is also used as the conn_mask byte in the | 1369 | * port_map_by_links is also used as the conn_mask byte in the |
1370 | * initiator/target port DDB. | 1370 | * initiator/target port DDB. |
1371 | */ | 1371 | */ |
1372 | void asd_update_port_links(struct asd_sas_phy *sas_phy) | 1372 | void asd_update_port_links(struct asd_ha_struct *asd_ha, struct asd_phy *phy) |
1373 | { | 1373 | { |
1374 | struct asd_ha_struct *asd_ha = sas_phy->ha->lldd_ha; | 1374 | const u8 phy_mask = (u8) phy->asd_port->phy_mask; |
1375 | const u8 phy_mask = (u8) sas_phy->port->phy_mask; | ||
1376 | u8 phy_is_up; | 1375 | u8 phy_is_up; |
1377 | u8 mask; | 1376 | u8 mask; |
1378 | int i, err; | 1377 | int i, err; |
diff --git a/drivers/scsi/aic94xx/aic94xx_seq.h b/drivers/scsi/aic94xx/aic94xx_seq.h index 42281c36153b..9e715e5496af 100644 --- a/drivers/scsi/aic94xx/aic94xx_seq.h +++ b/drivers/scsi/aic94xx/aic94xx_seq.h | |||
@@ -64,7 +64,7 @@ int asd_unpause_lseq(struct asd_ha_struct *asd_ha, u8 lseq_mask); | |||
64 | int asd_init_seqs(struct asd_ha_struct *asd_ha); | 64 | int asd_init_seqs(struct asd_ha_struct *asd_ha); |
65 | int asd_start_seqs(struct asd_ha_struct *asd_ha); | 65 | int asd_start_seqs(struct asd_ha_struct *asd_ha); |
66 | 66 | ||
67 | void asd_update_port_links(struct asd_sas_phy *phy); | 67 | void asd_update_port_links(struct asd_ha_struct *asd_ha, struct asd_phy *phy); |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #endif | 70 | #endif |
diff --git a/drivers/scsi/dpt/dpti_i2o.h b/drivers/scsi/dpt/dpti_i2o.h index b3fa7ed71faf..5a49216fe4cf 100644 --- a/drivers/scsi/dpt/dpti_i2o.h +++ b/drivers/scsi/dpt/dpti_i2o.h | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | #include <linux/wait.h> | 50 | #include <linux/wait.h> |
51 | typedef wait_queue_head_t adpt_wait_queue_head_t; | 51 | typedef wait_queue_head_t adpt_wait_queue_head_t; |
52 | #define ADPT_DECLARE_WAIT_QUEUE_HEAD(wait) DECLARE_WAIT_QUEUE_HEAD(wait) | 52 | #define ADPT_DECLARE_WAIT_QUEUE_HEAD(wait) DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait) |
53 | typedef wait_queue_t adpt_wait_queue_t; | 53 | typedef wait_queue_t adpt_wait_queue_t; |
54 | 54 | ||
55 | /* | 55 | /* |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 0d5713dfa204..54756722dd5f 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -82,7 +82,7 @@ | |||
82 | #include <linux/string.h> | 82 | #include <linux/string.h> |
83 | #include <linux/init.h> | 83 | #include <linux/init.h> |
84 | #include <linux/interrupt.h> | 84 | #include <linux/interrupt.h> |
85 | #include <asm/io.h> | 85 | #include <linux/io.h> |
86 | #include "scsi.h" | 86 | #include "scsi.h" |
87 | #include <scsi/scsi_host.h> | 87 | #include <scsi/scsi_host.h> |
88 | #include "dtc.h" | 88 | #include "dtc.h" |
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 811d8840707e..2dbb66d2f0a7 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c | |||
@@ -203,7 +203,7 @@ static irqreturn_t do_eata_pio_int_handler(int irq, void *dev_id) | |||
203 | irqreturn_t ret; | 203 | irqreturn_t ret; |
204 | 204 | ||
205 | spin_lock_irqsave(dev->host_lock, flags); | 205 | spin_lock_irqsave(dev->host_lock, flags); |
206 | ret = eata_pio_int_handler(irq, dev_id, regs); | 206 | ret = eata_pio_int_handler(irq, dev_id); |
207 | spin_unlock_irqrestore(dev->host_lock, flags); | 207 | spin_unlock_irqrestore(dev->host_lock, flags); |
208 | return ret; | 208 | return ret; |
209 | } | 209 | } |
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 41b05fc45380..5d4ea6f77953 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c | |||
@@ -278,9 +278,9 @@ | |||
278 | #include <linux/pci.h> | 278 | #include <linux/pci.h> |
279 | #include <linux/stat.h> | 279 | #include <linux/stat.h> |
280 | #include <linux/delay.h> | 280 | #include <linux/delay.h> |
281 | #include <linux/io.h> | ||
281 | #include <scsi/scsicam.h> | 282 | #include <scsi/scsicam.h> |
282 | 283 | ||
283 | #include <asm/io.h> | ||
284 | #include <asm/system.h> | 284 | #include <asm/system.h> |
285 | 285 | ||
286 | #include <scsi/scsi.h> | 286 | #include <scsi/scsi.h> |
@@ -387,6 +387,7 @@ static void __iomem * bios_mem; | |||
387 | static int bios_major; | 387 | static int bios_major; |
388 | static int bios_minor; | 388 | static int bios_minor; |
389 | static int PCI_bus; | 389 | static int PCI_bus; |
390 | static struct pci_dev *PCI_dev; | ||
390 | static int Quantum; /* Quantum board variant */ | 391 | static int Quantum; /* Quantum board variant */ |
391 | static int interrupt_level; | 392 | static int interrupt_level; |
392 | static volatile int in_command; | 393 | static volatile int in_command; |
@@ -812,9 +813,10 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_ | |||
812 | PCI_DEVICE_ID_FD_36C70 ); | 813 | PCI_DEVICE_ID_FD_36C70 ); |
813 | #endif | 814 | #endif |
814 | 815 | ||
815 | if ((pdev = pci_find_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL) | 816 | if ((pdev = pci_get_device(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, pdev)) == NULL) |
816 | return 0; | 817 | return 0; |
817 | if (pci_enable_device(pdev)) return 0; | 818 | if (pci_enable_device(pdev)) |
819 | goto fail; | ||
818 | 820 | ||
819 | #if DEBUG_DETECT | 821 | #if DEBUG_DETECT |
820 | printk( "scsi: <fdomain> TMC-3260 detect:" | 822 | printk( "scsi: <fdomain> TMC-3260 detect:" |
@@ -831,7 +833,7 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_ | |||
831 | pci_irq = pdev->irq; | 833 | pci_irq = pdev->irq; |
832 | 834 | ||
833 | if (!request_region( pci_base, 0x10, "fdomain" )) | 835 | if (!request_region( pci_base, 0x10, "fdomain" )) |
834 | return 0; | 836 | goto fail; |
835 | 837 | ||
836 | /* Now we have the I/O base address and interrupt from the PCI | 838 | /* Now we have the I/O base address and interrupt from the PCI |
837 | configuration registers. */ | 839 | configuration registers. */ |
@@ -848,17 +850,22 @@ static int fdomain_pci_bios_detect( int *irq, int *iobase, struct pci_dev **ret_ | |||
848 | if (!fdomain_is_valid_port(pci_base)) { | 850 | if (!fdomain_is_valid_port(pci_base)) { |
849 | printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" ); | 851 | printk(KERN_ERR "scsi: <fdomain> PCI card detected, but driver not loaded (invalid port)\n" ); |
850 | release_region(pci_base, 0x10); | 852 | release_region(pci_base, 0x10); |
851 | return 0; | 853 | goto fail; |
852 | } | 854 | } |
853 | 855 | ||
854 | /* Fill in a few global variables. Ugh. */ | 856 | /* Fill in a few global variables. Ugh. */ |
855 | bios_major = bios_minor = -1; | 857 | bios_major = bios_minor = -1; |
856 | PCI_bus = 1; | 858 | PCI_bus = 1; |
859 | PCI_dev = pdev; | ||
857 | Quantum = 0; | 860 | Quantum = 0; |
858 | bios_base = 0; | 861 | bios_base = 0; |
859 | 862 | ||
860 | return 1; | 863 | return 1; |
864 | fail: | ||
865 | pci_dev_put(pdev); | ||
866 | return 0; | ||
861 | } | 867 | } |
868 | |||
862 | #endif | 869 | #endif |
863 | 870 | ||
864 | struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | 871 | struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) |
@@ -909,8 +916,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | |||
909 | if (setup_called) { | 916 | if (setup_called) { |
910 | printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n"); | 917 | printk(KERN_ERR "scsi: <fdomain> Bad LILO/INSMOD parameters?\n"); |
911 | } | 918 | } |
912 | release_region(port_base, 0x10); | 919 | goto fail; |
913 | return NULL; | ||
914 | } | 920 | } |
915 | 921 | ||
916 | if (this_id) { | 922 | if (this_id) { |
@@ -942,8 +948,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | |||
942 | /* Log IRQ with kernel */ | 948 | /* Log IRQ with kernel */ |
943 | if (!interrupt_level) { | 949 | if (!interrupt_level) { |
944 | printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" ); | 950 | printk(KERN_ERR "scsi: <fdomain> Card Detected, but driver not loaded (no IRQ)\n" ); |
945 | release_region(port_base, 0x10); | 951 | goto fail; |
946 | return NULL; | ||
947 | } else { | 952 | } else { |
948 | /* Register the IRQ with the kernel */ | 953 | /* Register the IRQ with the kernel */ |
949 | 954 | ||
@@ -964,11 +969,14 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) | |||
964 | printk(KERN_ERR " Send mail to faith@acm.org\n" ); | 969 | printk(KERN_ERR " Send mail to faith@acm.org\n" ); |
965 | } | 970 | } |
966 | printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" ); | 971 | printk(KERN_ERR "scsi: <fdomain> Detected, but driver not loaded (IRQ)\n" ); |
967 | release_region(port_base, 0x10); | 972 | goto fail; |
968 | return NULL; | ||
969 | } | 973 | } |
970 | } | 974 | } |
971 | return shpnt; | 975 | return shpnt; |
976 | fail: | ||
977 | pci_dev_put(pdev); | ||
978 | release_region(port_base, 0x10); | ||
979 | return NULL; | ||
972 | } | 980 | } |
973 | 981 | ||
974 | static int fdomain_16x0_detect(struct scsi_host_template *tpnt) | 982 | static int fdomain_16x0_detect(struct scsi_host_template *tpnt) |
@@ -1714,6 +1722,8 @@ static int fdomain_16x0_release(struct Scsi_Host *shpnt) | |||
1714 | free_irq(shpnt->irq, shpnt); | 1722 | free_irq(shpnt->irq, shpnt); |
1715 | if (shpnt->io_port && shpnt->n_io_port) | 1723 | if (shpnt->io_port && shpnt->n_io_port) |
1716 | release_region(shpnt->io_port, shpnt->n_io_port); | 1724 | release_region(shpnt->io_port, shpnt->n_io_port); |
1725 | if (PCI_bus) | ||
1726 | pci_dev_put(PCI_dev); | ||
1717 | return 0; | 1727 | return 0; |
1718 | } | 1728 | } |
1719 | 1729 | ||
@@ -1736,6 +1746,15 @@ struct scsi_host_template fdomain_driver_template = { | |||
1736 | }; | 1746 | }; |
1737 | 1747 | ||
1738 | #ifndef PCMCIA | 1748 | #ifndef PCMCIA |
1749 | |||
1750 | static struct pci_device_id fdomain_pci_tbl[] __devinitdata = { | ||
1751 | { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, | ||
1752 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, | ||
1753 | { } | ||
1754 | }; | ||
1755 | MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl); | ||
1756 | |||
1739 | #define driver_template fdomain_driver_template | 1757 | #define driver_template fdomain_driver_template |
1740 | #include "scsi_module.c" | 1758 | #include "scsi_module.c" |
1759 | |||
1741 | #endif | 1760 | #endif |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 4bc14ad92e22..4c698a71f66f 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -3531,7 +3531,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id) | |||
3531 | IStatus &= ~0x80; | 3531 | IStatus &= ~0x80; |
3532 | #ifdef INT_COAL | 3532 | #ifdef INT_COAL |
3533 | if (coalesced) | 3533 | if (coalesced) |
3534 | ha->status = pcs->ext_status && 0xffff; | 3534 | ha->status = pcs->ext_status & 0xffff; |
3535 | else | 3535 | else |
3536 | #endif | 3536 | #endif |
3537 | ha->status = gdth_readw(&dp6m_ptr->i960r.status); | 3537 | ha->status = gdth_readw(&dp6m_ptr->i960r.status); |
@@ -3543,7 +3543,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id) | |||
3543 | if (coalesced) { | 3543 | if (coalesced) { |
3544 | ha->info = pcs->info0; | 3544 | ha->info = pcs->info0; |
3545 | ha->info2 = pcs->info1; | 3545 | ha->info2 = pcs->info1; |
3546 | ha->service = (pcs->ext_status >> 16) && 0xffff; | 3546 | ha->service = (pcs->ext_status >> 16) & 0xffff; |
3547 | } else | 3547 | } else |
3548 | #endif | 3548 | #endif |
3549 | { | 3549 | { |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 669ea4fff166..fbc1d5c3b0a7 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1213,7 +1213,7 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq, | |||
1213 | "ibmvscsi: Re-enabling adapter!\n"); | 1213 | "ibmvscsi: Re-enabling adapter!\n"); |
1214 | purge_requests(hostdata, DID_REQUEUE); | 1214 | purge_requests(hostdata, DID_REQUEUE); |
1215 | if ((ibmvscsi_reenable_crq_queue(&hostdata->queue, | 1215 | if ((ibmvscsi_reenable_crq_queue(&hostdata->queue, |
1216 | hostdata) == 0) || | 1216 | hostdata)) || |
1217 | (ibmvscsi_send_crq(hostdata, | 1217 | (ibmvscsi_send_crq(hostdata, |
1218 | 0xC001000000000000LL, 0))) { | 1218 | 0xC001000000000000LL, 0))) { |
1219 | atomic_set(&hostdata->request_limit, | 1219 | atomic_set(&hostdata->request_limit, |
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 2d95ac9c32c1..e31f6122106f 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c | |||
@@ -1153,7 +1153,7 @@ static int __imm_attach(struct parport *pb) | |||
1153 | { | 1153 | { |
1154 | struct Scsi_Host *host; | 1154 | struct Scsi_Host *host; |
1155 | imm_struct *dev; | 1155 | imm_struct *dev; |
1156 | DECLARE_WAIT_QUEUE_HEAD(waiting); | 1156 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waiting); |
1157 | DEFINE_WAIT(wait); | 1157 | DEFINE_WAIT(wait); |
1158 | int ports; | 1158 | int ports; |
1159 | int modes, ppb; | 1159 | int modes, ppb; |
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 911f2ff4a1f2..afed293dd7b9 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c | |||
@@ -142,8 +142,6 @@ | |||
142 | #define i91u_MAXQUEUE 2 | 142 | #define i91u_MAXQUEUE 2 |
143 | #define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a" | 143 | #define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a" |
144 | 144 | ||
145 | #define INI_VENDOR_ID 0x1101 /* Initio's PCI vendor ID */ | ||
146 | #define DMX_VENDOR_ID 0x134a /* Domex's PCI vendor ID */ | ||
147 | #define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */ | 145 | #define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */ |
148 | #define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */ | 146 | #define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */ |
149 | #define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */ | 147 | #define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */ |
@@ -171,13 +169,16 @@ static int setup_debug = 0; | |||
171 | 169 | ||
172 | static void i91uSCBPost(BYTE * pHcb, BYTE * pScb); | 170 | static void i91uSCBPost(BYTE * pHcb, BYTE * pScb); |
173 | 171 | ||
174 | static const PCI_ID i91u_pci_devices[] = { | 172 | /* PCI Devices supported by this driver */ |
175 | { INI_VENDOR_ID, I950_DEVICE_ID }, | 173 | static struct pci_device_id i91u_pci_devices[] __devinitdata = { |
176 | { INI_VENDOR_ID, I940_DEVICE_ID }, | 174 | { PCI_VENDOR_ID_INIT, I950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
177 | { INI_VENDOR_ID, I935_DEVICE_ID }, | 175 | { PCI_VENDOR_ID_INIT, I940_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
178 | { INI_VENDOR_ID, I920_DEVICE_ID }, | 176 | { PCI_VENDOR_ID_INIT, I935_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
179 | { DMX_VENDOR_ID, I920_DEVICE_ID }, | 177 | { PCI_VENDOR_ID_INIT, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
178 | { PCI_VENDOR_ID_DOMEX, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
179 | { } | ||
180 | }; | 180 | }; |
181 | MODULE_DEVICE_TABLE(pci, i91u_pci_devices); | ||
181 | 182 | ||
182 | #define DEBUG_INTERRUPT 0 | 183 | #define DEBUG_INTERRUPT 0 |
183 | #define DEBUG_QUEUE 0 | 184 | #define DEBUG_QUEUE 0 |
@@ -2771,7 +2772,7 @@ static int tul_NewReturnNumberOfAdapters(void) | |||
2771 | 2772 | ||
2772 | for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++) | 2773 | for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++) |
2773 | { | 2774 | { |
2774 | while ((pDev = pci_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, pDev)) != NULL) { | 2775 | while ((pDev = pci_find_device(i91u_pci_devices[i].vendor, i91u_pci_devices[i].device, pDev)) != NULL) { |
2775 | if (pci_enable_device(pDev)) | 2776 | if (pci_enable_device(pDev)) |
2776 | continue; | 2777 | continue; |
2777 | pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue); | 2778 | pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue); |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 0a9dbc59663f..d0b139cccbbc 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -415,8 +415,8 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
415 | iscsi_solicit_data_init(conn, ctask, r2t); | 415 | iscsi_solicit_data_init(conn, ctask, r2t); |
416 | 416 | ||
417 | tcp_ctask->exp_r2tsn = r2tsn + 1; | 417 | tcp_ctask->exp_r2tsn = r2tsn + 1; |
418 | tcp_ctask->xmstate |= XMSTATE_SOL_HDR; | ||
419 | __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); | 418 | __kfifo_put(tcp_ctask->r2tqueue, (void*)&r2t, sizeof(void*)); |
419 | tcp_ctask->xmstate |= XMSTATE_SOL_HDR; | ||
420 | list_move_tail(&ctask->running, &conn->xmitqueue); | 420 | list_move_tail(&ctask->running, &conn->xmitqueue); |
421 | 421 | ||
422 | scsi_queue_work(session->host, &conn->xmitwork); | 422 | scsi_queue_work(session->host, &conn->xmitwork); |
@@ -1627,9 +1627,12 @@ static int iscsi_send_sol_pdu(struct iscsi_conn *conn, | |||
1627 | if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { | 1627 | if (tcp_ctask->xmstate & XMSTATE_SOL_HDR) { |
1628 | tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; | 1628 | tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR; |
1629 | tcp_ctask->xmstate |= XMSTATE_SOL_DATA; | 1629 | tcp_ctask->xmstate |= XMSTATE_SOL_DATA; |
1630 | if (!tcp_ctask->r2t) | 1630 | if (!tcp_ctask->r2t) { |
1631 | spin_lock_bh(&session->lock); | ||
1631 | __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, | 1632 | __kfifo_get(tcp_ctask->r2tqueue, (void*)&tcp_ctask->r2t, |
1632 | sizeof(void*)); | 1633 | sizeof(void*)); |
1634 | spin_unlock_bh(&session->lock); | ||
1635 | } | ||
1633 | send_hdr: | 1636 | send_hdr: |
1634 | r2t = tcp_ctask->r2t; | 1637 | r2t = tcp_ctask->r2t; |
1635 | dtask = &r2t->dtask; | 1638 | dtask = &r2t->dtask; |
@@ -1816,21 +1819,14 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_conn *cls_conn) | |||
1816 | { | 1819 | { |
1817 | struct iscsi_conn *conn = cls_conn->dd_data; | 1820 | struct iscsi_conn *conn = cls_conn->dd_data; |
1818 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | 1821 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
1819 | int digest = 0; | ||
1820 | |||
1821 | if (conn->hdrdgst_en || conn->datadgst_en) | ||
1822 | digest = 1; | ||
1823 | 1822 | ||
1824 | iscsi_tcp_release_conn(conn); | 1823 | iscsi_tcp_release_conn(conn); |
1825 | iscsi_conn_teardown(cls_conn); | 1824 | iscsi_conn_teardown(cls_conn); |
1826 | 1825 | ||
1827 | /* now free tcp_conn */ | 1826 | if (tcp_conn->tx_hash.tfm) |
1828 | if (digest) { | 1827 | crypto_free_hash(tcp_conn->tx_hash.tfm); |
1829 | if (tcp_conn->tx_hash.tfm) | 1828 | if (tcp_conn->rx_hash.tfm) |
1830 | crypto_free_hash(tcp_conn->tx_hash.tfm); | 1829 | crypto_free_hash(tcp_conn->rx_hash.tfm); |
1831 | if (tcp_conn->rx_hash.tfm) | ||
1832 | crypto_free_hash(tcp_conn->rx_hash.tfm); | ||
1833 | } | ||
1834 | 1830 | ||
1835 | kfree(tcp_conn); | 1831 | kfree(tcp_conn); |
1836 | } | 1832 | } |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index c542d0e95e68..5d8862189485 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -481,8 +481,8 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
481 | break; | 481 | break; |
482 | case ISCSI_OP_ASYNC_EVENT: | 482 | case ISCSI_OP_ASYNC_EVENT: |
483 | conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; | 483 | conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; |
484 | /* we need sth like iscsi_async_event_rsp() */ | 484 | if (iscsi_recv_pdu(conn->cls_conn, hdr, data, datalen)) |
485 | rc = ISCSI_ERR_BAD_OPCODE; | 485 | rc = ISCSI_ERR_CONN_FAILED; |
486 | break; | 486 | break; |
487 | default: | 487 | default: |
488 | rc = ISCSI_ERR_BAD_OPCODE; | 488 | rc = ISCSI_ERR_BAD_OPCODE; |
@@ -578,6 +578,27 @@ void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err) | |||
578 | } | 578 | } |
579 | EXPORT_SYMBOL_GPL(iscsi_conn_failure); | 579 | EXPORT_SYMBOL_GPL(iscsi_conn_failure); |
580 | 580 | ||
581 | static int iscsi_xmit_imm_task(struct iscsi_conn *conn) | ||
582 | { | ||
583 | struct iscsi_hdr *hdr = conn->mtask->hdr; | ||
584 | int rc, was_logout = 0; | ||
585 | |||
586 | if ((hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGOUT) { | ||
587 | conn->session->state = ISCSI_STATE_IN_RECOVERY; | ||
588 | iscsi_block_session(session_to_cls(conn->session)); | ||
589 | was_logout = 1; | ||
590 | } | ||
591 | rc = conn->session->tt->xmit_mgmt_task(conn, conn->mtask); | ||
592 | if (rc) | ||
593 | return rc; | ||
594 | |||
595 | if (was_logout) { | ||
596 | set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); | ||
597 | return -ENODATA; | ||
598 | } | ||
599 | return 0; | ||
600 | } | ||
601 | |||
581 | /** | 602 | /** |
582 | * iscsi_data_xmit - xmit any command into the scheduled connection | 603 | * iscsi_data_xmit - xmit any command into the scheduled connection |
583 | * @conn: iscsi connection | 604 | * @conn: iscsi connection |
@@ -623,7 +644,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) | |||
623 | conn->ctask = NULL; | 644 | conn->ctask = NULL; |
624 | } | 645 | } |
625 | if (conn->mtask) { | 646 | if (conn->mtask) { |
626 | rc = tt->xmit_mgmt_task(conn, conn->mtask); | 647 | rc = iscsi_xmit_imm_task(conn); |
627 | if (rc) | 648 | if (rc) |
628 | goto again; | 649 | goto again; |
629 | /* done with this in-progress mtask */ | 650 | /* done with this in-progress mtask */ |
@@ -638,7 +659,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) | |||
638 | list_add_tail(&conn->mtask->running, | 659 | list_add_tail(&conn->mtask->running, |
639 | &conn->mgmt_run_list); | 660 | &conn->mgmt_run_list); |
640 | spin_unlock_bh(&conn->session->lock); | 661 | spin_unlock_bh(&conn->session->lock); |
641 | rc = tt->xmit_mgmt_task(conn, conn->mtask); | 662 | rc = iscsi_xmit_imm_task(conn); |
642 | if (rc) | 663 | if (rc) |
643 | goto again; | 664 | goto again; |
644 | } | 665 | } |
@@ -661,8 +682,6 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) | |||
661 | spin_unlock_bh(&conn->session->lock); | 682 | spin_unlock_bh(&conn->session->lock); |
662 | 683 | ||
663 | rc = tt->xmit_cmd_task(conn, conn->ctask); | 684 | rc = tt->xmit_cmd_task(conn, conn->ctask); |
664 | if (rc) | ||
665 | goto again; | ||
666 | 685 | ||
667 | spin_lock_bh(&conn->session->lock); | 686 | spin_lock_bh(&conn->session->lock); |
668 | __iscsi_put_ctask(conn->ctask); | 687 | __iscsi_put_ctask(conn->ctask); |
@@ -778,6 +797,10 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) | |||
778 | } | 797 | } |
779 | 798 | ||
780 | conn = session->leadconn; | 799 | conn = session->leadconn; |
800 | if (!conn) { | ||
801 | reason = FAILURE_SESSION_FREED; | ||
802 | goto fault; | ||
803 | } | ||
781 | 804 | ||
782 | if (!__kfifo_get(session->cmdpool.queue, (void*)&ctask, | 805 | if (!__kfifo_get(session->cmdpool.queue, (void*)&ctask, |
783 | sizeof(void*))) { | 806 | sizeof(void*))) { |
@@ -952,13 +975,13 @@ int iscsi_eh_host_reset(struct scsi_cmnd *sc) | |||
952 | if (session->state == ISCSI_STATE_TERMINATE) { | 975 | if (session->state == ISCSI_STATE_TERMINATE) { |
953 | failed: | 976 | failed: |
954 | debug_scsi("failing host reset: session terminated " | 977 | debug_scsi("failing host reset: session terminated " |
955 | "[CID %d age %d]", conn->id, session->age); | 978 | "[CID %d age %d]\n", conn->id, session->age); |
956 | spin_unlock_bh(&session->lock); | 979 | spin_unlock_bh(&session->lock); |
957 | return FAILED; | 980 | return FAILED; |
958 | } | 981 | } |
959 | 982 | ||
960 | if (sc->SCp.phase == session->age) { | 983 | if (sc->SCp.phase == session->age) { |
961 | debug_scsi("failing connection CID %d due to SCSI host reset", | 984 | debug_scsi("failing connection CID %d due to SCSI host reset\n", |
962 | conn->id); | 985 | conn->id); |
963 | fail_session = 1; | 986 | fail_session = 1; |
964 | } | 987 | } |
@@ -1031,7 +1054,8 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc, | |||
1031 | NULL, 0); | 1054 | NULL, 0); |
1032 | if (rc) { | 1055 | if (rc) { |
1033 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); | 1056 | iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); |
1034 | debug_scsi("abort sent failure [itt 0x%x] %d", ctask->itt, rc); | 1057 | debug_scsi("abort sent failure [itt 0x%x] %d\n", ctask->itt, |
1058 | rc); | ||
1035 | return rc; | 1059 | return rc; |
1036 | } | 1060 | } |
1037 | 1061 | ||
@@ -1048,7 +1072,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc, | |||
1048 | conn->tmabort_timer.function = iscsi_tmabort_timedout; | 1072 | conn->tmabort_timer.function = iscsi_tmabort_timedout; |
1049 | conn->tmabort_timer.data = (unsigned long)ctask; | 1073 | conn->tmabort_timer.data = (unsigned long)ctask; |
1050 | add_timer(&conn->tmabort_timer); | 1074 | add_timer(&conn->tmabort_timer); |
1051 | debug_scsi("abort set timeout [itt 0x%x]", ctask->itt); | 1075 | debug_scsi("abort set timeout [itt 0x%x]\n", ctask->itt); |
1052 | } | 1076 | } |
1053 | spin_unlock_bh(&session->lock); | 1077 | spin_unlock_bh(&session->lock); |
1054 | mutex_unlock(&conn->xmitmutex); | 1078 | mutex_unlock(&conn->xmitmutex); |
@@ -1377,7 +1401,6 @@ iscsi_session_setup(struct iscsi_transport *iscsit, | |||
1377 | } | 1401 | } |
1378 | 1402 | ||
1379 | spin_lock_init(&session->lock); | 1403 | spin_lock_init(&session->lock); |
1380 | INIT_LIST_HEAD(&session->connections); | ||
1381 | 1404 | ||
1382 | /* initialize immediate command pool */ | 1405 | /* initialize immediate command pool */ |
1383 | if (iscsi_pool_init(&session->mgmtpool, session->mgmtpool_max, | 1406 | if (iscsi_pool_init(&session->mgmtpool, session->mgmtpool_max, |
@@ -1580,16 +1603,11 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
1580 | kfree(conn->persistent_address); | 1603 | kfree(conn->persistent_address); |
1581 | __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask, | 1604 | __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask, |
1582 | sizeof(void*)); | 1605 | sizeof(void*)); |
1583 | list_del(&conn->item); | 1606 | if (session->leadconn == conn) { |
1584 | if (list_empty(&session->connections)) | ||
1585 | session->leadconn = NULL; | 1607 | session->leadconn = NULL; |
1586 | if (session->leadconn && session->leadconn == conn) | ||
1587 | session->leadconn = container_of(session->connections.next, | ||
1588 | struct iscsi_conn, item); | ||
1589 | |||
1590 | if (session->leadconn == NULL) | ||
1591 | /* no connections exits.. reset sequencing */ | 1608 | /* no connections exits.. reset sequencing */ |
1592 | session->cmdsn = session->max_cmdsn = session->exp_cmdsn = 1; | 1609 | session->cmdsn = session->max_cmdsn = session->exp_cmdsn = 1; |
1610 | } | ||
1593 | spin_unlock_bh(&session->lock); | 1611 | spin_unlock_bh(&session->lock); |
1594 | 1612 | ||
1595 | kfifo_free(conn->immqueue); | 1613 | kfifo_free(conn->immqueue); |
@@ -1777,32 +1795,12 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session, | |||
1777 | struct iscsi_cls_conn *cls_conn, int is_leading) | 1795 | struct iscsi_cls_conn *cls_conn, int is_leading) |
1778 | { | 1796 | { |
1779 | struct iscsi_session *session = class_to_transport_session(cls_session); | 1797 | struct iscsi_session *session = class_to_transport_session(cls_session); |
1780 | struct iscsi_conn *tmp = ERR_PTR(-EEXIST), *conn = cls_conn->dd_data; | 1798 | struct iscsi_conn *conn = cls_conn->dd_data; |
1781 | 1799 | ||
1782 | /* lookup for existing connection */ | ||
1783 | spin_lock_bh(&session->lock); | 1800 | spin_lock_bh(&session->lock); |
1784 | list_for_each_entry(tmp, &session->connections, item) { | ||
1785 | if (tmp == conn) { | ||
1786 | if (conn->c_stage != ISCSI_CONN_STOPPED || | ||
1787 | conn->stop_stage == STOP_CONN_TERM) { | ||
1788 | printk(KERN_ERR "iscsi: can't bind " | ||
1789 | "non-stopped connection (%d:%d)\n", | ||
1790 | conn->c_stage, conn->stop_stage); | ||
1791 | spin_unlock_bh(&session->lock); | ||
1792 | return -EIO; | ||
1793 | } | ||
1794 | break; | ||
1795 | } | ||
1796 | } | ||
1797 | if (tmp != conn) { | ||
1798 | /* bind new iSCSI connection to session */ | ||
1799 | conn->session = session; | ||
1800 | list_add(&conn->item, &session->connections); | ||
1801 | } | ||
1802 | spin_unlock_bh(&session->lock); | ||
1803 | |||
1804 | if (is_leading) | 1801 | if (is_leading) |
1805 | session->leadconn = conn; | 1802 | session->leadconn = conn; |
1803 | spin_unlock_bh(&session->lock); | ||
1806 | 1804 | ||
1807 | /* | 1805 | /* |
1808 | * Unblock xmitworker(), Login Phase will pass through. | 1806 | * Unblock xmitworker(), Login Phase will pass through. |
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 30b8014bcc7a..e34a93435497 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -71,55 +71,65 @@ static void smp_task_done(struct sas_task *task) | |||
71 | static int smp_execute_task(struct domain_device *dev, void *req, int req_size, | 71 | static int smp_execute_task(struct domain_device *dev, void *req, int req_size, |
72 | void *resp, int resp_size) | 72 | void *resp, int resp_size) |
73 | { | 73 | { |
74 | int res; | 74 | int res, retry; |
75 | struct sas_task *task = sas_alloc_task(GFP_KERNEL); | 75 | struct sas_task *task = NULL; |
76 | struct sas_internal *i = | 76 | struct sas_internal *i = |
77 | to_sas_internal(dev->port->ha->core.shost->transportt); | 77 | to_sas_internal(dev->port->ha->core.shost->transportt); |
78 | 78 | ||
79 | if (!task) | 79 | for (retry = 0; retry < 3; retry++) { |
80 | return -ENOMEM; | 80 | task = sas_alloc_task(GFP_KERNEL); |
81 | 81 | if (!task) | |
82 | task->dev = dev; | 82 | return -ENOMEM; |
83 | task->task_proto = dev->tproto; | ||
84 | sg_init_one(&task->smp_task.smp_req, req, req_size); | ||
85 | sg_init_one(&task->smp_task.smp_resp, resp, resp_size); | ||
86 | 83 | ||
87 | task->task_done = smp_task_done; | 84 | task->dev = dev; |
85 | task->task_proto = dev->tproto; | ||
86 | sg_init_one(&task->smp_task.smp_req, req, req_size); | ||
87 | sg_init_one(&task->smp_task.smp_resp, resp, resp_size); | ||
88 | 88 | ||
89 | task->timer.data = (unsigned long) task; | 89 | task->task_done = smp_task_done; |
90 | task->timer.function = smp_task_timedout; | ||
91 | task->timer.expires = jiffies + SMP_TIMEOUT*HZ; | ||
92 | add_timer(&task->timer); | ||
93 | 90 | ||
94 | res = i->dft->lldd_execute_task(task, 1, GFP_KERNEL); | 91 | task->timer.data = (unsigned long) task; |
92 | task->timer.function = smp_task_timedout; | ||
93 | task->timer.expires = jiffies + SMP_TIMEOUT*HZ; | ||
94 | add_timer(&task->timer); | ||
95 | 95 | ||
96 | if (res) { | 96 | res = i->dft->lldd_execute_task(task, 1, GFP_KERNEL); |
97 | del_timer(&task->timer); | ||
98 | SAS_DPRINTK("executing SMP task failed:%d\n", res); | ||
99 | goto ex_err; | ||
100 | } | ||
101 | 97 | ||
102 | wait_for_completion(&task->completion); | 98 | if (res) { |
103 | res = -ETASK; | 99 | del_timer(&task->timer); |
104 | if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { | 100 | SAS_DPRINTK("executing SMP task failed:%d\n", res); |
105 | SAS_DPRINTK("smp task timed out or aborted\n"); | ||
106 | i->dft->lldd_abort_task(task); | ||
107 | if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { | ||
108 | SAS_DPRINTK("SMP task aborted and not done\n"); | ||
109 | goto ex_err; | 101 | goto ex_err; |
110 | } | 102 | } |
103 | |||
104 | wait_for_completion(&task->completion); | ||
105 | res = -ETASK; | ||
106 | if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { | ||
107 | SAS_DPRINTK("smp task timed out or aborted\n"); | ||
108 | i->dft->lldd_abort_task(task); | ||
109 | if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { | ||
110 | SAS_DPRINTK("SMP task aborted and not done\n"); | ||
111 | goto ex_err; | ||
112 | } | ||
113 | } | ||
114 | if (task->task_status.resp == SAS_TASK_COMPLETE && | ||
115 | task->task_status.stat == SAM_GOOD) { | ||
116 | res = 0; | ||
117 | break; | ||
118 | } else { | ||
119 | SAS_DPRINTK("%s: task to dev %016llx response: 0x%x " | ||
120 | "status 0x%x\n", __FUNCTION__, | ||
121 | SAS_ADDR(dev->sas_addr), | ||
122 | task->task_status.resp, | ||
123 | task->task_status.stat); | ||
124 | sas_free_task(task); | ||
125 | task = NULL; | ||
126 | } | ||
111 | } | 127 | } |
112 | if (task->task_status.resp == SAS_TASK_COMPLETE && | ||
113 | task->task_status.stat == SAM_GOOD) | ||
114 | res = 0; | ||
115 | else | ||
116 | SAS_DPRINTK("%s: task to dev %016llx response: 0x%x " | ||
117 | "status 0x%x\n", __FUNCTION__, | ||
118 | SAS_ADDR(dev->sas_addr), | ||
119 | task->task_status.resp, | ||
120 | task->task_status.stat); | ||
121 | ex_err: | 128 | ex_err: |
122 | sas_free_task(task); | 129 | BUG_ON(retry == 3 && task != NULL); |
130 | if (task != NULL) { | ||
131 | sas_free_task(task); | ||
132 | } | ||
123 | return res; | 133 | return res; |
124 | } | 134 | } |
125 | 135 | ||
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 9496e87c135e..2a4e02e7a392 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -594,7 +594,8 @@ lpfc_soft_wwpn_show(struct class_device *cdev, char *buf) | |||
594 | { | 594 | { |
595 | struct Scsi_Host *host = class_to_shost(cdev); | 595 | struct Scsi_Host *host = class_to_shost(cdev); |
596 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | 596 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
597 | return snprintf(buf, PAGE_SIZE, "0x%llx\n", phba->cfg_soft_wwpn); | 597 | return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
598 | (unsigned long long)phba->cfg_soft_wwpn); | ||
598 | } | 599 | } |
599 | 600 | ||
600 | 601 | ||
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 1b53afb1cb57..3add7c237859 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -188,7 +188,8 @@ lpfc_alloc_ct_rsp(struct lpfc_hba * phba, int cmdcode, struct ulp_bde64 * bpl, | |||
188 | 188 | ||
189 | if (!mp->virt) { | 189 | if (!mp->virt) { |
190 | kfree(mp); | 190 | kfree(mp); |
191 | lpfc_free_ct_rsp(phba, mlist); | 191 | if (mlist) |
192 | lpfc_free_ct_rsp(phba, mlist); | ||
192 | return NULL; | 193 | return NULL; |
193 | } | 194 | } |
194 | 195 | ||
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index d586c3d3b0d0..19c79a0549a7 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -305,7 +305,7 @@ lpfc_do_work(void *p) | |||
305 | { | 305 | { |
306 | struct lpfc_hba *phba = p; | 306 | struct lpfc_hba *phba = p; |
307 | int rc; | 307 | int rc; |
308 | DECLARE_WAIT_QUEUE_HEAD(work_waitq); | 308 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(work_waitq); |
309 | 309 | ||
310 | set_user_nice(current, -20); | 310 | set_user_nice(current, -20); |
311 | phba->work_wait = &work_waitq; | 311 | phba->work_wait = &work_waitq; |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 24a1779b9af4..582f5ea4e84e 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -2983,7 +2983,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba * phba, | |||
2983 | struct lpfc_iocbq * prspiocbq, | 2983 | struct lpfc_iocbq * prspiocbq, |
2984 | uint32_t timeout) | 2984 | uint32_t timeout) |
2985 | { | 2985 | { |
2986 | DECLARE_WAIT_QUEUE_HEAD(done_q); | 2986 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); |
2987 | long timeleft, timeout_req = 0; | 2987 | long timeleft, timeout_req = 0; |
2988 | int retval = IOCB_SUCCESS; | 2988 | int retval = IOCB_SUCCESS; |
2989 | uint32_t creg_val; | 2989 | uint32_t creg_val; |
@@ -3061,7 +3061,7 @@ int | |||
3061 | lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, | 3061 | lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq, |
3062 | uint32_t timeout) | 3062 | uint32_t timeout) |
3063 | { | 3063 | { |
3064 | DECLARE_WAIT_QUEUE_HEAD(done_q); | 3064 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q); |
3065 | DECLARE_WAITQUEUE(wq_entry, current); | 3065 | DECLARE_WAITQUEUE(wq_entry, current); |
3066 | uint32_t timeleft = 0; | 3066 | uint32_t timeleft = 0; |
3067 | int retval; | 3067 | int retval; |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index c0edb662d863..7bac86dda88f 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -884,7 +884,7 @@ megaraid_init_mbox(adapter_t *adapter) | |||
884 | 884 | ||
885 | if (((magic64 == HBA_SIGNATURE_64_BIT) && | 885 | if (((magic64 == HBA_SIGNATURE_64_BIT) && |
886 | ((adapter->pdev->subsystem_device != | 886 | ((adapter->pdev->subsystem_device != |
887 | PCI_SUBSYS_ID_MEGARAID_SATA_150_6) || | 887 | PCI_SUBSYS_ID_MEGARAID_SATA_150_6) && |
888 | (adapter->pdev->subsystem_device != | 888 | (adapter->pdev->subsystem_device != |
889 | PCI_SUBSYS_ID_MEGARAID_SATA_150_4))) || | 889 | PCI_SUBSYS_ID_MEGARAID_SATA_150_4))) || |
890 | (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC && | 890 | (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC && |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index b1d346049525..f2d79c3f0b8e 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -183,7 +183,7 @@ static void nsp_cs_dmessage(const char *func, int line, int mask, char *fmt, ... | |||
183 | * Clenaup parameters and call done() functions. | 183 | * Clenaup parameters and call done() functions. |
184 | * You must be set SCpnt->result before call this function. | 184 | * You must be set SCpnt->result before call this function. |
185 | */ | 185 | */ |
186 | static void nsp_scsi_done(Scsi_Cmnd *SCpnt) | 186 | static void nsp_scsi_done(struct scsi_cmnd *SCpnt) |
187 | { | 187 | { |
188 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 188 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
189 | 189 | ||
@@ -192,7 +192,8 @@ static void nsp_scsi_done(Scsi_Cmnd *SCpnt) | |||
192 | SCpnt->scsi_done(SCpnt); | 192 | SCpnt->scsi_done(SCpnt); |
193 | } | 193 | } |
194 | 194 | ||
195 | static int nsp_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) | 195 | static int nsp_queuecommand(struct scsi_cmnd *SCpnt, |
196 | void (*done)(struct scsi_cmnd *)) | ||
196 | { | 197 | { |
197 | #ifdef NSP_DEBUG | 198 | #ifdef NSP_DEBUG |
198 | /*unsigned int host_id = SCpnt->device->host->this_id;*/ | 199 | /*unsigned int host_id = SCpnt->device->host->this_id;*/ |
@@ -365,7 +366,7 @@ static int nsphw_init(nsp_hw_data *data) | |||
365 | /* | 366 | /* |
366 | * Start selection phase | 367 | * Start selection phase |
367 | */ | 368 | */ |
368 | static int nsphw_start_selection(Scsi_Cmnd *SCpnt) | 369 | static int nsphw_start_selection(struct scsi_cmnd *SCpnt) |
369 | { | 370 | { |
370 | unsigned int host_id = SCpnt->device->host->this_id; | 371 | unsigned int host_id = SCpnt->device->host->this_id; |
371 | unsigned int base = SCpnt->device->host->io_port; | 372 | unsigned int base = SCpnt->device->host->io_port; |
@@ -446,7 +447,7 @@ static struct nsp_sync_table nsp_sync_table_20M[] = { | |||
446 | /* | 447 | /* |
447 | * setup synchronous data transfer mode | 448 | * setup synchronous data transfer mode |
448 | */ | 449 | */ |
449 | static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt) | 450 | static int nsp_analyze_sdtr(struct scsi_cmnd *SCpnt) |
450 | { | 451 | { |
451 | unsigned char target = scmd_id(SCpnt); | 452 | unsigned char target = scmd_id(SCpnt); |
452 | // unsigned char lun = SCpnt->device->lun; | 453 | // unsigned char lun = SCpnt->device->lun; |
@@ -504,7 +505,7 @@ static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt) | |||
504 | /* | 505 | /* |
505 | * start ninja hardware timer | 506 | * start ninja hardware timer |
506 | */ | 507 | */ |
507 | static void nsp_start_timer(Scsi_Cmnd *SCpnt, int time) | 508 | static void nsp_start_timer(struct scsi_cmnd *SCpnt, int time) |
508 | { | 509 | { |
509 | unsigned int base = SCpnt->device->host->io_port; | 510 | unsigned int base = SCpnt->device->host->io_port; |
510 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 511 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
@@ -517,7 +518,8 @@ static void nsp_start_timer(Scsi_Cmnd *SCpnt, int time) | |||
517 | /* | 518 | /* |
518 | * wait for bus phase change | 519 | * wait for bus phase change |
519 | */ | 520 | */ |
520 | static int nsp_negate_signal(Scsi_Cmnd *SCpnt, unsigned char mask, char *str) | 521 | static int nsp_negate_signal(struct scsi_cmnd *SCpnt, unsigned char mask, |
522 | char *str) | ||
521 | { | 523 | { |
522 | unsigned int base = SCpnt->device->host->io_port; | 524 | unsigned int base = SCpnt->device->host->io_port; |
523 | unsigned char reg; | 525 | unsigned char reg; |
@@ -544,9 +546,9 @@ static int nsp_negate_signal(Scsi_Cmnd *SCpnt, unsigned char mask, char *str) | |||
544 | /* | 546 | /* |
545 | * expect Ninja Irq | 547 | * expect Ninja Irq |
546 | */ | 548 | */ |
547 | static int nsp_expect_signal(Scsi_Cmnd *SCpnt, | 549 | static int nsp_expect_signal(struct scsi_cmnd *SCpnt, |
548 | unsigned char current_phase, | 550 | unsigned char current_phase, |
549 | unsigned char mask) | 551 | unsigned char mask) |
550 | { | 552 | { |
551 | unsigned int base = SCpnt->device->host->io_port; | 553 | unsigned int base = SCpnt->device->host->io_port; |
552 | int time_out; | 554 | int time_out; |
@@ -579,7 +581,7 @@ static int nsp_expect_signal(Scsi_Cmnd *SCpnt, | |||
579 | /* | 581 | /* |
580 | * transfer SCSI message | 582 | * transfer SCSI message |
581 | */ | 583 | */ |
582 | static int nsp_xfer(Scsi_Cmnd *SCpnt, int phase) | 584 | static int nsp_xfer(struct scsi_cmnd *SCpnt, int phase) |
583 | { | 585 | { |
584 | unsigned int base = SCpnt->device->host->io_port; | 586 | unsigned int base = SCpnt->device->host->io_port; |
585 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 587 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
@@ -619,7 +621,7 @@ static int nsp_xfer(Scsi_Cmnd *SCpnt, int phase) | |||
619 | /* | 621 | /* |
620 | * get extra SCSI data from fifo | 622 | * get extra SCSI data from fifo |
621 | */ | 623 | */ |
622 | static int nsp_dataphase_bypass(Scsi_Cmnd *SCpnt) | 624 | static int nsp_dataphase_bypass(struct scsi_cmnd *SCpnt) |
623 | { | 625 | { |
624 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 626 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
625 | unsigned int count; | 627 | unsigned int count; |
@@ -651,7 +653,7 @@ static int nsp_dataphase_bypass(Scsi_Cmnd *SCpnt) | |||
651 | /* | 653 | /* |
652 | * accept reselection | 654 | * accept reselection |
653 | */ | 655 | */ |
654 | static int nsp_reselected(Scsi_Cmnd *SCpnt) | 656 | static int nsp_reselected(struct scsi_cmnd *SCpnt) |
655 | { | 657 | { |
656 | unsigned int base = SCpnt->device->host->io_port; | 658 | unsigned int base = SCpnt->device->host->io_port; |
657 | unsigned int host_id = SCpnt->device->host->this_id; | 659 | unsigned int host_id = SCpnt->device->host->this_id; |
@@ -690,7 +692,7 @@ static int nsp_reselected(Scsi_Cmnd *SCpnt) | |||
690 | /* | 692 | /* |
691 | * count how many data transferd | 693 | * count how many data transferd |
692 | */ | 694 | */ |
693 | static int nsp_fifo_count(Scsi_Cmnd *SCpnt) | 695 | static int nsp_fifo_count(struct scsi_cmnd *SCpnt) |
694 | { | 696 | { |
695 | unsigned int base = SCpnt->device->host->io_port; | 697 | unsigned int base = SCpnt->device->host->io_port; |
696 | unsigned int count; | 698 | unsigned int count; |
@@ -717,7 +719,7 @@ static int nsp_fifo_count(Scsi_Cmnd *SCpnt) | |||
717 | /* | 719 | /* |
718 | * read data in DATA IN phase | 720 | * read data in DATA IN phase |
719 | */ | 721 | */ |
720 | static void nsp_pio_read(Scsi_Cmnd *SCpnt) | 722 | static void nsp_pio_read(struct scsi_cmnd *SCpnt) |
721 | { | 723 | { |
722 | unsigned int base = SCpnt->device->host->io_port; | 724 | unsigned int base = SCpnt->device->host->io_port; |
723 | unsigned long mmio_base = SCpnt->device->host->base; | 725 | unsigned long mmio_base = SCpnt->device->host->base; |
@@ -812,7 +814,7 @@ static void nsp_pio_read(Scsi_Cmnd *SCpnt) | |||
812 | /* | 814 | /* |
813 | * write data in DATA OUT phase | 815 | * write data in DATA OUT phase |
814 | */ | 816 | */ |
815 | static void nsp_pio_write(Scsi_Cmnd *SCpnt) | 817 | static void nsp_pio_write(struct scsi_cmnd *SCpnt) |
816 | { | 818 | { |
817 | unsigned int base = SCpnt->device->host->io_port; | 819 | unsigned int base = SCpnt->device->host->io_port; |
818 | unsigned long mmio_base = SCpnt->device->host->base; | 820 | unsigned long mmio_base = SCpnt->device->host->base; |
@@ -905,7 +907,7 @@ static void nsp_pio_write(Scsi_Cmnd *SCpnt) | |||
905 | /* | 907 | /* |
906 | * setup synchronous/asynchronous data transfer mode | 908 | * setup synchronous/asynchronous data transfer mode |
907 | */ | 909 | */ |
908 | static int nsp_nexus(Scsi_Cmnd *SCpnt) | 910 | static int nsp_nexus(struct scsi_cmnd *SCpnt) |
909 | { | 911 | { |
910 | unsigned int base = SCpnt->device->host->io_port; | 912 | unsigned int base = SCpnt->device->host->io_port; |
911 | unsigned char target = scmd_id(SCpnt); | 913 | unsigned char target = scmd_id(SCpnt); |
@@ -952,7 +954,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) | |||
952 | { | 954 | { |
953 | unsigned int base; | 955 | unsigned int base; |
954 | unsigned char irq_status, irq_phase, phase; | 956 | unsigned char irq_status, irq_phase, phase; |
955 | Scsi_Cmnd *tmpSC; | 957 | struct scsi_cmnd *tmpSC; |
956 | unsigned char target, lun; | 958 | unsigned char target, lun; |
957 | unsigned int *sync_neg; | 959 | unsigned int *sync_neg; |
958 | int i, tmp; | 960 | int i, tmp; |
@@ -1530,7 +1532,7 @@ nsp_proc_info( | |||
1530 | /*---------------------------------------------------------------*/ | 1532 | /*---------------------------------------------------------------*/ |
1531 | 1533 | ||
1532 | /* | 1534 | /* |
1533 | static int nsp_eh_abort(Scsi_Cmnd *SCpnt) | 1535 | static int nsp_eh_abort(struct scsi_cmnd *SCpnt) |
1534 | { | 1536 | { |
1535 | nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt); | 1537 | nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt); |
1536 | 1538 | ||
@@ -1558,7 +1560,7 @@ static int nsp_bus_reset(nsp_hw_data *data) | |||
1558 | return SUCCESS; | 1560 | return SUCCESS; |
1559 | } | 1561 | } |
1560 | 1562 | ||
1561 | static int nsp_eh_bus_reset(Scsi_Cmnd *SCpnt) | 1563 | static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt) |
1562 | { | 1564 | { |
1563 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 1565 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
1564 | 1566 | ||
@@ -1567,7 +1569,7 @@ static int nsp_eh_bus_reset(Scsi_Cmnd *SCpnt) | |||
1567 | return nsp_bus_reset(data); | 1569 | return nsp_bus_reset(data); |
1568 | } | 1570 | } |
1569 | 1571 | ||
1570 | static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt) | 1572 | static int nsp_eh_host_reset(struct scsi_cmnd *SCpnt) |
1571 | { | 1573 | { |
1572 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 1574 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
1573 | 1575 | ||
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index a88714f4c05b..625ca97da52d 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -266,7 +266,7 @@ typedef struct _nsp_hw_data { | |||
266 | 266 | ||
267 | int TimerCount; | 267 | int TimerCount; |
268 | int SelectionTimeOut; | 268 | int SelectionTimeOut; |
269 | Scsi_Cmnd *CurrentSC; | 269 | struct scsi_cmnd *CurrentSC; |
270 | //int CurrnetTarget; | 270 | //int CurrnetTarget; |
271 | 271 | ||
272 | int FifoCount; | 272 | int FifoCount; |
@@ -319,30 +319,34 @@ static int nsp_proc_info ( | |||
319 | int hostno, | 319 | int hostno, |
320 | #endif | 320 | #endif |
321 | int inout); | 321 | int inout); |
322 | static int nsp_queuecommand(Scsi_Cmnd *SCpnt, void (* done)(Scsi_Cmnd *SCpnt)); | 322 | static int nsp_queuecommand(struct scsi_cmnd *SCpnt, |
323 | void (* done)(struct scsi_cmnd *SCpnt)); | ||
323 | 324 | ||
324 | /* Error handler */ | 325 | /* Error handler */ |
325 | /*static int nsp_eh_abort (Scsi_Cmnd *SCpnt);*/ | 326 | /*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ |
326 | /*static int nsp_eh_device_reset(Scsi_Cmnd *SCpnt);*/ | 327 | /*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/ |
327 | static int nsp_eh_bus_reset (Scsi_Cmnd *SCpnt); | 328 | static int nsp_eh_bus_reset (struct scsi_cmnd *SCpnt); |
328 | static int nsp_eh_host_reset (Scsi_Cmnd *SCpnt); | 329 | static int nsp_eh_host_reset (struct scsi_cmnd *SCpnt); |
329 | static int nsp_bus_reset (nsp_hw_data *data); | 330 | static int nsp_bus_reset (nsp_hw_data *data); |
330 | 331 | ||
331 | /* */ | 332 | /* */ |
332 | static int nsphw_init (nsp_hw_data *data); | 333 | static int nsphw_init (nsp_hw_data *data); |
333 | static int nsphw_start_selection(Scsi_Cmnd *SCpnt); | 334 | static int nsphw_start_selection(struct scsi_cmnd *SCpnt); |
334 | static void nsp_start_timer (Scsi_Cmnd *SCpnt, int time); | 335 | static void nsp_start_timer (struct scsi_cmnd *SCpnt, int time); |
335 | static int nsp_fifo_count (Scsi_Cmnd *SCpnt); | 336 | static int nsp_fifo_count (struct scsi_cmnd *SCpnt); |
336 | static void nsp_pio_read (Scsi_Cmnd *SCpnt); | 337 | static void nsp_pio_read (struct scsi_cmnd *SCpnt); |
337 | static void nsp_pio_write (Scsi_Cmnd *SCpnt); | 338 | static void nsp_pio_write (struct scsi_cmnd *SCpnt); |
338 | static int nsp_nexus (Scsi_Cmnd *SCpnt); | 339 | static int nsp_nexus (struct scsi_cmnd *SCpnt); |
339 | static void nsp_scsi_done (Scsi_Cmnd *SCpnt); | 340 | static void nsp_scsi_done (struct scsi_cmnd *SCpnt); |
340 | static int nsp_analyze_sdtr (Scsi_Cmnd *SCpnt); | 341 | static int nsp_analyze_sdtr (struct scsi_cmnd *SCpnt); |
341 | static int nsp_negate_signal (Scsi_Cmnd *SCpnt, unsigned char mask, char *str); | 342 | static int nsp_negate_signal (struct scsi_cmnd *SCpnt, |
342 | static int nsp_expect_signal (Scsi_Cmnd *SCpnt, unsigned char current_phase, unsigned char mask); | 343 | unsigned char mask, char *str); |
343 | static int nsp_xfer (Scsi_Cmnd *SCpnt, int phase); | 344 | static int nsp_expect_signal (struct scsi_cmnd *SCpnt, |
344 | static int nsp_dataphase_bypass (Scsi_Cmnd *SCpnt); | 345 | unsigned char current_phase, |
345 | static int nsp_reselected (Scsi_Cmnd *SCpnt); | 346 | unsigned char mask); |
347 | static int nsp_xfer (struct scsi_cmnd *SCpnt, int phase); | ||
348 | static int nsp_dataphase_bypass (struct scsi_cmnd *SCpnt); | ||
349 | static int nsp_reselected (struct scsi_cmnd *SCpnt); | ||
346 | static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht); | 350 | static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht); |
347 | 351 | ||
348 | /* Interrupt handler */ | 352 | /* Interrupt handler */ |
@@ -355,8 +359,8 @@ static void __exit nsp_cs_exit(void); | |||
355 | 359 | ||
356 | /* Debug */ | 360 | /* Debug */ |
357 | #ifdef NSP_DEBUG | 361 | #ifdef NSP_DEBUG |
358 | static void show_command (Scsi_Cmnd *SCpnt); | 362 | static void show_command (struct scsi_cmnd *SCpnt); |
359 | static void show_phase (Scsi_Cmnd *SCpnt); | 363 | static void show_phase (struct scsi_cmnd *SCpnt); |
360 | static void show_busphase(unsigned char stat); | 364 | static void show_busphase(unsigned char stat); |
361 | static void show_message (nsp_hw_data *data); | 365 | static void show_message (nsp_hw_data *data); |
362 | #else | 366 | #else |
diff --git a/drivers/scsi/pcmcia/nsp_debug.c b/drivers/scsi/pcmcia/nsp_debug.c index 62e5c60067fd..2f75fe6e35a7 100644 --- a/drivers/scsi/pcmcia/nsp_debug.c +++ b/drivers/scsi/pcmcia/nsp_debug.c | |||
@@ -138,12 +138,12 @@ static void print_commandk (unsigned char *command) | |||
138 | printk("\n"); | 138 | printk("\n"); |
139 | } | 139 | } |
140 | 140 | ||
141 | static void show_command(Scsi_Cmnd *SCpnt) | 141 | static void show_command(struct scsi_cmnd *SCpnt) |
142 | { | 142 | { |
143 | print_commandk(SCpnt->cmnd); | 143 | print_commandk(SCpnt->cmnd); |
144 | } | 144 | } |
145 | 145 | ||
146 | static void show_phase(Scsi_Cmnd *SCpnt) | 146 | static void show_phase(struct scsi_cmnd *SCpnt) |
147 | { | 147 | { |
148 | int i = SCpnt->SCp.phase; | 148 | int i = SCpnt->SCp.phase; |
149 | 149 | ||
diff --git a/drivers/scsi/pcmcia/nsp_message.c b/drivers/scsi/pcmcia/nsp_message.c index d7057737ff34..ef593b70d0f0 100644 --- a/drivers/scsi/pcmcia/nsp_message.c +++ b/drivers/scsi/pcmcia/nsp_message.c | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | /* $Id: nsp_message.c,v 1.6 2003/07/26 14:21:09 elca Exp $ */ | 9 | /* $Id: nsp_message.c,v 1.6 2003/07/26 14:21:09 elca Exp $ */ |
10 | 10 | ||
11 | static void nsp_message_in(Scsi_Cmnd *SCpnt) | 11 | static void nsp_message_in(struct scsi_cmnd *SCpnt) |
12 | { | 12 | { |
13 | unsigned int base = SCpnt->device->host->io_port; | 13 | unsigned int base = SCpnt->device->host->io_port; |
14 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 14 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
@@ -50,7 +50,7 @@ static void nsp_message_in(Scsi_Cmnd *SCpnt) | |||
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
53 | static void nsp_message_out(Scsi_Cmnd *SCpnt) | 53 | static void nsp_message_out(struct scsi_cmnd *SCpnt) |
54 | { | 54 | { |
55 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; | 55 | nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; |
56 | int ret = 1; | 56 | int ret = 1; |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index b0eba39f208a..89a2a9f11e41 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -1012,7 +1012,7 @@ static LIST_HEAD(ppa_hosts); | |||
1012 | static int __ppa_attach(struct parport *pb) | 1012 | static int __ppa_attach(struct parport *pb) |
1013 | { | 1013 | { |
1014 | struct Scsi_Host *host; | 1014 | struct Scsi_Host *host; |
1015 | DECLARE_WAIT_QUEUE_HEAD(waiting); | 1015 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waiting); |
1016 | DEFINE_WAIT(wait); | 1016 | DEFINE_WAIT(wait); |
1017 | ppa_struct *dev; | 1017 | ppa_struct *dev; |
1018 | int ports; | 1018 | int ports; |
diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c index a720c9265e66..899e89d6fe67 100644 --- a/drivers/scsi/psi240i.c +++ b/drivers/scsi/psi240i.c | |||
@@ -87,11 +87,11 @@ typedef struct | |||
87 | { | 87 | { |
88 | USHORT ports[13]; | 88 | USHORT ports[13]; |
89 | OUR_DEVICE device[8]; | 89 | OUR_DEVICE device[8]; |
90 | Scsi_Cmnd *pSCmnd; | 90 | struct scsi_cmnd *pSCmnd; |
91 | IDE_STRUCT ide; | 91 | IDE_STRUCT ide; |
92 | ULONG startSector; | 92 | ULONG startSector; |
93 | USHORT sectorCount; | 93 | USHORT sectorCount; |
94 | Scsi_Cmnd *SCpnt; | 94 | struct scsi_cmnd *SCpnt; |
95 | VOID *buffer; | 95 | VOID *buffer; |
96 | USHORT expectingIRQ; | 96 | USHORT expectingIRQ; |
97 | } ADAPTER240I, *PADAPTER240I; | 97 | } ADAPTER240I, *PADAPTER240I; |
@@ -253,12 +253,12 @@ static ULONG DecodeError (struct Scsi_Host *pshost, UCHAR status) | |||
253 | ****************************************************************/ | 253 | ****************************************************************/ |
254 | static void Irq_Handler (int irq, void *dev_id) | 254 | static void Irq_Handler (int irq, void *dev_id) |
255 | { | 255 | { |
256 | struct Scsi_Host *shost; // Pointer to host data block | 256 | struct Scsi_Host *shost; // Pointer to host data block |
257 | PADAPTER240I padapter; // Pointer to adapter control structure | 257 | PADAPTER240I padapter; // Pointer to adapter control structure |
258 | USHORT *pports; // I/O port array | 258 | USHORT *pports; // I/O port array |
259 | Scsi_Cmnd *SCpnt; | 259 | struct scsi_cmnd *SCpnt; |
260 | UCHAR status; | 260 | UCHAR status; |
261 | int z; | 261 | int z; |
262 | 262 | ||
263 | DEB(printk ("\npsi240i received interrupt\n")); | 263 | DEB(printk ("\npsi240i received interrupt\n")); |
264 | 264 | ||
@@ -328,7 +328,7 @@ static void Irq_Handler (int irq, void *dev_id) | |||
328 | pinquiryData->AdditionalLength = 35 - 4; | 328 | pinquiryData->AdditionalLength = 35 - 4; |
329 | 329 | ||
330 | // Fill in vendor identification fields. | 330 | // Fill in vendor identification fields. |
331 | for ( z = 0; z < 20; z += 2 ) | 331 | for ( z = 0; z < 8; z += 2 ) |
332 | { | 332 | { |
333 | pinquiryData->VendorId[z] = ((UCHAR *)identifyData.ModelNumber)[z + 1]; | 333 | pinquiryData->VendorId[z] = ((UCHAR *)identifyData.ModelNumber)[z + 1]; |
334 | pinquiryData->VendorId[z + 1] = ((UCHAR *)identifyData.ModelNumber)[z]; | 334 | pinquiryData->VendorId[z + 1] = ((UCHAR *)identifyData.ModelNumber)[z]; |
@@ -389,12 +389,17 @@ static irqreturn_t do_Irq_Handler (int irq, void *dev_id) | |||
389 | * Returns: Status code. | 389 | * Returns: Status code. |
390 | * | 390 | * |
391 | ****************************************************************/ | 391 | ****************************************************************/ |
392 | static int Psi240i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) | 392 | static int Psi240i_QueueCommand(struct scsi_cmnd *SCpnt, |
393 | void (*done)(struct scsi_cmnd *)) | ||
393 | { | 394 | { |
394 | UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB | 395 | UCHAR *cdb = (UCHAR *)SCpnt->cmnd; |
395 | PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); // Pointer to adapter control structure | 396 | // Pointer to SCSI CDB |
396 | POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];// Pointer to device information | 397 | PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); |
397 | UCHAR rc; // command return code | 398 | // Pointer to adapter control structure |
399 | POUR_DEVICE pdev = &padapter->device [SCpnt->device->id]; | ||
400 | // Pointer to device information | ||
401 | UCHAR rc; | ||
402 | // command return code | ||
398 | 403 | ||
399 | SCpnt->scsi_done = done; | 404 | SCpnt->scsi_done = done; |
400 | padapter->ide.ide.ides.spigot = pdev->spigot; | 405 | padapter->ide.ide.ides.spigot = pdev->spigot; |
diff --git a/drivers/scsi/psi240i.h b/drivers/scsi/psi240i.h index 6a598766df51..21ebb9214004 100644 --- a/drivers/scsi/psi240i.h +++ b/drivers/scsi/psi240i.h | |||
@@ -309,7 +309,7 @@ typedef struct _IDENTIFY_DATA2 { | |||
309 | #endif // PSI_EIDE_SCSIOP | 309 | #endif // PSI_EIDE_SCSIOP |
310 | 310 | ||
311 | // function prototypes | 311 | // function prototypes |
312 | int Psi240i_Command (Scsi_Cmnd *SCpnt); | 312 | int Psi240i_Command(struct scsi_cmnd *SCpnt); |
313 | int Psi240i_Abort (Scsi_Cmnd *SCpnt); | 313 | int Psi240i_Abort(struct scsi_cmnd *SCpnt); |
314 | int Psi240i_Reset (Scsi_Cmnd *SCpnt, unsigned int flags); | 314 | int Psi240i_Reset(struct scsi_cmnd *SCpnt, unsigned int flags); |
315 | #endif | 315 | #endif |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 2521d548dd59..16af5b79e587 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -931,11 +931,10 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action) | |||
931 | 931 | ||
932 | case BUS_RESET: | 932 | case BUS_RESET: |
933 | if (qla1280_verbose) | 933 | if (qla1280_verbose) |
934 | printk(KERN_INFO "qla1280(%ld:%d): Issuing BUS " | 934 | printk(KERN_INFO "qla1280(%ld:%d): Issued bus " |
935 | "DEVICE RESET\n", ha->host_no, bus); | 935 | "reset.\n", ha->host_no, bus); |
936 | if (qla1280_bus_reset(ha, bus == 0)) | 936 | if (qla1280_bus_reset(ha, bus) == 0) |
937 | result = SUCCESS; | 937 | result = SUCCESS; |
938 | |||
939 | break; | 938 | break; |
940 | 939 | ||
941 | case ADAPTER_RESET: | 940 | case ADAPTER_RESET: |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index ee75a71f3c66..285c8e8ff1a0 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -379,21 +379,37 @@ static struct bin_attribute sysfs_sfp_attr = { | |||
379 | .read = qla2x00_sysfs_read_sfp, | 379 | .read = qla2x00_sysfs_read_sfp, |
380 | }; | 380 | }; |
381 | 381 | ||
382 | static struct sysfs_entry { | ||
383 | char *name; | ||
384 | struct bin_attribute *attr; | ||
385 | int is4GBp_only; | ||
386 | } bin_file_entries[] = { | ||
387 | { "fw_dump", &sysfs_fw_dump_attr, }, | ||
388 | { "nvram", &sysfs_nvram_attr, }, | ||
389 | { "optrom", &sysfs_optrom_attr, }, | ||
390 | { "optrom_ctl", &sysfs_optrom_ctl_attr, }, | ||
391 | { "vpd", &sysfs_vpd_attr, 1 }, | ||
392 | { "sfp", &sysfs_sfp_attr, 1 }, | ||
393 | { 0 }, | ||
394 | }; | ||
395 | |||
382 | void | 396 | void |
383 | qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) | 397 | qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha) |
384 | { | 398 | { |
385 | struct Scsi_Host *host = ha->host; | 399 | struct Scsi_Host *host = ha->host; |
400 | struct sysfs_entry *iter; | ||
401 | int ret; | ||
386 | 402 | ||
387 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); | 403 | for (iter = bin_file_entries; iter->name; iter++) { |
388 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); | 404 | if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))) |
389 | sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr); | 405 | continue; |
390 | sysfs_create_bin_file(&host->shost_gendev.kobj, | 406 | |
391 | &sysfs_optrom_ctl_attr); | 407 | ret = sysfs_create_bin_file(&host->shost_gendev.kobj, |
392 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { | 408 | iter->attr); |
393 | sysfs_create_bin_file(&host->shost_gendev.kobj, | 409 | if (ret) |
394 | &sysfs_vpd_attr); | 410 | qla_printk(KERN_INFO, ha, |
395 | sysfs_create_bin_file(&host->shost_gendev.kobj, | 411 | "Unable to create sysfs %s binary attribute " |
396 | &sysfs_sfp_attr); | 412 | "(%d).\n", iter->name, ret); |
397 | } | 413 | } |
398 | } | 414 | } |
399 | 415 | ||
@@ -401,17 +417,14 @@ void | |||
401 | qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) | 417 | qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) |
402 | { | 418 | { |
403 | struct Scsi_Host *host = ha->host; | 419 | struct Scsi_Host *host = ha->host; |
420 | struct sysfs_entry *iter; | ||
421 | |||
422 | for (iter = bin_file_entries; iter->name; iter++) { | ||
423 | if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))) | ||
424 | continue; | ||
404 | 425 | ||
405 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr); | ||
406 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr); | ||
407 | sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr); | ||
408 | sysfs_remove_bin_file(&host->shost_gendev.kobj, | ||
409 | &sysfs_optrom_ctl_attr); | ||
410 | if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { | ||
411 | sysfs_remove_bin_file(&host->shost_gendev.kobj, | ||
412 | &sysfs_vpd_attr); | ||
413 | sysfs_remove_bin_file(&host->shost_gendev.kobj, | 426 | sysfs_remove_bin_file(&host->shost_gendev.kobj, |
414 | &sysfs_sfp_attr); | 427 | iter->attr); |
415 | } | 428 | } |
416 | 429 | ||
417 | if (ha->beacon_blink_led == 1) | 430 | if (ha->beacon_blink_led == 1) |
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h index 90dad7e88985..5b12278968e0 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.h +++ b/drivers/scsi/qla2xxx/qla_dbg.h | |||
@@ -38,7 +38,7 @@ | |||
38 | * Macros use for debugging the driver. | 38 | * Macros use for debugging the driver. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #define DEBUG(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 41 | #define DEBUG(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
42 | 42 | ||
43 | #if defined(QL_DEBUG_LEVEL_1) | 43 | #if defined(QL_DEBUG_LEVEL_1) |
44 | #define DEBUG1(x) do {x;} while (0) | 44 | #define DEBUG1(x) do {x;} while (0) |
@@ -46,12 +46,12 @@ | |||
46 | #define DEBUG1(x) do {} while (0) | 46 | #define DEBUG1(x) do {} while (0) |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #define DEBUG2(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 49 | #define DEBUG2(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
50 | #define DEBUG2_3(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 50 | #define DEBUG2_3(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
51 | #define DEBUG2_3_11(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 51 | #define DEBUG2_3_11(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
52 | #define DEBUG2_9_10(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 52 | #define DEBUG2_9_10(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
53 | #define DEBUG2_11(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 53 | #define DEBUG2_11(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
54 | #define DEBUG2_13(x) do { if (qla2_extended_error_logging) { x; } } while (0) | 54 | #define DEBUG2_13(x) do { if (ql2xextended_error_logging) { x; } } while (0) |
55 | 55 | ||
56 | #if defined(QL_DEBUG_LEVEL_3) | 56 | #if defined(QL_DEBUG_LEVEL_3) |
57 | #define DEBUG3(x) do {x;} while (0) | 57 | #define DEBUG3(x) do {x;} while (0) |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index bab33f6d0bdb..c4fc40f8e8ca 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -1545,6 +1545,9 @@ typedef struct fc_port { | |||
1545 | spinlock_t rport_lock; | 1545 | spinlock_t rport_lock; |
1546 | struct fc_rport *rport, *drport; | 1546 | struct fc_rport *rport, *drport; |
1547 | u32 supported_classes; | 1547 | u32 supported_classes; |
1548 | |||
1549 | unsigned long last_queue_full; | ||
1550 | unsigned long last_ramp_up; | ||
1548 | } fc_port_t; | 1551 | } fc_port_t; |
1549 | 1552 | ||
1550 | /* | 1553 | /* |
@@ -2255,6 +2258,7 @@ typedef struct scsi_qla_host { | |||
2255 | uint16_t mgmt_svr_loop_id; | 2258 | uint16_t mgmt_svr_loop_id; |
2256 | 2259 | ||
2257 | uint32_t login_retry_count; | 2260 | uint32_t login_retry_count; |
2261 | int max_q_depth; | ||
2258 | 2262 | ||
2259 | /* Fibre Channel Device List. */ | 2263 | /* Fibre Channel Device List. */ |
2260 | struct list_head fcports; | 2264 | struct list_head fcports; |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 7da69832d74c..32ebeec45ff0 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -48,6 +48,7 @@ extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *); | |||
48 | extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *); | 48 | extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *); |
49 | 49 | ||
50 | extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *); | 50 | extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *); |
51 | extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *); | ||
51 | 52 | ||
52 | /* | 53 | /* |
53 | * Global Data in qla_os.c source file. | 54 | * Global Data in qla_os.c source file. |
@@ -60,7 +61,8 @@ extern int ql2xplogiabsentdevice; | |||
60 | extern int ql2xloginretrycount; | 61 | extern int ql2xloginretrycount; |
61 | extern int ql2xfdmienable; | 62 | extern int ql2xfdmienable; |
62 | extern int ql2xallocfwdump; | 63 | extern int ql2xallocfwdump; |
63 | extern int qla2_extended_error_logging; | 64 | extern int ql2xextended_error_logging; |
65 | extern int ql2xqfullrampup; | ||
64 | 66 | ||
65 | extern void qla2x00_sp_compl(scsi_qla_host_t *, srb_t *); | 67 | extern void qla2x00_sp_compl(scsi_qla_host_t *, srb_t *); |
66 | 68 | ||
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 833b93085fd3..08cb5e3fb553 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -1644,7 +1644,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha) | |||
1644 | * Set host adapter parameters. | 1644 | * Set host adapter parameters. |
1645 | */ | 1645 | */ |
1646 | if (nv->host_p[0] & BIT_7) | 1646 | if (nv->host_p[0] & BIT_7) |
1647 | qla2_extended_error_logging = 1; | 1647 | ql2xextended_error_logging = 1; |
1648 | ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0); | 1648 | ha->flags.disable_risc_code_load = ((nv->host_p[0] & BIT_4) ? 1 : 0); |
1649 | /* Always load RISC code on non ISP2[12]00 chips. */ | 1649 | /* Always load RISC code on non ISP2[12]00 chips. */ |
1650 | if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) | 1650 | if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) |
@@ -3948,3 +3948,24 @@ qla24xx_load_risc(scsi_qla_host_t *ha, uint32_t *srisc_addr) | |||
3948 | fail_fw_integrity: | 3948 | fail_fw_integrity: |
3949 | return QLA_FUNCTION_FAILED; | 3949 | return QLA_FUNCTION_FAILED; |
3950 | } | 3950 | } |
3951 | |||
3952 | void | ||
3953 | qla2x00_try_to_stop_firmware(scsi_qla_host_t *ha) | ||
3954 | { | ||
3955 | int ret, retries; | ||
3956 | |||
3957 | if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)) | ||
3958 | return; | ||
3959 | |||
3960 | ret = qla2x00_stop_firmware(ha); | ||
3961 | for (retries = 5; ret != QLA_SUCCESS && retries ; retries--) { | ||
3962 | qla2x00_reset_chip(ha); | ||
3963 | if (qla2x00_chip_diag(ha) != QLA_SUCCESS) | ||
3964 | continue; | ||
3965 | if (qla2x00_setup_chip(ha) != QLA_SUCCESS) | ||
3966 | continue; | ||
3967 | qla_printk(KERN_INFO, ha, | ||
3968 | "Attempting retry of stop-firmware command...\n"); | ||
3969 | ret = qla2x00_stop_firmware(ha); | ||
3970 | } | ||
3971 | } | ||
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 626c7178a434..d3b6df4d55c8 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -6,6 +6,8 @@ | |||
6 | */ | 6 | */ |
7 | #include "qla_def.h" | 7 | #include "qla_def.h" |
8 | 8 | ||
9 | #include <scsi/scsi_tcq.h> | ||
10 | |||
9 | static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t); | 11 | static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t); |
10 | static void qla2x00_async_event(scsi_qla_host_t *, uint16_t *); | 12 | static void qla2x00_async_event(scsi_qla_host_t *, uint16_t *); |
11 | static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t); | 13 | static void qla2x00_process_completed_request(struct scsi_qla_host *, uint32_t); |
@@ -593,6 +595,67 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
593 | } | 595 | } |
594 | } | 596 | } |
595 | 597 | ||
598 | static void | ||
599 | qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, void *data) | ||
600 | { | ||
601 | fc_port_t *fcport = data; | ||
602 | |||
603 | if (fcport->ha->max_q_depth <= sdev->queue_depth) | ||
604 | return; | ||
605 | |||
606 | if (sdev->ordered_tags) | ||
607 | scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, | ||
608 | sdev->queue_depth + 1); | ||
609 | else | ||
610 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, | ||
611 | sdev->queue_depth + 1); | ||
612 | |||
613 | fcport->last_ramp_up = jiffies; | ||
614 | |||
615 | DEBUG2(qla_printk(KERN_INFO, fcport->ha, | ||
616 | "scsi(%ld:%d:%d:%d): Queue depth adjusted-up to %d.\n", | ||
617 | fcport->ha->host_no, sdev->channel, sdev->id, sdev->lun, | ||
618 | sdev->queue_depth)); | ||
619 | } | ||
620 | |||
621 | static void | ||
622 | qla2x00_adjust_sdev_qdepth_down(struct scsi_device *sdev, void *data) | ||
623 | { | ||
624 | fc_port_t *fcport = data; | ||
625 | |||
626 | if (!scsi_track_queue_full(sdev, sdev->queue_depth - 1)) | ||
627 | return; | ||
628 | |||
629 | DEBUG2(qla_printk(KERN_INFO, fcport->ha, | ||
630 | "scsi(%ld:%d:%d:%d): Queue depth adjusted-down to %d.\n", | ||
631 | fcport->ha->host_no, sdev->channel, sdev->id, sdev->lun, | ||
632 | sdev->queue_depth)); | ||
633 | } | ||
634 | |||
635 | static inline void | ||
636 | qla2x00_ramp_up_queue_depth(scsi_qla_host_t *ha, srb_t *sp) | ||
637 | { | ||
638 | fc_port_t *fcport; | ||
639 | struct scsi_device *sdev; | ||
640 | |||
641 | sdev = sp->cmd->device; | ||
642 | if (sdev->queue_depth >= ha->max_q_depth) | ||
643 | return; | ||
644 | |||
645 | fcport = sp->fcport; | ||
646 | if (time_before(jiffies, | ||
647 | fcport->last_ramp_up + ql2xqfullrampup * HZ)) | ||
648 | return; | ||
649 | if (time_before(jiffies, | ||
650 | fcport->last_queue_full + ql2xqfullrampup * HZ)) | ||
651 | return; | ||
652 | |||
653 | spin_unlock_irq(&ha->hardware_lock); | ||
654 | starget_for_each_device(sdev->sdev_target, fcport, | ||
655 | qla2x00_adjust_sdev_qdepth_up); | ||
656 | spin_lock_irq(&ha->hardware_lock); | ||
657 | } | ||
658 | |||
596 | /** | 659 | /** |
597 | * qla2x00_process_completed_request() - Process a Fast Post response. | 660 | * qla2x00_process_completed_request() - Process a Fast Post response. |
598 | * @ha: SCSI driver HA context | 661 | * @ha: SCSI driver HA context |
@@ -624,6 +687,8 @@ qla2x00_process_completed_request(struct scsi_qla_host *ha, uint32_t index) | |||
624 | 687 | ||
625 | /* Save ISP completion status */ | 688 | /* Save ISP completion status */ |
626 | sp->cmd->result = DID_OK << 16; | 689 | sp->cmd->result = DID_OK << 16; |
690 | |||
691 | qla2x00_ramp_up_queue_depth(ha, sp); | ||
627 | qla2x00_sp_compl(ha, sp); | 692 | qla2x00_sp_compl(ha, sp); |
628 | } else { | 693 | } else { |
629 | DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n", | 694 | DEBUG2(printk("scsi(%ld): Invalid ISP SCSI completion handle\n", |
@@ -823,6 +888,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
823 | */ | 888 | */ |
824 | switch (comp_status) { | 889 | switch (comp_status) { |
825 | case CS_COMPLETE: | 890 | case CS_COMPLETE: |
891 | case CS_QUEUE_FULL: | ||
826 | if (scsi_status == 0) { | 892 | if (scsi_status == 0) { |
827 | cp->result = DID_OK << 16; | 893 | cp->result = DID_OK << 16; |
828 | break; | 894 | break; |
@@ -849,6 +915,20 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
849 | } | 915 | } |
850 | cp->result = DID_OK << 16 | lscsi_status; | 916 | cp->result = DID_OK << 16 | lscsi_status; |
851 | 917 | ||
918 | if (lscsi_status == SAM_STAT_TASK_SET_FULL) { | ||
919 | DEBUG2(printk(KERN_INFO | ||
920 | "scsi(%ld): QUEUE FULL status detected " | ||
921 | "0x%x-0x%x.\n", ha->host_no, comp_status, | ||
922 | scsi_status)); | ||
923 | |||
924 | /* Adjust queue depth for all luns on the port. */ | ||
925 | fcport->last_queue_full = jiffies; | ||
926 | spin_unlock_irq(&ha->hardware_lock); | ||
927 | starget_for_each_device(cp->device->sdev_target, | ||
928 | fcport, qla2x00_adjust_sdev_qdepth_down); | ||
929 | spin_lock_irq(&ha->hardware_lock); | ||
930 | break; | ||
931 | } | ||
852 | if (lscsi_status != SS_CHECK_CONDITION) | 932 | if (lscsi_status != SS_CHECK_CONDITION) |
853 | break; | 933 | break; |
854 | 934 | ||
@@ -1066,17 +1146,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
1066 | qla2x00_mark_device_lost(ha, fcport, 1, 1); | 1146 | qla2x00_mark_device_lost(ha, fcport, 1, 1); |
1067 | break; | 1147 | break; |
1068 | 1148 | ||
1069 | case CS_QUEUE_FULL: | ||
1070 | DEBUG2(printk(KERN_INFO | ||
1071 | "scsi(%ld): QUEUE FULL status detected 0x%x-0x%x.\n", | ||
1072 | ha->host_no, comp_status, scsi_status)); | ||
1073 | |||
1074 | /* SCSI Mid-Layer handles device queue full */ | ||
1075 | |||
1076 | cp->result = DID_OK << 16 | lscsi_status; | ||
1077 | |||
1078 | break; | ||
1079 | |||
1080 | default: | 1149 | default: |
1081 | DEBUG3(printk("scsi(%ld): Error detected (unknown status) " | 1150 | DEBUG3(printk("scsi(%ld): Error detected (unknown status) " |
1082 | "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status)); | 1151 | "0x%x-0x%x.\n", ha->host_no, comp_status, scsi_status)); |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 5e70c49fdf84..3eb4cd2cbc78 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -61,9 +61,9 @@ MODULE_PARM_DESC(ql2xallocfwdump, | |||
61 | "during HBA initialization. Memory allocation requirements " | 61 | "during HBA initialization. Memory allocation requirements " |
62 | "vary by ISP type. Default is 1 - allocate memory."); | 62 | "vary by ISP type. Default is 1 - allocate memory."); |
63 | 63 | ||
64 | int qla2_extended_error_logging; | 64 | int ql2xextended_error_logging; |
65 | module_param(qla2_extended_error_logging, int, S_IRUGO|S_IRUSR); | 65 | module_param(ql2xextended_error_logging, int, S_IRUGO|S_IRUSR); |
66 | MODULE_PARM_DESC(qla2_extended_error_logging, | 66 | MODULE_PARM_DESC(ql2xextended_error_logging, |
67 | "Option to enable extended error logging, " | 67 | "Option to enable extended error logging, " |
68 | "Default is 0 - no logging. 1 - log errors."); | 68 | "Default is 0 - no logging. 1 - log errors."); |
69 | 69 | ||
@@ -77,6 +77,19 @@ MODULE_PARM_DESC(ql2xfdmienable, | |||
77 | "Enables FDMI registratons " | 77 | "Enables FDMI registratons " |
78 | "Default is 0 - no FDMI. 1 - perfom FDMI."); | 78 | "Default is 0 - no FDMI. 1 - perfom FDMI."); |
79 | 79 | ||
80 | #define MAX_Q_DEPTH 32 | ||
81 | static int ql2xmaxqdepth = MAX_Q_DEPTH; | ||
82 | module_param(ql2xmaxqdepth, int, S_IRUGO|S_IWUSR); | ||
83 | MODULE_PARM_DESC(ql2xmaxqdepth, | ||
84 | "Maximum queue depth to report for target devices."); | ||
85 | |||
86 | int ql2xqfullrampup = 120; | ||
87 | module_param(ql2xqfullrampup, int, S_IRUGO|S_IWUSR); | ||
88 | MODULE_PARM_DESC(ql2xqfullrampup, | ||
89 | "Number of seconds to wait to begin to ramp-up the queue " | ||
90 | "depth for a device after a queue-full condition has been " | ||
91 | "detected. Default is 120 seconds."); | ||
92 | |||
80 | /* | 93 | /* |
81 | * SCSI host template entry points | 94 | * SCSI host template entry points |
82 | */ | 95 | */ |
@@ -1104,9 +1117,9 @@ qla2xxx_slave_configure(struct scsi_device *sdev) | |||
1104 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); | 1117 | struct fc_rport *rport = starget_to_rport(sdev->sdev_target); |
1105 | 1118 | ||
1106 | if (sdev->tagged_supported) | 1119 | if (sdev->tagged_supported) |
1107 | scsi_activate_tcq(sdev, 32); | 1120 | scsi_activate_tcq(sdev, ha->max_q_depth); |
1108 | else | 1121 | else |
1109 | scsi_deactivate_tcq(sdev, 32); | 1122 | scsi_deactivate_tcq(sdev, ha->max_q_depth); |
1110 | 1123 | ||
1111 | rport->dev_loss_tmo = ha->port_down_retry_count + 5; | 1124 | rport->dev_loss_tmo = ha->port_down_retry_count + 5; |
1112 | 1125 | ||
@@ -1413,6 +1426,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1413 | ha->link_data_rate = PORT_SPEED_UNKNOWN; | 1426 | ha->link_data_rate = PORT_SPEED_UNKNOWN; |
1414 | ha->optrom_size = OPTROM_SIZE_2300; | 1427 | ha->optrom_size = OPTROM_SIZE_2300; |
1415 | 1428 | ||
1429 | ha->max_q_depth = MAX_Q_DEPTH; | ||
1430 | if (ql2xmaxqdepth != 0 && ql2xmaxqdepth <= 0xffffU) | ||
1431 | ha->max_q_depth = ql2xmaxqdepth; | ||
1432 | |||
1416 | /* Assign ISP specific operations. */ | 1433 | /* Assign ISP specific operations. */ |
1417 | ha->isp_ops.pci_config = qla2100_pci_config; | 1434 | ha->isp_ops.pci_config = qla2100_pci_config; |
1418 | ha->isp_ops.reset_chip = qla2x00_reset_chip; | 1435 | ha->isp_ops.reset_chip = qla2x00_reset_chip; |
@@ -1712,8 +1729,10 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1712 | if (ha->eft) | 1729 | if (ha->eft) |
1713 | qla2x00_trace_control(ha, TC_DISABLE, 0, 0); | 1730 | qla2x00_trace_control(ha, TC_DISABLE, 0, 0); |
1714 | 1731 | ||
1732 | ha->flags.online = 0; | ||
1733 | |||
1715 | /* Stop currently executing firmware. */ | 1734 | /* Stop currently executing firmware. */ |
1716 | qla2x00_stop_firmware(ha); | 1735 | qla2x00_try_to_stop_firmware(ha); |
1717 | 1736 | ||
1718 | /* turn-off interrupts on the card */ | 1737 | /* turn-off interrupts on the card */ |
1719 | if (ha->interrupts_on) | 1738 | if (ha->interrupts_on) |
@@ -1721,8 +1740,6 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1721 | 1740 | ||
1722 | qla2x00_mem_free(ha); | 1741 | qla2x00_mem_free(ha); |
1723 | 1742 | ||
1724 | ha->flags.online = 0; | ||
1725 | |||
1726 | /* Detach interrupts */ | 1743 | /* Detach interrupts */ |
1727 | if (ha->host->irq) | 1744 | if (ha->host->irq) |
1728 | free_irq(ha->host->irq, ha); | 1745 | free_irq(ha->host->irq, ha); |
@@ -2697,7 +2714,7 @@ qla2x00_module_init(void) | |||
2697 | 2714 | ||
2698 | /* Derive version string. */ | 2715 | /* Derive version string. */ |
2699 | strcpy(qla2x00_version_str, QLA2XXX_VERSION); | 2716 | strcpy(qla2x00_version_str, QLA2XXX_VERSION); |
2700 | if (qla2_extended_error_logging) | 2717 | if (ql2xextended_error_logging) |
2701 | strcat(qla2x00_version_str, "-debug"); | 2718 | strcat(qla2x00_version_str, "-debug"); |
2702 | 2719 | ||
2703 | qla2xxx_transport_template = | 2720 | qla2xxx_transport_template = |
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h index e57bf45a3393..1fa0bce6b24e 100644 --- a/drivers/scsi/qla2xxx/qla_version.h +++ b/drivers/scsi/qla2xxx/qla_version.h | |||
@@ -7,7 +7,7 @@ | |||
7 | /* | 7 | /* |
8 | * Driver version | 8 | * Driver version |
9 | */ | 9 | */ |
10 | #define QLA2XXX_VERSION "8.01.07-k2" | 10 | #define QLA2XXX_VERSION "8.01.07-k3" |
11 | 11 | ||
12 | #define QLA_DRIVER_MAJOR_VER 8 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
13 | #define QLA_DRIVER_MINOR_VER 1 | 13 | #define QLA_DRIVER_MINOR_VER 1 |
diff --git a/drivers/scsi/qla4xxx/Kconfig b/drivers/scsi/qla4xxx/Kconfig index 08a07f0b8d94..69cbff3f57cf 100644 --- a/drivers/scsi/qla4xxx/Kconfig +++ b/drivers/scsi/qla4xxx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config SCSI_QLA_ISCSI | 1 | config SCSI_QLA_ISCSI |
2 | tristate "QLogic ISP4XXX host adapter family support" | 2 | tristate "QLogic ISP4XXX host adapter family support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI && NET |
4 | select SCSI_ISCSI_ATTRS | 4 | select SCSI_ISCSI_ATTRS |
5 | ---help--- | 5 | ---help--- |
6 | This driver supports the QLogic 40xx (ISP4XXX) iSCSI host | 6 | This driver supports the QLogic 40xx (ISP4XXX) iSCSI host |
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.h b/drivers/scsi/qla4xxx/ql4_dbg.h index 3e99dcfd5a9f..d861c3b411c8 100644 --- a/drivers/scsi/qla4xxx/ql4_dbg.h +++ b/drivers/scsi/qla4xxx/ql4_dbg.h | |||
@@ -22,14 +22,14 @@ | |||
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #if defined(QL_DEBUG_LEVEL_2) | 24 | #if defined(QL_DEBUG_LEVEL_2) |
25 | #define DEBUG2(x) do {if(qla4_extended_error_logging == 2) x;} while (0); | 25 | #define DEBUG2(x) do {if(ql4xextended_error_logging == 2) x;} while (0); |
26 | #define DEBUG2_3(x) do {x;} while (0); | 26 | #define DEBUG2_3(x) do {x;} while (0); |
27 | #else /* */ | 27 | #else /* */ |
28 | #define DEBUG2(x) do {} while (0); | 28 | #define DEBUG2(x) do {} while (0); |
29 | #endif /* */ | 29 | #endif /* */ |
30 | 30 | ||
31 | #if defined(QL_DEBUG_LEVEL_3) | 31 | #if defined(QL_DEBUG_LEVEL_3) |
32 | #define DEBUG3(x) do {if(qla4_extended_error_logging == 3) x;} while (0); | 32 | #define DEBUG3(x) do {if(ql4xextended_error_logging == 3) x;} while (0); |
33 | #else /* */ | 33 | #else /* */ |
34 | #define DEBUG3(x) do {} while (0); | 34 | #define DEBUG3(x) do {} while (0); |
35 | #if !defined(QL_DEBUG_LEVEL_2) | 35 | #if !defined(QL_DEBUG_LEVEL_2) |
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index 2c803edf2de8..eeefdcb1edb5 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef __QLA4x_GBL_H | 8 | #ifndef __QLA4x_GBL_H |
9 | #define __QLA4x_GBL_H | 9 | #define __QLA4x_GBL_H |
10 | 10 | ||
11 | int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a); | ||
11 | int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port); | 12 | int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port); |
12 | int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb); | 13 | int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb); |
13 | int qla4xxx_initialize_adapter(struct scsi_qla_host * ha, | 14 | int qla4xxx_initialize_adapter(struct scsi_qla_host * ha, |
@@ -72,7 +73,7 @@ int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha); | |||
72 | int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha, | 73 | int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha, |
73 | uint32_t fw_ddb_index, uint32_t state); | 74 | uint32_t fw_ddb_index, uint32_t state); |
74 | 75 | ||
75 | extern int qla4_extended_error_logging; | 76 | extern int ql4xextended_error_logging; |
76 | extern int ql4xdiscoverywait; | 77 | extern int ql4xdiscoverywait; |
77 | extern int ql4xdontresethba; | 78 | extern int ql4xdontresethba; |
78 | #endif /* _QLA4x_GBL_H */ | 79 | #endif /* _QLA4x_GBL_H */ |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index bb3a1c11f44c..9e81b810dc88 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
@@ -978,7 +978,7 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha) | |||
978 | return status; | 978 | return status; |
979 | } | 979 | } |
980 | 980 | ||
981 | static int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) | 981 | int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) |
982 | { | 982 | { |
983 | #define QL4_LOCK_DRVR_WAIT 300 | 983 | #define QL4_LOCK_DRVR_WAIT 300 |
984 | #define QL4_LOCK_DRVR_SLEEP 100 | 984 | #define QL4_LOCK_DRVR_SLEEP 100 |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index ef82399c0858..b721dc5dd711 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -701,7 +701,7 @@ void qla4xxx_get_conn_event_log(struct scsi_qla_host * ha) | |||
701 | DEBUG3(printk("scsi%ld: Connection Event Log Dump (%d entries):\n", | 701 | DEBUG3(printk("scsi%ld: Connection Event Log Dump (%d entries):\n", |
702 | ha->host_no, num_valid_entries)); | 702 | ha->host_no, num_valid_entries)); |
703 | 703 | ||
704 | if (qla4_extended_error_logging == 3) { | 704 | if (ql4xextended_error_logging == 3) { |
705 | if (oldest_entry == 0) { | 705 | if (oldest_entry == 0) { |
706 | /* Circular Buffer has not wrapped around */ | 706 | /* Circular Buffer has not wrapped around */ |
707 | for (i=0; i < num_valid_entries; i++) { | 707 | for (i=0; i < num_valid_entries; i++) { |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 178fcddcfd81..bab434ee774b 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -34,9 +34,9 @@ MODULE_PARM_DESC(ql4xdontresethba, | |||
34 | " default it will reset hba :0" | 34 | " default it will reset hba :0" |
35 | " set to 1 to avoid resetting HBA"); | 35 | " set to 1 to avoid resetting HBA"); |
36 | 36 | ||
37 | int qla4_extended_error_logging = 0; /* 0 = off, 1 = log errors */ | 37 | int ql4xextended_error_logging = 0; /* 0 = off, 1 = log errors */ |
38 | module_param(qla4_extended_error_logging, int, S_IRUGO | S_IRUSR); | 38 | module_param(ql4xextended_error_logging, int, S_IRUGO | S_IRUSR); |
39 | MODULE_PARM_DESC(qla4_extended_error_logging, | 39 | MODULE_PARM_DESC(ql4xextended_error_logging, |
40 | "Option to enable extended error logging, " | 40 | "Option to enable extended error logging, " |
41 | "Default is 0 - no logging, 1 - debug logging"); | 41 | "Default is 0 - no logging, 1 - debug logging"); |
42 | 42 | ||
@@ -919,18 +919,11 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha, | |||
919 | if (status == QLA_SUCCESS) { | 919 | if (status == QLA_SUCCESS) { |
920 | DEBUG2(printk("scsi%ld: %s - Performing soft reset..\n", | 920 | DEBUG2(printk("scsi%ld: %s - Performing soft reset..\n", |
921 | ha->host_no, __func__)); | 921 | ha->host_no, __func__)); |
922 | status = qla4xxx_soft_reset(ha); | 922 | qla4xxx_flush_active_srbs(ha); |
923 | } | 923 | if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) |
924 | /* FIXMEkaren: Do we want to keep interrupts enabled and process | 924 | status = qla4xxx_soft_reset(ha); |
925 | AENs after soft reset */ | 925 | else |
926 | 926 | status = QLA_ERROR; | |
927 | /* If firmware (SOFT) reset failed, or if all outstanding | ||
928 | * commands have not returned, then do a HARD reset. | ||
929 | */ | ||
930 | if (status == QLA_ERROR) { | ||
931 | DEBUG2(printk("scsi%ld: %s - Performing hard reset..\n", | ||
932 | ha->host_no, __func__)); | ||
933 | status = qla4xxx_hard_reset(ha); | ||
934 | } | 927 | } |
935 | 928 | ||
936 | /* Flush any pending ddb changed AENs */ | 929 | /* Flush any pending ddb changed AENs */ |
@@ -1016,13 +1009,9 @@ static void qla4xxx_do_dpc(void *data) | |||
1016 | struct scsi_qla_host *ha = (struct scsi_qla_host *) data; | 1009 | struct scsi_qla_host *ha = (struct scsi_qla_host *) data; |
1017 | struct ddb_entry *ddb_entry, *dtemp; | 1010 | struct ddb_entry *ddb_entry, *dtemp; |
1018 | 1011 | ||
1019 | DEBUG2(printk("scsi%ld: %s: DPC handler waking up.\n", | 1012 | DEBUG2(printk("scsi%ld: %s: DPC handler waking up." |
1020 | ha->host_no, __func__)); | 1013 | "flags = 0x%08lx, dpc_flags = 0x%08lx\n", |
1021 | 1014 | ha->host_no, __func__, ha->flags, ha->dpc_flags)); | |
1022 | DEBUG2(printk("scsi%ld: %s: ha->flags = 0x%08lx\n", | ||
1023 | ha->host_no, __func__, ha->flags)); | ||
1024 | DEBUG2(printk("scsi%ld: %s: ha->dpc_flags = 0x%08lx\n", | ||
1025 | ha->host_no, __func__, ha->dpc_flags)); | ||
1026 | 1015 | ||
1027 | /* Initialization not yet finished. Don't do anything yet. */ | 1016 | /* Initialization not yet finished. Don't do anything yet. */ |
1028 | if (!test_bit(AF_INIT_DONE, &ha->flags)) | 1017 | if (!test_bit(AF_INIT_DONE, &ha->flags)) |
@@ -1032,16 +1021,8 @@ static void qla4xxx_do_dpc(void *data) | |||
1032 | test_bit(DPC_RESET_HA, &ha->dpc_flags) || | 1021 | test_bit(DPC_RESET_HA, &ha->dpc_flags) || |
1033 | test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || | 1022 | test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) || |
1034 | test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) { | 1023 | test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) { |
1035 | if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags)) | 1024 | if (test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags) || |
1036 | /* | 1025 | test_bit(DPC_RESET_HA, &ha->dpc_flags)) |
1037 | * dg 09/23 Never initialize ddb list | ||
1038 | * once we up and running | ||
1039 | * qla4xxx_recover_adapter(ha, | ||
1040 | * REBUILD_DDB_LIST); | ||
1041 | */ | ||
1042 | qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); | ||
1043 | |||
1044 | if (test_bit(DPC_RESET_HA, &ha->dpc_flags)) | ||
1045 | qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); | 1026 | qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); |
1046 | 1027 | ||
1047 | if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { | 1028 | if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { |
@@ -1122,7 +1103,8 @@ static void qla4xxx_free_adapter(struct scsi_qla_host *ha) | |||
1122 | destroy_workqueue(ha->dpc_thread); | 1103 | destroy_workqueue(ha->dpc_thread); |
1123 | 1104 | ||
1124 | /* Issue Soft Reset to put firmware in unknown state */ | 1105 | /* Issue Soft Reset to put firmware in unknown state */ |
1125 | qla4xxx_soft_reset(ha); | 1106 | if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) |
1107 | qla4xxx_soft_reset(ha); | ||
1126 | 1108 | ||
1127 | /* Remove timer thread, if present */ | 1109 | /* Remove timer thread, if present */ |
1128 | if (ha->timer_active) | 1110 | if (ha->timer_active) |
@@ -1714,7 +1696,7 @@ static int __init qla4xxx_module_init(void) | |||
1714 | 1696 | ||
1715 | /* Derive version string. */ | 1697 | /* Derive version string. */ |
1716 | strcpy(qla4xxx_version_str, QLA4XXX_DRIVER_VERSION); | 1698 | strcpy(qla4xxx_version_str, QLA4XXX_DRIVER_VERSION); |
1717 | if (qla4_extended_error_logging) | 1699 | if (ql4xextended_error_logging) |
1718 | strcat(qla4xxx_version_str, "-debug"); | 1700 | strcat(qla4xxx_version_str, "-debug"); |
1719 | 1701 | ||
1720 | qla4xxx_scsi_transport = | 1702 | qla4xxx_scsi_transport = |
@@ -1724,13 +1706,13 @@ static int __init qla4xxx_module_init(void) | |||
1724 | goto release_srb_cache; | 1706 | goto release_srb_cache; |
1725 | } | 1707 | } |
1726 | 1708 | ||
1727 | printk(KERN_INFO "QLogic iSCSI HBA Driver\n"); | ||
1728 | ret = pci_register_driver(&qla4xxx_pci_driver); | 1709 | ret = pci_register_driver(&qla4xxx_pci_driver); |
1729 | if (ret) | 1710 | if (ret) |
1730 | goto unregister_transport; | 1711 | goto unregister_transport; |
1731 | 1712 | ||
1732 | printk(KERN_INFO "QLogic iSCSI HBA Driver\n"); | 1713 | printk(KERN_INFO "QLogic iSCSI HBA Driver\n"); |
1733 | return 0; | 1714 | return 0; |
1715 | |||
1734 | unregister_transport: | 1716 | unregister_transport: |
1735 | iscsi_unregister_transport(&qla4xxx_iscsi_transport); | 1717 | iscsi_unregister_transport(&qla4xxx_iscsi_transport); |
1736 | release_srb_cache: | 1718 | release_srb_cache: |
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h index b3fe7e68988e..d05048b4e88a 100644 --- a/drivers/scsi/qla4xxx/ql4_version.h +++ b/drivers/scsi/qla4xxx/ql4_version.h | |||
@@ -5,9 +5,4 @@ | |||
5 | * See LICENSE.qla4xxx for copyright and licensing details. | 5 | * See LICENSE.qla4xxx for copyright and licensing details. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define QLA4XXX_DRIVER_VERSION "5.00.05b9-k" | 8 | #define QLA4XXX_DRIVER_VERSION "5.00.06-k" |
9 | |||
10 | #define QL4_DRIVER_MAJOR_VER 5 | ||
11 | #define QL4_DRIVER_MINOR_VER 0 | ||
12 | #define QL4_DRIVER_PATCH_VER 5 | ||
13 | #define QL4_DRIVER_BETA_VER 9 | ||
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c index e0725353c99c..2e7db18f5aef 100644 --- a/drivers/scsi/qlogicfas408.c +++ b/drivers/scsi/qlogicfas408.c | |||
@@ -209,7 +209,7 @@ static int ql_wai(struct qlogicfas408_priv *priv) | |||
209 | * caller must hold host lock | 209 | * caller must hold host lock |
210 | */ | 210 | */ |
211 | 211 | ||
212 | static void ql_icmd(Scsi_Cmnd * cmd) | 212 | static void ql_icmd(struct scsi_cmnd *cmd) |
213 | { | 213 | { |
214 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); | 214 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); |
215 | int qbase = priv->qbase; | 215 | int qbase = priv->qbase; |
@@ -256,7 +256,7 @@ static void ql_icmd(Scsi_Cmnd * cmd) | |||
256 | * Process scsi command - usually after interrupt | 256 | * Process scsi command - usually after interrupt |
257 | */ | 257 | */ |
258 | 258 | ||
259 | static unsigned int ql_pcmd(Scsi_Cmnd * cmd) | 259 | static unsigned int ql_pcmd(struct scsi_cmnd *cmd) |
260 | { | 260 | { |
261 | unsigned int i, j; | 261 | unsigned int i, j; |
262 | unsigned long k; | 262 | unsigned long k; |
@@ -407,7 +407,7 @@ static unsigned int ql_pcmd(Scsi_Cmnd * cmd) | |||
407 | 407 | ||
408 | static void ql_ihandl(void *dev_id) | 408 | static void ql_ihandl(void *dev_id) |
409 | { | 409 | { |
410 | Scsi_Cmnd *icmd; | 410 | struct scsi_cmnd *icmd; |
411 | struct Scsi_Host *host = dev_id; | 411 | struct Scsi_Host *host = dev_id; |
412 | struct qlogicfas408_priv *priv = get_priv_by_host(host); | 412 | struct qlogicfas408_priv *priv = get_priv_by_host(host); |
413 | int qbase = priv->qbase; | 413 | int qbase = priv->qbase; |
@@ -447,7 +447,8 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id) | |||
447 | * Queued command | 447 | * Queued command |
448 | */ | 448 | */ |
449 | 449 | ||
450 | int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | 450 | int qlogicfas408_queuecommand(struct scsi_cmnd *cmd, |
451 | void (*done) (struct scsi_cmnd *)) | ||
451 | { | 452 | { |
452 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); | 453 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); |
453 | if (scmd_id(cmd) == priv->qinitid) { | 454 | if (scmd_id(cmd) == priv->qinitid) { |
@@ -470,9 +471,8 @@ int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
470 | * Return bios parameters | 471 | * Return bios parameters |
471 | */ | 472 | */ |
472 | 473 | ||
473 | int qlogicfas408_biosparam(struct scsi_device * disk, | 474 | int qlogicfas408_biosparam(struct scsi_device *disk, struct block_device *dev, |
474 | struct block_device *dev, | 475 | sector_t capacity, int ip[]) |
475 | sector_t capacity, int ip[]) | ||
476 | { | 476 | { |
477 | /* This should mimic the DOS Qlogic driver's behavior exactly */ | 477 | /* This should mimic the DOS Qlogic driver's behavior exactly */ |
478 | ip[0] = 0x40; | 478 | ip[0] = 0x40; |
@@ -494,7 +494,7 @@ int qlogicfas408_biosparam(struct scsi_device * disk, | |||
494 | * Abort a command in progress | 494 | * Abort a command in progress |
495 | */ | 495 | */ |
496 | 496 | ||
497 | int qlogicfas408_abort(Scsi_Cmnd * cmd) | 497 | int qlogicfas408_abort(struct scsi_cmnd *cmd) |
498 | { | 498 | { |
499 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); | 499 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); |
500 | priv->qabort = 1; | 500 | priv->qabort = 1; |
@@ -508,7 +508,7 @@ int qlogicfas408_abort(Scsi_Cmnd * cmd) | |||
508 | * the PCMCIA qlogic_stub code. This wants fixing | 508 | * the PCMCIA qlogic_stub code. This wants fixing |
509 | */ | 509 | */ |
510 | 510 | ||
511 | int qlogicfas408_bus_reset(Scsi_Cmnd * cmd) | 511 | int qlogicfas408_bus_reset(struct scsi_cmnd *cmd) |
512 | { | 512 | { |
513 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); | 513 | struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); |
514 | unsigned long flags; | 514 | unsigned long flags; |
diff --git a/drivers/scsi/qlogicfas408.h b/drivers/scsi/qlogicfas408.h index 8fd5555c75b1..260626427a32 100644 --- a/drivers/scsi/qlogicfas408.h +++ b/drivers/scsi/qlogicfas408.h | |||
@@ -75,15 +75,15 @@ | |||
75 | /*----------------------------------------------------------------*/ | 75 | /*----------------------------------------------------------------*/ |
76 | 76 | ||
77 | struct qlogicfas408_priv { | 77 | struct qlogicfas408_priv { |
78 | int qbase; /* Port */ | 78 | int qbase; /* Port */ |
79 | int qinitid; /* initiator ID */ | 79 | int qinitid; /* initiator ID */ |
80 | int qabort; /* Flag to cause an abort */ | 80 | int qabort; /* Flag to cause an abort */ |
81 | int qlirq; /* IRQ being used */ | 81 | int qlirq; /* IRQ being used */ |
82 | int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */ | 82 | int int_type; /* type of irq, 2 for ISA board, 0 for PCMCIA */ |
83 | char qinfo[80]; /* description */ | 83 | char qinfo[80]; /* description */ |
84 | Scsi_Cmnd *qlcmd; /* current command being processed */ | 84 | struct scsi_cmnd *qlcmd; /* current command being processed */ |
85 | struct Scsi_Host *shost; /* pointer back to host */ | 85 | struct Scsi_Host *shost; /* pointer back to host */ |
86 | struct qlogicfas408_priv *next; /* next private struct */ | 86 | struct qlogicfas408_priv *next; /* next private struct */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* The qlogic card uses two register maps - These macros select which one */ | 89 | /* The qlogic card uses two register maps - These macros select which one */ |
@@ -103,12 +103,13 @@ struct qlogicfas408_priv { | |||
103 | #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) | 103 | #define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) |
104 | 104 | ||
105 | irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); | 105 | irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); |
106 | int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); | 106 | int qlogicfas408_queuecommand(struct scsi_cmnd * cmd, |
107 | void (*done) (struct scsi_cmnd *)); | ||
107 | int qlogicfas408_biosparam(struct scsi_device * disk, | 108 | int qlogicfas408_biosparam(struct scsi_device * disk, |
108 | struct block_device *dev, | 109 | struct block_device *dev, |
109 | sector_t capacity, int ip[]); | 110 | sector_t capacity, int ip[]); |
110 | int qlogicfas408_abort(Scsi_Cmnd * cmd); | 111 | int qlogicfas408_abort(struct scsi_cmnd * cmd); |
111 | int qlogicfas408_bus_reset(Scsi_Cmnd * cmd); | 112 | int qlogicfas408_bus_reset(struct scsi_cmnd * cmd); |
112 | const char *qlogicfas408_info(struct Scsi_Host *host); | 113 | const char *qlogicfas408_info(struct Scsi_Host *host); |
113 | int qlogicfas408_get_chip_type(int qbase, int int_type); | 114 | int qlogicfas408_get_chip_type(int qbase, int int_type); |
114 | void qlogicfas408_setup(int qbase, int id, int int_type); | 115 | void qlogicfas408_setup(int qbase, int id, int int_type); |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index ed58bb489889..9b827ceec501 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -461,7 +461,7 @@ static int qlogicpti_reset_hardware(struct Scsi_Host *host) | |||
461 | 461 | ||
462 | #define PTI_RESET_LIMIT 400 | 462 | #define PTI_RESET_LIMIT 400 |
463 | 463 | ||
464 | static int __init qlogicpti_load_firmware(struct qlogicpti *qpti) | 464 | static int __devinit qlogicpti_load_firmware(struct qlogicpti *qpti) |
465 | { | 465 | { |
466 | struct Scsi_Host *host = qpti->qhost; | 466 | struct Scsi_Host *host = qpti->qhost; |
467 | unsigned short csum = 0; | 467 | unsigned short csum = 0; |
diff --git a/drivers/scsi/qlogicpti_asm.c b/drivers/scsi/qlogicpti_asm.c index 1545b30681b4..19aa84f46018 100644 --- a/drivers/scsi/qlogicpti_asm.c +++ b/drivers/scsi/qlogicpti_asm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Version 1.31.00 ISP1000 Initiator RISC firmware */ | 1 | /* Version 1.31.00 ISP1000 Initiator RISC firmware */ |
2 | unsigned short sbus_risc_code01[] __initdata = { | 2 | unsigned short sbus_risc_code01[] __devinitdata = { |
3 | 0x0078, 0x1030, 0x0000, 0x2419, 0x0000, 0x12ff, 0x2043, 0x4f50, | 3 | 0x0078, 0x1030, 0x0000, 0x2419, 0x0000, 0x12ff, 0x2043, 0x4f50, |
4 | 0x5952, 0x4947, 0x4854, 0x2031, 0x3939, 0x312c, 0x3139, 0x3932, | 4 | 0x5952, 0x4947, 0x4854, 0x2031, 0x3939, 0x312c, 0x3139, 0x3932, |
5 | 0x2c31, 0x3939, 0x332c, 0x3139, 0x3934, 0x2051, 0x4c4f, 0x4749, | 5 | 0x2c31, 0x3939, 0x332c, 0x3139, 0x3934, 0x2051, 0x4c4f, 0x4749, |
@@ -1157,4 +1157,4 @@ unsigned short sbus_risc_code01[] __initdata = { | |||
1157 | 0x003c, 0x0040, 0x3415, 0x2019, 0x2626, 0x7b22, 0x7b26, 0x007c, | 1157 | 0x003c, 0x0040, 0x3415, 0x2019, 0x2626, 0x7b22, 0x7b26, 0x007c, |
1158 | 0x92a7 | 1158 | 0x92a7 |
1159 | }; | 1159 | }; |
1160 | unsigned short sbus_risc_code_length01 = 0x2419; | 1160 | unsigned short __devinitdata sbus_risc_code_length01 = 0x2419; |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9c0f35820e3e..30ee3d72c021 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include "scsi_debug.h" | 52 | #include "scsi_debug.h" |
53 | 53 | ||
54 | #define SCSI_DEBUG_VERSION "1.80" | 54 | #define SCSI_DEBUG_VERSION "1.80" |
55 | static const char * scsi_debug_version_date = "20060914"; | 55 | static const char * scsi_debug_version_date = "20061018"; |
56 | 56 | ||
57 | /* Additional Sense Code (ASC) used */ | 57 | /* Additional Sense Code (ASC) used */ |
58 | #define NO_ADDITIONAL_SENSE 0x0 | 58 | #define NO_ADDITIONAL_SENSE 0x0 |
@@ -254,6 +254,8 @@ static int resp_requests(struct scsi_cmnd * SCpnt, | |||
254 | struct sdebug_dev_info * devip); | 254 | struct sdebug_dev_info * devip); |
255 | static int resp_start_stop(struct scsi_cmnd * scp, | 255 | static int resp_start_stop(struct scsi_cmnd * scp, |
256 | struct sdebug_dev_info * devip); | 256 | struct sdebug_dev_info * devip); |
257 | static int resp_report_tgtpgs(struct scsi_cmnd * scp, | ||
258 | struct sdebug_dev_info * devip); | ||
257 | static int resp_readcap(struct scsi_cmnd * SCpnt, | 259 | static int resp_readcap(struct scsi_cmnd * SCpnt, |
258 | struct sdebug_dev_info * devip); | 260 | struct sdebug_dev_info * devip); |
259 | static int resp_readcap16(struct scsi_cmnd * SCpnt, | 261 | static int resp_readcap16(struct scsi_cmnd * SCpnt, |
@@ -287,9 +289,9 @@ static void __init sdebug_build_parts(unsigned char * ramp); | |||
287 | static void __init init_all_queued(void); | 289 | static void __init init_all_queued(void); |
288 | static void stop_all_queued(void); | 290 | static void stop_all_queued(void); |
289 | static int stop_queued_cmnd(struct scsi_cmnd * cmnd); | 291 | static int stop_queued_cmnd(struct scsi_cmnd * cmnd); |
290 | static int inquiry_evpd_83(unsigned char * arr, int target_dev_id, | 292 | static int inquiry_evpd_83(unsigned char * arr, int port_group_id, |
291 | int dev_id_num, const char * dev_id_str, | 293 | int target_dev_id, int dev_id_num, |
292 | int dev_id_str_len); | 294 | const char * dev_id_str, int dev_id_str_len); |
293 | static int inquiry_evpd_88(unsigned char * arr, int target_dev_id); | 295 | static int inquiry_evpd_88(unsigned char * arr, int target_dev_id); |
294 | static int do_create_driverfs_files(void); | 296 | static int do_create_driverfs_files(void); |
295 | static void do_remove_driverfs_files(void); | 297 | static void do_remove_driverfs_files(void); |
@@ -422,6 +424,15 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) | |||
422 | } | 424 | } |
423 | errsts = resp_readcap16(SCpnt, devip); | 425 | errsts = resp_readcap16(SCpnt, devip); |
424 | break; | 426 | break; |
427 | case MAINTENANCE_IN: | ||
428 | if (MI_REPORT_TARGET_PGS != cmd[1]) { | ||
429 | mk_sense_buffer(devip, ILLEGAL_REQUEST, | ||
430 | INVALID_OPCODE, 0); | ||
431 | errsts = check_condition_result; | ||
432 | break; | ||
433 | } | ||
434 | errsts = resp_report_tgtpgs(SCpnt, devip); | ||
435 | break; | ||
425 | case READ_16: | 436 | case READ_16: |
426 | case READ_12: | 437 | case READ_12: |
427 | case READ_10: | 438 | case READ_10: |
@@ -665,8 +676,9 @@ static const char * inq_vendor_id = "Linux "; | |||
665 | static const char * inq_product_id = "scsi_debug "; | 676 | static const char * inq_product_id = "scsi_debug "; |
666 | static const char * inq_product_rev = "0004"; | 677 | static const char * inq_product_rev = "0004"; |
667 | 678 | ||
668 | static int inquiry_evpd_83(unsigned char * arr, int target_dev_id, | 679 | static int inquiry_evpd_83(unsigned char * arr, int port_group_id, |
669 | int dev_id_num, const char * dev_id_str, | 680 | int target_dev_id, int dev_id_num, |
681 | const char * dev_id_str, | ||
670 | int dev_id_str_len) | 682 | int dev_id_str_len) |
671 | { | 683 | { |
672 | int num, port_a; | 684 | int num, port_a; |
@@ -720,6 +732,15 @@ static int inquiry_evpd_83(unsigned char * arr, int target_dev_id, | |||
720 | arr[num++] = (port_a >> 16) & 0xff; | 732 | arr[num++] = (port_a >> 16) & 0xff; |
721 | arr[num++] = (port_a >> 8) & 0xff; | 733 | arr[num++] = (port_a >> 8) & 0xff; |
722 | arr[num++] = port_a & 0xff; | 734 | arr[num++] = port_a & 0xff; |
735 | /* NAA-5, Target port group identifier */ | ||
736 | arr[num++] = 0x61; /* proto=sas, binary */ | ||
737 | arr[num++] = 0x95; /* piv=1, target port group id */ | ||
738 | arr[num++] = 0x0; | ||
739 | arr[num++] = 0x4; | ||
740 | arr[num++] = 0; | ||
741 | arr[num++] = 0; | ||
742 | arr[num++] = (port_group_id >> 8) & 0xff; | ||
743 | arr[num++] = port_group_id & 0xff; | ||
723 | /* NAA-5, Target device identifier */ | 744 | /* NAA-5, Target device identifier */ |
724 | arr[num++] = 0x61; /* proto=sas, binary */ | 745 | arr[num++] = 0x61; /* proto=sas, binary */ |
725 | arr[num++] = 0xa3; /* piv=1, target device, naa */ | 746 | arr[num++] = 0xa3; /* piv=1, target device, naa */ |
@@ -928,12 +949,12 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target, | |||
928 | struct sdebug_dev_info * devip) | 949 | struct sdebug_dev_info * devip) |
929 | { | 950 | { |
930 | unsigned char pq_pdt; | 951 | unsigned char pq_pdt; |
931 | unsigned char arr[SDEBUG_MAX_INQ_ARR_SZ]; | 952 | unsigned char * arr; |
932 | unsigned char *cmd = (unsigned char *)scp->cmnd; | 953 | unsigned char *cmd = (unsigned char *)scp->cmnd; |
933 | int alloc_len, n; | 954 | int alloc_len, n, ret; |
934 | 955 | ||
935 | alloc_len = (cmd[3] << 8) + cmd[4]; | 956 | alloc_len = (cmd[3] << 8) + cmd[4]; |
936 | memset(arr, 0, SDEBUG_MAX_INQ_ARR_SZ); | 957 | arr = kzalloc(SDEBUG_MAX_INQ_ARR_SZ, GFP_KERNEL); |
937 | if (devip->wlun) | 958 | if (devip->wlun) |
938 | pq_pdt = 0x1e; /* present, wlun */ | 959 | pq_pdt = 0x1e; /* present, wlun */ |
939 | else if (scsi_debug_no_lun_0 && (0 == devip->lun)) | 960 | else if (scsi_debug_no_lun_0 && (0 == devip->lun)) |
@@ -944,12 +965,15 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target, | |||
944 | if (0x2 & cmd[1]) { /* CMDDT bit set */ | 965 | if (0x2 & cmd[1]) { /* CMDDT bit set */ |
945 | mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, | 966 | mk_sense_buffer(devip, ILLEGAL_REQUEST, INVALID_FIELD_IN_CDB, |
946 | 0); | 967 | 0); |
968 | kfree(arr); | ||
947 | return check_condition_result; | 969 | return check_condition_result; |
948 | } else if (0x1 & cmd[1]) { /* EVPD bit set */ | 970 | } else if (0x1 & cmd[1]) { /* EVPD bit set */ |
949 | int lu_id_num, target_dev_id, len; | 971 | int lu_id_num, port_group_id, target_dev_id, len; |
950 | char lu_id_str[6]; | 972 | char lu_id_str[6]; |
951 | int host_no = devip->sdbg_host->shost->host_no; | 973 | int host_no = devip->sdbg_host->shost->host_no; |
952 | 974 | ||
975 | port_group_id = (((host_no + 1) & 0x7f) << 8) + | ||
976 | (devip->channel & 0x7f); | ||
953 | if (0 == scsi_debug_vpd_use_hostno) | 977 | if (0 == scsi_debug_vpd_use_hostno) |
954 | host_no = 0; | 978 | host_no = 0; |
955 | lu_id_num = devip->wlun ? -1 : (((host_no + 1) * 2000) + | 979 | lu_id_num = devip->wlun ? -1 : (((host_no + 1) * 2000) + |
@@ -977,8 +1001,9 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target, | |||
977 | memcpy(&arr[4], lu_id_str, len); | 1001 | memcpy(&arr[4], lu_id_str, len); |
978 | } else if (0x83 == cmd[2]) { /* device identification */ | 1002 | } else if (0x83 == cmd[2]) { /* device identification */ |
979 | arr[1] = cmd[2]; /*sanity */ | 1003 | arr[1] = cmd[2]; /*sanity */ |
980 | arr[3] = inquiry_evpd_83(&arr[4], target_dev_id, | 1004 | arr[3] = inquiry_evpd_83(&arr[4], port_group_id, |
981 | lu_id_num, lu_id_str, len); | 1005 | target_dev_id, lu_id_num, |
1006 | lu_id_str, len); | ||
982 | } else if (0x84 == cmd[2]) { /* Software interface ident. */ | 1007 | } else if (0x84 == cmd[2]) { /* Software interface ident. */ |
983 | arr[1] = cmd[2]; /*sanity */ | 1008 | arr[1] = cmd[2]; /*sanity */ |
984 | arr[3] = inquiry_evpd_84(&arr[4]); | 1009 | arr[3] = inquiry_evpd_84(&arr[4]); |
@@ -1012,17 +1037,22 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target, | |||
1012 | /* Illegal request, invalid field in cdb */ | 1037 | /* Illegal request, invalid field in cdb */ |
1013 | mk_sense_buffer(devip, ILLEGAL_REQUEST, | 1038 | mk_sense_buffer(devip, ILLEGAL_REQUEST, |
1014 | INVALID_FIELD_IN_CDB, 0); | 1039 | INVALID_FIELD_IN_CDB, 0); |
1040 | kfree(arr); | ||
1015 | return check_condition_result; | 1041 | return check_condition_result; |
1016 | } | 1042 | } |
1017 | len = min(((arr[2] << 8) + arr[3]) + 4, alloc_len); | 1043 | len = min(((arr[2] << 8) + arr[3]) + 4, alloc_len); |
1018 | return fill_from_dev_buffer(scp, arr, | 1044 | ret = fill_from_dev_buffer(scp, arr, |
1019 | min(len, SDEBUG_MAX_INQ_ARR_SZ)); | 1045 | min(len, SDEBUG_MAX_INQ_ARR_SZ)); |
1046 | kfree(arr); | ||
1047 | return ret; | ||
1020 | } | 1048 | } |
1021 | /* drops through here for a standard inquiry */ | 1049 | /* drops through here for a standard inquiry */ |
1022 | arr[1] = DEV_REMOVEABLE(target) ? 0x80 : 0; /* Removable disk */ | 1050 | arr[1] = DEV_REMOVEABLE(target) ? 0x80 : 0; /* Removable disk */ |
1023 | arr[2] = scsi_debug_scsi_level; | 1051 | arr[2] = scsi_debug_scsi_level; |
1024 | arr[3] = 2; /* response_data_format==2 */ | 1052 | arr[3] = 2; /* response_data_format==2 */ |
1025 | arr[4] = SDEBUG_LONG_INQ_SZ - 5; | 1053 | arr[4] = SDEBUG_LONG_INQ_SZ - 5; |
1054 | if (0 == scsi_debug_vpd_use_hostno) | ||
1055 | arr[5] = 0x10; /* claim: implicit TGPS */ | ||
1026 | arr[6] = 0x10; /* claim: MultiP */ | 1056 | arr[6] = 0x10; /* claim: MultiP */ |
1027 | /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ | 1057 | /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ |
1028 | arr[7] = 0xa; /* claim: LINKED + CMDQUE */ | 1058 | arr[7] = 0xa; /* claim: LINKED + CMDQUE */ |
@@ -1039,8 +1069,10 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target, | |||
1039 | arr[n++] = 0x3; arr[n++] = 0x60; /* SSC-2 no version */ | 1069 | arr[n++] = 0x3; arr[n++] = 0x60; /* SSC-2 no version */ |
1040 | } | 1070 | } |
1041 | arr[n++] = 0xc; arr[n++] = 0xf; /* SAS-1.1 rev 10 */ | 1071 | arr[n++] = 0xc; arr[n++] = 0xf; /* SAS-1.1 rev 10 */ |
1042 | return fill_from_dev_buffer(scp, arr, | 1072 | ret = fill_from_dev_buffer(scp, arr, |
1043 | min(alloc_len, SDEBUG_LONG_INQ_SZ)); | 1073 | min(alloc_len, SDEBUG_LONG_INQ_SZ)); |
1074 | kfree(arr); | ||
1075 | return ret; | ||
1044 | } | 1076 | } |
1045 | 1077 | ||
1046 | static int resp_requests(struct scsi_cmnd * scp, | 1078 | static int resp_requests(struct scsi_cmnd * scp, |
@@ -1171,6 +1203,87 @@ static int resp_readcap16(struct scsi_cmnd * scp, | |||
1171 | min(alloc_len, SDEBUG_READCAP16_ARR_SZ)); | 1203 | min(alloc_len, SDEBUG_READCAP16_ARR_SZ)); |
1172 | } | 1204 | } |
1173 | 1205 | ||
1206 | #define SDEBUG_MAX_TGTPGS_ARR_SZ 1412 | ||
1207 | |||
1208 | static int resp_report_tgtpgs(struct scsi_cmnd * scp, | ||
1209 | struct sdebug_dev_info * devip) | ||
1210 | { | ||
1211 | unsigned char *cmd = (unsigned char *)scp->cmnd; | ||
1212 | unsigned char * arr; | ||
1213 | int host_no = devip->sdbg_host->shost->host_no; | ||
1214 | int n, ret, alen, rlen; | ||
1215 | int port_group_a, port_group_b, port_a, port_b; | ||
1216 | |||
1217 | alen = ((cmd[6] << 24) + (cmd[7] << 16) + (cmd[8] << 8) | ||
1218 | + cmd[9]); | ||
1219 | |||
1220 | arr = kzalloc(SDEBUG_MAX_TGTPGS_ARR_SZ, GFP_KERNEL); | ||
1221 | /* | ||
1222 | * EVPD page 0x88 states we have two ports, one | ||
1223 | * real and a fake port with no device connected. | ||
1224 | * So we create two port groups with one port each | ||
1225 | * and set the group with port B to unavailable. | ||
1226 | */ | ||
1227 | port_a = 0x1; /* relative port A */ | ||
1228 | port_b = 0x2; /* relative port B */ | ||
1229 | port_group_a = (((host_no + 1) & 0x7f) << 8) + | ||
1230 | (devip->channel & 0x7f); | ||
1231 | port_group_b = (((host_no + 1) & 0x7f) << 8) + | ||
1232 | (devip->channel & 0x7f) + 0x80; | ||
1233 | |||
1234 | /* | ||
1235 | * The asymmetric access state is cycled according to the host_id. | ||
1236 | */ | ||
1237 | n = 4; | ||
1238 | if (0 == scsi_debug_vpd_use_hostno) { | ||
1239 | arr[n++] = host_no % 3; /* Asymm access state */ | ||
1240 | arr[n++] = 0x0F; /* claim: all states are supported */ | ||
1241 | } else { | ||
1242 | arr[n++] = 0x0; /* Active/Optimized path */ | ||
1243 | arr[n++] = 0x01; /* claim: only support active/optimized paths */ | ||
1244 | } | ||
1245 | arr[n++] = (port_group_a >> 8) & 0xff; | ||
1246 | arr[n++] = port_group_a & 0xff; | ||
1247 | arr[n++] = 0; /* Reserved */ | ||
1248 | arr[n++] = 0; /* Status code */ | ||
1249 | arr[n++] = 0; /* Vendor unique */ | ||
1250 | arr[n++] = 0x1; /* One port per group */ | ||
1251 | arr[n++] = 0; /* Reserved */ | ||
1252 | arr[n++] = 0; /* Reserved */ | ||
1253 | arr[n++] = (port_a >> 8) & 0xff; | ||
1254 | arr[n++] = port_a & 0xff; | ||
1255 | arr[n++] = 3; /* Port unavailable */ | ||
1256 | arr[n++] = 0x08; /* claim: only unavailalbe paths are supported */ | ||
1257 | arr[n++] = (port_group_b >> 8) & 0xff; | ||
1258 | arr[n++] = port_group_b & 0xff; | ||
1259 | arr[n++] = 0; /* Reserved */ | ||
1260 | arr[n++] = 0; /* Status code */ | ||
1261 | arr[n++] = 0; /* Vendor unique */ | ||
1262 | arr[n++] = 0x1; /* One port per group */ | ||
1263 | arr[n++] = 0; /* Reserved */ | ||
1264 | arr[n++] = 0; /* Reserved */ | ||
1265 | arr[n++] = (port_b >> 8) & 0xff; | ||
1266 | arr[n++] = port_b & 0xff; | ||
1267 | |||
1268 | rlen = n - 4; | ||
1269 | arr[0] = (rlen >> 24) & 0xff; | ||
1270 | arr[1] = (rlen >> 16) & 0xff; | ||
1271 | arr[2] = (rlen >> 8) & 0xff; | ||
1272 | arr[3] = rlen & 0xff; | ||
1273 | |||
1274 | /* | ||
1275 | * Return the smallest value of either | ||
1276 | * - The allocated length | ||
1277 | * - The constructed command length | ||
1278 | * - The maximum array size | ||
1279 | */ | ||
1280 | rlen = min(alen,n); | ||
1281 | ret = fill_from_dev_buffer(scp, arr, | ||
1282 | min(rlen, SDEBUG_MAX_TGTPGS_ARR_SZ)); | ||
1283 | kfree(arr); | ||
1284 | return ret; | ||
1285 | } | ||
1286 | |||
1174 | /* <<Following mode page info copied from ST318451LW>> */ | 1287 | /* <<Following mode page info copied from ST318451LW>> */ |
1175 | 1288 | ||
1176 | static int resp_err_recov_pg(unsigned char * p, int pcontrol, int target) | 1289 | static int resp_err_recov_pg(unsigned char * p, int pcontrol, int target) |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ee35a62bb7a2..2f12f9f12fcb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -410,6 +410,7 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, | |||
410 | goto free_req; | 410 | goto free_req; |
411 | 411 | ||
412 | req->cmd_len = cmd_len; | 412 | req->cmd_len = cmd_len; |
413 | memset(req->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */ | ||
413 | memcpy(req->cmd, cmd, req->cmd_len); | 414 | memcpy(req->cmd, cmd, req->cmd_len); |
414 | req->sense = sioc->sense; | 415 | req->sense = sioc->sense; |
415 | req->sense_len = 0; | 416 | req->sense_len = 0; |
@@ -1119,7 +1120,7 @@ static int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1119 | req->buffer = NULL; | 1120 | req->buffer = NULL; |
1120 | } | 1121 | } |
1121 | 1122 | ||
1122 | BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); | 1123 | BUILD_BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); |
1123 | memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); | 1124 | memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); |
1124 | cmd->cmd_len = req->cmd_len; | 1125 | cmd->cmd_len = req->cmd_len; |
1125 | if (!req->data_len) | 1126 | if (!req->data_len) |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 148e24cc3222..aa1b1e0e9d22 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -700,12 +700,22 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
700 | * scanning run at their own risk, or supply a user level program | 700 | * scanning run at their own risk, or supply a user level program |
701 | * that can correctly scan. | 701 | * that can correctly scan. |
702 | */ | 702 | */ |
703 | sdev->inquiry = kmalloc(sdev->inquiry_len, GFP_ATOMIC); | 703 | |
704 | if (sdev->inquiry == NULL) { | 704 | /* |
705 | * Copy at least 36 bytes of INQUIRY data, so that we don't | ||
706 | * dereference unallocated memory when accessing the Vendor, | ||
707 | * Product, and Revision strings. Badly behaved devices may set | ||
708 | * the INQUIRY Additional Length byte to a small value, indicating | ||
709 | * these strings are invalid, but often they contain plausible data | ||
710 | * nonetheless. It doesn't matter if the device sent < 36 bytes | ||
711 | * total, since scsi_probe_lun() initializes inq_result with 0s. | ||
712 | */ | ||
713 | sdev->inquiry = kmemdup(inq_result, | ||
714 | max_t(size_t, sdev->inquiry_len, 36), | ||
715 | GFP_ATOMIC); | ||
716 | if (sdev->inquiry == NULL) | ||
705 | return SCSI_SCAN_NO_RESPONSE; | 717 | return SCSI_SCAN_NO_RESPONSE; |
706 | } | ||
707 | 718 | ||
708 | memcpy(sdev->inquiry, inq_result, sdev->inquiry_len); | ||
709 | sdev->vendor = (char *) (sdev->inquiry + 8); | 719 | sdev->vendor = (char *) (sdev->inquiry + 8); |
710 | sdev->model = (char *) (sdev->inquiry + 16); | 720 | sdev->model = (char *) (sdev->inquiry + 16); |
711 | sdev->rev = (char *) (sdev->inquiry + 32); | 721 | sdev->rev = (char *) (sdev->inquiry + 32); |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index e7fe565b96de..e1a91665d1c2 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -192,6 +192,7 @@ static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost | |||
192 | shost_rd_attr(unique_id, "%u\n"); | 192 | shost_rd_attr(unique_id, "%u\n"); |
193 | shost_rd_attr(host_busy, "%hu\n"); | 193 | shost_rd_attr(host_busy, "%hu\n"); |
194 | shost_rd_attr(cmd_per_lun, "%hd\n"); | 194 | shost_rd_attr(cmd_per_lun, "%hd\n"); |
195 | shost_rd_attr(can_queue, "%hd\n"); | ||
195 | shost_rd_attr(sg_tablesize, "%hu\n"); | 196 | shost_rd_attr(sg_tablesize, "%hu\n"); |
196 | shost_rd_attr(unchecked_isa_dma, "%d\n"); | 197 | shost_rd_attr(unchecked_isa_dma, "%d\n"); |
197 | shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); | 198 | shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); |
@@ -200,6 +201,7 @@ static struct class_device_attribute *scsi_sysfs_shost_attrs[] = { | |||
200 | &class_device_attr_unique_id, | 201 | &class_device_attr_unique_id, |
201 | &class_device_attr_host_busy, | 202 | &class_device_attr_host_busy, |
202 | &class_device_attr_cmd_per_lun, | 203 | &class_device_attr_cmd_per_lun, |
204 | &class_device_attr_can_queue, | ||
203 | &class_device_attr_sg_tablesize, | 205 | &class_device_attr_sg_tablesize, |
204 | &class_device_attr_unchecked_isa_dma, | 206 | &class_device_attr_unchecked_isa_dma, |
205 | &class_device_attr_proc_name, | 207 | &class_device_attr_proc_name, |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 7b0019cccce3..9b25124a989e 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -21,7 +21,6 @@ | |||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/mempool.h> | ||
25 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
26 | #include <net/tcp.h> | 25 | #include <net/tcp.h> |
27 | #include <scsi/scsi.h> | 26 | #include <scsi/scsi.h> |
@@ -34,7 +33,7 @@ | |||
34 | #define ISCSI_SESSION_ATTRS 11 | 33 | #define ISCSI_SESSION_ATTRS 11 |
35 | #define ISCSI_CONN_ATTRS 11 | 34 | #define ISCSI_CONN_ATTRS 11 |
36 | #define ISCSI_HOST_ATTRS 0 | 35 | #define ISCSI_HOST_ATTRS 0 |
37 | #define ISCSI_TRANSPORT_VERSION "2.0-685" | 36 | #define ISCSI_TRANSPORT_VERSION "2.0-724" |
38 | 37 | ||
39 | struct iscsi_internal { | 38 | struct iscsi_internal { |
40 | int daemon_pid; | 39 | int daemon_pid; |
@@ -149,30 +148,6 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class, | |||
149 | static struct sock *nls; | 148 | static struct sock *nls; |
150 | static DEFINE_MUTEX(rx_queue_mutex); | 149 | static DEFINE_MUTEX(rx_queue_mutex); |
151 | 150 | ||
152 | struct mempool_zone { | ||
153 | mempool_t *pool; | ||
154 | atomic_t allocated; | ||
155 | int size; | ||
156 | int hiwat; | ||
157 | struct list_head freequeue; | ||
158 | spinlock_t freelock; | ||
159 | }; | ||
160 | |||
161 | static struct mempool_zone *z_reply; | ||
162 | |||
163 | /* | ||
164 | * Z_MAX_* - actual mempool size allocated at the mempool_zone_init() time | ||
165 | * Z_HIWAT_* - zone's high watermark when if_error bit will be set to -ENOMEM | ||
166 | * so daemon will notice OOM on NETLINK tranposrt level and will | ||
167 | * be able to predict or change operational behavior | ||
168 | */ | ||
169 | #define Z_MAX_REPLY 8 | ||
170 | #define Z_HIWAT_REPLY 6 | ||
171 | #define Z_MAX_PDU 8 | ||
172 | #define Z_HIWAT_PDU 6 | ||
173 | #define Z_MAX_ERROR 16 | ||
174 | #define Z_HIWAT_ERROR 12 | ||
175 | |||
176 | static LIST_HEAD(sesslist); | 151 | static LIST_HEAD(sesslist); |
177 | static DEFINE_SPINLOCK(sesslock); | 152 | static DEFINE_SPINLOCK(sesslock); |
178 | static LIST_HEAD(connlist); | 153 | static LIST_HEAD(connlist); |
@@ -414,59 +389,11 @@ int iscsi_destroy_session(struct iscsi_cls_session *session) | |||
414 | } | 389 | } |
415 | EXPORT_SYMBOL_GPL(iscsi_destroy_session); | 390 | EXPORT_SYMBOL_GPL(iscsi_destroy_session); |
416 | 391 | ||
417 | static void mempool_zone_destroy(struct mempool_zone *zp) | ||
418 | { | ||
419 | mempool_destroy(zp->pool); | ||
420 | kfree(zp); | ||
421 | } | ||
422 | |||
423 | static void* | ||
424 | mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data) | ||
425 | { | ||
426 | struct mempool_zone *zone = pool_data; | ||
427 | |||
428 | return alloc_skb(zone->size, gfp_mask); | ||
429 | } | ||
430 | |||
431 | static void | ||
432 | mempool_zone_free_skb(void *element, void *pool_data) | ||
433 | { | ||
434 | kfree_skb(element); | ||
435 | } | ||
436 | |||
437 | static struct mempool_zone * | ||
438 | mempool_zone_init(unsigned max, unsigned size, unsigned hiwat) | ||
439 | { | ||
440 | struct mempool_zone *zp; | ||
441 | |||
442 | zp = kzalloc(sizeof(*zp), GFP_KERNEL); | ||
443 | if (!zp) | ||
444 | return NULL; | ||
445 | |||
446 | zp->size = size; | ||
447 | zp->hiwat = hiwat; | ||
448 | INIT_LIST_HEAD(&zp->freequeue); | ||
449 | spin_lock_init(&zp->freelock); | ||
450 | atomic_set(&zp->allocated, 0); | ||
451 | |||
452 | zp->pool = mempool_create(max, mempool_zone_alloc_skb, | ||
453 | mempool_zone_free_skb, zp); | ||
454 | if (!zp->pool) { | ||
455 | kfree(zp); | ||
456 | return NULL; | ||
457 | } | ||
458 | |||
459 | return zp; | ||
460 | } | ||
461 | |||
462 | static void iscsi_conn_release(struct device *dev) | 392 | static void iscsi_conn_release(struct device *dev) |
463 | { | 393 | { |
464 | struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev); | 394 | struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev); |
465 | struct device *parent = conn->dev.parent; | 395 | struct device *parent = conn->dev.parent; |
466 | 396 | ||
467 | mempool_zone_destroy(conn->z_pdu); | ||
468 | mempool_zone_destroy(conn->z_error); | ||
469 | |||
470 | kfree(conn); | 397 | kfree(conn); |
471 | put_device(parent); | 398 | put_device(parent); |
472 | } | 399 | } |
@@ -476,31 +403,6 @@ static int iscsi_is_conn_dev(const struct device *dev) | |||
476 | return dev->release == iscsi_conn_release; | 403 | return dev->release == iscsi_conn_release; |
477 | } | 404 | } |
478 | 405 | ||
479 | static int iscsi_create_event_pools(struct iscsi_cls_conn *conn) | ||
480 | { | ||
481 | conn->z_pdu = mempool_zone_init(Z_MAX_PDU, | ||
482 | NLMSG_SPACE(sizeof(struct iscsi_uevent) + | ||
483 | sizeof(struct iscsi_hdr) + | ||
484 | DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH), | ||
485 | Z_HIWAT_PDU); | ||
486 | if (!conn->z_pdu) { | ||
487 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not allocate " | ||
488 | "pdu zone for new conn\n"); | ||
489 | return -ENOMEM; | ||
490 | } | ||
491 | |||
492 | conn->z_error = mempool_zone_init(Z_MAX_ERROR, | ||
493 | NLMSG_SPACE(sizeof(struct iscsi_uevent)), | ||
494 | Z_HIWAT_ERROR); | ||
495 | if (!conn->z_error) { | ||
496 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not allocate " | ||
497 | "error zone for new conn\n"); | ||
498 | mempool_zone_destroy(conn->z_pdu); | ||
499 | return -ENOMEM; | ||
500 | } | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | /** | 406 | /** |
505 | * iscsi_create_conn - create iscsi class connection | 407 | * iscsi_create_conn - create iscsi class connection |
506 | * @session: iscsi cls session | 408 | * @session: iscsi cls session |
@@ -533,12 +435,9 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid) | |||
533 | conn->transport = transport; | 435 | conn->transport = transport; |
534 | conn->cid = cid; | 436 | conn->cid = cid; |
535 | 437 | ||
536 | if (iscsi_create_event_pools(conn)) | ||
537 | goto free_conn; | ||
538 | |||
539 | /* this is released in the dev's release function */ | 438 | /* this is released in the dev's release function */ |
540 | if (!get_device(&session->dev)) | 439 | if (!get_device(&session->dev)) |
541 | goto free_conn_pools; | 440 | goto free_conn; |
542 | 441 | ||
543 | snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u", | 442 | snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u", |
544 | session->sid, cid); | 443 | session->sid, cid); |
@@ -555,8 +454,6 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid) | |||
555 | 454 | ||
556 | release_parent_ref: | 455 | release_parent_ref: |
557 | put_device(&session->dev); | 456 | put_device(&session->dev); |
558 | free_conn_pools: | ||
559 | |||
560 | free_conn: | 457 | free_conn: |
561 | kfree(conn); | 458 | kfree(conn); |
562 | return NULL; | 459 | return NULL; |
@@ -599,81 +496,31 @@ iscsi_if_transport_lookup(struct iscsi_transport *tt) | |||
599 | return NULL; | 496 | return NULL; |
600 | } | 497 | } |
601 | 498 | ||
602 | static inline struct list_head *skb_to_lh(struct sk_buff *skb) | ||
603 | { | ||
604 | return (struct list_head *)&skb->cb; | ||
605 | } | ||
606 | |||
607 | static void | ||
608 | mempool_zone_complete(struct mempool_zone *zone) | ||
609 | { | ||
610 | unsigned long flags; | ||
611 | struct list_head *lh, *n; | ||
612 | |||
613 | spin_lock_irqsave(&zone->freelock, flags); | ||
614 | list_for_each_safe(lh, n, &zone->freequeue) { | ||
615 | struct sk_buff *skb = (struct sk_buff *)((char *)lh - | ||
616 | offsetof(struct sk_buff, cb)); | ||
617 | if (!skb_shared(skb)) { | ||
618 | list_del(skb_to_lh(skb)); | ||
619 | mempool_free(skb, zone->pool); | ||
620 | atomic_dec(&zone->allocated); | ||
621 | } | ||
622 | } | ||
623 | spin_unlock_irqrestore(&zone->freelock, flags); | ||
624 | } | ||
625 | |||
626 | static struct sk_buff* | ||
627 | mempool_zone_get_skb(struct mempool_zone *zone) | ||
628 | { | ||
629 | struct sk_buff *skb; | ||
630 | |||
631 | skb = mempool_alloc(zone->pool, GFP_ATOMIC); | ||
632 | if (skb) | ||
633 | atomic_inc(&zone->allocated); | ||
634 | return skb; | ||
635 | } | ||
636 | |||
637 | static int | 499 | static int |
638 | iscsi_broadcast_skb(struct mempool_zone *zone, struct sk_buff *skb, gfp_t gfp) | 500 | iscsi_broadcast_skb(struct sk_buff *skb, gfp_t gfp) |
639 | { | 501 | { |
640 | unsigned long flags; | ||
641 | int rc; | 502 | int rc; |
642 | 503 | ||
643 | skb_get(skb); | ||
644 | rc = netlink_broadcast(nls, skb, 0, 1, gfp); | 504 | rc = netlink_broadcast(nls, skb, 0, 1, gfp); |
645 | if (rc < 0) { | 505 | if (rc < 0) { |
646 | mempool_free(skb, zone->pool); | ||
647 | printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc); | 506 | printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc); |
648 | return rc; | 507 | return rc; |
649 | } | 508 | } |
650 | 509 | ||
651 | spin_lock_irqsave(&zone->freelock, flags); | ||
652 | INIT_LIST_HEAD(skb_to_lh(skb)); | ||
653 | list_add(skb_to_lh(skb), &zone->freequeue); | ||
654 | spin_unlock_irqrestore(&zone->freelock, flags); | ||
655 | return 0; | 510 | return 0; |
656 | } | 511 | } |
657 | 512 | ||
658 | static int | 513 | static int |
659 | iscsi_unicast_skb(struct mempool_zone *zone, struct sk_buff *skb, int pid) | 514 | iscsi_unicast_skb(struct sk_buff *skb, int pid) |
660 | { | 515 | { |
661 | unsigned long flags; | ||
662 | int rc; | 516 | int rc; |
663 | 517 | ||
664 | skb_get(skb); | ||
665 | rc = netlink_unicast(nls, skb, pid, MSG_DONTWAIT); | 518 | rc = netlink_unicast(nls, skb, pid, MSG_DONTWAIT); |
666 | if (rc < 0) { | 519 | if (rc < 0) { |
667 | mempool_free(skb, zone->pool); | ||
668 | printk(KERN_ERR "iscsi: can not unicast skb (%d)\n", rc); | 520 | printk(KERN_ERR "iscsi: can not unicast skb (%d)\n", rc); |
669 | return rc; | 521 | return rc; |
670 | } | 522 | } |
671 | 523 | ||
672 | spin_lock_irqsave(&zone->freelock, flags); | ||
673 | INIT_LIST_HEAD(skb_to_lh(skb)); | ||
674 | list_add(skb_to_lh(skb), &zone->freequeue); | ||
675 | spin_unlock_irqrestore(&zone->freelock, flags); | ||
676 | |||
677 | return 0; | 524 | return 0; |
678 | } | 525 | } |
679 | 526 | ||
@@ -692,9 +539,7 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | |||
692 | if (!priv) | 539 | if (!priv) |
693 | return -EINVAL; | 540 | return -EINVAL; |
694 | 541 | ||
695 | mempool_zone_complete(conn->z_pdu); | 542 | skb = alloc_skb(len, GFP_ATOMIC); |
696 | |||
697 | skb = mempool_zone_get_skb(conn->z_pdu); | ||
698 | if (!skb) { | 543 | if (!skb) { |
699 | iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); | 544 | iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); |
700 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " | 545 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " |
@@ -707,15 +552,13 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | |||
707 | memset(ev, 0, sizeof(*ev)); | 552 | memset(ev, 0, sizeof(*ev)); |
708 | ev->transport_handle = iscsi_handle(conn->transport); | 553 | ev->transport_handle = iscsi_handle(conn->transport); |
709 | ev->type = ISCSI_KEVENT_RECV_PDU; | 554 | ev->type = ISCSI_KEVENT_RECV_PDU; |
710 | if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) | ||
711 | ev->iferror = -ENOMEM; | ||
712 | ev->r.recv_req.cid = conn->cid; | 555 | ev->r.recv_req.cid = conn->cid; |
713 | ev->r.recv_req.sid = iscsi_conn_get_sid(conn); | 556 | ev->r.recv_req.sid = iscsi_conn_get_sid(conn); |
714 | pdu = (char*)ev + sizeof(*ev); | 557 | pdu = (char*)ev + sizeof(*ev); |
715 | memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); | 558 | memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); |
716 | memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); | 559 | memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); |
717 | 560 | ||
718 | return iscsi_unicast_skb(conn->z_pdu, skb, priv->daemon_pid); | 561 | return iscsi_unicast_skb(skb, priv->daemon_pid); |
719 | } | 562 | } |
720 | EXPORT_SYMBOL_GPL(iscsi_recv_pdu); | 563 | EXPORT_SYMBOL_GPL(iscsi_recv_pdu); |
721 | 564 | ||
@@ -731,9 +574,7 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error) | |||
731 | if (!priv) | 574 | if (!priv) |
732 | return; | 575 | return; |
733 | 576 | ||
734 | mempool_zone_complete(conn->z_error); | 577 | skb = alloc_skb(len, GFP_ATOMIC); |
735 | |||
736 | skb = mempool_zone_get_skb(conn->z_error); | ||
737 | if (!skb) { | 578 | if (!skb) { |
738 | dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored " | 579 | dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored " |
739 | "conn error (%d)\n", error); | 580 | "conn error (%d)\n", error); |
@@ -744,13 +585,11 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error) | |||
744 | ev = NLMSG_DATA(nlh); | 585 | ev = NLMSG_DATA(nlh); |
745 | ev->transport_handle = iscsi_handle(conn->transport); | 586 | ev->transport_handle = iscsi_handle(conn->transport); |
746 | ev->type = ISCSI_KEVENT_CONN_ERROR; | 587 | ev->type = ISCSI_KEVENT_CONN_ERROR; |
747 | if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat) | ||
748 | ev->iferror = -ENOMEM; | ||
749 | ev->r.connerror.error = error; | 588 | ev->r.connerror.error = error; |
750 | ev->r.connerror.cid = conn->cid; | 589 | ev->r.connerror.cid = conn->cid; |
751 | ev->r.connerror.sid = iscsi_conn_get_sid(conn); | 590 | ev->r.connerror.sid = iscsi_conn_get_sid(conn); |
752 | 591 | ||
753 | iscsi_broadcast_skb(conn->z_error, skb, GFP_ATOMIC); | 592 | iscsi_broadcast_skb(skb, GFP_ATOMIC); |
754 | 593 | ||
755 | dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n", | 594 | dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n", |
756 | error); | 595 | error); |
@@ -767,9 +606,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi, | |||
767 | int flags = multi ? NLM_F_MULTI : 0; | 606 | int flags = multi ? NLM_F_MULTI : 0; |
768 | int t = done ? NLMSG_DONE : type; | 607 | int t = done ? NLMSG_DONE : type; |
769 | 608 | ||
770 | mempool_zone_complete(z_reply); | 609 | skb = alloc_skb(len, GFP_ATOMIC); |
771 | |||
772 | skb = mempool_zone_get_skb(z_reply); | ||
773 | /* | 610 | /* |
774 | * FIXME: | 611 | * FIXME: |
775 | * user is supposed to react on iferror == -ENOMEM; | 612 | * user is supposed to react on iferror == -ENOMEM; |
@@ -780,7 +617,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi, | |||
780 | nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0); | 617 | nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0); |
781 | nlh->nlmsg_flags = flags; | 618 | nlh->nlmsg_flags = flags; |
782 | memcpy(NLMSG_DATA(nlh), payload, size); | 619 | memcpy(NLMSG_DATA(nlh), payload, size); |
783 | return iscsi_unicast_skb(z_reply, skb, pid); | 620 | return iscsi_unicast_skb(skb, pid); |
784 | } | 621 | } |
785 | 622 | ||
786 | static int | 623 | static int |
@@ -810,9 +647,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
810 | do { | 647 | do { |
811 | int actual_size; | 648 | int actual_size; |
812 | 649 | ||
813 | mempool_zone_complete(conn->z_pdu); | 650 | skbstat = alloc_skb(len, GFP_ATOMIC); |
814 | |||
815 | skbstat = mempool_zone_get_skb(conn->z_pdu); | ||
816 | if (!skbstat) { | 651 | if (!skbstat) { |
817 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not " | 652 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not " |
818 | "deliver stats: OOM\n"); | 653 | "deliver stats: OOM\n"); |
@@ -825,8 +660,6 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
825 | memset(evstat, 0, sizeof(*evstat)); | 660 | memset(evstat, 0, sizeof(*evstat)); |
826 | evstat->transport_handle = iscsi_handle(conn->transport); | 661 | evstat->transport_handle = iscsi_handle(conn->transport); |
827 | evstat->type = nlh->nlmsg_type; | 662 | evstat->type = nlh->nlmsg_type; |
828 | if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) | ||
829 | evstat->iferror = -ENOMEM; | ||
830 | evstat->u.get_stats.cid = | 663 | evstat->u.get_stats.cid = |
831 | ev->u.get_stats.cid; | 664 | ev->u.get_stats.cid; |
832 | evstat->u.get_stats.sid = | 665 | evstat->u.get_stats.sid = |
@@ -845,7 +678,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
845 | skb_trim(skbstat, NLMSG_ALIGN(actual_size)); | 678 | skb_trim(skbstat, NLMSG_ALIGN(actual_size)); |
846 | nlhstat->nlmsg_len = actual_size; | 679 | nlhstat->nlmsg_len = actual_size; |
847 | 680 | ||
848 | err = iscsi_unicast_skb(conn->z_pdu, skbstat, priv->daemon_pid); | 681 | err = iscsi_unicast_skb(skbstat, priv->daemon_pid); |
849 | } while (err < 0 && err != -ECONNREFUSED); | 682 | } while (err < 0 && err != -ECONNREFUSED); |
850 | 683 | ||
851 | return err; | 684 | return err; |
@@ -876,9 +709,7 @@ int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn) | |||
876 | session = iscsi_dev_to_session(conn->dev.parent); | 709 | session = iscsi_dev_to_session(conn->dev.parent); |
877 | shost = iscsi_session_to_shost(session); | 710 | shost = iscsi_session_to_shost(session); |
878 | 711 | ||
879 | mempool_zone_complete(conn->z_pdu); | 712 | skb = alloc_skb(len, GFP_KERNEL); |
880 | |||
881 | skb = mempool_zone_get_skb(conn->z_pdu); | ||
882 | if (!skb) { | 713 | if (!skb) { |
883 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " | 714 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " |
884 | "session creation event\n"); | 715 | "session creation event\n"); |
@@ -896,7 +727,7 @@ int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn) | |||
896 | * this will occur if the daemon is not up, so we just warn | 727 | * this will occur if the daemon is not up, so we just warn |
897 | * the user and when the daemon is restarted it will handle it | 728 | * the user and when the daemon is restarted it will handle it |
898 | */ | 729 | */ |
899 | rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL); | 730 | rc = iscsi_broadcast_skb(skb, GFP_KERNEL); |
900 | if (rc < 0) | 731 | if (rc < 0) |
901 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " | 732 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " |
902 | "session destruction event. Check iscsi daemon\n"); | 733 | "session destruction event. Check iscsi daemon\n"); |
@@ -939,9 +770,7 @@ int iscsi_if_create_session_done(struct iscsi_cls_conn *conn) | |||
939 | session = iscsi_dev_to_session(conn->dev.parent); | 770 | session = iscsi_dev_to_session(conn->dev.parent); |
940 | shost = iscsi_session_to_shost(session); | 771 | shost = iscsi_session_to_shost(session); |
941 | 772 | ||
942 | mempool_zone_complete(conn->z_pdu); | 773 | skb = alloc_skb(len, GFP_KERNEL); |
943 | |||
944 | skb = mempool_zone_get_skb(conn->z_pdu); | ||
945 | if (!skb) { | 774 | if (!skb) { |
946 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " | 775 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " |
947 | "session creation event\n"); | 776 | "session creation event\n"); |
@@ -959,7 +788,7 @@ int iscsi_if_create_session_done(struct iscsi_cls_conn *conn) | |||
959 | * this will occur if the daemon is not up, so we just warn | 788 | * this will occur if the daemon is not up, so we just warn |
960 | * the user and when the daemon is restarted it will handle it | 789 | * the user and when the daemon is restarted it will handle it |
961 | */ | 790 | */ |
962 | rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL); | 791 | rc = iscsi_broadcast_skb(skb, GFP_KERNEL); |
963 | if (rc < 0) | 792 | if (rc < 0) |
964 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " | 793 | dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " |
965 | "session creation event. Check iscsi daemon\n"); | 794 | "session creation event. Check iscsi daemon\n"); |
@@ -1278,9 +1107,6 @@ iscsi_if_rx(struct sock *sk, int len) | |||
1278 | err = iscsi_if_send_reply( | 1107 | err = iscsi_if_send_reply( |
1279 | NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq, | 1108 | NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq, |
1280 | nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); | 1109 | nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); |
1281 | if (atomic_read(&z_reply->allocated) >= | ||
1282 | z_reply->hiwat) | ||
1283 | ev->iferror = -ENOMEM; | ||
1284 | } while (err < 0 && err != -ECONNREFUSED); | 1110 | } while (err < 0 && err != -ECONNREFUSED); |
1285 | skb_pull(skb, rlen); | 1111 | skb_pull(skb, rlen); |
1286 | } | 1112 | } |
@@ -1584,32 +1410,6 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) | |||
1584 | } | 1410 | } |
1585 | EXPORT_SYMBOL_GPL(iscsi_unregister_transport); | 1411 | EXPORT_SYMBOL_GPL(iscsi_unregister_transport); |
1586 | 1412 | ||
1587 | static int | ||
1588 | iscsi_rcv_nl_event(struct notifier_block *this, unsigned long event, void *ptr) | ||
1589 | { | ||
1590 | struct netlink_notify *n = ptr; | ||
1591 | |||
1592 | if (event == NETLINK_URELEASE && | ||
1593 | n->protocol == NETLINK_ISCSI && n->pid) { | ||
1594 | struct iscsi_cls_conn *conn; | ||
1595 | unsigned long flags; | ||
1596 | |||
1597 | mempool_zone_complete(z_reply); | ||
1598 | spin_lock_irqsave(&connlock, flags); | ||
1599 | list_for_each_entry(conn, &connlist, conn_list) { | ||
1600 | mempool_zone_complete(conn->z_error); | ||
1601 | mempool_zone_complete(conn->z_pdu); | ||
1602 | } | ||
1603 | spin_unlock_irqrestore(&connlock, flags); | ||
1604 | } | ||
1605 | |||
1606 | return NOTIFY_DONE; | ||
1607 | } | ||
1608 | |||
1609 | static struct notifier_block iscsi_nl_notifier = { | ||
1610 | .notifier_call = iscsi_rcv_nl_event, | ||
1611 | }; | ||
1612 | |||
1613 | static __init int iscsi_transport_init(void) | 1413 | static __init int iscsi_transport_init(void) |
1614 | { | 1414 | { |
1615 | int err; | 1415 | int err; |
@@ -1633,25 +1433,15 @@ static __init int iscsi_transport_init(void) | |||
1633 | if (err) | 1433 | if (err) |
1634 | goto unregister_conn_class; | 1434 | goto unregister_conn_class; |
1635 | 1435 | ||
1636 | err = netlink_register_notifier(&iscsi_nl_notifier); | ||
1637 | if (err) | ||
1638 | goto unregister_session_class; | ||
1639 | |||
1640 | nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx, | 1436 | nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx, |
1641 | THIS_MODULE); | 1437 | THIS_MODULE); |
1642 | if (!nls) { | 1438 | if (!nls) { |
1643 | err = -ENOBUFS; | 1439 | err = -ENOBUFS; |
1644 | goto unregister_notifier; | 1440 | goto unregister_session_class; |
1645 | } | 1441 | } |
1646 | 1442 | ||
1647 | z_reply = mempool_zone_init(Z_MAX_REPLY, | 1443 | return 0; |
1648 | NLMSG_SPACE(sizeof(struct iscsi_uevent)), Z_HIWAT_REPLY); | ||
1649 | if (z_reply) | ||
1650 | return 0; | ||
1651 | 1444 | ||
1652 | sock_release(nls->sk_socket); | ||
1653 | unregister_notifier: | ||
1654 | netlink_unregister_notifier(&iscsi_nl_notifier); | ||
1655 | unregister_session_class: | 1445 | unregister_session_class: |
1656 | transport_class_unregister(&iscsi_session_class); | 1446 | transport_class_unregister(&iscsi_session_class); |
1657 | unregister_conn_class: | 1447 | unregister_conn_class: |
@@ -1665,9 +1455,7 @@ unregister_transport_class: | |||
1665 | 1455 | ||
1666 | static void __exit iscsi_transport_exit(void) | 1456 | static void __exit iscsi_transport_exit(void) |
1667 | { | 1457 | { |
1668 | mempool_zone_destroy(z_reply); | ||
1669 | sock_release(nls->sk_socket); | 1458 | sock_release(nls->sk_socket); |
1670 | netlink_unregister_notifier(&iscsi_nl_notifier); | ||
1671 | transport_class_unregister(&iscsi_connection_class); | 1459 | transport_class_unregister(&iscsi_connection_class); |
1672 | transport_class_unregister(&iscsi_session_class); | 1460 | transport_class_unregister(&iscsi_session_class); |
1673 | transport_class_unregister(&iscsi_host_class); | 1461 | transport_class_unregister(&iscsi_host_class); |
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index 8ff1f2866f7b..5ffec2721b28 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c | |||
@@ -97,8 +97,8 @@ | |||
97 | #include <linux/blkdev.h> | 97 | #include <linux/blkdev.h> |
98 | #include <linux/stat.h> | 98 | #include <linux/stat.h> |
99 | #include <linux/delay.h> | 99 | #include <linux/delay.h> |
100 | #include <linux/io.h> | ||
100 | 101 | ||
101 | #include <asm/io.h> | ||
102 | #include <asm/system.h> | 102 | #include <asm/system.h> |
103 | #include <asm/uaccess.h> | 103 | #include <asm/uaccess.h> |
104 | 104 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3f8b93188567..81e3bc7b02a1 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -60,7 +60,7 @@ static int sg_version_num = 30534; /* 2 digits for each component */ | |||
60 | 60 | ||
61 | #ifdef CONFIG_SCSI_PROC_FS | 61 | #ifdef CONFIG_SCSI_PROC_FS |
62 | #include <linux/proc_fs.h> | 62 | #include <linux/proc_fs.h> |
63 | static char *sg_version_date = "20060920"; | 63 | static char *sg_version_date = "20061027"; |
64 | 64 | ||
65 | static int sg_proc_init(void); | 65 | static int sg_proc_init(void); |
66 | static void sg_proc_cleanup(void); | 66 | static void sg_proc_cleanup(void); |
@@ -710,12 +710,12 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, | |||
710 | (int) cmnd[0], (int) hp->cmd_len)); | 710 | (int) cmnd[0], (int) hp->cmd_len)); |
711 | 711 | ||
712 | if ((k = sg_start_req(srp))) { | 712 | if ((k = sg_start_req(srp))) { |
713 | SCSI_LOG_TIMEOUT(1, printk("sg_write: start_req err=%d\n", k)); | 713 | SCSI_LOG_TIMEOUT(1, printk("sg_common_write: start_req err=%d\n", k)); |
714 | sg_finish_rem_req(srp); | 714 | sg_finish_rem_req(srp); |
715 | return k; /* probably out of space --> ENOMEM */ | 715 | return k; /* probably out of space --> ENOMEM */ |
716 | } | 716 | } |
717 | if ((k = sg_write_xfer(srp))) { | 717 | if ((k = sg_write_xfer(srp))) { |
718 | SCSI_LOG_TIMEOUT(1, printk("sg_write: write_xfer, bad address\n")); | 718 | SCSI_LOG_TIMEOUT(1, printk("sg_common_write: write_xfer, bad address\n")); |
719 | sg_finish_rem_req(srp); | 719 | sg_finish_rem_req(srp); |
720 | return k; | 720 | return k; |
721 | } | 721 | } |
@@ -746,7 +746,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, | |||
746 | hp->dxfer_len, srp->data.k_use_sg, timeout, | 746 | hp->dxfer_len, srp->data.k_use_sg, timeout, |
747 | SG_DEFAULT_RETRIES, srp, sg_cmd_done, | 747 | SG_DEFAULT_RETRIES, srp, sg_cmd_done, |
748 | GFP_ATOMIC)) { | 748 | GFP_ATOMIC)) { |
749 | SCSI_LOG_TIMEOUT(1, printk("sg_write: scsi_execute_async failed\n")); | 749 | SCSI_LOG_TIMEOUT(1, printk("sg_common_write: scsi_execute_async failed\n")); |
750 | /* | 750 | /* |
751 | * most likely out of mem, but could also be a bad map | 751 | * most likely out of mem, but could also be a bad map |
752 | */ | 752 | */ |
@@ -1283,7 +1283,7 @@ sg_cmd_done(void *data, char *sense, int result, int resid) | |||
1283 | sg_finish_rem_req(srp); | 1283 | sg_finish_rem_req(srp); |
1284 | srp = NULL; | 1284 | srp = NULL; |
1285 | if (NULL == sfp->headrp) { | 1285 | if (NULL == sfp->headrp) { |
1286 | SCSI_LOG_TIMEOUT(1, printk("sg...bh: already closed, final cleanup\n")); | 1286 | SCSI_LOG_TIMEOUT(1, printk("sg_cmd_done: already closed, final cleanup\n")); |
1287 | if (0 == sg_remove_sfp(sdp, sfp)) { /* device still present */ | 1287 | if (0 == sg_remove_sfp(sdp, sfp)) { /* device still present */ |
1288 | scsi_device_put(sdp->device); | 1288 | scsi_device_put(sdp->device); |
1289 | } | 1289 | } |
@@ -1512,12 +1512,12 @@ sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf) | |||
1512 | POLL_HUP); | 1512 | POLL_HUP); |
1513 | } | 1513 | } |
1514 | } | 1514 | } |
1515 | SCSI_LOG_TIMEOUT(3, printk("sg_detach: dev=%d, dirty\n", k)); | 1515 | SCSI_LOG_TIMEOUT(3, printk("sg_remove: dev=%d, dirty\n", k)); |
1516 | if (NULL == sdp->headfp) { | 1516 | if (NULL == sdp->headfp) { |
1517 | sg_dev_arr[k] = NULL; | 1517 | sg_dev_arr[k] = NULL; |
1518 | } | 1518 | } |
1519 | } else { /* nothing active, simple case */ | 1519 | } else { /* nothing active, simple case */ |
1520 | SCSI_LOG_TIMEOUT(3, printk("sg_detach: dev=%d\n", k)); | 1520 | SCSI_LOG_TIMEOUT(3, printk("sg_remove: dev=%d\n", k)); |
1521 | sg_dev_arr[k] = NULL; | 1521 | sg_dev_arr[k] = NULL; |
1522 | } | 1522 | } |
1523 | sg_nr_dev--; | 1523 | sg_nr_dev--; |
@@ -1876,14 +1876,15 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) | |||
1876 | } | 1876 | } |
1877 | } | 1877 | } |
1878 | sg->page = p; | 1878 | sg->page = p; |
1879 | sg->length = ret_sz; | 1879 | sg->length = (ret_sz > num) ? num : ret_sz; |
1880 | 1880 | ||
1881 | SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n", | 1881 | SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, " |
1882 | k, p, ret_sz)); | 1882 | "ret_sz=%d\n", k, num, ret_sz)); |
1883 | } /* end of for loop */ | 1883 | } /* end of for loop */ |
1884 | 1884 | ||
1885 | schp->k_use_sg = k; | 1885 | schp->k_use_sg = k; |
1886 | SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k_use_sg=%d, rem_sz=%d\n", k, rem_sz)); | 1886 | SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k_use_sg=%d, " |
1887 | "rem_sz=%d\n", k, rem_sz)); | ||
1887 | 1888 | ||
1888 | schp->bufflen = blk_size; | 1889 | schp->bufflen = blk_size; |
1889 | if (rem_sz > 0) /* must have failed */ | 1890 | if (rem_sz > 0) /* must have failed */ |
@@ -2014,7 +2015,7 @@ sg_remove_scat(Sg_scatter_hold * schp) | |||
2014 | for (k = 0; (k < schp->k_use_sg) && sg->page; | 2015 | for (k = 0; (k < schp->k_use_sg) && sg->page; |
2015 | ++k, ++sg) { | 2016 | ++k, ++sg) { |
2016 | SCSI_LOG_TIMEOUT(5, printk( | 2017 | SCSI_LOG_TIMEOUT(5, printk( |
2017 | "sg_remove_scat: k=%d, a=0x%p, len=%d\n", | 2018 | "sg_remove_scat: k=%d, pg=0x%p, len=%d\n", |
2018 | k, sg->page, sg->length)); | 2019 | k, sg->page, sg->length)); |
2019 | sg_page_free(sg->page, sg->length); | 2020 | sg_page_free(sg->page, sg->length); |
2020 | } | 2021 | } |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index febfac97ad38..587274dd7059 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -1177,7 +1177,10 @@ static int st_open(struct inode *inode, struct file *filp) | |||
1177 | goto err_out; | 1177 | goto err_out; |
1178 | if ((filp->f_flags & O_NONBLOCK) == 0 && | 1178 | if ((filp->f_flags & O_NONBLOCK) == 0 && |
1179 | retval != CHKRES_READY) { | 1179 | retval != CHKRES_READY) { |
1180 | retval = (-EIO); | 1180 | if (STp->ready == NO_TAPE) |
1181 | retval = (-ENOMEDIUM); | ||
1182 | else | ||
1183 | retval = (-EIO); | ||
1181 | goto err_out; | 1184 | goto err_out; |
1182 | } | 1185 | } |
1183 | return 0; | 1186 | return 0; |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index 5ec5af8e3379..3b3f3050a877 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -266,8 +266,8 @@ static struct scsi_host_template *the_template = NULL; | |||
266 | (struct NCR5380_hostdata *)(in)->hostdata | 266 | (struct NCR5380_hostdata *)(in)->hostdata |
267 | #define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata) | 267 | #define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata) |
268 | 268 | ||
269 | #define NEXT(cmd) ((Scsi_Cmnd *)((cmd)->host_scribble)) | 269 | #define NEXT(cmd) ((struct scsi_cmnd *)((cmd)->host_scribble)) |
270 | #define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) | 270 | #define NEXTADDR(cmd) ((struct scsi_cmnd **)&((cmd)->host_scribble)) |
271 | 271 | ||
272 | #define HOSTNO instance->host_no | 272 | #define HOSTNO instance->host_no |
273 | #define H_NO(cmd) (cmd)->device->host->host_no | 273 | #define H_NO(cmd) (cmd)->device->host->host_no |
@@ -360,7 +360,7 @@ static void __init init_tags( void ) | |||
360 | * conditions. | 360 | * conditions. |
361 | */ | 361 | */ |
362 | 362 | ||
363 | static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) | 363 | static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged) |
364 | { | 364 | { |
365 | SETUP_HOSTDATA(cmd->device->host); | 365 | SETUP_HOSTDATA(cmd->device->host); |
366 | 366 | ||
@@ -384,7 +384,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) | |||
384 | * untagged. | 384 | * untagged. |
385 | */ | 385 | */ |
386 | 386 | ||
387 | static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) | 387 | static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged) |
388 | { | 388 | { |
389 | SETUP_HOSTDATA(cmd->device->host); | 389 | SETUP_HOSTDATA(cmd->device->host); |
390 | 390 | ||
@@ -416,7 +416,7 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) | |||
416 | * unlock the LUN. | 416 | * unlock the LUN. |
417 | */ | 417 | */ |
418 | 418 | ||
419 | static void cmd_free_tag( Scsi_Cmnd *cmd ) | 419 | static void cmd_free_tag(struct scsi_cmnd *cmd) |
420 | { | 420 | { |
421 | SETUP_HOSTDATA(cmd->device->host); | 421 | SETUP_HOSTDATA(cmd->device->host); |
422 | 422 | ||
@@ -460,18 +460,18 @@ static void free_all_tags( void ) | |||
460 | 460 | ||
461 | 461 | ||
462 | /* | 462 | /* |
463 | * Function: void merge_contiguous_buffers( Scsi_Cmnd *cmd ) | 463 | * Function: void merge_contiguous_buffers(struct scsi_cmnd *cmd) |
464 | * | 464 | * |
465 | * Purpose: Try to merge several scatter-gather requests into one DMA | 465 | * Purpose: Try to merge several scatter-gather requests into one DMA |
466 | * transfer. This is possible if the scatter buffers lie on | 466 | * transfer. This is possible if the scatter buffers lie on |
467 | * physical contiguous addresses. | 467 | * physical contiguous addresses. |
468 | * | 468 | * |
469 | * Parameters: Scsi_Cmnd *cmd | 469 | * Parameters: struct scsi_cmnd *cmd |
470 | * The command to work on. The first scatter buffer's data are | 470 | * The command to work on. The first scatter buffer's data are |
471 | * assumed to be already transfered into ptr/this_residual. | 471 | * assumed to be already transfered into ptr/this_residual. |
472 | */ | 472 | */ |
473 | 473 | ||
474 | static void merge_contiguous_buffers( Scsi_Cmnd *cmd ) | 474 | static void merge_contiguous_buffers(struct scsi_cmnd *cmd) |
475 | { | 475 | { |
476 | unsigned long endaddr; | 476 | unsigned long endaddr; |
477 | #if (NDEBUG & NDEBUG_MERGING) | 477 | #if (NDEBUG & NDEBUG_MERGING) |
@@ -501,15 +501,15 @@ static void merge_contiguous_buffers( Scsi_Cmnd *cmd ) | |||
501 | } | 501 | } |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * Function : void initialize_SCp(Scsi_Cmnd *cmd) | 504 | * Function : void initialize_SCp(struct scsi_cmnd *cmd) |
505 | * | 505 | * |
506 | * Purpose : initialize the saved data pointers for cmd to point to the | 506 | * Purpose : initialize the saved data pointers for cmd to point to the |
507 | * start of the buffer. | 507 | * start of the buffer. |
508 | * | 508 | * |
509 | * Inputs : cmd - Scsi_Cmnd structure to have pointers reset. | 509 | * Inputs : cmd - struct scsi_cmnd structure to have pointers reset. |
510 | */ | 510 | */ |
511 | 511 | ||
512 | static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) | 512 | static __inline__ void initialize_SCp(struct scsi_cmnd *cmd) |
513 | { | 513 | { |
514 | /* | 514 | /* |
515 | * Initialize the Scsi Pointer field so that all of the commands in the | 515 | * Initialize the Scsi Pointer field so that all of the commands in the |
@@ -753,14 +753,15 @@ static void NCR5380_print_status (struct Scsi_Host *instance) | |||
753 | do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ | 753 | do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ |
754 | pos += sprintf(pos, fmt , ## args); } while(0) | 754 | pos += sprintf(pos, fmt , ## args); } while(0) |
755 | static | 755 | static |
756 | char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length); | 756 | char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer, |
757 | int length); | ||
757 | 758 | ||
758 | static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, | 759 | static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer, |
759 | off_t offset, int length, int inout) | 760 | char **start, off_t offset, int length, int inout) |
760 | { | 761 | { |
761 | char *pos = buffer; | 762 | char *pos = buffer; |
762 | struct NCR5380_hostdata *hostdata; | 763 | struct NCR5380_hostdata *hostdata; |
763 | Scsi_Cmnd *ptr; | 764 | struct scsi_cmnd *ptr; |
764 | unsigned long flags; | 765 | unsigned long flags; |
765 | off_t begin = 0; | 766 | off_t begin = 0; |
766 | #define check_offset() \ | 767 | #define check_offset() \ |
@@ -784,18 +785,19 @@ static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **s | |||
784 | if (!hostdata->connected) | 785 | if (!hostdata->connected) |
785 | SPRINTF("scsi%d: no currently connected command\n", HOSTNO); | 786 | SPRINTF("scsi%d: no currently connected command\n", HOSTNO); |
786 | else | 787 | else |
787 | pos = lprint_Scsi_Cmnd ((Scsi_Cmnd *) hostdata->connected, | 788 | pos = lprint_Scsi_Cmnd ((struct scsi_cmnd *) hostdata->connected, |
788 | pos, buffer, length); | 789 | pos, buffer, length); |
789 | SPRINTF("scsi%d: issue_queue\n", HOSTNO); | 790 | SPRINTF("scsi%d: issue_queue\n", HOSTNO); |
790 | check_offset(); | 791 | check_offset(); |
791 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr)) { | 792 | for (ptr = (struct scsi_cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr)) |
793 | { | ||
792 | pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); | 794 | pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); |
793 | check_offset(); | 795 | check_offset(); |
794 | } | 796 | } |
795 | 797 | ||
796 | SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); | 798 | SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); |
797 | check_offset(); | 799 | check_offset(); |
798 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; | 800 | for (ptr = (struct scsi_cmnd *) hostdata->disconnected_queue; ptr; |
799 | ptr = NEXT(ptr)) { | 801 | ptr = NEXT(ptr)) { |
800 | pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); | 802 | pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); |
801 | check_offset(); | 803 | check_offset(); |
@@ -810,8 +812,8 @@ static int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **s | |||
810 | return length; | 812 | return length; |
811 | } | 813 | } |
812 | 814 | ||
813 | static char * | 815 | static char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer, |
814 | lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length) | 816 | int length) |
815 | { | 817 | { |
816 | int i, s; | 818 | int i, s; |
817 | unsigned char *command; | 819 | unsigned char *command; |
@@ -888,8 +890,8 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags) | |||
888 | } | 890 | } |
889 | 891 | ||
890 | /* | 892 | /* |
891 | * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, | 893 | * Function : int NCR5380_queue_command (struct scsi_cmnd *cmd, |
892 | * void (*done)(Scsi_Cmnd *)) | 894 | * void (*done)(struct scsi_cmnd *)) |
893 | * | 895 | * |
894 | * Purpose : enqueues a SCSI command | 896 | * Purpose : enqueues a SCSI command |
895 | * | 897 | * |
@@ -906,10 +908,11 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags) | |||
906 | */ | 908 | */ |
907 | 909 | ||
908 | /* Only make static if a wrapper function is used */ | 910 | /* Only make static if a wrapper function is used */ |
909 | static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | 911 | static int NCR5380_queue_command(struct scsi_cmnd *cmd, |
912 | void (*done)(struct scsi_cmnd *)) | ||
910 | { | 913 | { |
911 | SETUP_HOSTDATA(cmd->device->host); | 914 | SETUP_HOSTDATA(cmd->device->host); |
912 | Scsi_Cmnd *tmp; | 915 | struct scsi_cmnd *tmp; |
913 | unsigned long flags; | 916 | unsigned long flags; |
914 | 917 | ||
915 | #if (NDEBUG & NDEBUG_NO_WRITE) | 918 | #if (NDEBUG & NDEBUG_NO_WRITE) |
@@ -990,7 +993,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | |||
990 | NEXT(cmd) = hostdata->issue_queue; | 993 | NEXT(cmd) = hostdata->issue_queue; |
991 | hostdata->issue_queue = cmd; | 994 | hostdata->issue_queue = cmd; |
992 | } else { | 995 | } else { |
993 | for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; | 996 | for (tmp = (struct scsi_cmnd *)hostdata->issue_queue; |
994 | NEXT(tmp); tmp = NEXT(tmp)) | 997 | NEXT(tmp); tmp = NEXT(tmp)) |
995 | ; | 998 | ; |
996 | LIST(cmd, tmp); | 999 | LIST(cmd, tmp); |
@@ -1030,7 +1033,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) | |||
1030 | 1033 | ||
1031 | static void NCR5380_main (void *bl) | 1034 | static void NCR5380_main (void *bl) |
1032 | { | 1035 | { |
1033 | Scsi_Cmnd *tmp, *prev; | 1036 | struct scsi_cmnd *tmp, *prev; |
1034 | struct Scsi_Host *instance = first_instance; | 1037 | struct Scsi_Host *instance = first_instance; |
1035 | struct NCR5380_hostdata *hostdata = HOSTDATA(instance); | 1038 | struct NCR5380_hostdata *hostdata = HOSTDATA(instance); |
1036 | int done; | 1039 | int done; |
@@ -1073,12 +1076,12 @@ static void NCR5380_main (void *bl) | |||
1073 | * for a target that's not busy. | 1076 | * for a target that's not busy. |
1074 | */ | 1077 | */ |
1075 | #if (NDEBUG & NDEBUG_LISTS) | 1078 | #if (NDEBUG & NDEBUG_LISTS) |
1076 | for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; | 1079 | for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, prev = NULL; |
1077 | tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp)) | 1080 | tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp)) |
1078 | ; | 1081 | ; |
1079 | if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/ | 1082 | if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/ |
1080 | #endif | 1083 | #endif |
1081 | for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, | 1084 | for (tmp = (struct scsi_cmnd *) hostdata->issue_queue, |
1082 | prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { | 1085 | prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { |
1083 | 1086 | ||
1084 | #if (NDEBUG & NDEBUG_LISTS) | 1087 | #if (NDEBUG & NDEBUG_LISTS) |
@@ -1339,7 +1342,8 @@ static irqreturn_t NCR5380_intr (int irq, void *dev_id) | |||
1339 | } | 1342 | } |
1340 | 1343 | ||
1341 | #ifdef NCR5380_STATS | 1344 | #ifdef NCR5380_STATS |
1342 | static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) | 1345 | static void collect_stats(struct NCR5380_hostdata *hostdata, |
1346 | struct scsi_cmnd *cmd) | ||
1343 | { | 1347 | { |
1344 | # ifdef NCR5380_STAT_LIMIT | 1348 | # ifdef NCR5380_STAT_LIMIT |
1345 | if (cmd->request_bufflen > NCR5380_STAT_LIMIT) | 1349 | if (cmd->request_bufflen > NCR5380_STAT_LIMIT) |
@@ -1365,8 +1369,8 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) | |||
1365 | #endif | 1369 | #endif |
1366 | 1370 | ||
1367 | /* | 1371 | /* |
1368 | * Function : int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, | 1372 | * Function : int NCR5380_select(struct Scsi_Host *instance, |
1369 | * int tag); | 1373 | * struct scsi_cmnd *cmd, int tag); |
1370 | * | 1374 | * |
1371 | * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, | 1375 | * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, |
1372 | * including ARBITRATION, SELECTION, and initial message out for | 1376 | * including ARBITRATION, SELECTION, and initial message out for |
@@ -1395,7 +1399,8 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) | |||
1395 | * cmd->result host byte set to DID_BAD_TARGET. | 1399 | * cmd->result host byte set to DID_BAD_TARGET. |
1396 | */ | 1400 | */ |
1397 | 1401 | ||
1398 | static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) | 1402 | static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd, |
1403 | int tag) | ||
1399 | { | 1404 | { |
1400 | SETUP_HOSTDATA(instance); | 1405 | SETUP_HOSTDATA(instance); |
1401 | unsigned char tmp[3], phase; | 1406 | unsigned char tmp[3], phase; |
@@ -1985,7 +1990,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) | |||
1985 | #endif | 1990 | #endif |
1986 | unsigned char *data; | 1991 | unsigned char *data; |
1987 | unsigned char phase, tmp, extended_msg[10], old_phase=0xff; | 1992 | unsigned char phase, tmp, extended_msg[10], old_phase=0xff; |
1988 | Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected; | 1993 | struct scsi_cmnd *cmd = (struct scsi_cmnd *) hostdata->connected; |
1989 | 1994 | ||
1990 | #ifdef SUN3_SCSI_VME | 1995 | #ifdef SUN3_SCSI_VME |
1991 | dregs->csr |= CSR_INTR; | 1996 | dregs->csr |= CSR_INTR; |
@@ -2272,7 +2277,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) | |||
2272 | local_irq_save(flags); | 2277 | local_irq_save(flags); |
2273 | LIST(cmd,hostdata->issue_queue); | 2278 | LIST(cmd,hostdata->issue_queue); |
2274 | NEXT(cmd) = hostdata->issue_queue; | 2279 | NEXT(cmd) = hostdata->issue_queue; |
2275 | hostdata->issue_queue = (Scsi_Cmnd *) cmd; | 2280 | hostdata->issue_queue = (struct scsi_cmnd *) cmd; |
2276 | local_irq_restore(flags); | 2281 | local_irq_restore(flags); |
2277 | QU_PRINTK("scsi%d: REQUEST SENSE added to head of " | 2282 | QU_PRINTK("scsi%d: REQUEST SENSE added to head of " |
2278 | "issue queue\n", H_NO(cmd)); | 2283 | "issue queue\n", H_NO(cmd)); |
@@ -2502,7 +2507,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) | |||
2502 | * Function : void NCR5380_reselect (struct Scsi_Host *instance) | 2507 | * Function : void NCR5380_reselect (struct Scsi_Host *instance) |
2503 | * | 2508 | * |
2504 | * Purpose : does reselection, initializing the instance->connected | 2509 | * Purpose : does reselection, initializing the instance->connected |
2505 | * field to point to the Scsi_Cmnd for which the I_T_L or I_T_L_Q | 2510 | * field to point to the struct scsi_cmnd for which the I_T_L or I_T_L_Q |
2506 | * nexus has been reestablished, | 2511 | * nexus has been reestablished, |
2507 | * | 2512 | * |
2508 | * Inputs : instance - this instance of the NCR5380. | 2513 | * Inputs : instance - this instance of the NCR5380. |
@@ -2521,7 +2526,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) | |||
2521 | unsigned char tag; | 2526 | unsigned char tag; |
2522 | #endif | 2527 | #endif |
2523 | unsigned char msg[3]; | 2528 | unsigned char msg[3]; |
2524 | Scsi_Cmnd *tmp = NULL, *prev; | 2529 | struct scsi_cmnd *tmp = NULL, *prev; |
2525 | /* unsigned long flags; */ | 2530 | /* unsigned long flags; */ |
2526 | 2531 | ||
2527 | /* | 2532 | /* |
@@ -2577,7 +2582,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) | |||
2577 | * just reestablished, and remove it from the disconnected queue. | 2582 | * just reestablished, and remove it from the disconnected queue. |
2578 | */ | 2583 | */ |
2579 | 2584 | ||
2580 | for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; | 2585 | for (tmp = (struct scsi_cmnd *) hostdata->disconnected_queue, prev = NULL; |
2581 | tmp; prev = tmp, tmp = NEXT(tmp) ) { | 2586 | tmp; prev = tmp, tmp = NEXT(tmp) ) { |
2582 | if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) | 2587 | if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) |
2583 | #ifdef SUPPORT_TAGS | 2588 | #ifdef SUPPORT_TAGS |
@@ -2668,11 +2673,11 @@ static void NCR5380_reselect (struct Scsi_Host *instance) | |||
2668 | 2673 | ||
2669 | 2674 | ||
2670 | /* | 2675 | /* |
2671 | * Function : int NCR5380_abort (Scsi_Cmnd *cmd) | 2676 | * Function : int NCR5380_abort(struct scsi_cmnd *cmd) |
2672 | * | 2677 | * |
2673 | * Purpose : abort a command | 2678 | * Purpose : abort a command |
2674 | * | 2679 | * |
2675 | * Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the | 2680 | * Inputs : cmd - the struct scsi_cmnd to abort, code - code to set the |
2676 | * host byte of the result field to, if zero DID_ABORTED is | 2681 | * host byte of the result field to, if zero DID_ABORTED is |
2677 | * used. | 2682 | * used. |
2678 | * | 2683 | * |
@@ -2684,11 +2689,11 @@ static void NCR5380_reselect (struct Scsi_Host *instance) | |||
2684 | * called where the loop started in NCR5380_main(). | 2689 | * called where the loop started in NCR5380_main(). |
2685 | */ | 2690 | */ |
2686 | 2691 | ||
2687 | static int NCR5380_abort (Scsi_Cmnd *cmd) | 2692 | static int NCR5380_abort(struct scsi_cmnd *cmd) |
2688 | { | 2693 | { |
2689 | struct Scsi_Host *instance = cmd->device->host; | 2694 | struct Scsi_Host *instance = cmd->device->host; |
2690 | SETUP_HOSTDATA(instance); | 2695 | SETUP_HOSTDATA(instance); |
2691 | Scsi_Cmnd *tmp, **prev; | 2696 | struct scsi_cmnd *tmp, **prev; |
2692 | unsigned long flags; | 2697 | unsigned long flags; |
2693 | 2698 | ||
2694 | printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO); | 2699 | printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO); |
@@ -2753,9 +2758,9 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) | |||
2753 | * Case 2 : If the command hasn't been issued yet, we simply remove it | 2758 | * Case 2 : If the command hasn't been issued yet, we simply remove it |
2754 | * from the issue queue. | 2759 | * from the issue queue. |
2755 | */ | 2760 | */ |
2756 | for (prev = (Scsi_Cmnd **) &(hostdata->issue_queue), | 2761 | for (prev = (struct scsi_cmnd **) &(hostdata->issue_queue), |
2757 | tmp = (Scsi_Cmnd *) hostdata->issue_queue; | 2762 | tmp = (struct scsi_cmnd *) hostdata->issue_queue; |
2758 | tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) | 2763 | tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp)) |
2759 | if (cmd == tmp) { | 2764 | if (cmd == tmp) { |
2760 | REMOVE(5, *prev, tmp, NEXT(tmp)); | 2765 | REMOVE(5, *prev, tmp, NEXT(tmp)); |
2761 | (*prev) = NEXT(tmp); | 2766 | (*prev) = NEXT(tmp); |
@@ -2812,7 +2817,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) | |||
2812 | * it from the disconnected queue. | 2817 | * it from the disconnected queue. |
2813 | */ | 2818 | */ |
2814 | 2819 | ||
2815 | for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; | 2820 | for (tmp = (struct scsi_cmnd *) hostdata->disconnected_queue; tmp; |
2816 | tmp = NEXT(tmp)) | 2821 | tmp = NEXT(tmp)) |
2817 | if (cmd == tmp) { | 2822 | if (cmd == tmp) { |
2818 | local_irq_restore(flags); | 2823 | local_irq_restore(flags); |
@@ -2826,8 +2831,8 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) | |||
2826 | do_abort (instance); | 2831 | do_abort (instance); |
2827 | 2832 | ||
2828 | local_irq_save(flags); | 2833 | local_irq_save(flags); |
2829 | for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), | 2834 | for (prev = (struct scsi_cmnd **) &(hostdata->disconnected_queue), |
2830 | tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; | 2835 | tmp = (struct scsi_cmnd *) hostdata->disconnected_queue; |
2831 | tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) | 2836 | tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) |
2832 | if (cmd == tmp) { | 2837 | if (cmd == tmp) { |
2833 | REMOVE(5, *prev, tmp, NEXT(tmp)); | 2838 | REMOVE(5, *prev, tmp, NEXT(tmp)); |
@@ -2868,7 +2873,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) | |||
2868 | 2873 | ||
2869 | 2874 | ||
2870 | /* | 2875 | /* |
2871 | * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd) | 2876 | * Function : int NCR5380_bus_reset(struct scsi_cmnd *cmd) |
2872 | * | 2877 | * |
2873 | * Purpose : reset the SCSI bus. | 2878 | * Purpose : reset the SCSI bus. |
2874 | * | 2879 | * |
@@ -2876,13 +2881,13 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) | |||
2876 | * | 2881 | * |
2877 | */ | 2882 | */ |
2878 | 2883 | ||
2879 | static int NCR5380_bus_reset( Scsi_Cmnd *cmd) | 2884 | static int NCR5380_bus_reset(struct scsi_cmnd *cmd) |
2880 | { | 2885 | { |
2881 | SETUP_HOSTDATA(cmd->device->host); | 2886 | SETUP_HOSTDATA(cmd->device->host); |
2882 | int i; | 2887 | int i; |
2883 | unsigned long flags; | 2888 | unsigned long flags; |
2884 | #if 1 | 2889 | #if 1 |
2885 | Scsi_Cmnd *connected, *disconnected_queue; | 2890 | struct scsi_cmnd *connected, *disconnected_queue; |
2886 | #endif | 2891 | #endif |
2887 | 2892 | ||
2888 | 2893 | ||
@@ -2914,9 +2919,9 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd) | |||
2914 | * remembered in local variables first. | 2919 | * remembered in local variables first. |
2915 | */ | 2920 | */ |
2916 | local_irq_save(flags); | 2921 | local_irq_save(flags); |
2917 | connected = (Scsi_Cmnd *)hostdata->connected; | 2922 | connected = (struct scsi_cmnd *)hostdata->connected; |
2918 | hostdata->connected = NULL; | 2923 | hostdata->connected = NULL; |
2919 | disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; | 2924 | disconnected_queue = (struct scsi_cmnd *)hostdata->disconnected_queue; |
2920 | hostdata->disconnected_queue = NULL; | 2925 | hostdata->disconnected_queue = NULL; |
2921 | #ifdef SUPPORT_TAGS | 2926 | #ifdef SUPPORT_TAGS |
2922 | free_all_tags(); | 2927 | free_all_tags(); |
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c index e625b4c5833a..d56d85dd9ba0 100644 --- a/drivers/scsi/sun3_scsi.c +++ b/drivers/scsi/sun3_scsi.c | |||
@@ -119,7 +119,7 @@ module_param(setup_use_tagged_queuing, int, 0); | |||
119 | static int setup_hostid = -1; | 119 | static int setup_hostid = -1; |
120 | module_param(setup_hostid, int, 0); | 120 | module_param(setup_hostid, int, 0); |
121 | 121 | ||
122 | static Scsi_Cmnd *sun3_dma_setup_done = NULL; | 122 | static struct scsi_cmnd *sun3_dma_setup_done = NULL; |
123 | 123 | ||
124 | #define AFTER_RESET_DELAY (HZ/2) | 124 | #define AFTER_RESET_DELAY (HZ/2) |
125 | 125 | ||
@@ -521,8 +521,9 @@ static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance) | |||
521 | return last_residual; | 521 | return last_residual; |
522 | } | 522 | } |
523 | 523 | ||
524 | static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, Scsi_Cmnd *cmd, | 524 | static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, |
525 | int write_flag) | 525 | struct scsi_cmnd *cmd, |
526 | int write_flag) | ||
526 | { | 527 | { |
527 | if(blk_fs_request(cmd->request)) | 528 | if(blk_fs_request(cmd->request)) |
528 | return wanted; | 529 | return wanted; |
diff --git a/drivers/scsi/sun3_scsi.h b/drivers/scsi/sun3_scsi.h index 834dab428019..a1103b3e2034 100644 --- a/drivers/scsi/sun3_scsi.h +++ b/drivers/scsi/sun3_scsi.h | |||
@@ -47,11 +47,12 @@ | |||
47 | 47 | ||
48 | #define IOBASE_SUN3_VMESCSI 0xff200000 | 48 | #define IOBASE_SUN3_VMESCSI 0xff200000 |
49 | 49 | ||
50 | static int sun3scsi_abort (Scsi_Cmnd *); | 50 | static int sun3scsi_abort(struct scsi_cmnd *); |
51 | static int sun3scsi_detect (struct scsi_host_template *); | 51 | static int sun3scsi_detect (struct scsi_host_template *); |
52 | static const char *sun3scsi_info (struct Scsi_Host *); | 52 | static const char *sun3scsi_info (struct Scsi_Host *); |
53 | static int sun3scsi_bus_reset(Scsi_Cmnd *); | 53 | static int sun3scsi_bus_reset(struct scsi_cmnd *); |
54 | static int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); | 54 | static int sun3scsi_queue_command(struct scsi_cmnd *, |
55 | void (*done)(struct scsi_cmnd *)); | ||
55 | static int sun3scsi_release (struct Scsi_Host *); | 56 | static int sun3scsi_release (struct Scsi_Host *); |
56 | 57 | ||
57 | #ifndef CMD_PER_LUN | 58 | #ifndef CMD_PER_LUN |
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c index e8faab16567b..92def310a84c 100644 --- a/drivers/scsi/sun3_scsi_vme.c +++ b/drivers/scsi/sun3_scsi_vme.c | |||
@@ -84,7 +84,7 @@ module_param(setup_use_tagged_queuing, int, 0); | |||
84 | static int setup_hostid = -1; | 84 | static int setup_hostid = -1; |
85 | module_param(setup_hostid, int, 0); | 85 | module_param(setup_hostid, int, 0); |
86 | 86 | ||
87 | static Scsi_Cmnd *sun3_dma_setup_done = NULL; | 87 | static struct scsi_cmnd *sun3_dma_setup_done = NULL; |
88 | 88 | ||
89 | #define AFTER_RESET_DELAY (HZ/2) | 89 | #define AFTER_RESET_DELAY (HZ/2) |
90 | 90 | ||
@@ -455,8 +455,9 @@ static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance) | |||
455 | return last_residual; | 455 | return last_residual; |
456 | } | 456 | } |
457 | 457 | ||
458 | static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, Scsi_Cmnd *cmd, | 458 | static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted, |
459 | int write_flag) | 459 | struct scsi_cmnd *cmd, |
460 | int write_flag) | ||
460 | { | 461 | { |
461 | if(blk_fs_request(cmd->request)) | 462 | if(blk_fs_request(cmd->request)) |
462 | return wanted; | 463 | return wanted; |
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 2df6747cb76f..0b7a70f61e0d 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -109,7 +109,7 @@ | |||
109 | #include <asm/system.h> | 109 | #include <asm/system.h> |
110 | #include <linux/signal.h> | 110 | #include <linux/signal.h> |
111 | #include <linux/sched.h> | 111 | #include <linux/sched.h> |
112 | #include <asm/io.h> | 112 | #include <linux/io.h> |
113 | #include <linux/blkdev.h> | 113 | #include <linux/blkdev.h> |
114 | #include <linux/interrupt.h> | 114 | #include <linux/interrupt.h> |
115 | #include <linux/stat.h> | 115 | #include <linux/stat.h> |
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index d03aa6ce8fe8..fa5382e354be 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -2304,6 +2304,7 @@ static struct scsi_host_template driver_template = { | |||
2304 | .sg_tablesize = SG_ALL, | 2304 | .sg_tablesize = SG_ALL, |
2305 | .cmd_per_lun = 1, | 2305 | .cmd_per_lun = 1, |
2306 | .use_clustering = ENABLE_CLUSTERING, | 2306 | .use_clustering = ENABLE_CLUSTERING, |
2307 | .max_sectors = 0x4000, /* 8MiB = 16 * 1024 * 512 */ | ||
2307 | }; | 2308 | }; |
2308 | 2309 | ||
2309 | /*********************************************************************** | 2310 | /*********************************************************************** |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index 331e1cf159b0..30be76514c43 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -178,10 +178,10 @@ | |||
178 | #include <linux/blkdev.h> | 178 | #include <linux/blkdev.h> |
179 | #include <linux/init.h> | 179 | #include <linux/init.h> |
180 | #include <linux/stat.h> | 180 | #include <linux/stat.h> |
181 | #include <linux/io.h> | ||
181 | 182 | ||
182 | #include <asm/system.h> | 183 | #include <asm/system.h> |
183 | #include <asm/dma.h> | 184 | #include <asm/dma.h> |
184 | #include <asm/io.h> | ||
185 | 185 | ||
186 | #include <scsi/scsi.h> | 186 | #include <scsi/scsi.h> |
187 | #include <scsi/scsi_cmnd.h> | 187 | #include <scsi/scsi_cmnd.h> |