aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_bsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_bsg.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_bsg.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index 0dd43bb91618..793b9f1131fb 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2009-2010 Emulex. All rights reserved. * 4 * Copyright (C) 2009-2011 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -348,7 +348,10 @@ lpfc_bsg_send_mgmt_cmd(struct fc_bsg_job *job)
348 dd_data->context_un.iocb.bmp = bmp; 348 dd_data->context_un.iocb.bmp = bmp;
349 349
350 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 350 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
351 creg_val = readl(phba->HCregaddr); 351 if (lpfc_readl(phba->HCregaddr, &creg_val)) {
352 rc = -EIO ;
353 goto free_cmdiocbq;
354 }
352 creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING); 355 creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
353 writel(creg_val, phba->HCregaddr); 356 writel(creg_val, phba->HCregaddr);
354 readl(phba->HCregaddr); /* flush */ 357 readl(phba->HCregaddr); /* flush */
@@ -599,7 +602,10 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
599 dd_data->context_un.iocb.ndlp = ndlp; 602 dd_data->context_un.iocb.ndlp = ndlp;
600 603
601 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 604 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
602 creg_val = readl(phba->HCregaddr); 605 if (lpfc_readl(phba->HCregaddr, &creg_val)) {
606 rc = -EIO;
607 goto linkdown_err;
608 }
603 creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING); 609 creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
604 writel(creg_val, phba->HCregaddr); 610 writel(creg_val, phba->HCregaddr);
605 readl(phba->HCregaddr); /* flush */ 611 readl(phba->HCregaddr); /* flush */
@@ -613,6 +619,7 @@ lpfc_bsg_rport_els(struct fc_bsg_job *job)
613 else 619 else
614 rc = -EIO; 620 rc = -EIO;
615 621
622linkdown_err:
616 pci_unmap_sg(phba->pcidev, job->request_payload.sg_list, 623 pci_unmap_sg(phba->pcidev, job->request_payload.sg_list,
617 job->request_payload.sg_cnt, DMA_TO_DEVICE); 624 job->request_payload.sg_cnt, DMA_TO_DEVICE);
618 pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list, 625 pci_unmap_sg(phba->pcidev, job->reply_payload.sg_list,
@@ -1357,7 +1364,10 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct fc_bsg_job *job, uint32_t tag,
1357 dd_data->context_un.iocb.ndlp = ndlp; 1364 dd_data->context_un.iocb.ndlp = ndlp;
1358 1365
1359 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 1366 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
1360 creg_val = readl(phba->HCregaddr); 1367 if (lpfc_readl(phba->HCregaddr, &creg_val)) {
1368 rc = -IOCB_ERROR;
1369 goto issue_ct_rsp_exit;
1370 }
1361 creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING); 1371 creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
1362 writel(creg_val, phba->HCregaddr); 1372 writel(creg_val, phba->HCregaddr);
1363 readl(phba->HCregaddr); /* flush */ 1373 readl(phba->HCregaddr); /* flush */
@@ -2479,16 +2489,18 @@ lpfc_bsg_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
2479 2489
2480 from = (uint8_t *)dd_data->context_un.mbox.mb; 2490 from = (uint8_t *)dd_data->context_un.mbox.mb;
2481 job = dd_data->context_un.mbox.set_job; 2491 job = dd_data->context_un.mbox.set_job;
2482 size = job->reply_payload.payload_len; 2492 if (job) {
2483 job->reply->reply_payload_rcv_len = 2493 size = job->reply_payload.payload_len;
2484 sg_copy_from_buffer(job->reply_payload.sg_list, 2494 job->reply->reply_payload_rcv_len =
2485 job->reply_payload.sg_cnt, 2495 sg_copy_from_buffer(job->reply_payload.sg_list,
2486 from, size); 2496 job->reply_payload.sg_cnt,
2487 job->reply->result = 0; 2497 from, size);
2498 job->reply->result = 0;
2488 2499
2500 job->dd_data = NULL;
2501 job->job_done(job);
2502 }
2489 dd_data->context_un.mbox.set_job = NULL; 2503 dd_data->context_un.mbox.set_job = NULL;
2490 job->dd_data = NULL;
2491 job->job_done(job);
2492 /* need to hold the lock until we call job done to hold off 2504 /* need to hold the lock until we call job done to hold off
2493 * the timeout handler returning to the midlayer while 2505 * the timeout handler returning to the midlayer while
2494 * we are stillprocessing the job 2506 * we are stillprocessing the job