diff options
author | Ajit Khaparde <ajitk@serverengines.com> | 2010-03-30 21:57:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-01 20:25:58 -0400 |
commit | 8b93b710a9cd70d67013b4b0f00df7dfda058064 (patch) | |
tree | 67a831ec17c9049261732d550526a0ae980065ee | |
parent | f510fc64cce4646a1fd3c7e5ba7e36cad7e98f02 (diff) |
be2net: fix flashing on big endian architectures
Flashing is broken on big endian architectures like ppc.
This patch fixes it.
From: Naresh G <nareshg@serverengines.com>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/benet/be_cmds.c | 4 | ||||
-rw-r--r-- | drivers/net/benet/be_main.c | 15 |
2 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 50e6259b50e4..d0ef4ac987cd 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -1464,8 +1464,8 @@ int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, | |||
1464 | 1464 | ||
1465 | req->params.op_type = cpu_to_le32(IMG_TYPE_REDBOOT); | 1465 | req->params.op_type = cpu_to_le32(IMG_TYPE_REDBOOT); |
1466 | req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT); | 1466 | req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT); |
1467 | req->params.offset = offset; | 1467 | req->params.offset = cpu_to_le32(offset); |
1468 | req->params.data_buf_size = 0x4; | 1468 | req->params.data_buf_size = cpu_to_le32(0x4); |
1469 | 1469 | ||
1470 | status = be_mcc_notify_wait(adapter); | 1470 | status = be_mcc_notify_wait(adapter); |
1471 | if (!status) | 1471 | if (!status) |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index a08faf3c8e1c..b0faaa204c7c 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1991,7 +1991,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *func) | |||
1991 | struct flash_file_hdr_g3 *fhdr3; | 1991 | struct flash_file_hdr_g3 *fhdr3; |
1992 | struct image_hdr *img_hdr_ptr = NULL; | 1992 | struct image_hdr *img_hdr_ptr = NULL; |
1993 | struct be_dma_mem flash_cmd; | 1993 | struct be_dma_mem flash_cmd; |
1994 | int status, i = 0; | 1994 | int status, i = 0, num_imgs = 0; |
1995 | const u8 *p; | 1995 | const u8 *p; |
1996 | 1996 | ||
1997 | strcpy(fw_file, func); | 1997 | strcpy(fw_file, func); |
@@ -2017,15 +2017,14 @@ int be_load_fw(struct be_adapter *adapter, u8 *func) | |||
2017 | if ((adapter->generation == BE_GEN3) && | 2017 | if ((adapter->generation == BE_GEN3) && |
2018 | (get_ufigen_type(fhdr) == BE_GEN3)) { | 2018 | (get_ufigen_type(fhdr) == BE_GEN3)) { |
2019 | fhdr3 = (struct flash_file_hdr_g3 *) fw->data; | 2019 | fhdr3 = (struct flash_file_hdr_g3 *) fw->data; |
2020 | for (i = 0; i < fhdr3->num_imgs; i++) { | 2020 | num_imgs = le32_to_cpu(fhdr3->num_imgs); |
2021 | for (i = 0; i < num_imgs; i++) { | ||
2021 | img_hdr_ptr = (struct image_hdr *) (fw->data + | 2022 | img_hdr_ptr = (struct image_hdr *) (fw->data + |
2022 | (sizeof(struct flash_file_hdr_g3) + | 2023 | (sizeof(struct flash_file_hdr_g3) + |
2023 | i * sizeof(struct image_hdr))); | 2024 | i * sizeof(struct image_hdr))); |
2024 | if (img_hdr_ptr->imageid == 1) { | 2025 | if (le32_to_cpu(img_hdr_ptr->imageid) == 1) |
2025 | status = be_flash_data(adapter, fw, | 2026 | status = be_flash_data(adapter, fw, &flash_cmd, |
2026 | &flash_cmd, fhdr3->num_imgs); | 2027 | num_imgs); |
2027 | } | ||
2028 | |||
2029 | } | 2028 | } |
2030 | } else if ((adapter->generation == BE_GEN2) && | 2029 | } else if ((adapter->generation == BE_GEN2) && |
2031 | (get_ufigen_type(fhdr) == BE_GEN2)) { | 2030 | (get_ufigen_type(fhdr) == BE_GEN2)) { |