netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: anirban.chakraborty@qlogic.com
To: netdev@vger.kernel.org
Cc: davem@davemloft.com, Dept_NX_Linux_NIC_driver@qlogic.com,
	Sritej Velaga <sritej.velaga@qlogic.com>
Subject: [PATCH 7/9 net-next-2.6] qlcnic: Use flt method to determine flash fw region
Date: Fri,  1 Apr 2011 17:07:14 -0700	[thread overview]
Message-ID: <1301702836-3265-7-git-send-email-anirban.chakraborty@qlogic.com> (raw)
In-Reply-To: <1301702836-3265-1-git-send-email-anirban.chakraborty@qlogic.com>

From: Sritej Velaga <sritej.velaga@qlogic.com>

Use flash layout table to get flash fw starting address and its size.
If that fails, use legacy method.

Signed-off-by: Sritej Velaga <sritej.velaga@qlogic.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
---
 drivers/net/qlcnic/qlcnic.h      |    3 ++-
 drivers/net/qlcnic/qlcnic_init.c |   17 ++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 9d2e630..d9dd2c4 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -292,6 +292,7 @@ struct uni_data_desc{
 /* Flash Defines and Structures */
 #define QLCNIC_FLT_LOCATION	0x3F1000
 #define QLCNIC_FW_IMAGE_REGION	0x74
+#define QLCNIC_BOOTLD_REGION    0X72
 struct qlcnic_flt_header {
 	u16 version;
 	u16 len;
@@ -306,7 +307,7 @@ struct qlcnic_flt_entry {
 	u8 reserved1;
 	u32 size;
 	u32 start_addr;
-	u32 end_add;
+	u32 end_addr;
 };
 
 /* Magic number to let user know flash is programmed */
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 74ec96d..4ec0eeb 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -1130,9 +1130,20 @@ qlcnic_load_firmware(struct qlcnic_adapter *adapter)
 	} else {
 		u64 data;
 		u32 hi, lo;
-
-		size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8;
-		flashaddr = QLCNIC_BOOTLD_START;
+		int ret;
+		struct qlcnic_flt_entry bootld_entry;
+
+		ret = qlcnic_get_flt_entry(adapter, QLCNIC_BOOTLD_REGION,
+					&bootld_entry);
+		if (!ret) {
+			size = bootld_entry.size / 8;
+			flashaddr = bootld_entry.start_addr;
+		} else {
+			size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8;
+			flashaddr = QLCNIC_BOOTLD_START;
+			dev_info(&pdev->dev,
+				"using legacy method to get flash fw region");
+		}
 
 		for (i = 0; i < size; i++) {
 			if (qlcnic_rom_fast_read(adapter,
-- 
1.7.1


  parent reply	other threads:[~2011-04-02  0:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-02  0:07 [PATCH 1/9 net-next-2.6] qlcnic: Make PCI info available in all modes anirban.chakraborty
2011-04-02  0:07 ` [PATCH 2/9 net-next-2.6] qlcnic: Memory leak fix anirban.chakraborty
2011-04-02  0:07 ` [PATCH 3/9 net-next-2.6] qlcnic: Cleanup patch anirban.chakraborty
2011-04-02  0:07 ` [PATCH 4/9 net-next-2.6] qlcnic: Code optimization patch anirban.chakraborty
2011-04-02  0:07 ` [PATCH 5/9 net-next-2.6] qlcnic: Changes to VLAN code anirban.chakraborty
2011-04-02  0:07 ` [PATCH 6/9 net-next-2.6] qlcnic: Remove unused code anirban.chakraborty
2011-04-02  0:07 ` anirban.chakraborty [this message]
2011-04-02  0:07 ` [PATCH 7/9 net-next-2.6] qlcnic: Use flt method to determine flash fw region anirban.chakraborty
2011-04-02  0:07 ` anirban.chakraborty
  -- strict thread matches above, loose matches on Subject: below --
2011-04-02  0:28 anirban.chakraborty
2011-04-01  4:40 Anirban Chakraborty
2011-03-30 20:23 Anirban Chakraborty

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=1301702836-3265-7-git-send-email-anirban.chakraborty@qlogic.com \
    --to=anirban.chakraborty@qlogic.com \
    --cc=Dept_NX_Linux_NIC_driver@qlogic.com \
    --cc=davem@davemloft.com \
    --cc=netdev@vger.kernel.org \
    --cc=sritej.velaga@qlogic.com \
    /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).