Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > ea32411352494358b8d75a78402a4713 > files > 4685

kernel-2.6.18-238.19.1.el5.centos.plus.src.rpm

From: Chad Dupuis <cdupuis@redhat.com>
Date: Tue, 30 Nov 2010 20:00:32 -0500
Subject: [scsi] qla4xxx: fail init if pci mem write fails
Message-id: <20101130200032.10450.48443.sendpatchset@localhost.localdomain>
Patchwork-id: 29709
O-Subject: [RHEL 5.6 PATCH 18/28] qla4xxx: Fail initialization if
	qla4_8xxx_pci_mem_write_2M fails
Bugzilla: 656999

Bugzilla
--------

Bug 656999 (https://bugzilla.redhat.com/show_bug.cgi?id=656999)

Upstream Status
---------------

RHEL 5 specific.

Description
-----------

>From e6ba790724008b17353b933f4e5c2c138f009ff3 Mon Sep 17 00:00:00 2001
From: Lalit Chandivade <lalit.chandivade@qlogic.com>
Date: Sat, 20 Nov 2010 15:04:34 -0800
Subject: [PATCH 19/29] qla4xxx: Fail initialization if qla4_8xxx_pci_mem_write_2M fails

Since if fw load is failing, running on incomplete fw load would
be fatal.

Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Prasanna Mumbai <prasanna.mumbai@qlogic.com>

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 73b39ed..4013c52 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -1055,32 +1055,37 @@ qla4_8xxx_pinit_from_rom(struct scsi_qla_host *ha, int verbose)
 static int
 qla4_8xxx_load_from_flash(struct scsi_qla_host *ha, uint32_t image_start)
 {
-	int  i;
+	int  i, rval = 0;
 	long size = 0;
 	long flashaddr, memaddr;
 	u64 data;
 	u32 high, low;
 
-		flashaddr = memaddr = ha->hw.flt_region_bootload;
-		size = (image_start - flashaddr) / 8;
-
-		DEBUG2(printk("scsi%ld: %s: bootldr = 0x%lx, fw_image = 0x%x\n",
-				ha->host_no, __func__, flashaddr, image_start));
-
-		for (i = 0; i < size; i++) {
-			if ((qla4_8xxx_rom_fast_read(ha, flashaddr, (int *)&low)) ||
-			    (qla4_8xxx_rom_fast_read(ha, flashaddr + 4, (int *)&high))) {
-				return -1;
-			}
-			data = ((u64)high << 32) | low ;
-			qla4_8xxx_pci_mem_write_2M(ha, memaddr, &data, 8);
-			flashaddr += 8;
-			memaddr   += 8;
-
-			if (i % 0x1000 == 0) {
-				msleep(1);
-			}
+	flashaddr = memaddr = ha->hw.flt_region_bootload;
+	size = (image_start - flashaddr) / 8;
+
+	DEBUG2(printk("scsi%ld: %s: bootldr = 0x%lx, fw_image = 0x%x\n",
+			ha->host_no, __func__, flashaddr, image_start));
+
+	for (i = 0; i < size; i++) {
+		if ((qla4_8xxx_rom_fast_read(ha, flashaddr, (int *)&low)) ||
+		    (qla4_8xxx_rom_fast_read(ha, flashaddr + 4,
+		    (int *)&high))) {
+			rval = -1;
+			goto exit_load_from_flash;
 		}
+		data = ((u64)high << 32) | low ;
+		rval = qla4_8xxx_pci_mem_write_2M(ha, memaddr, &data, 8);
+		if (rval)
+			goto exit_load_from_flash;
+
+		flashaddr += 8;
+		memaddr   += 8;
+
+		if (i % 0x1000 == 0) {
+			msleep(1);
+		}
+	}
 
 	udelay(100);
 
@@ -1088,7 +1093,9 @@ qla4_8xxx_load_from_flash(struct scsi_qla_host *ha, uint32_t image_start)
 	qla4_8xxx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x18, 0x1020);
 	qla4_8xxx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0x80001e);
 	read_unlock(&ha->hw_lock);
-	return 0;
+
+exit_load_from_flash:
+	return rval;
 }
 
 static int qla4_8xxx_load_fw(struct scsi_qla_host *ha, uint32_t image_start)