Commit 75d09c02 authored by Ben Hutchings's avatar Ben Hutchings Committed by Ben Hutchings

sfc: Convert firmware subtypes to native byte order in efx_mcdi_get_board_cfg()

[ Upstream commit bfeed902 ]

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: default avatarBen Hutchings <bhutchings@solarflare.com>
[bwh: Backported to 3.2: use old macros for length of firmware subtype array]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 1f3559e7
...@@ -666,9 +666,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -666,9 +666,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
u16 *fw_subtype_list) u16 *fw_subtype_list)
{ {
uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN]; uint8_t outbuf[MC_CMD_GET_BOARD_CFG_OUT_LEN];
size_t outlen; size_t outlen, offset, i;
int port_num = efx_port_num(efx); int port_num = efx_port_num(efx);
int offset;
int rc; int rc;
BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0); BUILD_BUG_ON(MC_CMD_GET_BOARD_CFG_IN_LEN != 0);
...@@ -688,10 +687,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -688,10 +687,16 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
: MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST; : MC_CMD_GET_BOARD_CFG_OUT_MAC_ADDR_BASE_PORT0_OFST;
if (mac_address) if (mac_address)
memcpy(mac_address, outbuf + offset, ETH_ALEN); memcpy(mac_address, outbuf + offset, ETH_ALEN);
if (fw_subtype_list) if (fw_subtype_list) {
memcpy(fw_subtype_list, offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, for (i = 0;
MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN); i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN / 2;
i++) {
fw_subtype_list[i] =
le16_to_cpup((__le16 *)(outbuf + offset));
offset += 2;
}
}
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment