Commit 05a9320f authored by Ben Hutchings's avatar Ben Hutchings

sfc: Update MCDI (firmware interface) definitions

Some commands and constants have been renamed; adjust the code
accordingly.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent 783b6bb6
...@@ -604,7 +604,7 @@ void efx_mcdi_process_event(struct efx_channel *channel, ...@@ -604,7 +604,7 @@ void efx_mcdi_process_event(struct efx_channel *channel,
void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
{ {
u8 outbuf[ALIGN(MC_CMD_GET_VERSION_V1_OUT_LEN, 4)]; u8 outbuf[ALIGN(MC_CMD_GET_VERSION_OUT_LEN, 4)];
size_t outlength; size_t outlength;
const __le16 *ver_words; const __le16 *ver_words;
int rc; int rc;
...@@ -616,7 +616,7 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len) ...@@ -616,7 +616,7 @@ void efx_mcdi_print_fwver(struct efx_nic *efx, char *buf, size_t len)
if (rc) if (rc)
goto fail; goto fail;
if (outlength < MC_CMD_GET_VERSION_V1_OUT_LEN) { if (outlength < MC_CMD_GET_VERSION_OUT_LEN) {
rc = -EIO; rc = -EIO;
goto fail; goto fail;
} }
...@@ -665,7 +665,7 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, ...@@ -665,7 +665,7 @@ int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, 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_LENMIN];
size_t outlen; size_t outlen;
int port_num = efx_port_num(efx); int port_num = efx_port_num(efx);
int offset; int offset;
...@@ -678,7 +678,7 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -678,7 +678,7 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
if (rc) if (rc)
goto fail; goto fail;
if (outlen < MC_CMD_GET_BOARD_CFG_OUT_LEN) { if (outlen < MC_CMD_GET_BOARD_CFG_OUT_LENMIN) {
rc = -EIO; rc = -EIO;
goto fail; goto fail;
} }
...@@ -691,7 +691,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address, ...@@ -691,7 +691,8 @@ int efx_mcdi_get_board_cfg(struct efx_nic *efx, u8 *mac_address,
if (fw_subtype_list) if (fw_subtype_list)
memcpy(fw_subtype_list, memcpy(fw_subtype_list,
outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST, outbuf + MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_OFST,
MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_LEN); MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM *
sizeof(fw_subtype_list[0]));
return 0; return 0;
...@@ -779,7 +780,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type, ...@@ -779,7 +780,7 @@ int efx_mcdi_nvram_info(struct efx_nic *efx, unsigned int type,
*size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_SIZE); *size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_SIZE);
*erase_size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_ERASESIZE); *erase_size_out = MCDI_DWORD(outbuf, NVRAM_INFO_OUT_ERASESIZE);
*protected_out = !!(MCDI_DWORD(outbuf, NVRAM_INFO_OUT_FLAGS) & *protected_out = !!(MCDI_DWORD(outbuf, NVRAM_INFO_OUT_FLAGS) &
(1 << MC_CMD_NVRAM_PROTECTED_LBN)); (1 << MC_CMD_NVRAM_INFO_OUT_PROTECTED_LBN));
return 0; return 0;
fail: fail:
...@@ -1060,7 +1061,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) ...@@ -1060,7 +1061,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
int efx_mcdi_reset_port(struct efx_nic *efx) int efx_mcdi_reset_port(struct efx_nic *efx)
{ {
int rc = efx_mcdi_rpc(efx, MC_CMD_PORT_RESET, NULL, 0, NULL, 0, NULL); int rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, NULL, 0, NULL, 0, NULL);
if (rc) if (rc)
netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n", netif_err(efx, hw, efx->net_dev, "%s: failed rc=%d\n",
__func__, rc); __func__, rc);
......
...@@ -84,7 +84,7 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, ...@@ -84,7 +84,7 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
u32 addr_hi; u32 addr_hi;
u32 addr_lo; u32 addr_lo;
BUILD_BUG_ON(MC_CMD_MAC_STATS_OUT_LEN != 0); BUILD_BUG_ON(MC_CMD_MAC_STATS_OUT_DMA_LEN != 0);
addr_lo = ((u64)dma_addr) >> 0; addr_lo = ((u64)dma_addr) >> 0;
addr_hi = ((u64)dma_addr) >> 32; addr_hi = ((u64)dma_addr) >> 32;
...@@ -93,13 +93,13 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, ...@@ -93,13 +93,13 @@ int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_ADDR_HI, addr_hi); MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_ADDR_HI, addr_hi);
cmd_ptr = (efx_dword_t *)MCDI_PTR(inbuf, MAC_STATS_IN_CMD); cmd_ptr = (efx_dword_t *)MCDI_PTR(inbuf, MAC_STATS_IN_CMD);
EFX_POPULATE_DWORD_7(*cmd_ptr, EFX_POPULATE_DWORD_7(*cmd_ptr,
MC_CMD_MAC_STATS_CMD_DMA, !!enable, MC_CMD_MAC_STATS_IN_DMA, !!enable,
MC_CMD_MAC_STATS_CMD_CLEAR, clear, MC_CMD_MAC_STATS_IN_CLEAR, clear,
MC_CMD_MAC_STATS_CMD_PERIODIC_CHANGE, 1, MC_CMD_MAC_STATS_IN_PERIODIC_CHANGE, 1,
MC_CMD_MAC_STATS_CMD_PERIODIC_ENABLE, !!enable, MC_CMD_MAC_STATS_IN_PERIODIC_ENABLE, !!enable,
MC_CMD_MAC_STATS_CMD_PERIODIC_CLEAR, 0, MC_CMD_MAC_STATS_IN_PERIODIC_CLEAR, 0,
MC_CMD_MAC_STATS_CMD_PERIODIC_NOEVENT, 1, MC_CMD_MAC_STATS_IN_PERIODIC_NOEVENT, 1,
MC_CMD_MAC_STATS_CMD_PERIOD_MS, period); MC_CMD_MAC_STATS_IN_PERIOD_MS, period);
MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len); MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len);
rc = efx_mcdi_rpc(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf), rc = efx_mcdi_rpc(efx, MC_CMD_MAC_STATS, inbuf, sizeof(inbuf),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -116,7 +116,7 @@ static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes) ...@@ -116,7 +116,7 @@ static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes)
goto fail; goto fail;
} }
*loopback_modes = MCDI_QWORD(outbuf, GET_LOOPBACK_MODES_SUGGESTED); *loopback_modes = MCDI_QWORD(outbuf, GET_LOOPBACK_MODES_OUT_SUGGESTED);
return 0; return 0;
...@@ -264,22 +264,22 @@ static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx) ...@@ -264,22 +264,22 @@ static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx)
/* TODO: Advertise the capabilities supported by this PHY */ /* TODO: Advertise the capabilities supported by this PHY */
supported = 0; supported = 0;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_TXDIS_LBN)) if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_TXDIS_LBN))
supported |= PHY_MODE_TX_DISABLED; supported |= PHY_MODE_TX_DISABLED;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_LOWPOWER_LBN)) if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_LOWPOWER_LBN))
supported |= PHY_MODE_LOW_POWER; supported |= PHY_MODE_LOW_POWER;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_POWEROFF_LBN)) if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_POWEROFF_LBN))
supported |= PHY_MODE_OFF; supported |= PHY_MODE_OFF;
mode = efx->phy_mode & supported; mode = efx->phy_mode & supported;
flags = 0; flags = 0;
if (mode & PHY_MODE_TX_DISABLED) if (mode & PHY_MODE_TX_DISABLED)
flags |= (1 << MC_CMD_SET_LINK_TXDIS_LBN); flags |= (1 << MC_CMD_SET_LINK_IN_TXDIS_LBN);
if (mode & PHY_MODE_LOW_POWER) if (mode & PHY_MODE_LOW_POWER)
flags |= (1 << MC_CMD_SET_LINK_LOWPOWER_LBN); flags |= (1 << MC_CMD_SET_LINK_IN_LOWPOWER_LBN);
if (mode & PHY_MODE_OFF) if (mode & PHY_MODE_OFF)
flags |= (1 << MC_CMD_SET_LINK_POWEROFF_LBN); flags |= (1 << MC_CMD_SET_LINK_IN_POWEROFF_LBN);
return flags; return flags;
} }
...@@ -436,8 +436,8 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx, ...@@ -436,8 +436,8 @@ void efx_mcdi_phy_decode_link(struct efx_nic *efx,
break; break;
} }
link_state->up = !!(flags & (1 << MC_CMD_GET_LINK_LINK_UP_LBN)); link_state->up = !!(flags & (1 << MC_CMD_GET_LINK_OUT_LINK_UP_LBN));
link_state->fd = !!(flags & (1 << MC_CMD_GET_LINK_FULL_DUPLEX_LBN)); link_state->fd = !!(flags & (1 << MC_CMD_GET_LINK_OUT_FULL_DUPLEX_LBN));
link_state->speed = speed; link_state->speed = speed;
} }
...@@ -592,7 +592,7 @@ static int efx_mcdi_phy_test_alive(struct efx_nic *efx) ...@@ -592,7 +592,7 @@ static int efx_mcdi_phy_test_alive(struct efx_nic *efx)
if (outlen < MC_CMD_GET_PHY_STATE_OUT_LEN) if (outlen < MC_CMD_GET_PHY_STATE_OUT_LEN)
return -EIO; return -EIO;
if (MCDI_DWORD(outbuf, GET_PHY_STATE_STATE) != MC_CMD_PHY_STATE_OK) if (MCDI_DWORD(outbuf, GET_PHY_STATE_OUT_STATE) != MC_CMD_PHY_STATE_OK)
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -680,7 +680,7 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, ...@@ -680,7 +680,7 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results,
u32 mode; u32 mode;
int rc; int rc;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_LBN)) { if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_LBN)) {
rc = efx_mcdi_bist(efx, MC_CMD_PHY_BIST, results); rc = efx_mcdi_bist(efx, MC_CMD_PHY_BIST, results);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -691,15 +691,15 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results, ...@@ -691,15 +691,15 @@ static int efx_mcdi_phy_run_tests(struct efx_nic *efx, int *results,
/* If we support both LONG and SHORT, then run each in response to /* If we support both LONG and SHORT, then run each in response to
* break or not. Otherwise, run the one we support */ * break or not. Otherwise, run the one we support */
mode = 0; mode = 0;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_SHORT_LBN)) { if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_SHORT_LBN)) {
if ((flags & ETH_TEST_FL_OFFLINE) && if ((flags & ETH_TEST_FL_OFFLINE) &&
(phy_cfg->flags & (phy_cfg->flags &
(1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_LONG_LBN))) (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_LONG_LBN)))
mode = MC_CMD_PHY_BIST_CABLE_LONG; mode = MC_CMD_PHY_BIST_CABLE_LONG;
else else
mode = MC_CMD_PHY_BIST_CABLE_SHORT; mode = MC_CMD_PHY_BIST_CABLE_SHORT;
} else if (phy_cfg->flags & } else if (phy_cfg->flags &
(1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_LONG_LBN)) (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_LONG_LBN))
mode = MC_CMD_PHY_BIST_CABLE_LONG; mode = MC_CMD_PHY_BIST_CABLE_LONG;
if (mode != 0) { if (mode != 0) {
...@@ -717,14 +717,14 @@ static const char *efx_mcdi_phy_test_name(struct efx_nic *efx, ...@@ -717,14 +717,14 @@ static const char *efx_mcdi_phy_test_name(struct efx_nic *efx,
{ {
struct efx_mcdi_phy_data *phy_cfg = efx->phy_data; struct efx_mcdi_phy_data *phy_cfg = efx->phy_data;
if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_BIST_LBN)) { if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_LBN)) {
if (index == 0) if (index == 0)
return "bist"; return "bist";
--index; --index;
} }
if (phy_cfg->flags & ((1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_SHORT_LBN) | if (phy_cfg->flags & ((1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_SHORT_LBN) |
(1 << MC_CMD_GET_PHY_CFG_BIST_CABLE_LONG_LBN))) { (1 << MC_CMD_GET_PHY_CFG_OUT_BIST_CABLE_LONG_LBN))) {
if (index == 0) if (index == 0)
return "cable"; return "cable";
--index; --index;
......
...@@ -627,8 +627,7 @@ static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, ...@@ -627,8 +627,7 @@ 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_LEN / uint16_t fw_subtype_list[MC_CMD_GET_BOARD_CFG_OUT_FW_SUBTYPE_LIST_MINNUM];
sizeof(uint16_t)];
int rc; int rc;
rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list); rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list);
......
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