diff options
author | Sritej Velaga <sritej.velaga@qlogic.com> | 2011-04-01 10:28:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 15:47:13 -0400 |
commit | f8d54811cb125094769704722e4eda6610339b92 (patch) | |
tree | 1c562a24bb1e091722edce0a84152f29402b2369 | |
parent | 8816d0099b9c0f48452b69471c2f54037f7e0e3b (diff) |
qlcnic: Use flt method to determine flash fw region
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 3 | ||||
-rw-r--r-- | 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 9d2e630c3895..d9dd2c40c92f 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -292,6 +292,7 @@ struct uni_data_desc{ | |||
292 | /* Flash Defines and Structures */ | 292 | /* Flash Defines and Structures */ |
293 | #define QLCNIC_FLT_LOCATION 0x3F1000 | 293 | #define QLCNIC_FLT_LOCATION 0x3F1000 |
294 | #define QLCNIC_FW_IMAGE_REGION 0x74 | 294 | #define QLCNIC_FW_IMAGE_REGION 0x74 |
295 | #define QLCNIC_BOOTLD_REGION 0X72 | ||
295 | struct qlcnic_flt_header { | 296 | struct qlcnic_flt_header { |
296 | u16 version; | 297 | u16 version; |
297 | u16 len; | 298 | u16 len; |
@@ -306,7 +307,7 @@ struct qlcnic_flt_entry { | |||
306 | u8 reserved1; | 307 | u8 reserved1; |
307 | u32 size; | 308 | u32 size; |
308 | u32 start_addr; | 309 | u32 start_addr; |
309 | u32 end_add; | 310 | u32 end_addr; |
310 | }; | 311 | }; |
311 | 312 | ||
312 | /* Magic number to let user know flash is programmed */ | 313 | /* 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 74ec96da1762..4ec0eeb6bff9 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) | |||
1130 | } else { | 1130 | } else { |
1131 | u64 data; | 1131 | u64 data; |
1132 | u32 hi, lo; | 1132 | u32 hi, lo; |
1133 | 1133 | int ret; | |
1134 | size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8; | 1134 | struct qlcnic_flt_entry bootld_entry; |
1135 | flashaddr = QLCNIC_BOOTLD_START; | 1135 | |
1136 | ret = qlcnic_get_flt_entry(adapter, QLCNIC_BOOTLD_REGION, | ||
1137 | &bootld_entry); | ||
1138 | if (!ret) { | ||
1139 | size = bootld_entry.size / 8; | ||
1140 | flashaddr = bootld_entry.start_addr; | ||
1141 | } else { | ||
1142 | size = (QLCNIC_IMAGE_START - QLCNIC_BOOTLD_START) / 8; | ||
1143 | flashaddr = QLCNIC_BOOTLD_START; | ||
1144 | dev_info(&pdev->dev, | ||
1145 | "using legacy method to get flash fw region"); | ||
1146 | } | ||
1136 | 1147 | ||
1137 | for (i = 0; i < size; i++) { | 1148 | for (i = 0; i < size; i++) { |
1138 | if (qlcnic_rom_fast_read(adapter, | 1149 | if (qlcnic_rom_fast_read(adapter, |