Commit e3f5ec11 authored by Ben Hutchings's avatar Ben Hutchings

sfc: Support variable-length response to MCDI GET_BOARD_CFG

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent bfeed902
...@@ -683,12 +683,14 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -683,12 +683,14 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
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) {
/* Byte-swap and truncate or zero-pad as necessary */
offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST; offset = MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST;
for (i = 0; for (i = 0;
i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM; i < MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM;
i++) { i++) {
fw_subtype_list[i] = fw_subtype_list[i] =
le16_to_cpup((__le16 *)(outbuf + offset)); (offset + 2 <= outlen) ?
le16_to_cpup((__le16 *)(outbuf + offset)) : 0;
offset += 2; offset += 2;
} }
} }
......
...@@ -627,7 +627,8 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, ...@@ -627,7 +627,8 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx,
struct efx_mtd *efx_mtd) struct efx_mtd *efx_mtd)
{ {
struct efx_mtd_partition *part; struct efx_mtd_partition *part;
uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM]; uint16_t fw_subtype_list[
MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MAXNUM];
int rc; int rc;
rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL); rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL);
......
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