linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saurav Kashyap <saurav.kashyap@qlogic.com>
To: jbottomley@parallels.com
Cc: giridhar.malavali@qlogic.com, saurav.kashyap@qlogic.com,
	andrew.vasquez@qlogic.com, linux-scsi@vger.kernel.org
Subject: [PATCH 15/42] qla2xxx: Remove unnecessary delays from fw dump code path.
Date: Fri, 11 Apr 2014 16:54:20 -0400	[thread overview]
Message-ID: <1397249687-32666-16-git-send-email-saurav.kashyap@qlogic.com> (raw)
In-Reply-To: <1397249687-32666-1-git-send-email-saurav.kashyap@qlogic.com>

From: Hiral Patel <hiral.patel@qlogic.com>

Signed-off-by: Hiral Patel <hiral.patel@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_dbg.c |   71 +++++++++++++++++----------------------
 drivers/scsi/qla2xxx/qla_dbg.h |    2 +-
 2 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index ba72e16..16939a9 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -296,23 +296,13 @@ qla24xx_read_window(struct device_reg_24xx __iomem *reg, uint32_t iobase,
 	return buf;
 }
 
-int
+void
 qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
 {
-	int rval = QLA_SUCCESS;
-	uint32_t cnt;
-
 	WRT_REG_DWORD(&reg->hccr, HCCRX_SET_RISC_PAUSE);
-	for (cnt = 30000;
-	    ((RD_REG_DWORD(&reg->host_status) & HSRX_RISC_PAUSED) == 0) &&
-	    rval == QLA_SUCCESS; cnt--) {
-		if (cnt)
-			udelay(100);
-		else
-			rval = QLA_FUNCTION_TIMEOUT;
-	}
 
-	return rval;
+	/* 100 usec delay is sufficient enough for hardware to pause RISC */
+	udelay(100);
 }
 
 int
@@ -320,10 +310,14 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
 {
 	int rval = QLA_SUCCESS;
 	uint32_t cnt;
-	uint16_t mb0, wd;
+	uint16_t wd;
 	struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
 
-	/* Reset RISC. */
+	/*
+	 * Reset RISC. The delay is dependent on system architecture.
+	 * Driver can proceed with the reset sequence after waiting
+	 * for a timeout period.
+	 */
 	WRT_REG_DWORD(&reg->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
 	for (cnt = 0; cnt < 30000; cnt++) {
 		if ((RD_REG_DWORD(&reg->ctrl_status) & CSRX_DMA_ACTIVE) == 0)
@@ -337,13 +331,6 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
 	pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
 
 	udelay(100);
-	/* Wait for firmware to complete NVRAM accesses. */
-	mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
-	for (cnt = 10000 ; cnt && mb0; cnt--) {
-		udelay(5);
-		mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
-		barrier();
-	}
 
 	/* Wait for soft-reset to complete. */
 	for (cnt = 0; cnt < 30000; cnt++) {
@@ -356,10 +343,10 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
 	WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_RESET);
 	RD_REG_DWORD(&reg->hccr);             /* PCI Posting. */
 
-	for (cnt = 30000; RD_REG_WORD(&reg->mailbox0) != 0 &&
+	for (cnt = 10000; RD_REG_WORD(&reg->mailbox0) != 0 &&
 	    rval == QLA_SUCCESS; cnt--) {
 		if (cnt)
-			udelay(100);
+			udelay(10);
 		else
 			rval = QLA_FUNCTION_TIMEOUT;
 	}
@@ -1075,10 +1062,11 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
 	fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
 
-	/* Pause RISC. */
-	rval = qla24xx_pause_risc(reg);
-	if (rval != QLA_SUCCESS)
-		goto qla24xx_fw_dump_failed_0;
+	/*
+	 * Pause RISC. No need to track timeout, as resetting the chip
+	 * is the right approach incase of pause timeout
+	 */
+	qla24xx_pause_risc(reg);
 
 	/* Host interface registers. */
 	dmp_reg = &reg->flash_addr;
@@ -1325,10 +1313,11 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
 	fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
 
-	/* Pause RISC. */
-	rval = qla24xx_pause_risc(reg);
-	if (rval != QLA_SUCCESS)
-		goto qla25xx_fw_dump_failed_0;
+	/*
+	 * Pause RISC. No need to track timeout, as resetting the chip
+	 * is the right approach incase of pause timeout
+	 */
+	qla24xx_pause_risc(reg);
 
 	/* Host/Risc registers. */
 	iter_reg = fw->host_risc_reg;
@@ -1641,10 +1630,11 @@ qla81xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
 	fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
 
-	/* Pause RISC. */
-	rval = qla24xx_pause_risc(reg);
-	if (rval != QLA_SUCCESS)
-		goto qla81xx_fw_dump_failed_0;
+	/*
+	 * Pause RISC. No need to track timeout, as resetting the chip
+	 * is the right approach incase of pause timeout
+	 */
+	qla24xx_pause_risc(reg);
 
 	/* Host/Risc registers. */
 	iter_reg = fw->host_risc_reg;
@@ -1959,10 +1949,11 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
 	fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
 
-	/* Pause RISC. */
-	rval = qla24xx_pause_risc(reg);
-	if (rval != QLA_SUCCESS)
-		goto qla83xx_fw_dump_failed_0;
+	/*
+	 * Pause RISC. No need to track timeout, as resetting the chip
+	 * is the right approach incase of pause timeout
+	 */
+	qla24xx_pause_risc(reg);
 
 	WRT_REG_DWORD(&reg->iobase_addr, 0x6000);
 	dmp_reg = &reg->iobase_window;
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
index cc96104..3679b73 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -353,5 +353,5 @@ extern int qla27xx_dump_mpi_ram(struct qla_hw_data *, uint32_t, uint32_t *,
 	uint32_t, void **);
 extern int qla24xx_dump_ram(struct qla_hw_data *, uint32_t, uint32_t *,
 	uint32_t, void **);
-extern int qla24xx_pause_risc(struct device_reg_24xx __iomem *);
+extern void qla24xx_pause_risc(struct device_reg_24xx __iomem *);
 extern int qla24xx_soft_reset(struct qla_hw_data *);
-- 
1.7.7


  parent reply	other threads:[~2014-04-11 21:31 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11 20:54 [PATCH 00/42] qla2xxx: 8.07.00.08-k: Updates for scsi "misc" branch Saurav Kashyap
2014-04-11 20:54 ` [PATCH 01/42] qla2xxx: Wait for reset completion without lock for ISPFX00 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 02/42] qla2xxx: Do not schedule reset when one is already active when receiving an invalid status handle Saurav Kashyap
2014-04-11 20:54 ` [PATCH 03/42] qla2xxx: Correct operations for ISP27xx template types 270 and 271 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 04/42] qla2xxx: Allow ISP83XX and ISP27XX both to write req_q_out register Saurav Kashyap
2014-04-11 20:54 ` [PATCH 05/42] qla2xxx: Correct ISP83xx/ISP27xx mislogic in setting out_mb in qla25xx_init_req_que() Saurav Kashyap
2014-04-11 20:54 ` [PATCH 06/42] qla2xxx: Log when device state is moved to failed state Saurav Kashyap
2014-04-11 20:54 ` [PATCH 07/42] qla2xxx: Issue abort command for outstanding commands during cleanup when only firmware is alive Saurav Kashyap
2014-04-11 20:54 ` [PATCH 08/42] qla2xxx: Add pci device id 0x2271 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 09/42] qla2xxx: Allow the next firmware dump if the previous dump capture fails for ISP8044 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 10/42] qla2xxx: Support of new firmware dump opcodes QLA8044_RDDFE(38), QLA8044_RDMDIO(39),QLA8044_POLLWR(40) Saurav Kashyap
2014-04-11 20:54 ` [PATCH 11/42] qla2xxx: Check for peg alive counter and clear any outstanding mailbox command Saurav Kashyap
2014-04-11 20:54 ` [PATCH 12/42] qla2xxx: Add ISP8044 serdes bsg interface Saurav Kashyap
2014-04-11 20:54 ` [PATCH 13/42] qla2xxx: Correction to ISP27xx template entry types 256 and 258 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 14/42] qla2xxx: Track the process when the ROM_LOCK failure happens Saurav Kashyap
2014-04-11 20:54 ` Saurav Kashyap [this message]
2014-04-11 20:54 ` [PATCH 16/42] qla2xxx: Introduce fw_dump_flag to track fw dump progress Saurav Kashyap
2014-04-11 20:54 ` [PATCH 17/42] qla2xxx: Enable fw_dump_size for ISP8044 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 18/42] qla2xxx: Update entry type 270 to match spec update Saurav Kashyap
2014-04-11 20:54 ` [PATCH 19/42] qla2xxx: Change copyright year to 2014 in all the source files Saurav Kashyap
2014-04-11 20:54 ` [PATCH 20/42] qla2xxx: Decrease pci access for response queue processing for ISPFX00 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 21/42] qla2xxx: Use proper log message for flash lock failed error Saurav Kashyap
2014-04-11 20:54 ` [PATCH 22/42] qla2xxx: Include <delay.h> file for msleep declartion in qla_nx2.c file Saurav Kashyap
2014-04-11 20:54 ` [PATCH 23/42] qla2xxx: Remove unnecessary printk_ratelimited from qla_nx2.c Saurav Kashyap
2014-04-11 20:54 ` [PATCH 24/42] qla2xxx: ISP8044 poll ipmdio bus timeout improvement Saurav Kashyap
2014-04-11 20:54 ` [PATCH 25/42] qla2xxx: IOCB data should be copied to I/O mem using memcpy_toio Saurav Kashyap
2014-04-11 20:54 ` [PATCH 26/42] qla2xxx: Avoid escalating the SCSI error handler if the command is not found in firmware Saurav Kashyap
2014-04-11 20:54 ` [PATCH 27/42] qla2xxx: Adjust adapter reset routine to the changes in firmware specification for ISPFx00 Saurav Kashyap
2014-04-11 20:54 ` [PATCH 28/42] qla2xxx: Clear loop_id for ports that are marked lost during fabric scanning Saurav Kashyap
2014-04-11 20:54 ` [PATCH 29/42] qla2xxx: Check the QLA8044_CRB_DRV_ACTIVE_INDEX register when we are not the owner of the reset Saurav Kashyap
2014-04-11 20:54 ` [PATCH 30/42] qla2xxx: Reduce the time we wait for a command to complete during SCSI error handling Saurav Kashyap
2014-04-11 20:54 ` [PATCH 31/42] qla2xxx: ISP27xx firmware dump template spec updates (including T274) Saurav Kashyap
2014-04-11 20:54 ` [PATCH 32/42] qla2xxx: ISP27xx queue index shadow registers Saurav Kashyap
2014-04-11 20:54 ` [PATCH 33/42] qla2xxx: Delay driver unload if there is any pending activity going on Saurav Kashyap
2014-04-11 20:54 ` [PATCH 34/42] qla2xxx: Don't check for firmware hung during the reset context for ISP82XX Saurav Kashyap
2014-04-11 20:54 ` [PATCH 35/42] qla2xxx: Fix beacon blink logic for ISP26xx/83xx Saurav Kashyap
2014-04-11 20:54 ` [PATCH 36/42] qla2xxx: Add MBC option for fast SFP data access Saurav Kashyap
2014-04-11 20:54 ` [PATCH 37/42] qla2xxx: Remove mapped vp index iterator macro dead code Saurav Kashyap
2014-04-11 20:54 ` [PATCH 38/42] qla2xxx: T10-Dif: add T10-PI support Saurav Kashyap
2014-04-11 20:54 ` [PATCH 39/42] qla2xxx: ABTS cause double free of qla_tgt_cmd + Saurav Kashyap
2014-05-23  3:00   ` Nicholas A. Bellinger
2014-05-28 18:52     ` Quinn Tran
2014-04-11 20:54 ` [PATCH 40/42] qla2xxx: Do logins from a chip reset in DPC thread instead of the error handler thread Saurav Kashyap
2014-04-11 20:54 ` [PATCH 41/42] qla2xxx: Remove wait for online from host reset handler Saurav Kashyap
2014-04-11 20:54 ` [PATCH 42/42] qla2xxx: Update the driver version to 8.07.00.08-k Saurav Kashyap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397249687-32666-16-git-send-email-saurav.kashyap@qlogic.com \
    --to=saurav.kashyap@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).