提交 8836ff48 编写于 作者: S Suresh Reddy 提交者: David S. Miller

be2net: cleanup FW flash image related macro defines

Many constant definitions relating to the FW-image layout
(such as section offset values) were defined in decimal format rather than
hexa-decimal. This makes this part of the code un-readable. Also some
defines related to BE2 are labeld "g2" and defines related to BE3 are
labeled "g3".  This patch cleans up all of this to make this code more
readable.
Signed-off-by: NSuresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: NSathya Perla <sathya.perla@avagotech.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ac0f5fba
...@@ -1207,68 +1207,85 @@ struct be_cmd_resp_get_beacon_state { ...@@ -1207,68 +1207,85 @@ struct be_cmd_resp_get_beacon_state {
/* Flashrom related descriptors */ /* Flashrom related descriptors */
#define MAX_FLASH_COMP 32 #define MAX_FLASH_COMP 32
#define OPTYPE_ISCSI_ACTIVE 0 /* Optypes of each component in the UFI */
#define OPTYPE_REDBOOT 1 enum {
#define OPTYPE_BIOS 2 OPTYPE_ISCSI_ACTIVE = 0,
#define OPTYPE_PXE_BIOS 3 OPTYPE_REDBOOT = 1,
#define OPTYPE_OFFSET_SPECIFIED 7 OPTYPE_BIOS = 2,
#define OPTYPE_FCOE_BIOS 8 OPTYPE_PXE_BIOS = 3,
#define OPTYPE_ISCSI_BACKUP 9 OPTYPE_OFFSET_SPECIFIED = 7,
#define OPTYPE_FCOE_FW_ACTIVE 10 OPTYPE_FCOE_BIOS = 8,
#define OPTYPE_FCOE_FW_BACKUP 11 OPTYPE_ISCSI_BACKUP = 9,
#define OPTYPE_NCSI_FW 13 OPTYPE_FCOE_FW_ACTIVE = 10,
#define OPTYPE_REDBOOT_DIR 18 OPTYPE_FCOE_FW_BACKUP = 11,
#define OPTYPE_REDBOOT_CONFIG 19 OPTYPE_NCSI_FW = 13,
#define OPTYPE_SH_PHY_FW 21 OPTYPE_REDBOOT_DIR = 18,
#define OPTYPE_FLASHISM_JUMPVECTOR 22 OPTYPE_REDBOOT_CONFIG = 19,
#define OPTYPE_UFI_DIR 23 OPTYPE_SH_PHY_FW = 21,
#define OPTYPE_PHY_FW 99 OPTYPE_FLASHISM_JUMPVECTOR = 22,
OPTYPE_UFI_DIR = 23,
#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 262144 /* Max OPTION ROM image sz */ OPTYPE_PHY_FW = 99
#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 262144 /* Max Redboot image sz */ };
#define FLASH_IMAGE_MAX_SIZE_g2 1310720 /* Max firmware image size */
/* Maximum sizes of components in BE2 FW UFI */
#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 262144 enum {
#define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144 BE2_BIOS_COMP_MAX_SIZE = 0x40000,
#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 524288 /* Max OPTION ROM image sz */ BE2_REDBOOT_COMP_MAX_SIZE = 0x40000,
#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 1048576 /* Max Redboot image sz */ BE2_COMP_MAX_SIZE = 0x140000
#define FLASH_IMAGE_MAX_SIZE_g3 2097152 /* Max firmware image size */ };
/* Offsets for components on Flash. */ /* Maximum sizes of components in BE3 FW UFI */
#define FLASH_REDBOOT_START_g2 0 enum {
#define FLASH_FCoE_BIOS_START_g2 524288 BE3_NCSI_COMP_MAX_SIZE = 0x40000,
#define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 1048576 BE3_PHY_FW_COMP_MAX_SIZE = 0x40000,
#define FLASH_iSCSI_BACKUP_IMAGE_START_g2 2359296 BE3_BIOS_COMP_MAX_SIZE = 0x80000,
#define FLASH_FCoE_PRIMARY_IMAGE_START_g2 3670016 BE3_REDBOOT_COMP_MAX_SIZE = 0x100000,
#define FLASH_FCoE_BACKUP_IMAGE_START_g2 4980736 BE3_COMP_MAX_SIZE = 0x200000
#define FLASH_iSCSI_BIOS_START_g2 7340032 };
#define FLASH_PXE_BIOS_START_g2 7864320
/* Offsets for components in BE2 FW UFI */
#define FLASH_REDBOOT_START_g3 262144 enum {
#define FLASH_PHY_FW_START_g3 1310720 BE2_REDBOOT_START = 0x8000,
#define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 2097152 BE2_FCOE_BIOS_START = 0x80000,
#define FLASH_iSCSI_BACKUP_IMAGE_START_g3 4194304 BE2_ISCSI_PRIMARY_IMAGE_START = 0x100000,
#define FLASH_FCoE_PRIMARY_IMAGE_START_g3 6291456 BE2_ISCSI_BACKUP_IMAGE_START = 0x240000,
#define FLASH_FCoE_BACKUP_IMAGE_START_g3 8388608 BE2_FCOE_PRIMARY_IMAGE_START = 0x380000,
#define FLASH_iSCSI_BIOS_START_g3 12582912 BE2_FCOE_BACKUP_IMAGE_START = 0x4c0000,
#define FLASH_PXE_BIOS_START_g3 13107200 BE2_ISCSI_BIOS_START = 0x700000,
#define FLASH_FCoE_BIOS_START_g3 13631488 BE2_PXE_BIOS_START = 0x780000
#define FLASH_NCSI_START_g3 15990784 };
#define IMAGE_NCSI 16 /* Offsets for components in BE3 FW UFI */
#define IMAGE_OPTION_ROM_PXE 32 enum {
#define IMAGE_OPTION_ROM_FCoE 33 BE3_REDBOOT_START = 0x40000,
#define IMAGE_OPTION_ROM_ISCSI 34 BE3_PHY_FW_START = 0x140000,
#define IMAGE_FLASHISM_JUMPVECTOR 48 BE3_ISCSI_PRIMARY_IMAGE_START = 0x200000,
#define IMAGE_FIRMWARE_iSCSI 160 BE3_ISCSI_BACKUP_IMAGE_START = 0x400000,
#define IMAGE_FIRMWARE_FCoE 162 BE3_FCOE_PRIMARY_IMAGE_START = 0x600000,
#define IMAGE_FIRMWARE_BACKUP_iSCSI 176 BE3_FCOE_BACKUP_IMAGE_START = 0x800000,
#define IMAGE_FIRMWARE_BACKUP_FCoE 178 BE3_ISCSI_BIOS_START = 0xc00000,
#define IMAGE_FIRMWARE_PHY 192 BE3_PXE_BIOS_START = 0xc80000,
#define IMAGE_REDBOOT_DIR 208 BE3_FCOE_BIOS_START = 0xd00000,
#define IMAGE_REDBOOT_CONFIG 209 BE3_NCSI_START = 0xf40000
#define IMAGE_UFI_DIR 210 };
#define IMAGE_BOOT_CODE 224
/* Component entry types */
enum {
IMAGE_NCSI = 0x10,
IMAGE_OPTION_ROM_PXE = 0x20,
IMAGE_OPTION_ROM_FCOE = 0x21,
IMAGE_OPTION_ROM_ISCSI = 0x22,
IMAGE_FLASHISM_JUMPVECTOR = 0x30,
IMAGE_FIRMWARE_ISCSI = 0xa0,
IMAGE_FIRMWARE_FCOE = 0xa2,
IMAGE_FIRMWARE_BACKUP_ISCSI = 0xb0,
IMAGE_FIRMWARE_BACKUP_FCOE = 0xb2,
IMAGE_FIRMWARE_PHY = 0xc0,
IMAGE_REDBOOT_DIR = 0xd0,
IMAGE_REDBOOT_CONFIG = 0xd1,
IMAGE_UFI_DIR = 0xd2,
IMAGE_BOOT_CODE = 0xe2
};
struct controller_id { struct controller_id {
u32 vendor; u32 vendor;
......
...@@ -4616,45 +4616,45 @@ static int be_flash_BEx(struct be_adapter *adapter, ...@@ -4616,45 +4616,45 @@ static int be_flash_BEx(struct be_adapter *adapter,
const u8 *p; const u8 *p;
struct flash_comp gen3_flash_types[] = { struct flash_comp gen3_flash_types[] = {
{ FLASH_iSCSI_PRIMARY_IMAGE_START_g3, OPTYPE_ISCSI_ACTIVE, { BE3_ISCSI_PRIMARY_IMAGE_START, OPTYPE_ISCSI_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g3, IMAGE_FIRMWARE_iSCSI}, BE3_COMP_MAX_SIZE, IMAGE_FIRMWARE_ISCSI},
{ FLASH_REDBOOT_START_g3, OPTYPE_REDBOOT, { BE3_REDBOOT_START, OPTYPE_REDBOOT,
FLASH_REDBOOT_IMAGE_MAX_SIZE_g3, IMAGE_BOOT_CODE}, BE3_REDBOOT_COMP_MAX_SIZE, IMAGE_BOOT_CODE},
{ FLASH_iSCSI_BIOS_START_g3, OPTYPE_BIOS, { BE3_ISCSI_BIOS_START, OPTYPE_BIOS,
FLASH_BIOS_IMAGE_MAX_SIZE_g3, IMAGE_OPTION_ROM_ISCSI}, BE3_BIOS_COMP_MAX_SIZE, IMAGE_OPTION_ROM_ISCSI},
{ FLASH_PXE_BIOS_START_g3, OPTYPE_PXE_BIOS, { BE3_PXE_BIOS_START, OPTYPE_PXE_BIOS,
FLASH_BIOS_IMAGE_MAX_SIZE_g3, IMAGE_OPTION_ROM_PXE}, BE3_BIOS_COMP_MAX_SIZE, IMAGE_OPTION_ROM_PXE},
{ FLASH_FCoE_BIOS_START_g3, OPTYPE_FCOE_BIOS, { BE3_FCOE_BIOS_START, OPTYPE_FCOE_BIOS,
FLASH_BIOS_IMAGE_MAX_SIZE_g3, IMAGE_OPTION_ROM_FCoE}, BE3_BIOS_COMP_MAX_SIZE, IMAGE_OPTION_ROM_FCOE},
{ FLASH_iSCSI_BACKUP_IMAGE_START_g3, OPTYPE_ISCSI_BACKUP, { BE3_ISCSI_BACKUP_IMAGE_START, OPTYPE_ISCSI_BACKUP,
FLASH_IMAGE_MAX_SIZE_g3, IMAGE_FIRMWARE_BACKUP_iSCSI}, BE3_COMP_MAX_SIZE, IMAGE_FIRMWARE_BACKUP_ISCSI},
{ FLASH_FCoE_PRIMARY_IMAGE_START_g3, OPTYPE_FCOE_FW_ACTIVE, { BE3_FCOE_PRIMARY_IMAGE_START, OPTYPE_FCOE_FW_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g3, IMAGE_FIRMWARE_FCoE}, BE3_COMP_MAX_SIZE, IMAGE_FIRMWARE_FCOE},
{ FLASH_FCoE_BACKUP_IMAGE_START_g3, OPTYPE_FCOE_FW_BACKUP, { BE3_FCOE_BACKUP_IMAGE_START, OPTYPE_FCOE_FW_BACKUP,
FLASH_IMAGE_MAX_SIZE_g3, IMAGE_FIRMWARE_BACKUP_FCoE}, BE3_COMP_MAX_SIZE, IMAGE_FIRMWARE_BACKUP_FCOE},
{ FLASH_NCSI_START_g3, OPTYPE_NCSI_FW, { BE3_NCSI_START, OPTYPE_NCSI_FW,
FLASH_NCSI_IMAGE_MAX_SIZE_g3, IMAGE_NCSI}, BE3_NCSI_COMP_MAX_SIZE, IMAGE_NCSI},
{ FLASH_PHY_FW_START_g3, OPTYPE_PHY_FW, { BE3_PHY_FW_START, OPTYPE_PHY_FW,
FLASH_PHY_FW_IMAGE_MAX_SIZE_g3, IMAGE_FIRMWARE_PHY} BE3_PHY_FW_COMP_MAX_SIZE, IMAGE_FIRMWARE_PHY}
}; };
struct flash_comp gen2_flash_types[] = { struct flash_comp gen2_flash_types[] = {
{ FLASH_iSCSI_PRIMARY_IMAGE_START_g2, OPTYPE_ISCSI_ACTIVE, { BE2_ISCSI_PRIMARY_IMAGE_START, OPTYPE_ISCSI_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g2, IMAGE_FIRMWARE_iSCSI}, BE2_COMP_MAX_SIZE, IMAGE_FIRMWARE_ISCSI},
{ FLASH_REDBOOT_START_g2, OPTYPE_REDBOOT, { BE2_REDBOOT_START, OPTYPE_REDBOOT,
FLASH_REDBOOT_IMAGE_MAX_SIZE_g2, IMAGE_BOOT_CODE}, BE2_REDBOOT_COMP_MAX_SIZE, IMAGE_BOOT_CODE},
{ FLASH_iSCSI_BIOS_START_g2, OPTYPE_BIOS, { BE2_ISCSI_BIOS_START, OPTYPE_BIOS,
FLASH_BIOS_IMAGE_MAX_SIZE_g2, IMAGE_OPTION_ROM_ISCSI}, BE2_BIOS_COMP_MAX_SIZE, IMAGE_OPTION_ROM_ISCSI},
{ FLASH_PXE_BIOS_START_g2, OPTYPE_PXE_BIOS, { BE2_PXE_BIOS_START, OPTYPE_PXE_BIOS,
FLASH_BIOS_IMAGE_MAX_SIZE_g2, IMAGE_OPTION_ROM_PXE}, BE2_BIOS_COMP_MAX_SIZE, IMAGE_OPTION_ROM_PXE},
{ FLASH_FCoE_BIOS_START_g2, OPTYPE_FCOE_BIOS, { BE2_FCOE_BIOS_START, OPTYPE_FCOE_BIOS,
FLASH_BIOS_IMAGE_MAX_SIZE_g2, IMAGE_OPTION_ROM_FCoE}, BE2_BIOS_COMP_MAX_SIZE, IMAGE_OPTION_ROM_FCOE},
{ FLASH_iSCSI_BACKUP_IMAGE_START_g2, OPTYPE_ISCSI_BACKUP, { BE2_ISCSI_BACKUP_IMAGE_START, OPTYPE_ISCSI_BACKUP,
FLASH_IMAGE_MAX_SIZE_g2, IMAGE_FIRMWARE_BACKUP_iSCSI}, BE2_COMP_MAX_SIZE, IMAGE_FIRMWARE_BACKUP_ISCSI},
{ FLASH_FCoE_PRIMARY_IMAGE_START_g2, OPTYPE_FCOE_FW_ACTIVE, { BE2_FCOE_PRIMARY_IMAGE_START, OPTYPE_FCOE_FW_ACTIVE,
FLASH_IMAGE_MAX_SIZE_g2, IMAGE_FIRMWARE_FCoE}, BE2_COMP_MAX_SIZE, IMAGE_FIRMWARE_FCOE},
{ FLASH_FCoE_BACKUP_IMAGE_START_g2, OPTYPE_FCOE_FW_BACKUP, { BE2_FCOE_BACKUP_IMAGE_START, OPTYPE_FCOE_FW_BACKUP,
FLASH_IMAGE_MAX_SIZE_g2, IMAGE_FIRMWARE_BACKUP_FCoE} BE2_COMP_MAX_SIZE, IMAGE_FIRMWARE_BACKUP_FCOE}
}; };
if (BE3_chip(adapter)) { if (BE3_chip(adapter)) {
...@@ -4729,7 +4729,7 @@ static u16 be_get_img_optype(struct flash_section_entry fsec_entry) ...@@ -4729,7 +4729,7 @@ static u16 be_get_img_optype(struct flash_section_entry fsec_entry)
return img_optype; return img_optype;
switch (img_type) { switch (img_type) {
case IMAGE_FIRMWARE_iSCSI: case IMAGE_FIRMWARE_ISCSI:
img_optype = OPTYPE_ISCSI_ACTIVE; img_optype = OPTYPE_ISCSI_ACTIVE;
break; break;
case IMAGE_BOOT_CODE: case IMAGE_BOOT_CODE:
...@@ -4741,10 +4741,10 @@ static u16 be_get_img_optype(struct flash_section_entry fsec_entry) ...@@ -4741,10 +4741,10 @@ static u16 be_get_img_optype(struct flash_section_entry fsec_entry)
case IMAGE_OPTION_ROM_PXE: case IMAGE_OPTION_ROM_PXE:
img_optype = OPTYPE_PXE_BIOS; img_optype = OPTYPE_PXE_BIOS;
break; break;
case IMAGE_OPTION_ROM_FCoE: case IMAGE_OPTION_ROM_FCOE:
img_optype = OPTYPE_FCOE_BIOS; img_optype = OPTYPE_FCOE_BIOS;
break; break;
case IMAGE_FIRMWARE_BACKUP_iSCSI: case IMAGE_FIRMWARE_BACKUP_ISCSI:
img_optype = OPTYPE_ISCSI_BACKUP; img_optype = OPTYPE_ISCSI_BACKUP;
break; break;
case IMAGE_NCSI: case IMAGE_NCSI:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册