aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_main.c
diff options
context:
space:
mode:
authorJohn Soni Jose <sony.john-n@emulex.com>2012-10-19 19:12:37 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-11-26 23:59:36 -0500
commit4d4d1ef8cbc33b650a96bbdf0ca9b14db10e1b29 (patch)
treef3139e48b2dd1e9d20e794ce38261d024e4a3cb2 /drivers/scsi/be2iscsi/be_main.c
parent5cac7596bac1fffda261643dba20be8c4c44b547 (diff)
[SCSI] be2iscsi: Issue an function level reset when driver is loaded
Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c65
1 files changed, 18 insertions, 47 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index bd0f49f2b76f..41c7c56fcfcb 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -47,8 +47,6 @@
47static unsigned int be_iopoll_budget = 10; 47static unsigned int be_iopoll_budget = 10;
48static unsigned int be_max_phys_size = 64; 48static unsigned int be_max_phys_size = 64;
49static unsigned int enable_msix = 1; 49static unsigned int enable_msix = 1;
50static unsigned int gcrashmode = 0;
51static unsigned int num_hba = 0;
52 50
53MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); 51MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table);
54MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); 52MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR);
@@ -4446,14 +4444,18 @@ void beiscsi_hba_attrs_init(struct beiscsi_hba *phba)
4446 beiscsi_log_enable_init(phba, beiscsi_log_enable); 4444 beiscsi_log_enable_init(phba, beiscsi_log_enable);
4447} 4445}
4448 4446
4447/*
4448 * beiscsi_quiesce()- Cleanup Driver resources
4449 * @phba: Instance Priv structure
4450 *
4451 * Free the OS and HW resources held by the driver
4452 **/
4449static void beiscsi_quiesce(struct beiscsi_hba *phba) 4453static void beiscsi_quiesce(struct beiscsi_hba *phba)
4450{ 4454{
4451 struct hwi_controller *phwi_ctrlr; 4455 struct hwi_controller *phwi_ctrlr;
4452 struct hwi_context_memory *phwi_context; 4456 struct hwi_context_memory *phwi_context;
4453 struct be_eq_obj *pbe_eq; 4457 struct be_eq_obj *pbe_eq;
4454 unsigned int i, msix_vec; 4458 unsigned int i, msix_vec;
4455 u8 *real_offset = 0;
4456 u32 value = 0;
4457 4459
4458 phwi_ctrlr = phba->phwi_ctrlr; 4460 phwi_ctrlr = phba->phwi_ctrlr;
4459 phwi_context = phwi_ctrlr->phwi_ctxt; 4461 phwi_context = phwi_ctrlr->phwi_ctxt;
@@ -4477,14 +4479,7 @@ static void beiscsi_quiesce(struct beiscsi_hba *phba)
4477 4479
4478 beiscsi_clean_port(phba); 4480 beiscsi_clean_port(phba);
4479 beiscsi_free_mem(phba); 4481 beiscsi_free_mem(phba);
4480 real_offset = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE;
4481
4482 value = readl((void *)real_offset);
4483 4482
4484 if (value & 0x00010000) {
4485 value &= 0xfffeffff;
4486 writel(value, (void *)real_offset);
4487 }
4488 beiscsi_unmap_pci_function(phba); 4483 beiscsi_unmap_pci_function(phba);
4489 pci_free_consistent(phba->pcidev, 4484 pci_free_consistent(phba->pcidev,
4490 phba->ctrl.mbox_mem_alloced.size, 4485 phba->ctrl.mbox_mem_alloced.size,
@@ -4550,8 +4545,6 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4550 struct hwi_context_memory *phwi_context; 4545 struct hwi_context_memory *phwi_context;
4551 struct be_eq_obj *pbe_eq; 4546 struct be_eq_obj *pbe_eq;
4552 int ret, i; 4547 int ret, i;
4553 u8 *real_offset = 0;
4554 u32 value = 0;
4555 4548
4556 ret = beiscsi_enable_pci(pcidev); 4549 ret = beiscsi_enable_pci(pcidev);
4557 if (ret < 0) { 4550 if (ret < 0) {
@@ -4606,31 +4599,18 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
4606 goto hba_free; 4599 goto hba_free;
4607 } 4600 }
4608 4601
4609 if (!num_hba) { 4602 ret = beiscsi_cmd_reset_function(phba);
4610 real_offset = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE; 4603 if (ret) {
4611 value = readl((void *)real_offset); 4604 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4612 if (value & 0x00010000) { 4605 "BM_%d : Reset Failed. Aborting Crashdump\n");
4613 gcrashmode++; 4606 goto hba_free;
4614 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 4607 }
4615 "BM_%d : Loading Driver in crashdump mode\n"); 4608 ret = be_chk_reset_complete(phba);
4616 ret = beiscsi_cmd_reset_function(phba); 4609 if (ret) {
4617 if (ret) { 4610 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4618 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 4611 "BM_%d : Failed to get out of reset."
4619 "BM_%d : Reset Failed. Aborting Crashdump\n"); 4612 "Aborting Crashdump\n");
4620 goto hba_free; 4613 goto hba_free;
4621 }
4622 ret = be_chk_reset_complete(phba);
4623 if (ret) {
4624 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4625 "BM_%d : Failed to get out of reset."
4626 "Aborting Crashdump\n");
4627 goto hba_free;
4628 }
4629 } else {
4630 value |= 0x00010000;
4631 writel(value, (void *)real_offset);
4632 num_hba++;
4633 }
4634 } 4614 }
4635 4615
4636 spin_lock_init(&phba->io_sgl_lock); 4616 spin_lock_init(&phba->io_sgl_lock);
@@ -4718,15 +4698,6 @@ free_twq:
4718 beiscsi_clean_port(phba); 4698 beiscsi_clean_port(phba);
4719 beiscsi_free_mem(phba); 4699 beiscsi_free_mem(phba);
4720free_port: 4700free_port:
4721 real_offset = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE;
4722
4723 value = readl((void *)real_offset);
4724
4725 if (value & 0x00010000) {
4726 value &= 0xfffeffff;
4727 writel(value, (void *)real_offset);
4728 }
4729
4730 pci_free_consistent(phba->pcidev, 4701 pci_free_consistent(phba->pcidev,
4731 phba->ctrl.mbox_mem_alloced.size, 4702 phba->ctrl.mbox_mem_alloced.size,
4732 phba->ctrl.mbox_mem_alloced.va, 4703 phba->ctrl.mbox_mem_alloced.va,