diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-12-22 12:57:02 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-12-22 12:57:02 -0500 |
commit | 4b7bd364700d9ac8372eff48832062b936d0793b (patch) | |
tree | 0dbf78c95456a0b02d07fcd473281f04a87e266d /drivers/scsi/megaraid | |
parent | c0d8768af260e2cbb4bf659ae6094a262c86b085 (diff) | |
parent | 90a8a73c06cc32b609a880d48449d7083327e11a (diff) |
Merge branch 'master' into for-next
Conflicts:
MAINTAINERS
arch/arm/mach-omap2/pm24xx.c
drivers/scsi/bfa/bfa_fcpim.c
Needed to update to apply fixes for which the old branch was too
outdated.
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_mbox.c | 7 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 130 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 7 |
3 files changed, 135 insertions, 9 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index a7810a106b37..5708cb27d078 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -113,8 +113,7 @@ static int megaraid_mbox_fire_sync_cmd(adapter_t *); | |||
113 | static void megaraid_mbox_display_scb(adapter_t *, scb_t *); | 113 | static void megaraid_mbox_display_scb(adapter_t *, scb_t *); |
114 | static void megaraid_mbox_setup_device_map(adapter_t *); | 114 | static void megaraid_mbox_setup_device_map(adapter_t *); |
115 | 115 | ||
116 | static int megaraid_queue_command(struct scsi_cmnd *, | 116 | static int megaraid_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
117 | void (*)(struct scsi_cmnd *)); | ||
118 | static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *); | 117 | static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *); |
119 | static void megaraid_mbox_runpendq(adapter_t *, scb_t *); | 118 | static void megaraid_mbox_runpendq(adapter_t *, scb_t *); |
120 | static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *, | 119 | static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *, |
@@ -1484,7 +1483,7 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) | |||
1484 | * Queue entry point for mailbox based controllers. | 1483 | * Queue entry point for mailbox based controllers. |
1485 | */ | 1484 | */ |
1486 | static int | 1485 | static int |
1487 | megaraid_queue_command(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) | 1486 | megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) |
1488 | { | 1487 | { |
1489 | adapter_t *adapter; | 1488 | adapter_t *adapter; |
1490 | scb_t *scb; | 1489 | scb_t *scb; |
@@ -1513,6 +1512,8 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) | |||
1513 | return if_busy; | 1512 | return if_busy; |
1514 | } | 1513 | } |
1515 | 1514 | ||
1515 | static DEF_SCSI_QCMD(megaraid_queue_command) | ||
1516 | |||
1516 | /** | 1517 | /** |
1517 | * megaraid_mbox_build_cmd - transform the mid-layer scsi commands | 1518 | * megaraid_mbox_build_cmd - transform the mid-layer scsi commands |
1518 | * @adapter : controller's soft state | 1519 | * @adapter : controller's soft state |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index d3c9cdee292b..7451bc096a01 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.04.17.1-rc1 | 13 | * Version : v00.00.04.31-rc1 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * (email-id : megaraidlinux@lsi.com) | 16 | * (email-id : megaraidlinux@lsi.com) |
@@ -56,6 +56,15 @@ module_param_named(poll_mode_io, poll_mode_io, int, 0); | |||
56 | MODULE_PARM_DESC(poll_mode_io, | 56 | MODULE_PARM_DESC(poll_mode_io, |
57 | "Complete cmds from IO path, (default=0)"); | 57 | "Complete cmds from IO path, (default=0)"); |
58 | 58 | ||
59 | /* | ||
60 | * Number of sectors per IO command | ||
61 | * Will be set in megasas_init_mfi if user does not provide | ||
62 | */ | ||
63 | static unsigned int max_sectors; | ||
64 | module_param_named(max_sectors, max_sectors, int, 0); | ||
65 | MODULE_PARM_DESC(max_sectors, | ||
66 | "Maximum number of sectors per IO command"); | ||
67 | |||
59 | MODULE_LICENSE("GPL"); | 68 | MODULE_LICENSE("GPL"); |
60 | MODULE_VERSION(MEGASAS_VERSION); | 69 | MODULE_VERSION(MEGASAS_VERSION); |
61 | MODULE_AUTHOR("megaraidlinux@lsi.com"); | 70 | MODULE_AUTHOR("megaraidlinux@lsi.com"); |
@@ -103,6 +112,7 @@ static int megasas_poll_wait_aen; | |||
103 | static DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); | 112 | static DECLARE_WAIT_QUEUE_HEAD(megasas_poll_wait); |
104 | static u32 support_poll_for_event; | 113 | static u32 support_poll_for_event; |
105 | static u32 megasas_dbg_lvl; | 114 | static u32 megasas_dbg_lvl; |
115 | static u32 support_device_change; | ||
106 | 116 | ||
107 | /* define lock for aen poll */ | 117 | /* define lock for aen poll */ |
108 | spinlock_t poll_aen_lock; | 118 | spinlock_t poll_aen_lock; |
@@ -718,6 +728,10 @@ static int | |||
718 | megasas_check_reset_gen2(struct megasas_instance *instance, | 728 | megasas_check_reset_gen2(struct megasas_instance *instance, |
719 | struct megasas_register_set __iomem *regs) | 729 | struct megasas_register_set __iomem *regs) |
720 | { | 730 | { |
731 | if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) { | ||
732 | return 1; | ||
733 | } | ||
734 | |||
721 | return 0; | 735 | return 0; |
722 | } | 736 | } |
723 | 737 | ||
@@ -930,6 +944,7 @@ megasas_make_sgl_skinny(struct megasas_instance *instance, | |||
930 | mfi_sgl->sge_skinny[i].length = sg_dma_len(os_sgl); | 944 | mfi_sgl->sge_skinny[i].length = sg_dma_len(os_sgl); |
931 | mfi_sgl->sge_skinny[i].phys_addr = | 945 | mfi_sgl->sge_skinny[i].phys_addr = |
932 | sg_dma_address(os_sgl); | 946 | sg_dma_address(os_sgl); |
947 | mfi_sgl->sge_skinny[i].flag = 0; | ||
933 | } | 948 | } |
934 | } | 949 | } |
935 | return sge_count; | 950 | return sge_count; |
@@ -1319,7 +1334,7 @@ megasas_dump_pending_frames(struct megasas_instance *instance) | |||
1319 | * @done: Callback entry point | 1334 | * @done: Callback entry point |
1320 | */ | 1335 | */ |
1321 | static int | 1336 | static int |
1322 | megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | 1337 | megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) |
1323 | { | 1338 | { |
1324 | u32 frame_count; | 1339 | u32 frame_count; |
1325 | struct megasas_cmd *cmd; | 1340 | struct megasas_cmd *cmd; |
@@ -1402,6 +1417,8 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
1402 | return 0; | 1417 | return 0; |
1403 | } | 1418 | } |
1404 | 1419 | ||
1420 | static DEF_SCSI_QCMD(megasas_queue_command) | ||
1421 | |||
1405 | static struct megasas_instance *megasas_lookup_instance(u16 host_no) | 1422 | static struct megasas_instance *megasas_lookup_instance(u16 host_no) |
1406 | { | 1423 | { |
1407 | int i; | 1424 | int i; |
@@ -1557,6 +1574,28 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr) | |||
1557 | } | 1574 | } |
1558 | } | 1575 | } |
1559 | 1576 | ||
1577 | static void | ||
1578 | megasas_internal_reset_defer_cmds(struct megasas_instance *instance); | ||
1579 | |||
1580 | static void | ||
1581 | process_fw_state_change_wq(struct work_struct *work); | ||
1582 | |||
1583 | void megasas_do_ocr(struct megasas_instance *instance) | ||
1584 | { | ||
1585 | if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) || | ||
1586 | (instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) || | ||
1587 | (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR)) { | ||
1588 | *instance->consumer = MEGASAS_ADPRESET_INPROG_SIGN; | ||
1589 | } | ||
1590 | instance->instancet->disable_intr(instance->reg_set); | ||
1591 | instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT; | ||
1592 | instance->issuepend_done = 0; | ||
1593 | |||
1594 | atomic_set(&instance->fw_outstanding, 0); | ||
1595 | megasas_internal_reset_defer_cmds(instance); | ||
1596 | process_fw_state_change_wq(&instance->work_init); | ||
1597 | } | ||
1598 | |||
1560 | /** | 1599 | /** |
1561 | * megasas_wait_for_outstanding - Wait for all outstanding cmds | 1600 | * megasas_wait_for_outstanding - Wait for all outstanding cmds |
1562 | * @instance: Adapter soft state | 1601 | * @instance: Adapter soft state |
@@ -1574,6 +1613,8 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance) | |||
1574 | unsigned long flags; | 1613 | unsigned long flags; |
1575 | struct list_head clist_local; | 1614 | struct list_head clist_local; |
1576 | struct megasas_cmd *reset_cmd; | 1615 | struct megasas_cmd *reset_cmd; |
1616 | u32 fw_state; | ||
1617 | u8 kill_adapter_flag; | ||
1577 | 1618 | ||
1578 | spin_lock_irqsave(&instance->hba_lock, flags); | 1619 | spin_lock_irqsave(&instance->hba_lock, flags); |
1579 | adprecovery = instance->adprecovery; | 1620 | adprecovery = instance->adprecovery; |
@@ -1659,7 +1700,45 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance) | |||
1659 | msleep(1000); | 1700 | msleep(1000); |
1660 | } | 1701 | } |
1661 | 1702 | ||
1662 | if (atomic_read(&instance->fw_outstanding)) { | 1703 | i = 0; |
1704 | kill_adapter_flag = 0; | ||
1705 | do { | ||
1706 | fw_state = instance->instancet->read_fw_status_reg( | ||
1707 | instance->reg_set) & MFI_STATE_MASK; | ||
1708 | if ((fw_state == MFI_STATE_FAULT) && | ||
1709 | (instance->disableOnlineCtrlReset == 0)) { | ||
1710 | if (i == 3) { | ||
1711 | kill_adapter_flag = 2; | ||
1712 | break; | ||
1713 | } | ||
1714 | megasas_do_ocr(instance); | ||
1715 | kill_adapter_flag = 1; | ||
1716 | |||
1717 | /* wait for 1 secs to let FW finish the pending cmds */ | ||
1718 | msleep(1000); | ||
1719 | } | ||
1720 | i++; | ||
1721 | } while (i <= 3); | ||
1722 | |||
1723 | if (atomic_read(&instance->fw_outstanding) && | ||
1724 | !kill_adapter_flag) { | ||
1725 | if (instance->disableOnlineCtrlReset == 0) { | ||
1726 | |||
1727 | megasas_do_ocr(instance); | ||
1728 | |||
1729 | /* wait for 5 secs to let FW finish the pending cmds */ | ||
1730 | for (i = 0; i < wait_time; i++) { | ||
1731 | int outstanding = | ||
1732 | atomic_read(&instance->fw_outstanding); | ||
1733 | if (!outstanding) | ||
1734 | return SUCCESS; | ||
1735 | msleep(1000); | ||
1736 | } | ||
1737 | } | ||
1738 | } | ||
1739 | |||
1740 | if (atomic_read(&instance->fw_outstanding) || | ||
1741 | (kill_adapter_flag == 2)) { | ||
1663 | printk(KERN_NOTICE "megaraid_sas: pending cmds after reset\n"); | 1742 | printk(KERN_NOTICE "megaraid_sas: pending cmds after reset\n"); |
1664 | /* | 1743 | /* |
1665 | * Send signal to FW to stop processing any pending cmds. | 1744 | * Send signal to FW to stop processing any pending cmds. |
@@ -2669,6 +2748,7 @@ static int megasas_create_frame_pool(struct megasas_instance *instance) | |||
2669 | return -ENOMEM; | 2748 | return -ENOMEM; |
2670 | } | 2749 | } |
2671 | 2750 | ||
2751 | memset(cmd->frame, 0, total_sz); | ||
2672 | cmd->frame->io.context = cmd->index; | 2752 | cmd->frame->io.context = cmd->index; |
2673 | cmd->frame->io.pad_0 = 0; | 2753 | cmd->frame->io.pad_0 = 0; |
2674 | } | 2754 | } |
@@ -3585,6 +3665,27 @@ static int megasas_io_attach(struct megasas_instance *instance) | |||
3585 | instance->max_fw_cmds - MEGASAS_INT_CMDS; | 3665 | instance->max_fw_cmds - MEGASAS_INT_CMDS; |
3586 | host->this_id = instance->init_id; | 3666 | host->this_id = instance->init_id; |
3587 | host->sg_tablesize = instance->max_num_sge; | 3667 | host->sg_tablesize = instance->max_num_sge; |
3668 | /* | ||
3669 | * Check if the module parameter value for max_sectors can be used | ||
3670 | */ | ||
3671 | if (max_sectors && max_sectors < instance->max_sectors_per_req) | ||
3672 | instance->max_sectors_per_req = max_sectors; | ||
3673 | else { | ||
3674 | if (max_sectors) { | ||
3675 | if (((instance->pdev->device == | ||
3676 | PCI_DEVICE_ID_LSI_SAS1078GEN2) || | ||
3677 | (instance->pdev->device == | ||
3678 | PCI_DEVICE_ID_LSI_SAS0079GEN2)) && | ||
3679 | (max_sectors <= MEGASAS_MAX_SECTORS)) { | ||
3680 | instance->max_sectors_per_req = max_sectors; | ||
3681 | } else { | ||
3682 | printk(KERN_INFO "megasas: max_sectors should be > 0" | ||
3683 | "and <= %d (or < 1MB for GEN2 controller)\n", | ||
3684 | instance->max_sectors_per_req); | ||
3685 | } | ||
3686 | } | ||
3687 | } | ||
3688 | |||
3588 | host->max_sectors = instance->max_sectors_per_req; | 3689 | host->max_sectors = instance->max_sectors_per_req; |
3589 | host->cmd_per_lun = 128; | 3690 | host->cmd_per_lun = 128; |
3590 | host->max_channel = MEGASAS_MAX_CHANNELS - 1; | 3691 | host->max_channel = MEGASAS_MAX_CHANNELS - 1; |
@@ -4658,6 +4759,15 @@ megasas_sysfs_show_support_poll_for_event(struct device_driver *dd, char *buf) | |||
4658 | static DRIVER_ATTR(support_poll_for_event, S_IRUGO, | 4759 | static DRIVER_ATTR(support_poll_for_event, S_IRUGO, |
4659 | megasas_sysfs_show_support_poll_for_event, NULL); | 4760 | megasas_sysfs_show_support_poll_for_event, NULL); |
4660 | 4761 | ||
4762 | static ssize_t | ||
4763 | megasas_sysfs_show_support_device_change(struct device_driver *dd, char *buf) | ||
4764 | { | ||
4765 | return sprintf(buf, "%u\n", support_device_change); | ||
4766 | } | ||
4767 | |||
4768 | static DRIVER_ATTR(support_device_change, S_IRUGO, | ||
4769 | megasas_sysfs_show_support_device_change, NULL); | ||
4770 | |||
4661 | static ssize_t | 4771 | static ssize_t |
4662 | megasas_sysfs_show_dbg_lvl(struct device_driver *dd, char *buf) | 4772 | megasas_sysfs_show_dbg_lvl(struct device_driver *dd, char *buf) |
4663 | { | 4773 | { |
@@ -4978,6 +5088,7 @@ static int __init megasas_init(void) | |||
4978 | MEGASAS_EXT_VERSION); | 5088 | MEGASAS_EXT_VERSION); |
4979 | 5089 | ||
4980 | support_poll_for_event = 2; | 5090 | support_poll_for_event = 2; |
5091 | support_device_change = 1; | ||
4981 | 5092 | ||
4982 | memset(&megasas_mgmt_info, 0, sizeof(megasas_mgmt_info)); | 5093 | memset(&megasas_mgmt_info, 0, sizeof(megasas_mgmt_info)); |
4983 | 5094 | ||
@@ -5026,8 +5137,17 @@ static int __init megasas_init(void) | |||
5026 | if (rval) | 5137 | if (rval) |
5027 | goto err_dcf_poll_mode_io; | 5138 | goto err_dcf_poll_mode_io; |
5028 | 5139 | ||
5140 | rval = driver_create_file(&megasas_pci_driver.driver, | ||
5141 | &driver_attr_support_device_change); | ||
5142 | if (rval) | ||
5143 | goto err_dcf_support_device_change; | ||
5144 | |||
5029 | return rval; | 5145 | return rval; |
5030 | 5146 | ||
5147 | err_dcf_support_device_change: | ||
5148 | driver_remove_file(&megasas_pci_driver.driver, | ||
5149 | &driver_attr_poll_mode_io); | ||
5150 | |||
5031 | err_dcf_poll_mode_io: | 5151 | err_dcf_poll_mode_io: |
5032 | driver_remove_file(&megasas_pci_driver.driver, | 5152 | driver_remove_file(&megasas_pci_driver.driver, |
5033 | &driver_attr_dbg_lvl); | 5153 | &driver_attr_dbg_lvl); |
@@ -5058,6 +5178,10 @@ static void __exit megasas_exit(void) | |||
5058 | driver_remove_file(&megasas_pci_driver.driver, | 5178 | driver_remove_file(&megasas_pci_driver.driver, |
5059 | &driver_attr_dbg_lvl); | 5179 | &driver_attr_dbg_lvl); |
5060 | driver_remove_file(&megasas_pci_driver.driver, | 5180 | driver_remove_file(&megasas_pci_driver.driver, |
5181 | &driver_attr_support_poll_for_event); | ||
5182 | driver_remove_file(&megasas_pci_driver.driver, | ||
5183 | &driver_attr_support_device_change); | ||
5184 | driver_remove_file(&megasas_pci_driver.driver, | ||
5061 | &driver_attr_release_date); | 5185 | &driver_attr_release_date); |
5062 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); | 5186 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); |
5063 | 5187 | ||
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 16a4f68a34b0..ad16f5e60046 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,9 +18,9 @@ | |||
18 | /* | 18 | /* |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.04.17.1-rc1" | 21 | #define MEGASAS_VERSION "00.00.04.31-rc1" |
22 | #define MEGASAS_RELDATE "Oct. 29, 2009" | 22 | #define MEGASAS_RELDATE "May 3, 2010" |
23 | #define MEGASAS_EXT_VERSION "Thu. Oct. 29, 11:41:51 PST 2009" | 23 | #define MEGASAS_EXT_VERSION "Mon. May 3, 11:41:51 PST 2010" |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Device IDs | 26 | * Device IDs |
@@ -706,6 +706,7 @@ struct megasas_ctrl_info { | |||
706 | #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ | 706 | #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ |
707 | MEGASAS_MAX_DEV_PER_CHANNEL) | 707 | MEGASAS_MAX_DEV_PER_CHANNEL) |
708 | 708 | ||
709 | #define MEGASAS_MAX_SECTORS (2*1024) | ||
709 | #define MEGASAS_DBG_LVL 1 | 710 | #define MEGASAS_DBG_LVL 1 |
710 | 711 | ||
711 | #define MEGASAS_FW_BUSY 1 | 712 | #define MEGASAS_FW_BUSY 1 |