aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-09-06 19:58:10 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-09-18 21:56:16 -0400
commitbfeed902946a31692e7a24ed355b6d13ac37d014 (patch)
tree4765f35704a687d1132565f966d8d3d03f165874
parent7c236c43b838221e17220bcb39e8e8d8c7123713 (diff)
sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()
On big-endian systems the MTD partition names currently have mangled subtype numbers and are not recognised by the firmware update tool (sfupdate). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--drivers/net/ethernet/sfc/mcdi.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 294df4bca4a6..578e5f72aabe 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -661,9 +661,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
661 u16 *fw_subtype_list, u32 *capabilities) 661 u16 *fw_subtype_list, u32 *capabilities)
662{ 662{
663 uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN]; 663 uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LENMIN];
664 size_t outlen; 664 size_t outlen, offset, i;
665 int port_num = efx_port_num(efx); 665 int port_num = efx_port_num(efx);
666 int offset;
667 int rc; 666 int rc;
668 667
669 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0); 668 BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);
@@ -683,11 +682,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
683 : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST; 682 : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;
684 if (mac_address) 683 if (mac_address)
685 memcpy(mac_address, outbuf + offset, ETH_ALEN); 684 memcpy(mac_address, outbuf + offset, ETH_ALEN);
686 if (fw_subtype_list) 685 if (fw_subtype_list) {
687 memcpy(fw_subtype_list, 686 offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
688 outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, 687 for (i = 0;
689 MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM * 688 i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM;
690 sizeof(fw_subtype_list[0])); 689 i++) {
690 fw_subtype_list[i] =
691 le16_to_cpup((__le16 *)(outbuf + offset));
692 offset += 2;
693 }
694 }
691 if (capabilities) { 695 if (capabilities) {
692 if (port_num) 696 if (port_num)
693 *capabilities = MCDI_DWORD(outbuf, 697 *capabilities = MCDI_DWORD(outbuf,