aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJitendra Bhivare <jitendra.bhivare@broadcom.com>2016-08-19 05:50:16 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-08-23 22:42:44 -0400
commit4d2ee1e688a26ee580b9f3e824afa278bbb178a5 (patch)
tree2fe462936936e91d8191937c59d9f50910955ec9
parent480195c267a4c9f9fcb490897278a41940759b4f (diff)
scsi: be2iscsi: Fix POST check and reset sequence
SLIPORT FUNCTION_RESET does not reset the chip. So POST status needs to be checked before issuing FUNCTION_RESET. The completion of FUNCTION_RESET is indicated in BMBX Rdy bit. be_cmd_fw_initialize too needs to be done before issuing any cmd to FW. be_cmd_fw_initialize is renamed as beiscsi_cmd_special_wrb. Rearrange and rename few functions in init and cleanup path. Signed-off-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.c250
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.h38
-rw-r--r--drivers/scsi/be2iscsi/be_main.c64
-rw-r--r--drivers/scsi/be2iscsi/be_main.h8
4 files changed, 164 insertions, 196 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 1ebb6ce12742..771670c0682b 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -21,35 +21,6 @@
21#include "be.h" 21#include "be.h"
22#include "be_mgmt.h" 22#include "be_mgmt.h"
23 23
24int be_chk_reset_complete(struct beiscsi_hba *phba)
25{
26 unsigned int num_loop;
27 u8 *mpu_sem = 0;
28 u32 status;
29
30 num_loop = 1000;
31 mpu_sem = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE;
32 msleep(5000);
33
34 while (num_loop) {
35 status = readl((void *)mpu_sem);
36
37 if ((status & 0x80000000) || (status & 0x0000FFFF) == 0xC000)
38 break;
39 msleep(60);
40 num_loop--;
41 }
42
43 if ((status & 0x80000000) || (!num_loop)) {
44 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
45 "BC_%d : Failed in be_chk_reset_complete"
46 "status = 0x%x\n", status);
47 return -EIO;
48 }
49
50 return 0;
51}
52
53struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba, 24struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba,
54 unsigned int *ref_tag) 25 unsigned int *ref_tag)
55{ 26{
@@ -769,87 +740,6 @@ int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
769 return status; 740 return status;
770} 741}
771 742
772/**
773 * be_cmd_fw_initialize()- Initialize FW
774 * @ctrl: Pointer to function control structure
775 *
776 * Send FW initialize pattern for the function.
777 *
778 * return
779 * Success: 0
780 * Failure: Non-Zero value
781 **/
782int be_cmd_fw_initialize(struct be_ctrl_info *ctrl)
783{
784 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
785 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
786 int status;
787 u8 *endian_check;
788
789 mutex_lock(&ctrl->mbox_lock);
790 memset(wrb, 0, sizeof(*wrb));
791
792 endian_check = (u8 *) wrb;
793 *endian_check++ = 0xFF;
794 *endian_check++ = 0x12;
795 *endian_check++ = 0x34;
796 *endian_check++ = 0xFF;
797 *endian_check++ = 0xFF;
798 *endian_check++ = 0x56;
799 *endian_check++ = 0x78;
800 *endian_check++ = 0xFF;
801 be_dws_cpu_to_le(wrb, sizeof(*wrb));
802
803 status = be_mbox_notify(ctrl);
804 if (status)
805 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
806 "BC_%d : be_cmd_fw_initialize Failed\n");
807
808 mutex_unlock(&ctrl->mbox_lock);
809 return status;
810}
811
812/**
813 * be_cmd_fw_uninit()- Uinitialize FW
814 * @ctrl: Pointer to function control structure
815 *
816 * Send FW uninitialize pattern for the function
817 *
818 * return
819 * Success: 0
820 * Failure: Non-Zero value
821 **/
822int be_cmd_fw_uninit(struct be_ctrl_info *ctrl)
823{
824 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
825 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
826 int status;
827 u8 *endian_check;
828
829 mutex_lock(&ctrl->mbox_lock);
830 memset(wrb, 0, sizeof(*wrb));
831
832 endian_check = (u8 *) wrb;
833 *endian_check++ = 0xFF;
834 *endian_check++ = 0xAA;
835 *endian_check++ = 0xBB;
836 *endian_check++ = 0xFF;
837 *endian_check++ = 0xFF;
838 *endian_check++ = 0xCC;
839 *endian_check++ = 0xDD;
840 *endian_check = 0xFF;
841
842 be_dws_cpu_to_le(wrb, sizeof(*wrb));
843
844 status = be_mbox_notify(ctrl);
845 if (status)
846 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
847 "BC_%d : be_cmd_fw_uninit Failed\n");
848
849 mutex_unlock(&ctrl->mbox_lock);
850 return status;
851}
852
853int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, 743int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
854 struct be_queue_info *cq, struct be_queue_info *eq, 744 struct be_queue_info *cq, struct be_queue_info *eq,
855 bool sol_evts, bool no_delay, int coalesce_wm) 745 bool sol_evts, bool no_delay, int coalesce_wm)
@@ -1293,25 +1183,6 @@ error:
1293 return status; 1183 return status;
1294} 1184}
1295 1185
1296int beiscsi_cmd_reset_function(struct beiscsi_hba *phba)
1297{
1298 struct be_ctrl_info *ctrl = &phba->ctrl;
1299 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
1300 struct be_post_sgl_pages_req *req = embedded_payload(wrb);
1301 int status;
1302
1303 mutex_lock(&ctrl->mbox_lock);
1304
1305 req = embedded_payload(wrb);
1306 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1307 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1308 OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
1309 status = be_mbox_notify(ctrl);
1310
1311 mutex_unlock(&ctrl->mbox_lock);
1312 return status;
1313}
1314
1315/** 1186/**
1316 * be_cmd_set_vlan()- Configure VLAN paramters on the adapter 1187 * be_cmd_set_vlan()- Configure VLAN paramters on the adapter
1317 * @phba: device priv structure instance 1188 * @phba: device priv structure instance
@@ -1653,3 +1524,124 @@ int beiscsi_set_uer_feature(struct beiscsi_hba *phba)
1653 mutex_unlock(&ctrl->mbox_lock); 1524 mutex_unlock(&ctrl->mbox_lock);
1654 return ret; 1525 return ret;
1655} 1526}
1527
1528static u32 beiscsi_get_post_stage(struct beiscsi_hba *phba)
1529{
1530 u32 sem;
1531
1532 if (is_chip_be2_be3r(phba))
1533 sem = ioread32(phba->csr_va + SLIPORT_SEMAPHORE_OFFSET_BEx);
1534 else
1535 pci_read_config_dword(phba->pcidev,
1536 SLIPORT_SEMAPHORE_OFFSET_SH, &sem);
1537 return sem;
1538}
1539
1540int beiscsi_check_fw_rdy(struct beiscsi_hba *phba)
1541{
1542 u32 loop, post, rdy = 0;
1543
1544 loop = 1000;
1545 while (loop--) {
1546 post = beiscsi_get_post_stage(phba);
1547 if (post & POST_ERROR_BIT)
1548 break;
1549 if ((post & POST_STAGE_MASK) == POST_STAGE_ARMFW_RDY) {
1550 rdy = 1;
1551 break;
1552 }
1553 msleep(60);
1554 }
1555
1556 if (!rdy) {
1557 __beiscsi_log(phba, KERN_ERR,
1558 "BC_%d : FW not ready 0x%x\n", post);
1559 }
1560
1561 return rdy;
1562}
1563
1564static int beiscsi_cmd_function_reset(struct beiscsi_hba *phba)
1565{
1566 struct be_ctrl_info *ctrl = &phba->ctrl;
1567 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
1568 struct be_post_sgl_pages_req *req = embedded_payload(wrb);
1569 int status;
1570
1571 mutex_lock(&ctrl->mbox_lock);
1572
1573 req = embedded_payload(wrb);
1574 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1575 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1576 OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
1577 status = be_mbox_notify(ctrl);
1578
1579 mutex_unlock(&ctrl->mbox_lock);
1580 return status;
1581}
1582
1583int beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load)
1584{
1585 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
1586 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
1587 u8 *endian_check;
1588 int status;
1589
1590 mutex_lock(&ctrl->mbox_lock);
1591 memset(wrb, 0, sizeof(*wrb));
1592
1593 endian_check = (u8 *) wrb;
1594 if (load) {
1595 /* to start communicating */
1596 *endian_check++ = 0xFF;
1597 *endian_check++ = 0x12;
1598 *endian_check++ = 0x34;
1599 *endian_check++ = 0xFF;
1600 *endian_check++ = 0xFF;
1601 *endian_check++ = 0x56;
1602 *endian_check++ = 0x78;
1603 *endian_check++ = 0xFF;
1604 } else {
1605 /* to stop communicating */
1606 *endian_check++ = 0xFF;
1607 *endian_check++ = 0xAA;
1608 *endian_check++ = 0xBB;
1609 *endian_check++ = 0xFF;
1610 *endian_check++ = 0xFF;
1611 *endian_check++ = 0xCC;
1612 *endian_check++ = 0xDD;
1613 *endian_check = 0xFF;
1614 }
1615 be_dws_cpu_to_le(wrb, sizeof(*wrb));
1616
1617 status = be_mbox_notify(ctrl);
1618 if (status)
1619 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
1620 "BC_%d : special WRB message failed\n");
1621 mutex_unlock(&ctrl->mbox_lock);
1622 return status;
1623}
1624
1625int beiscsi_init_sliport(struct beiscsi_hba *phba)
1626{
1627 int status;
1628
1629 /* check POST stage before talking to FW */
1630 status = beiscsi_check_fw_rdy(phba);
1631 if (!status)
1632 return -EIO;
1633
1634 /*
1635 * SLI COMMON_FUNCTION_RESET completion is indicated by BMBX RDY bit.
1636 * It should clean up any stale info in FW for this fn.
1637 */
1638 status = beiscsi_cmd_function_reset(phba);
1639 if (status) {
1640 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
1641 "BC_%d : SLI Function Reset failed\n");
1642 return status;
1643 }
1644
1645 /* indicate driver is loading */
1646 return beiscsi_cmd_special_wrb(&phba->ctrl, 1);
1647}
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index c9823b00b254..47b7197f17a2 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -98,11 +98,23 @@ struct be_mcc_compl {
98#define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */ 98#define MPU_MAILBOX_DB_RDY_MASK 0x1 /* bit 0 */
99#define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */ 99#define MPU_MAILBOX_DB_HI_MASK 0x2 /* bit 1 */
100 100
101/********** MPU semphore ******************/ 101/********** MPU semphore: used for SH & BE ******************/
102#define MPU_EP_SEMAPHORE_OFFSET 0xac 102#define SLIPORT_SOFTRESET_OFFSET 0x5c /* CSR BAR offset */
103#define EP_SEMAPHORE_POST_STAGE_MASK 0x0000FFFF 103#define SLIPORT_SEMAPHORE_OFFSET_BEx 0xac /* CSR BAR offset */
104#define EP_SEMAPHORE_POST_ERR_MASK 0x1 104#define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 /* PCI-CFG offset */
105#define EP_SEMAPHORE_POST_ERR_SHIFT 31 105#define POST_STAGE_MASK 0x0000FFFF
106#define POST_ERROR_BIT 0x80000000
107#define POST_ERR_RECOVERY_CODE_MASK 0xF000
108
109/* Soft Reset register masks */
110#define SLIPORT_SOFTRESET_SR_MASK 0x00000080 /* SR bit */
111
112/* MPU semphore POST stage values */
113#define POST_STAGE_AWAITING_HOST_RDY 0x1 /* FW awaiting goahead from host */
114#define POST_STAGE_HOST_RDY 0x2 /* Host has given go-ahed to FW */
115#define POST_STAGE_BE_RESET 0x3 /* Host wants to reset chip */
116#define POST_STAGE_ARMFW_RDY 0xC000 /* FW is done with POST */
117#define POST_STAGE_RECOVERABLE_ERR 0xE000 /* Recoverable err detected */
106 118
107/********** MCC door bell ************/ 119/********** MCC door bell ************/
108#define DB_MCCQ_OFFSET 0x140 120#define DB_MCCQ_OFFSET 0x140
@@ -110,9 +122,6 @@ struct be_mcc_compl {
110/* Number of entries posted */ 122/* Number of entries posted */
111#define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */ 123#define DB_MCCQ_NUM_POSTED_SHIFT 16 /* bits 16 - 29 */
112 124
113/* MPU semphore POST stage values */
114#define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */
115
116/** 125/**
117 * When the async bit of mcc_compl is set, the last 4 bytes of 126 * When the async bit of mcc_compl is set, the last 4 bytes of
118 * mcc_compl is interpreted as follows: 127 * mcc_compl is interpreted as follows:
@@ -753,6 +762,12 @@ struct be_cmd_set_features {
753 } param; 762 } param;
754} __packed; 763} __packed;
755 764
765int beiscsi_cmd_special_wrb(struct be_ctrl_info *ctrl, u32 load);
766
767int beiscsi_check_fw_rdy(struct beiscsi_hba *phba);
768
769int beiscsi_init_sliport(struct beiscsi_hba *phba);
770
756int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, 771int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
757 struct be_queue_info *eq, int eq_delay); 772 struct be_queue_info *eq, int eq_delay);
758 773
@@ -784,9 +799,6 @@ int __beiscsi_mcc_compl_status(struct beiscsi_hba *phba,
784 struct be_mcc_wrb **wrb, 799 struct be_mcc_wrb **wrb,
785 struct be_dma_mem *mbx_cmd_mem); 800 struct be_dma_mem *mbx_cmd_mem);
786/*ISCSI Functuions */ 801/*ISCSI Functuions */
787int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
788int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
789
790struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem); 802struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
791int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag); 803int be_mcc_compl_poll(struct beiscsi_hba *phba, unsigned int tag);
792void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag); 804void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag);
@@ -812,8 +824,6 @@ int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl,
812 struct be_dma_mem *q_mem, u32 page_offset, 824 struct be_dma_mem *q_mem, u32 page_offset,
813 u32 num_pages); 825 u32 num_pages);
814 826
815int beiscsi_cmd_reset_function(struct beiscsi_hba *phba);
816
817int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem, 827int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct be_dma_mem *q_mem,
818 struct be_queue_info *wrbq, 828 struct be_queue_info *wrbq,
819 struct hwi_wrb_context *pwrb_context, 829 struct hwi_wrb_context *pwrb_context,
@@ -1422,8 +1432,6 @@ struct be_cmd_get_port_name {
1422 * the cxn 1432 * the cxn
1423 */ 1433 */
1424 1434
1425int be_chk_reset_complete(struct beiscsi_hba *phba);
1426
1427void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len, 1435void be_wrb_hdr_prepare(struct be_mcc_wrb *wrb, int payload_len,
1428 bool embedded, u8 sge_cnt); 1436 bool embedded, u8 sge_cnt);
1429 1437
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 77ecd6c48207..b4e6fc222d60 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3544,7 +3544,7 @@ static void be_mcc_queues_destroy(struct beiscsi_hba *phba)
3544 } 3544 }
3545} 3545}
3546 3546
3547static void hwi_cleanup(struct beiscsi_hba *phba) 3547static void hwi_cleanup_port(struct beiscsi_hba *phba)
3548{ 3548{
3549 struct be_queue_info *q; 3549 struct be_queue_info *q;
3550 struct be_ctrl_info *ctrl = &phba->ctrl; 3550 struct be_ctrl_info *ctrl = &phba->ctrl;
@@ -3603,7 +3603,8 @@ static void hwi_cleanup(struct beiscsi_hba *phba)
3603 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ); 3603 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ);
3604 } 3604 }
3605 } 3605 }
3606 be_cmd_fw_uninit(ctrl); 3606 /* last communication, indicate driver is unloading */
3607 beiscsi_cmd_special_wrb(&phba->ctrl, 0);
3607} 3608}
3608 3609
3609static int be_mcc_queues_create(struct beiscsi_hba *phba, 3610static int be_mcc_queues_create(struct beiscsi_hba *phba,
@@ -3700,8 +3701,7 @@ static int hwi_init_port(struct beiscsi_hba *phba)
3700 phwi_context->max_eqd = 128; 3701 phwi_context->max_eqd = 128;
3701 phwi_context->min_eqd = 0; 3702 phwi_context->min_eqd = 0;
3702 phwi_context->cur_eqd = 0; 3703 phwi_context->cur_eqd = 0;
3703 be_cmd_fw_initialize(&phba->ctrl); 3704 /* set port optic state to unknown */
3704 /* set optic state to unknown */
3705 phba->optic_state = 0xff; 3705 phba->optic_state = 0xff;
3706 3706
3707 status = beiscsi_create_eqs(phba, phwi_context); 3707 status = beiscsi_create_eqs(phba, phwi_context);
@@ -3807,7 +3807,7 @@ static int hwi_init_port(struct beiscsi_hba *phba)
3807error: 3807error:
3808 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 3808 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3809 "BM_%d : hwi_init_port failed"); 3809 "BM_%d : hwi_init_port failed");
3810 hwi_cleanup(phba); 3810 hwi_cleanup_port(phba);
3811 return status; 3811 return status;
3812} 3812}
3813 3813
@@ -4196,7 +4196,7 @@ static int beiscsi_init_port(struct beiscsi_hba *phba)
4196 return ret; 4196 return ret;
4197 4197
4198do_cleanup_ctrlr: 4198do_cleanup_ctrlr:
4199 hwi_cleanup(phba); 4199 hwi_cleanup_port(phba);
4200 return ret; 4200 return ret;
4201} 4201}
4202 4202
@@ -4233,7 +4233,7 @@ static void hwi_purge_eq(struct beiscsi_hba *phba)
4233 } 4233 }
4234} 4234}
4235 4235
4236static void beiscsi_clean_port(struct beiscsi_hba *phba) 4236static void beiscsi_cleanup_port(struct beiscsi_hba *phba)
4237{ 4237{
4238 int mgmt_status, ulp_num; 4238 int mgmt_status, ulp_num;
4239 struct ulp_cid_info *ptr_cid_info = NULL; 4239 struct ulp_cid_info *ptr_cid_info = NULL;
@@ -4250,7 +4250,7 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba)
4250 } 4250 }
4251 4251
4252 hwi_purge_eq(phba); 4252 hwi_purge_eq(phba);
4253 hwi_cleanup(phba); 4253 hwi_cleanup_port(phba);
4254 kfree(phba->io_sgl_hndl_base); 4254 kfree(phba->io_sgl_hndl_base);
4255 kfree(phba->eh_sgl_hndl_base); 4255 kfree(phba->eh_sgl_hndl_base);
4256 kfree(phba->ep_array); 4256 kfree(phba->ep_array);
@@ -5011,12 +5011,12 @@ static void beiscsi_quiesce(struct beiscsi_hba *phba)
5011 /* PCI_ERR is set then check if driver is not unloading */ 5011 /* PCI_ERR is set then check if driver is not unloading */
5012 if (test_bit(BEISCSI_HBA_RUNNING, &phba->state) && 5012 if (test_bit(BEISCSI_HBA_RUNNING, &phba->state) &&
5013 test_bit(BEISCSI_HBA_PCI_ERR, &phba->state)) { 5013 test_bit(BEISCSI_HBA_PCI_ERR, &phba->state)) {
5014 hwi_cleanup(phba); 5014 hwi_cleanup_port(phba);
5015 return; 5015 return;
5016 } 5016 }
5017 5017
5018 destroy_workqueue(phba->wq); 5018 destroy_workqueue(phba->wq);
5019 beiscsi_clean_port(phba); 5019 beiscsi_cleanup_port(phba);
5020 beiscsi_free_mem(phba); 5020 beiscsi_free_mem(phba);
5021 5021
5022 beiscsi_unmap_pci_function(phba); 5022 beiscsi_unmap_pci_function(phba);
@@ -5461,9 +5461,8 @@ static pci_ers_result_t beiscsi_eeh_reset(struct pci_dev *pdev)
5461 pci_set_power_state(pdev, PCI_D0); 5461 pci_set_power_state(pdev, PCI_D0);
5462 pci_restore_state(pdev); 5462 pci_restore_state(pdev);
5463 5463
5464 /* Wait for the CHIP Reset to complete */ 5464 status = beiscsi_check_fw_rdy(phba);
5465 status = be_chk_reset_complete(phba); 5465 if (status) {
5466 if (!status) {
5467 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT, 5466 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
5468 "BM_%d : EEH Reset Completed\n"); 5467 "BM_%d : EEH Reset Completed\n");
5469 } else { 5468 } else {
@@ -5478,7 +5477,7 @@ static pci_ers_result_t beiscsi_eeh_reset(struct pci_dev *pdev)
5478 5477
5479static void beiscsi_eeh_resume(struct pci_dev *pdev) 5478static void beiscsi_eeh_resume(struct pci_dev *pdev)
5480{ 5479{
5481 int ret = 0, i; 5480 int ret, i;
5482 struct be_eq_obj *pbe_eq; 5481 struct be_eq_obj *pbe_eq;
5483 struct beiscsi_hba *phba = NULL; 5482 struct beiscsi_hba *phba = NULL;
5484 struct hwi_controller *phwi_ctrlr; 5483 struct hwi_controller *phwi_ctrlr;
@@ -5498,19 +5497,9 @@ static void beiscsi_eeh_resume(struct pci_dev *pdev)
5498 phba->num_cpus = 1; 5497 phba->num_cpus = 1;
5499 } 5498 }
5500 5499
5501 ret = beiscsi_cmd_reset_function(phba); 5500 ret = beiscsi_init_sliport(phba);
5502 if (ret) { 5501 if (ret)
5503 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5504 "BM_%d : Reset Failed\n");
5505 goto ret_err;
5506 }
5507
5508 ret = be_chk_reset_complete(phba);
5509 if (ret) {
5510 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5511 "BM_%d : Failed to get out of reset.\n");
5512 goto ret_err; 5502 goto ret_err;
5513 }
5514 5503
5515 beiscsi_get_params(phba); 5504 beiscsi_get_params(phba);
5516 phba->shost->max_id = phba->params.cxns_per_ctrl; 5505 phba->shost->max_id = phba->params.cxns_per_ctrl;
@@ -5627,28 +5616,15 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
5627 ret = be_ctrl_init(phba, pcidev); 5616 ret = be_ctrl_init(phba, pcidev);
5628 if (ret) { 5617 if (ret) {
5629 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 5618 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5630 "BM_%d : beiscsi_dev_probe-" 5619 "BM_%d : be_ctrl_init failed\n");
5631 "Failed in be_ctrl_init\n");
5632 goto hba_free; 5620 goto hba_free;
5633 } 5621 }
5634 5622
5635 set_bit(BEISCSI_HBA_RUNNING, &phba->state); 5623 ret = beiscsi_init_sliport(phba);
5636 /* 5624 if (ret)
5637 * FUNCTION_RESET should clean up any stale info in FW for this fn
5638 */
5639 ret = beiscsi_cmd_reset_function(phba);
5640 if (ret) {
5641 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5642 "BM_%d : Reset Failed\n");
5643 goto hba_free;
5644 }
5645 ret = be_chk_reset_complete(phba);
5646 if (ret) {
5647 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
5648 "BM_%d : Failed to get out of reset.\n");
5649 goto hba_free; 5625 goto hba_free;
5650 }
5651 5626
5627 set_bit(BEISCSI_HBA_RUNNING, &phba->state);
5652 spin_lock_init(&phba->io_sgl_lock); 5628 spin_lock_init(&phba->io_sgl_lock);
5653 spin_lock_init(&phba->mgmt_sgl_lock); 5629 spin_lock_init(&phba->mgmt_sgl_lock);
5654 spin_lock_init(&phba->async_pdu_lock); 5630 spin_lock_init(&phba->async_pdu_lock);
@@ -5772,7 +5748,7 @@ free_blkenbld:
5772 irq_poll_disable(&pbe_eq->iopoll); 5748 irq_poll_disable(&pbe_eq->iopoll);
5773 } 5749 }
5774free_twq: 5750free_twq:
5775 beiscsi_clean_port(phba); 5751 beiscsi_cleanup_port(phba);
5776 beiscsi_free_mem(phba); 5752 beiscsi_free_mem(phba);
5777free_port: 5753free_port:
5778 pci_free_consistent(phba->pcidev, 5754 pci_free_consistent(phba->pcidev,
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 0a5de01c3883..4cdb34c3de5d 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -82,14 +82,6 @@
82#define BEISCSI_MAX_FRAGS_INIT 192 82#define BEISCSI_MAX_FRAGS_INIT 192
83#define BE_NUM_MSIX_ENTRIES 1 83#define BE_NUM_MSIX_ENTRIES 1
84 84
85#define MPU_EP_CONTROL 0
86#define MPU_EP_SEMAPHORE 0xac
87#define BE2_SOFT_RESET 0x5c
88#define BE2_PCI_ONLINE0 0xb0
89#define BE2_PCI_ONLINE1 0xb4
90#define BE2_SET_RESET 0x80
91#define BE2_MPU_IRAM_ONLINE 0x00000080
92
93#define BE_SENSE_INFO_SIZE 258 85#define BE_SENSE_INFO_SIZE 258
94#define BE_ISCSI_PDU_HEADER_SIZE 64 86#define BE_ISCSI_PDU_HEADER_SIZE 64
95#define BE_MIN_MEM_SIZE 16384 87#define BE_MIN_MEM_SIZE 16384