aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorVasundhara Volam <vasundhara.volam@emulex.com>2013-04-21 19:28:16 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-22 15:36:06 -0400
commit0ad3157e813a59e91dfbea2eff6a3d330215f5af (patch)
treeac8c1182bd3ba65c703fe34ff7d315e9ecff4d21 /drivers/net/ethernet
parent4d277125d88f14947141083f323a75adf7e52989 (diff)
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: Vasundhara Volam <vasundhara.volam@emulex.com> Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c3
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.h4
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h3
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c42
5 files changed, 37 insertions, 16 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 880226872c64..e2d5ced7e733 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -435,6 +435,7 @@ struct be_adapter {
435 u8 wol_cap; 435 u8 wol_cap;
436 bool wol; 436 bool wol;
437 u32 uc_macs; /* Count of secondary UC MAC programmed */ 437 u32 uc_macs; /* Count of secondary UC MAC programmed */
438 u16 asic_rev;
438 u32 msg_enable; 439 u32 msg_enable;
439 int be_get_temp_freq; 440 int be_get_temp_freq;
440 u16 max_mcast_mac; 441 u16 max_mcast_mac;
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index a20b31d48a5e..d60be6845ee6 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -1834,7 +1834,7 @@ err:
1834 1834
1835/* Uses mbox */ 1835/* Uses mbox */
1836int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, 1836int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
1837 u32 *mode, u32 *caps) 1837 u32 *mode, u32 *caps, u16 *asic_rev)
1838{ 1838{
1839 struct be_mcc_wrb *wrb; 1839 struct be_mcc_wrb *wrb;
1840 struct be_cmd_req_query_fw_cfg *req; 1840 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,
1855 *port_num = le32_to_cpu(resp->phys_port); 1855 *port_num = le32_to_cpu(resp->phys_port);
1856 *mode = le32_to_cpu(resp->function_mode); 1856 *mode = le32_to_cpu(resp->function_mode);
1857 *caps = le32_to_cpu(resp->function_caps); 1857 *caps = le32_to_cpu(resp->function_caps);
1858 *asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF;
1858 } 1859 }
1859 1860
1860 mutex_unlock(&adapter->mbox_lock); 1861 mutex_unlock(&adapter->mbox_lock);
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
index ba41f8360f9f..e9597852a404 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
@@ -1848,8 +1848,8 @@ extern int be_cmd_set_flow_control(struct be_adapter *adapter,
1848 u32 tx_fc, u32 rx_fc); 1848 u32 tx_fc, u32 rx_fc);
1849extern int be_cmd_get_flow_control(struct be_adapter *adapter, 1849extern int be_cmd_get_flow_control(struct be_adapter *adapter,
1850 u32 *tx_fc, u32 *rx_fc); 1850 u32 *tx_fc, u32 *rx_fc);
1851extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, 1851extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
1852 u32 *port_num, u32 *function_mode, u32 *function_caps); 1852 u32 *function_mode, u32 *function_caps, u16 *asic_rev);
1853extern int be_cmd_reset_function(struct be_adapter *adapter); 1853extern int be_cmd_reset_function(struct be_adapter *adapter);
1854extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, 1854extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
1855 u16 table_size); 1855 u16 table_size);
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index b305f8d22f9c..3c1099b47f2a 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -499,7 +499,8 @@ struct flash_file_hdr_g3 {
499 u32 antidote; 499 u32 antidote;
500 u32 num_imgs; 500 u32 num_imgs;
501 u8 build[24]; 501 u8 build[24];
502 u8 rsvd[32]; 502 u8 asic_type_rev;
503 u8 rsvd[31];
503}; 504};
504 505
505struct flash_section_hdr { 506struct flash_section_hdr {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 8d10b781bc65..c70b8fff8cff 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2959,7 +2959,8 @@ static int be_get_config(struct be_adapter *adapter)
2959 2959
2960 status = be_cmd_query_fw_cfg(adapter, &adapter->port_num, 2960 status = be_cmd_query_fw_cfg(adapter, &adapter->port_num,
2961 &adapter->function_mode, 2961 &adapter->function_mode,
2962 &adapter->function_caps); 2962 &adapter->function_caps,
2963 &adapter->asic_rev);
2963 if (status) 2964 if (status)
2964 goto err; 2965 goto err;
2965 2966
@@ -3220,7 +3221,7 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
3220 return 0; 3221 return 0;
3221} 3222}
3222 3223
3223/* For BE2 and BE3 */ 3224/* For BE2, BE3 and BE3-R */
3224static int be_flash_BEx(struct be_adapter *adapter, 3225static int be_flash_BEx(struct be_adapter *adapter,
3225 const struct firmware *fw, 3226 const struct firmware *fw,
3226 struct be_dma_mem *flash_cmd, 3227 struct be_dma_mem *flash_cmd,
@@ -3533,18 +3534,22 @@ lancer_fw_exit:
3533 3534
3534#define UFI_TYPE2 2 3535#define UFI_TYPE2 2
3535#define UFI_TYPE3 3 3536#define UFI_TYPE3 3
3537#define UFI_TYPE3R 10
3536#define UFI_TYPE4 4 3538#define UFI_TYPE4 4
3537static int be_get_ufi_type(struct be_adapter *adapter, 3539static int be_get_ufi_type(struct be_adapter *adapter,
3538 struct flash_file_hdr_g2 *fhdr) 3540 struct flash_file_hdr_g3 *fhdr)
3539{ 3541{
3540 if (fhdr == NULL) 3542 if (fhdr == NULL)
3541 goto be_get_ufi_exit; 3543 goto be_get_ufi_exit;
3542 3544
3543 if (skyhawk_chip(adapter) && fhdr->build[0] == '4') 3545 if (skyhawk_chip(adapter) && fhdr->build[0] == '4')
3544 return UFI_TYPE4; 3546 return UFI_TYPE4;
3545 else if (BE3_chip(adapter) && fhdr->build[0] == '3') 3547 else if (BE3_chip(adapter) && fhdr->build[0] == '3') {
3546 return UFI_TYPE3; 3548 if (fhdr->asic_type_rev == 0x10)
3547 else if (BE2_chip(adapter) && fhdr->build[0] == '2') 3549 return UFI_TYPE3R;
3550 else
3551 return UFI_TYPE3;
3552 } else if (BE2_chip(adapter) && fhdr->build[0] == '2')
3548 return UFI_TYPE2; 3553 return UFI_TYPE2;
3549 3554
3550be_get_ufi_exit: 3555be_get_ufi_exit:
@@ -3555,7 +3560,6 @@ be_get_ufi_exit:
3555 3560
3556static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) 3561static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
3557{ 3562{
3558 struct flash_file_hdr_g2 *fhdr;
3559 struct flash_file_hdr_g3 *fhdr3; 3563 struct flash_file_hdr_g3 *fhdr3;
3560 struct image_hdr *img_hdr_ptr = NULL; 3564 struct image_hdr *img_hdr_ptr = NULL;
3561 struct be_dma_mem flash_cmd; 3565 struct be_dma_mem flash_cmd;
@@ -3571,23 +3575,37 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
3571 } 3575 }
3572 3576
3573 p = fw->data; 3577 p = fw->data;
3574 fhdr = (struct flash_file_hdr_g2 *)p; 3578 fhdr3 = (struct flash_file_hdr_g3 *)p;
3575 3579
3576 ufi_type = be_get_ufi_type(adapter, fhdr); 3580 ufi_type = be_get_ufi_type(adapter, fhdr3);
3577 3581
3578 fhdr3 = (struct flash_file_hdr_g3 *)fw->data;
3579 num_imgs = le32_to_cpu(fhdr3->num_imgs); 3582 num_imgs = le32_to_cpu(fhdr3->num_imgs);
3580 for (i = 0; i < num_imgs; i++) { 3583 for (i = 0; i < num_imgs; i++) {
3581 img_hdr_ptr = (struct image_hdr *)(fw->data + 3584 img_hdr_ptr = (struct image_hdr *)(fw->data +
3582 (sizeof(struct flash_file_hdr_g3) + 3585 (sizeof(struct flash_file_hdr_g3) +
3583 i * sizeof(struct image_hdr))); 3586 i * sizeof(struct image_hdr)));
3584 if (le32_to_cpu(img_hdr_ptr->imageid) == 1) { 3587 if (le32_to_cpu(img_hdr_ptr->imageid) == 1) {
3585 if (ufi_type == UFI_TYPE4) 3588 switch (ufi_type) {
3589 case UFI_TYPE4:
3586 status = be_flash_skyhawk(adapter, fw, 3590 status = be_flash_skyhawk(adapter, fw,
3587 &flash_cmd, num_imgs); 3591 &flash_cmd, num_imgs);
3588 else if (ufi_type == UFI_TYPE3) 3592 break;
3593 case UFI_TYPE3R:
3589 status = be_flash_BEx(adapter, fw, &flash_cmd, 3594 status = be_flash_BEx(adapter, fw, &flash_cmd,
3590 num_imgs); 3595 num_imgs);
3596 break;
3597 case UFI_TYPE3:
3598 /* Do not flash this ufi on BE3-R cards */
3599 if (adapter->asic_rev < 0x10)
3600 status = be_flash_BEx(adapter, fw,
3601 &flash_cmd,
3602 num_imgs);
3603 else {
3604 status = -1;
3605 dev_err(&adapter->pdev->dev,
3606 "Can't load BE3 UFI on BE3R\n");
3607 }
3608 }
3591 } 3609 }
3592 } 3610 }
3593 3611