be2net: simplify UFI compatibility checking
The code in be_check_ufi_compatibility() checks to see if a UFI file meant for a lower rev of a chip is being flashed on a higher rev, which is disallowed. This patch re-writes the code needed for this check in a much simpler manner. Signed-off-by: Vasundhara Volam <vasundhara.volam@avagotech.com> Signed-off-by: Sathya Perla <sathya.perla@avagotech.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b02e60c86e
commit
a6e6ff6eee
@ -1110,10 +1110,6 @@ struct be_cmd_req_query_fw_cfg {
|
|||||||
u32 rsvd[31];
|
u32 rsvd[31];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ASIC revisions */
|
|
||||||
#define ASIC_REV_B0 0x10
|
|
||||||
#define ASIC_REV_P2 0x11
|
|
||||||
|
|
||||||
struct be_cmd_resp_query_fw_cfg {
|
struct be_cmd_resp_query_fw_cfg {
|
||||||
struct be_cmd_resp_hdr hdr;
|
struct be_cmd_resp_hdr hdr;
|
||||||
u32 be_config_number;
|
u32 be_config_number;
|
||||||
|
@ -4773,14 +4773,11 @@ static int lancer_fw_download(struct be_adapter *adapter,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BE2_UFI 2
|
/* Check if the flash image file is compatible with the adapter that
|
||||||
#define BE3_UFI 3
|
* is being flashed.
|
||||||
#define BE3R_UFI 10
|
*/
|
||||||
#define SH_UFI 4
|
static bool be_check_ufi_compatibility(struct be_adapter *adapter,
|
||||||
#define SH_P2_UFI 11
|
struct flash_file_hdr_g3 *fhdr)
|
||||||
|
|
||||||
static int be_get_ufi_type(struct be_adapter *adapter,
|
|
||||||
struct flash_file_hdr_g3 *fhdr)
|
|
||||||
{
|
{
|
||||||
if (!fhdr) {
|
if (!fhdr) {
|
||||||
dev_err(&adapter->pdev->dev, "Invalid FW UFI file");
|
dev_err(&adapter->pdev->dev, "Invalid FW UFI file");
|
||||||
@ -4792,43 +4789,22 @@ static int be_get_ufi_type(struct be_adapter *adapter,
|
|||||||
*/
|
*/
|
||||||
switch (fhdr->build[0]) {
|
switch (fhdr->build[0]) {
|
||||||
case BLD_STR_UFI_TYPE_SH:
|
case BLD_STR_UFI_TYPE_SH:
|
||||||
return (fhdr->asic_type_rev == ASIC_REV_P2) ? SH_P2_UFI :
|
if (!skyhawk_chip(adapter))
|
||||||
SH_UFI;
|
return false;
|
||||||
|
break;
|
||||||
case BLD_STR_UFI_TYPE_BE3:
|
case BLD_STR_UFI_TYPE_BE3:
|
||||||
return (fhdr->asic_type_rev == ASIC_REV_B0) ? BE3R_UFI :
|
if (!BE3_chip(adapter))
|
||||||
BE3_UFI;
|
return false;
|
||||||
|
break;
|
||||||
case BLD_STR_UFI_TYPE_BE2:
|
case BLD_STR_UFI_TYPE_BE2:
|
||||||
return BE2_UFI;
|
if (!BE2_chip(adapter))
|
||||||
default:
|
return false;
|
||||||
return -1;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the flash image file is compatible with the adapter that
|
|
||||||
* is being flashed.
|
|
||||||
* BE3 chips with asic-rev B0 must be flashed only with BE3R_UFI type.
|
|
||||||
* Skyhawk chips with asic-rev P2 must be flashed only with SH_P2_UFI type.
|
|
||||||
*/
|
|
||||||
static bool be_check_ufi_compatibility(struct be_adapter *adapter,
|
|
||||||
struct flash_file_hdr_g3 *fhdr)
|
|
||||||
{
|
|
||||||
int ufi_type = be_get_ufi_type(adapter, fhdr);
|
|
||||||
|
|
||||||
switch (ufi_type) {
|
|
||||||
case SH_P2_UFI:
|
|
||||||
return skyhawk_chip(adapter);
|
|
||||||
case SH_UFI:
|
|
||||||
return (skyhawk_chip(adapter) &&
|
|
||||||
adapter->asic_rev < ASIC_REV_P2);
|
|
||||||
case BE3R_UFI:
|
|
||||||
return BE3_chip(adapter);
|
|
||||||
case BE3_UFI:
|
|
||||||
return (BE3_chip(adapter) && adapter->asic_rev < ASIC_REV_B0);
|
|
||||||
case BE2_UFI:
|
|
||||||
return BE2_chip(adapter);
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (fhdr->asic_type_rev >= adapter->asic_rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
|
static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw)
|
||||||
|
Loading…
Reference in New Issue
Block a user