Commit 0ad3157e authored by Vasundhara Volam's avatar Vasundhara Volam Committed by David S. Miller

be2net: Avoid flashing BE3 UFI on BE3-R chip.

Avoid flashing BE3 UFI on BE3-R chip by verifying asic_revision
number of the chip.
Signed-off-by: default avatarVasundhara Volam <vasundhara.volam@emulex.com>
Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d277125
......@@ -435,6 +435,7 @@ struct be_adapter {
u8 wol_cap;
bool wol;
u32 uc_macs; /* Count of secondary UC MAC programmed */
u16 asic_rev;
u32 msg_enable;
int be_get_temp_freq;
u16 max_mcast_mac;
......
......@@ -1834,7 +1834,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc)
/* Uses mbox */
int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
u32 *mode, u32 *caps)
u32 *mode, u32 *caps, u16 *asic_rev)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_query_fw_cfg *req;
......@@ -1855,6 +1855,7 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
*port_num = le32_to_cpu(resp->phys_port);
*mode = le32_to_cpu(resp->function_mode);
*caps = le32_to_cpu(resp->function_caps);
*asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF;
}
mutex_unlock(&adapter->mbox_lock);
......
......@@ -1848,8 +1848,8 @@ extern int be_cmd_set_flow_control(struct be_adapter *adapter,
u32 tx_fc, u32 rx_fc);
extern int be_cmd_get_flow_control(struct be_adapter *adapter,
u32 *tx_fc, u32 *rx_fc);
extern int be_cmd_query_fw_cfg(struct be_adapter *adapter,
u32 *port_num, u32 *function_mode, u32 *function_caps);
extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
u32 *function_mode, u32 *function_caps, u16 *asic_rev);
extern int be_cmd_reset_function(struct be_adapter *adapter);
extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
u16 table_size);
......
......@@ -499,7 +499,8 @@ struct flash_file_hdr_g3 {
u32 antidote;
u32 num_imgs;
u8 build[24];
u8 rsvd[32];
u8 asic_type_rev;
u8 rsvd[31];
};
struct flash_section_hdr {
......
......@@ -2959,7 +2959,8 @@ static int be_get_config(struct be_adapter *adapter)
status = be_cmd_query_fw_cfg(adapter, &adapter->port_num,
&adapter->function_mode,
&adapter->function_caps);
&adapter->function_caps,
&adapter->asic_rev);
if (status)
goto err;
......@@ -3220,7 +3221,7 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
return 0;
}
/* For BE2 and BE3 */
/* For BE2, BE3 and BE3-R */
static int be_flash_BEx(struct be_adapter *adapter,
const struct firmware *fw,
struct be_dma_mem *flash_cmd,
......@@ -3533,18 +3534,22 @@ static int lancer_fw_download(struct be_adapter *adapter,
#define UFI_TYPE2 2
#define UFI_TYPE3 3
#define UFI_TYPE3R 10
#define UFI_TYPE4 4
static int be_get_ufi_type(struct be_adapter *adapter,
struct flash_file_hdr_g2 *fhdr)
struct flash_file_hdr_g3 *fhdr)
{
if (fhdr == NULL)
goto be_get_ufi_exit;
if (skyhawk_chip(adapter) && fhdr->build[0] == '4')
return UFI_TYPE4;
else if (BE3_chip(adapter) && fhdr->build[0] == '3')
return UFI_TYPE3;
else if (BE2_chip(adapter) && fhdr->build[0] == '2')
else if (BE3_chip(adapter) && fhdr->build[0] == '3') {
if (fhdr->asic_type_rev == 0x10)
return UFI_TYPE3R;
else
return UFI_TYPE3;
} else if (BE2_chip(adapter) && fhdr->build[0] == '2')
return UFI_TYPE2;
be_get_ufi_exit:
......@@ -3555,7 +3560,6 @@ static int be_get_ufi_type(struct be_adapter *adapter,
static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
{
struct flash_file_hdr_g2 *fhdr;
struct flash_file_hdr_g3 *fhdr3;
struct image_hdr *img_hdr_ptr = NULL;
struct be_dma_mem flash_cmd;
......@@ -3571,23 +3575,37 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
}
p = fw->data;
fhdr = (struct flash_file_hdr_g2 *)p;
fhdr3 = (struct flash_file_hdr_g3 *)p;
ufi_type = be_get_ufi_type(adapter, fhdr);
ufi_type = be_get_ufi_type(adapter, fhdr3);
fhdr3 = (struct flash_file_hdr_g3 *)fw->data;
num_imgs = le32_to_cpu(fhdr3->num_imgs);
for (i = 0; i < num_imgs; i++) {
img_hdr_ptr = (struct image_hdr *)(fw->data +
(sizeof(struct flash_file_hdr_g3) +
i * sizeof(struct image_hdr)));
if (le32_to_cpu(img_hdr_ptr->imageid) == 1) {
if (ufi_type == UFI_TYPE4)
switch (ufi_type) {
case UFI_TYPE4:
status = be_flash_skyhawk(adapter, fw,
&flash_cmd, num_imgs);
else if (ufi_type == UFI_TYPE3)
break;
case UFI_TYPE3R:
status = be_flash_BEx(adapter, fw, &flash_cmd,
num_imgs);
break;
case UFI_TYPE3:
/* Do not flash this ufi on BE3-R cards */
if (adapter->asic_rev < 0x10)
status = be_flash_BEx(adapter, fw,
&flash_cmd,
num_imgs);
else {
status = -1;
dev_err(&adapter->pdev->dev,
"Can't load BE3 UFI on BE3R\n");
}
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment