diff options
author | James Smart <james.smart@emulex.com> | 2011-07-22 18:36:33 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-07-27 07:09:14 -0400 |
commit | 88a2cfbb8bf3802ca5a90c7d1567a1e542e6ef0c (patch) | |
tree | ca4881c35397515cddea448084dd8a3c6db97191 /drivers/scsi | |
parent | 7c56b9fd3b6d2d933075d12abee67ceb7c90d04a (diff) |
[SCSI] lpfc 8.3.25: Miscellaneous Bug fixes and code cleanup
Miscellaneous Bug fixes and code cleanup
- Fix 16G link speed reporting by adding check for 16G check.
- Change the check and enforcement of MAILBOX_EXT_SIZE (2048B)
to the check and enforcement of BSG_MBOX_SIZE - sizeof(MAILBOX_t) (3840B).
- Instead of waiting for a fixed amount of time after performing firmware
reset, the driver shall wait for the Lancer SLIPORT_STATUS register for the
readiness of the firmware for bring up.
- Add logging to indicate when dynamic parameters are changed.
- Add revision and date to the firmware image format.
- Use revision instead of rev_name to check firmware image version.
- Update temporary offset after memcopy is complete for firmware update.
- Consolidated the use of the macros to get rid of duplicated register
offset definitions.
- Removed the unused second parameter in routine lpfc_bsg_diag_mode_enter()
- Enable debugfs when debugfs is enabled.
- Update function comments for lpfc_sli4_alloc_xri and lpfc_sli4_init_rpi_hdrs.
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 5 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 67 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_bsg.c | 37 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw4.h | 21 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 34 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 17 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 2 |
7 files changed, 129 insertions, 54 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 8ec2c86a49d4..42b583b26139 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -20,6 +20,11 @@ | |||
20 | *******************************************************************/ | 20 | *******************************************************************/ |
21 | 21 | ||
22 | #include <scsi/scsi_host.h> | 22 | #include <scsi/scsi_host.h> |
23 | |||
24 | #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS) | ||
25 | #define CONFIG_SCSI_LPFC_DEBUG_FS | ||
26 | #endif | ||
27 | |||
23 | struct lpfc_sli2_slim; | 28 | struct lpfc_sli2_slim; |
24 | 29 | ||
25 | #define LPFC_PCI_DEV_LP 0x1 | 30 | #define LPFC_PCI_DEV_LP 0x1 |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 29ccb1519226..bffd86f204dd 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -755,6 +755,47 @@ lpfc_issue_reset(struct device *dev, struct device_attribute *attr, | |||
755 | } | 755 | } |
756 | 756 | ||
757 | /** | 757 | /** |
758 | * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness | ||
759 | * @phba: lpfc_hba pointer. | ||
760 | * | ||
761 | * Description: | ||
762 | * SLI4 interface type-2 device to wait on the sliport status register for | ||
763 | * the readyness after performing a firmware reset. | ||
764 | * | ||
765 | * Returns: | ||
766 | * zero for success | ||
767 | **/ | ||
768 | static int | ||
769 | lpfc_sli4_pdev_status_reg_wait(struct lpfc_hba *phba) | ||
770 | { | ||
771 | struct lpfc_register portstat_reg; | ||
772 | int i; | ||
773 | |||
774 | |||
775 | lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, | ||
776 | &portstat_reg.word0); | ||
777 | |||
778 | /* wait for the SLI port firmware ready after firmware reset */ | ||
779 | for (i = 0; i < LPFC_FW_RESET_MAXIMUM_WAIT_10MS_CNT; i++) { | ||
780 | msleep(10); | ||
781 | lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, | ||
782 | &portstat_reg.word0); | ||
783 | if (!bf_get(lpfc_sliport_status_err, &portstat_reg)) | ||
784 | continue; | ||
785 | if (!bf_get(lpfc_sliport_status_rn, &portstat_reg)) | ||
786 | continue; | ||
787 | if (!bf_get(lpfc_sliport_status_rdy, &portstat_reg)) | ||
788 | continue; | ||
789 | break; | ||
790 | } | ||
791 | |||
792 | if (i < LPFC_FW_RESET_MAXIMUM_WAIT_10MS_CNT) | ||
793 | return 0; | ||
794 | else | ||
795 | return -EIO; | ||
796 | } | ||
797 | |||
798 | /** | ||
758 | * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc | 799 | * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc |
759 | * @phba: lpfc_hba pointer. | 800 | * @phba: lpfc_hba pointer. |
760 | * | 801 | * |
@@ -805,7 +846,10 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode) | |||
805 | readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); | 846 | readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); |
806 | 847 | ||
807 | /* delay driver action following IF_TYPE_2 reset */ | 848 | /* delay driver action following IF_TYPE_2 reset */ |
808 | msleep(100); | 849 | rc = lpfc_sli4_pdev_status_reg_wait(phba); |
850 | |||
851 | if (rc) | ||
852 | return -EIO; | ||
809 | 853 | ||
810 | init_completion(&online_compl); | 854 | init_completion(&online_compl); |
811 | rc = lpfc_workq_post_event(phba, &status, &online_compl, | 855 | rc = lpfc_workq_post_event(phba, &status, &online_compl, |
@@ -895,6 +939,10 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr, | |||
895 | 939 | ||
896 | if (!phba->cfg_enable_hba_reset) | 940 | if (!phba->cfg_enable_hba_reset) |
897 | return -EACCES; | 941 | return -EACCES; |
942 | |||
943 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
944 | "3050 lpfc_board_mode set to %s\n", buf); | ||
945 | |||
898 | init_completion(&online_compl); | 946 | init_completion(&online_compl); |
899 | 947 | ||
900 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) { | 948 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) { |
@@ -1290,6 +1338,10 @@ lpfc_poll_store(struct device *dev, struct device_attribute *attr, | |||
1290 | if (phba->sli_rev == LPFC_SLI_REV4) | 1338 | if (phba->sli_rev == LPFC_SLI_REV4) |
1291 | val = 0; | 1339 | val = 0; |
1292 | 1340 | ||
1341 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
1342 | "3051 lpfc_poll changed from %d to %d\n", | ||
1343 | phba->cfg_poll, val); | ||
1344 | |||
1293 | spin_lock_irq(&phba->hbalock); | 1345 | spin_lock_irq(&phba->hbalock); |
1294 | 1346 | ||
1295 | old_val = phba->cfg_poll; | 1347 | old_val = phba->cfg_poll; |
@@ -1605,6 +1657,9 @@ static int \ | |||
1605 | lpfc_##attr##_set(struct lpfc_hba *phba, uint val) \ | 1657 | lpfc_##attr##_set(struct lpfc_hba *phba, uint val) \ |
1606 | { \ | 1658 | { \ |
1607 | if (val >= minval && val <= maxval) {\ | 1659 | if (val >= minval && val <= maxval) {\ |
1660 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \ | ||
1661 | "3052 lpfc_" #attr " changed from %d to %d\n", \ | ||
1662 | phba->cfg_##attr, val); \ | ||
1608 | phba->cfg_##attr = val;\ | 1663 | phba->cfg_##attr = val;\ |
1609 | return 0;\ | 1664 | return 0;\ |
1610 | }\ | 1665 | }\ |
@@ -1762,6 +1817,9 @@ static int \ | |||
1762 | lpfc_##attr##_set(struct lpfc_vport *vport, uint val) \ | 1817 | lpfc_##attr##_set(struct lpfc_vport *vport, uint val) \ |
1763 | { \ | 1818 | { \ |
1764 | if (val >= minval && val <= maxval) {\ | 1819 | if (val >= minval && val <= maxval) {\ |
1820 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \ | ||
1821 | "3053 lpfc_" #attr " changed from %d to %d\n", \ | ||
1822 | vport->cfg_##attr, val); \ | ||
1765 | vport->cfg_##attr = val;\ | 1823 | vport->cfg_##attr = val;\ |
1766 | return 0;\ | 1824 | return 0;\ |
1767 | }\ | 1825 | }\ |
@@ -2678,6 +2736,9 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr, | |||
2678 | if (nolip) | 2736 | if (nolip) |
2679 | return strlen(buf); | 2737 | return strlen(buf); |
2680 | 2738 | ||
2739 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
2740 | "3054 lpfc_topology changed from %d to %d\n", | ||
2741 | prev_val, val); | ||
2681 | err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); | 2742 | err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); |
2682 | if (err) { | 2743 | if (err) { |
2683 | phba->cfg_topology = prev_val; | 2744 | phba->cfg_topology = prev_val; |
@@ -3101,6 +3162,10 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, | |||
3101 | if (sscanf(val_buf, "%i", &val) != 1) | 3162 | if (sscanf(val_buf, "%i", &val) != 1) |
3102 | return -EINVAL; | 3163 | return -EINVAL; |
3103 | 3164 | ||
3165 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3166 | "3055 lpfc_link_speed changed from %d to %d %s\n", | ||
3167 | phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); | ||
3168 | |||
3104 | if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || | 3169 | if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || |
3105 | ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || | 3170 | ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || |
3106 | ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || | 3171 | ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || |
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index 7fb0ba4cbfa7..8675aa20642a 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c | |||
@@ -1471,13 +1471,12 @@ send_mgmt_rsp_exit: | |||
1471 | /** | 1471 | /** |
1472 | * lpfc_bsg_diag_mode_enter - process preparing into device diag loopback mode | 1472 | * lpfc_bsg_diag_mode_enter - process preparing into device diag loopback mode |
1473 | * @phba: Pointer to HBA context object. | 1473 | * @phba: Pointer to HBA context object. |
1474 | * @job: LPFC_BSG_VENDOR_DIAG_MODE | ||
1475 | * | 1474 | * |
1476 | * This function is responsible for preparing driver for diag loopback | 1475 | * This function is responsible for preparing driver for diag loopback |
1477 | * on device. | 1476 | * on device. |
1478 | */ | 1477 | */ |
1479 | static int | 1478 | static int |
1480 | lpfc_bsg_diag_mode_enter(struct lpfc_hba *phba, struct fc_bsg_job *job) | 1479 | lpfc_bsg_diag_mode_enter(struct lpfc_hba *phba) |
1481 | { | 1480 | { |
1482 | struct lpfc_vport **vports; | 1481 | struct lpfc_vport **vports; |
1483 | struct Scsi_Host *shost; | 1482 | struct Scsi_Host *shost; |
@@ -1521,7 +1520,6 @@ lpfc_bsg_diag_mode_enter(struct lpfc_hba *phba, struct fc_bsg_job *job) | |||
1521 | /** | 1520 | /** |
1522 | * lpfc_bsg_diag_mode_exit - exit process from device diag loopback mode | 1521 | * lpfc_bsg_diag_mode_exit - exit process from device diag loopback mode |
1523 | * @phba: Pointer to HBA context object. | 1522 | * @phba: Pointer to HBA context object. |
1524 | * @job: LPFC_BSG_VENDOR_DIAG_MODE | ||
1525 | * | 1523 | * |
1526 | * This function is responsible for driver exit processing of setting up | 1524 | * This function is responsible for driver exit processing of setting up |
1527 | * diag loopback mode on device. | 1525 | * diag loopback mode on device. |
@@ -1586,7 +1584,7 @@ lpfc_sli3_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct fc_bsg_job *job) | |||
1586 | goto job_error; | 1584 | goto job_error; |
1587 | } | 1585 | } |
1588 | 1586 | ||
1589 | rc = lpfc_bsg_diag_mode_enter(phba, job); | 1587 | rc = lpfc_bsg_diag_mode_enter(phba); |
1590 | if (rc) | 1588 | if (rc) |
1591 | goto job_error; | 1589 | goto job_error; |
1592 | 1590 | ||
@@ -1758,7 +1756,7 @@ lpfc_sli4_bsg_diag_loopback_mode(struct lpfc_hba *phba, struct fc_bsg_job *job) | |||
1758 | goto job_error; | 1756 | goto job_error; |
1759 | } | 1757 | } |
1760 | 1758 | ||
1761 | rc = lpfc_bsg_diag_mode_enter(phba, job); | 1759 | rc = lpfc_bsg_diag_mode_enter(phba); |
1762 | if (rc) | 1760 | if (rc) |
1763 | goto job_error; | 1761 | goto job_error; |
1764 | 1762 | ||
@@ -1982,7 +1980,7 @@ lpfc_sli4_bsg_link_diag_test(struct fc_bsg_job *job) | |||
1982 | goto job_error; | 1980 | goto job_error; |
1983 | } | 1981 | } |
1984 | 1982 | ||
1985 | rc = lpfc_bsg_diag_mode_enter(phba, job); | 1983 | rc = lpfc_bsg_diag_mode_enter(phba); |
1986 | if (rc) | 1984 | if (rc) |
1987 | goto job_error; | 1985 | goto job_error; |
1988 | 1986 | ||
@@ -3511,7 +3509,7 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
3511 | lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, | 3509 | lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, |
3512 | "2947 Issued SLI_CONFIG ext-buffer " | 3510 | "2947 Issued SLI_CONFIG ext-buffer " |
3513 | "maibox command, rc:x%x\n", rc); | 3511 | "maibox command, rc:x%x\n", rc); |
3514 | return 1; | 3512 | return SLI_CONFIG_HANDLED; |
3515 | } | 3513 | } |
3516 | lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | 3514 | lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, |
3517 | "2948 Failed to issue SLI_CONFIG ext-buffer " | 3515 | "2948 Failed to issue SLI_CONFIG ext-buffer " |
@@ -3549,7 +3547,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
3549 | LPFC_MBOXQ_t *pmboxq = NULL; | 3547 | LPFC_MBOXQ_t *pmboxq = NULL; |
3550 | MAILBOX_t *pmb; | 3548 | MAILBOX_t *pmb; |
3551 | uint8_t *mbx; | 3549 | uint8_t *mbx; |
3552 | int rc = 0, i; | 3550 | int rc = SLI_CONFIG_NOT_HANDLED, i; |
3553 | 3551 | ||
3554 | mbox_req = | 3552 | mbox_req = |
3555 | (struct dfc_mbox_req *)job->request->rqst_data.h_vendor.vendor_cmd; | 3553 | (struct dfc_mbox_req *)job->request->rqst_data.h_vendor.vendor_cmd; |
@@ -3660,7 +3658,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
3660 | lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, | 3658 | lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, |
3661 | "2955 Issued SLI_CONFIG ext-buffer " | 3659 | "2955 Issued SLI_CONFIG ext-buffer " |
3662 | "maibox command, rc:x%x\n", rc); | 3660 | "maibox command, rc:x%x\n", rc); |
3663 | return 1; | 3661 | return SLI_CONFIG_HANDLED; |
3664 | } | 3662 | } |
3665 | lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | 3663 | lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, |
3666 | "2956 Failed to issue SLI_CONFIG ext-buffer " | 3664 | "2956 Failed to issue SLI_CONFIG ext-buffer " |
@@ -3668,6 +3666,11 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
3668 | rc = -EPIPE; | 3666 | rc = -EPIPE; |
3669 | } | 3667 | } |
3670 | 3668 | ||
3669 | /* wait for additoinal external buffers */ | ||
3670 | job->reply->result = 0; | ||
3671 | job->job_done(job); | ||
3672 | return SLI_CONFIG_HANDLED; | ||
3673 | |||
3671 | job_error: | 3674 | job_error: |
3672 | if (pmboxq) | 3675 | if (pmboxq) |
3673 | mempool_free(pmboxq, phba->mbox_mem_pool); | 3676 | mempool_free(pmboxq, phba->mbox_mem_pool); |
@@ -3959,7 +3962,7 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
3959 | lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, | 3962 | lpfc_printf_log(phba, KERN_INFO, LOG_LIBDFC, |
3960 | "2969 Issued SLI_CONFIG ext-buffer " | 3963 | "2969 Issued SLI_CONFIG ext-buffer " |
3961 | "maibox command, rc:x%x\n", rc); | 3964 | "maibox command, rc:x%x\n", rc); |
3962 | return 1; | 3965 | return SLI_CONFIG_HANDLED; |
3963 | } | 3966 | } |
3964 | lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, | 3967 | lpfc_printf_log(phba, KERN_ERR, LOG_LIBDFC, |
3965 | "2970 Failed to issue SLI_CONFIG ext-buffer " | 3968 | "2970 Failed to issue SLI_CONFIG ext-buffer " |
@@ -4039,14 +4042,14 @@ lpfc_bsg_handle_sli_cfg_ext(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
4039 | struct lpfc_dmabuf *dmabuf) | 4042 | struct lpfc_dmabuf *dmabuf) |
4040 | { | 4043 | { |
4041 | struct dfc_mbox_req *mbox_req; | 4044 | struct dfc_mbox_req *mbox_req; |
4042 | int rc; | 4045 | int rc = SLI_CONFIG_NOT_HANDLED; |
4043 | 4046 | ||
4044 | mbox_req = | 4047 | mbox_req = |
4045 | (struct dfc_mbox_req *)job->request->rqst_data.h_vendor.vendor_cmd; | 4048 | (struct dfc_mbox_req *)job->request->rqst_data.h_vendor.vendor_cmd; |
4046 | 4049 | ||
4047 | /* mbox command with/without single external buffer */ | 4050 | /* mbox command with/without single external buffer */ |
4048 | if (mbox_req->extMboxTag == 0 && mbox_req->extSeqNum == 0) | 4051 | if (mbox_req->extMboxTag == 0 && mbox_req->extSeqNum == 0) |
4049 | return SLI_CONFIG_NOT_HANDLED; | 4052 | return rc; |
4050 | 4053 | ||
4051 | /* mbox command and first external buffer */ | 4054 | /* mbox command and first external buffer */ |
4052 | if (phba->mbox_ext_buf_ctx.state == LPFC_BSG_MBOX_IDLE) { | 4055 | if (phba->mbox_ext_buf_ctx.state == LPFC_BSG_MBOX_IDLE) { |
@@ -4249,7 +4252,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
4249 | * mailbox extension size | 4252 | * mailbox extension size |
4250 | */ | 4253 | */ |
4251 | if ((transmit_length > receive_length) || | 4254 | if ((transmit_length > receive_length) || |
4252 | (transmit_length > MAILBOX_EXT_SIZE)) { | 4255 | (transmit_length > BSG_MBOX_SIZE - sizeof(MAILBOX_t))) { |
4253 | rc = -ERANGE; | 4256 | rc = -ERANGE; |
4254 | goto job_done; | 4257 | goto job_done; |
4255 | } | 4258 | } |
@@ -4272,7 +4275,7 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
4272 | /* receive length cannot be greater than mailbox | 4275 | /* receive length cannot be greater than mailbox |
4273 | * extension size | 4276 | * extension size |
4274 | */ | 4277 | */ |
4275 | if (receive_length > MAILBOX_EXT_SIZE) { | 4278 | if (receive_length > BSG_MBOX_SIZE - sizeof(MAILBOX_t)) { |
4276 | rc = -ERANGE; | 4279 | rc = -ERANGE; |
4277 | goto job_done; | 4280 | goto job_done; |
4278 | } | 4281 | } |
@@ -4306,7 +4309,8 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
4306 | bde = (struct ulp_bde64 *)&pmb->un.varWords[4]; | 4309 | bde = (struct ulp_bde64 *)&pmb->un.varWords[4]; |
4307 | 4310 | ||
4308 | /* bde size cannot be greater than mailbox ext size */ | 4311 | /* bde size cannot be greater than mailbox ext size */ |
4309 | if (bde->tus.f.bdeSize > MAILBOX_EXT_SIZE) { | 4312 | if (bde->tus.f.bdeSize > |
4313 | BSG_MBOX_SIZE - sizeof(MAILBOX_t)) { | ||
4310 | rc = -ERANGE; | 4314 | rc = -ERANGE; |
4311 | goto job_done; | 4315 | goto job_done; |
4312 | } | 4316 | } |
@@ -4332,7 +4336,8 @@ lpfc_bsg_issue_mbox(struct lpfc_hba *phba, struct fc_bsg_job *job, | |||
4332 | * mailbox extension size | 4336 | * mailbox extension size |
4333 | */ | 4337 | */ |
4334 | if ((receive_length == 0) || | 4338 | if ((receive_length == 0) || |
4335 | (receive_length > MAILBOX_EXT_SIZE)) { | 4339 | (receive_length > |
4340 | BSG_MBOX_SIZE - sizeof(MAILBOX_t))) { | ||
4336 | rc = -ERANGE; | 4341 | rc = -ERANGE; |
4337 | goto job_done; | 4342 | goto job_done; |
4338 | } | 4343 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 11e26a26b5d1..cc6f7c34ea2a 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
@@ -170,15 +170,8 @@ struct lpfc_sli_intf { | |||
170 | #define LPFC_PCI_FUNC3 3 | 170 | #define LPFC_PCI_FUNC3 3 |
171 | #define LPFC_PCI_FUNC4 4 | 171 | #define LPFC_PCI_FUNC4 4 |
172 | 172 | ||
173 | /* SLI4 interface type-2 control register offsets */ | 173 | /* SLI4 interface type-2 PDEV_CTL register */ |
174 | #define LPFC_CTL_PORT_SEM_OFFSET 0x400 | ||
175 | #define LPFC_CTL_PORT_STA_OFFSET 0x404 | ||
176 | #define LPFC_CTL_PORT_CTL_OFFSET 0x408 | ||
177 | #define LPFC_CTL_PORT_ER1_OFFSET 0x40C | ||
178 | #define LPFC_CTL_PORT_ER2_OFFSET 0x410 | ||
179 | #define LPFC_CTL_PDEV_CTL_OFFSET 0x414 | 174 | #define LPFC_CTL_PDEV_CTL_OFFSET 0x414 |
180 | |||
181 | /* Some SLI4 interface type-2 PDEV_CTL register bits */ | ||
182 | #define LPFC_CTL_PDEV_CTL_DRST 0x00000001 | 175 | #define LPFC_CTL_PDEV_CTL_DRST 0x00000001 |
183 | #define LPFC_CTL_PDEV_CTL_FRST 0x00000002 | 176 | #define LPFC_CTL_PDEV_CTL_FRST 0x00000002 |
184 | #define LPFC_CTL_PDEV_CTL_DD 0x00000004 | 177 | #define LPFC_CTL_PDEV_CTL_DD 0x00000004 |
@@ -515,7 +508,7 @@ struct lpfc_register { | |||
515 | /* The following BAR0 register sets are defined for if_type 0 and 2 UCNAs. */ | 508 | /* The following BAR0 register sets are defined for if_type 0 and 2 UCNAs. */ |
516 | #define LPFC_SLI_INTF 0x0058 | 509 | #define LPFC_SLI_INTF 0x0058 |
517 | 510 | ||
518 | #define LPFC_SLIPORT_IF2_SMPHR 0x0400 | 511 | #define LPFC_CTL_PORT_SEM_OFFSET 0x400 |
519 | #define lpfc_port_smphr_perr_SHIFT 31 | 512 | #define lpfc_port_smphr_perr_SHIFT 31 |
520 | #define lpfc_port_smphr_perr_MASK 0x1 | 513 | #define lpfc_port_smphr_perr_MASK 0x1 |
521 | #define lpfc_port_smphr_perr_WORD word0 | 514 | #define lpfc_port_smphr_perr_WORD word0 |
@@ -575,7 +568,7 @@ struct lpfc_register { | |||
575 | #define LPFC_POST_STAGE_PORT_READY 0xC000 | 568 | #define LPFC_POST_STAGE_PORT_READY 0xC000 |
576 | #define LPFC_POST_STAGE_PORT_UE 0xF000 | 569 | #define LPFC_POST_STAGE_PORT_UE 0xF000 |
577 | 570 | ||
578 | #define LPFC_SLIPORT_STATUS 0x0404 | 571 | #define LPFC_CTL_PORT_STA_OFFSET 0x404 |
579 | #define lpfc_sliport_status_err_SHIFT 31 | 572 | #define lpfc_sliport_status_err_SHIFT 31 |
580 | #define lpfc_sliport_status_err_MASK 0x1 | 573 | #define lpfc_sliport_status_err_MASK 0x1 |
581 | #define lpfc_sliport_status_err_WORD word0 | 574 | #define lpfc_sliport_status_err_WORD word0 |
@@ -593,7 +586,7 @@ struct lpfc_register { | |||
593 | #define lpfc_sliport_status_rdy_WORD word0 | 586 | #define lpfc_sliport_status_rdy_WORD word0 |
594 | #define MAX_IF_TYPE_2_RESETS 1000 | 587 | #define MAX_IF_TYPE_2_RESETS 1000 |
595 | 588 | ||
596 | #define LPFC_SLIPORT_CNTRL 0x0408 | 589 | #define LPFC_CTL_PORT_CTL_OFFSET 0x408 |
597 | #define lpfc_sliport_ctrl_end_SHIFT 30 | 590 | #define lpfc_sliport_ctrl_end_SHIFT 30 |
598 | #define lpfc_sliport_ctrl_end_MASK 0x1 | 591 | #define lpfc_sliport_ctrl_end_MASK 0x1 |
599 | #define lpfc_sliport_ctrl_end_WORD word0 | 592 | #define lpfc_sliport_ctrl_end_WORD word0 |
@@ -604,8 +597,8 @@ struct lpfc_register { | |||
604 | #define lpfc_sliport_ctrl_ip_WORD word0 | 597 | #define lpfc_sliport_ctrl_ip_WORD word0 |
605 | #define LPFC_SLIPORT_INIT_PORT 1 | 598 | #define LPFC_SLIPORT_INIT_PORT 1 |
606 | 599 | ||
607 | #define LPFC_SLIPORT_ERR_1 0x040C | 600 | #define LPFC_CTL_PORT_ER1_OFFSET 0x40C |
608 | #define LPFC_SLIPORT_ERR_2 0x0410 | 601 | #define LPFC_CTL_PORT_ER2_OFFSET 0x410 |
609 | 602 | ||
610 | /* The following Registers apply to SLI4 if_type 0 UCNAs. They typically | 603 | /* The following Registers apply to SLI4 if_type 0 UCNAs. They typically |
611 | * reside in BAR 2. | 604 | * reside in BAR 2. |
@@ -3198,6 +3191,8 @@ struct lpfc_grp_hdr { | |||
3198 | #define lpfc_grp_hdr_id_MASK 0x000000FF | 3191 | #define lpfc_grp_hdr_id_MASK 0x000000FF |
3199 | #define lpfc_grp_hdr_id_WORD word2 | 3192 | #define lpfc_grp_hdr_id_WORD word2 |
3200 | uint8_t rev_name[128]; | 3193 | uint8_t rev_name[128]; |
3194 | uint8_t date[12]; | ||
3195 | uint8_t revision[32]; | ||
3201 | }; | 3196 | }; |
3202 | 3197 | ||
3203 | #define FCP_COMMAND 0x0 | 3198 | #define FCP_COMMAND 0x0 |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 148b98ddbb1d..bf999b2600f4 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -2927,6 +2927,8 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost) | |||
2927 | sizeof fc_host_symbolic_name(shost)); | 2927 | sizeof fc_host_symbolic_name(shost)); |
2928 | 2928 | ||
2929 | fc_host_supported_speeds(shost) = 0; | 2929 | fc_host_supported_speeds(shost) = 0; |
2930 | if (phba->lmt & LMT_16Gb) | ||
2931 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_16GBIT; | ||
2930 | if (phba->lmt & LMT_10Gb) | 2932 | if (phba->lmt & LMT_10Gb) |
2931 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_10GBIT; | 2933 | fc_host_supported_speeds(shost) |= FC_PORTSPEED_10GBIT; |
2932 | if (phba->lmt & LMT_8Gb) | 2934 | if (phba->lmt & LMT_8Gb) |
@@ -4966,17 +4968,14 @@ out_free_mem: | |||
4966 | * @phba: pointer to lpfc hba data structure. | 4968 | * @phba: pointer to lpfc hba data structure. |
4967 | * | 4969 | * |
4968 | * This routine is invoked to post rpi header templates to the | 4970 | * This routine is invoked to post rpi header templates to the |
4969 | * HBA consistent with the SLI-4 interface spec. This routine | 4971 | * port for those SLI4 ports that do not support extents. This routine |
4970 | * posts a PAGE_SIZE memory region to the port to hold up to | 4972 | * posts a PAGE_SIZE memory region to the port to hold up to |
4971 | * PAGE_SIZE modulo 64 rpi context headers. | 4973 | * PAGE_SIZE modulo 64 rpi context headers. This is an initialization routine |
4972 | * No locks are held here because this is an initialization routine | 4974 | * and should be called only when interrupts are disabled. |
4973 | * called only from probe or lpfc_online when interrupts are not | ||
4974 | * enabled and the driver is reinitializing the device. | ||
4975 | * | 4975 | * |
4976 | * Return codes | 4976 | * Return codes |
4977 | * 0 - successful | 4977 | * 0 - successful |
4978 | * -ENOMEM - No available memory | 4978 | * -ERROR - otherwise. |
4979 | * -EIO - The mailbox failed to complete successfully. | ||
4980 | **/ | 4979 | **/ |
4981 | int | 4980 | int |
4982 | lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) | 4981 | lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) |
@@ -5687,17 +5686,22 @@ lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) | |||
5687 | break; | 5686 | break; |
5688 | case LPFC_SLI_INTF_IF_TYPE_2: | 5687 | case LPFC_SLI_INTF_IF_TYPE_2: |
5689 | phba->sli4_hba.u.if_type2.ERR1regaddr = | 5688 | phba->sli4_hba.u.if_type2.ERR1regaddr = |
5690 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLIPORT_ERR_1; | 5689 | phba->sli4_hba.conf_regs_memmap_p + |
5690 | LPFC_CTL_PORT_ER1_OFFSET; | ||
5691 | phba->sli4_hba.u.if_type2.ERR2regaddr = | 5691 | phba->sli4_hba.u.if_type2.ERR2regaddr = |
5692 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLIPORT_ERR_2; | 5692 | phba->sli4_hba.conf_regs_memmap_p + |
5693 | LPFC_CTL_PORT_ER2_OFFSET; | ||
5693 | phba->sli4_hba.u.if_type2.CTRLregaddr = | 5694 | phba->sli4_hba.u.if_type2.CTRLregaddr = |
5694 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLIPORT_CNTRL; | 5695 | phba->sli4_hba.conf_regs_memmap_p + |
5696 | LPFC_CTL_PORT_CTL_OFFSET; | ||
5695 | phba->sli4_hba.u.if_type2.STATUSregaddr = | 5697 | phba->sli4_hba.u.if_type2.STATUSregaddr = |
5696 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLIPORT_STATUS; | 5698 | phba->sli4_hba.conf_regs_memmap_p + |
5699 | LPFC_CTL_PORT_STA_OFFSET; | ||
5697 | phba->sli4_hba.SLIINTFregaddr = | 5700 | phba->sli4_hba.SLIINTFregaddr = |
5698 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; | 5701 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLI_INTF; |
5699 | phba->sli4_hba.PSMPHRregaddr = | 5702 | phba->sli4_hba.PSMPHRregaddr = |
5700 | phba->sli4_hba.conf_regs_memmap_p + LPFC_SLIPORT_IF2_SMPHR; | 5703 | phba->sli4_hba.conf_regs_memmap_p + |
5704 | LPFC_CTL_PORT_SEM_OFFSET; | ||
5701 | phba->sli4_hba.RQDBregaddr = | 5705 | phba->sli4_hba.RQDBregaddr = |
5702 | phba->sli4_hba.conf_regs_memmap_p + LPFC_RQ_DOORBELL; | 5706 | phba->sli4_hba.conf_regs_memmap_p + LPFC_RQ_DOORBELL; |
5703 | phba->sli4_hba.WQDBregaddr = | 5707 | phba->sli4_hba.WQDBregaddr = |
@@ -8859,11 +8863,11 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | |||
8859 | return -EINVAL; | 8863 | return -EINVAL; |
8860 | } | 8864 | } |
8861 | lpfc_decode_firmware_rev(phba, fwrev, 1); | 8865 | lpfc_decode_firmware_rev(phba, fwrev, 1); |
8862 | if (strncmp(fwrev, image->rev_name, strnlen(fwrev, 16))) { | 8866 | if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) { |
8863 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 8867 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
8864 | "3023 Updating Firmware. Current Version:%s " | 8868 | "3023 Updating Firmware. Current Version:%s " |
8865 | "New Version:%s\n", | 8869 | "New Version:%s\n", |
8866 | fwrev, image->rev_name); | 8870 | fwrev, image->revision); |
8867 | for (i = 0; i < LPFC_MBX_WR_CONFIG_MAX_BDE; i++) { | 8871 | for (i = 0; i < LPFC_MBX_WR_CONFIG_MAX_BDE; i++) { |
8868 | dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), | 8872 | dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), |
8869 | GFP_KERNEL); | 8873 | GFP_KERNEL); |
@@ -8892,9 +8896,9 @@ lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw) | |||
8892 | fw->size - offset); | 8896 | fw->size - offset); |
8893 | break; | 8897 | break; |
8894 | } | 8898 | } |
8895 | temp_offset += SLI4_PAGE_SIZE; | ||
8896 | memcpy(dmabuf->virt, fw->data + temp_offset, | 8899 | memcpy(dmabuf->virt, fw->data + temp_offset, |
8897 | SLI4_PAGE_SIZE); | 8900 | SLI4_PAGE_SIZE); |
8901 | temp_offset += SLI4_PAGE_SIZE; | ||
8898 | } | 8902 | } |
8899 | rc = lpfc_wr_object(phba, &dma_buffer_list, | 8903 | rc = lpfc_wr_object(phba, &dma_buffer_list, |
8900 | (fw->size - offset), &offset); | 8904 | (fw->size - offset), &offset); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 98999bbd8cbf..6740c52e99c4 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -12345,19 +12345,18 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba, | |||
12345 | } | 12345 | } |
12346 | 12346 | ||
12347 | /** | 12347 | /** |
12348 | * lpfc_sli4_init_rpi_hdrs - Post the rpi header memory region to the port | 12348 | * lpfc_sli4_alloc_xri - Get an available rpi in the device's range |
12349 | * @phba: pointer to lpfc hba data structure. | 12349 | * @phba: pointer to lpfc hba data structure. |
12350 | * | 12350 | * |
12351 | * This routine is invoked to post rpi header templates to the | 12351 | * This routine is invoked to post rpi header templates to the |
12352 | * port for those SLI4 ports that do not support extents. This routine | 12352 | * HBA consistent with the SLI-4 interface spec. This routine |
12353 | * posts a PAGE_SIZE memory region to the port to hold up to | 12353 | * posts a SLI4_PAGE_SIZE memory region to the port to hold up to |
12354 | * PAGE_SIZE modulo 64 rpi context headers. This is an initialization routine | 12354 | * SLI4_PAGE_SIZE modulo 64 rpi context headers. |
12355 | * and should be called only when interrupts are disabled. | ||
12356 | * | 12355 | * |
12357 | * Return codes | 12356 | * Returns |
12358 | * 0 - successful | 12357 | * A nonzero rpi defined as rpi_base <= rpi < max_rpi if successful |
12359 | * -ERROR - otherwise. | 12358 | * LPFC_RPI_ALLOC_ERROR if no rpis are available. |
12360 | */ | 12359 | **/ |
12361 | uint16_t | 12360 | uint16_t |
12362 | lpfc_sli4_alloc_xri(struct lpfc_hba *phba) | 12361 | lpfc_sli4_alloc_xri(struct lpfc_hba *phba) |
12363 | { | 12362 | { |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 4b1703554a26..88387c1c2dcc 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -81,6 +81,8 @@ | |||
81 | (fc_hdr)->fh_f_ctl[1] << 8 | \ | 81 | (fc_hdr)->fh_f_ctl[1] << 8 | \ |
82 | (fc_hdr)->fh_f_ctl[2]) | 82 | (fc_hdr)->fh_f_ctl[2]) |
83 | 83 | ||
84 | #define LPFC_FW_RESET_MAXIMUM_WAIT_10MS_CNT 12000 | ||
85 | |||
84 | enum lpfc_sli4_queue_type { | 86 | enum lpfc_sli4_queue_type { |
85 | LPFC_EQ, | 87 | LPFC_EQ, |
86 | LPFC_GCQ, | 88 | LPFC_GCQ, |