sfxge: convert nvram set_version method to use partition id

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
This commit is contained in:
Andrew Rybchenko 2016-01-18 06:18:01 +00:00
parent 9218711910
commit 6d0b856c80
6 changed files with 27 additions and 57 deletions

View File

@ -484,9 +484,6 @@ typedef struct efx_nvram_ops_s {
#if EFSYS_OPT_DIAG
efx_rc_t (*envo_test)(efx_nic_t *);
#endif /* EFSYS_OPT_DIAG */
efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t,
uint16_t *);
efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
uint32_t *);
efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *);
@ -500,6 +497,8 @@ typedef struct efx_nvram_ops_s {
void (*envo_partn_rw_finish)(efx_nic_t *, uint32_t);
efx_rc_t (*envo_partn_get_version)(efx_nic_t *, uint32_t,
uint32_t *, uint16_t *);
efx_rc_t (*envo_partn_set_version)(efx_nic_t *, uint32_t,
uint16_t *);
} efx_nvram_ops_t;
#endif /* EFSYS_OPT_NVRAM */

View File

@ -42,7 +42,6 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
#if EFSYS_OPT_DIAG
falcon_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
falcon_nvram_set_version, /* envo_set_version */
falcon_nvram_type_to_partn, /* envo_type_to_partn */
falcon_nvram_partn_size, /* envo_partn_size */
falcon_nvram_partn_rw_start, /* envo_partn_rw_start */
@ -51,6 +50,7 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
falcon_nvram_partn_write, /* envo_partn_write */
falcon_nvram_partn_rw_finish, /* envo_partn_rw_finish */
falcon_nvram_partn_get_version, /* envo_partn_get_version */
falcon_nvram_partn_set_version, /* envo_partn_set_version */
};
#endif /* EFSYS_OPT_FALCON */
@ -61,7 +61,6 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
#if EFSYS_OPT_DIAG
siena_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
siena_nvram_set_version, /* envo_set_version */
siena_nvram_type_to_partn, /* envo_type_to_partn */
siena_nvram_partn_size, /* envo_partn_size */
siena_nvram_partn_rw_start, /* envo_partn_rw_start */
@ -70,6 +69,7 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
siena_nvram_partn_write, /* envo_partn_write */
siena_nvram_partn_rw_finish, /* envo_partn_rw_finish */
siena_nvram_partn_get_version, /* envo_partn_get_version */
siena_nvram_partn_set_version, /* envo_partn_set_version */
};
#endif /* EFSYS_OPT_SIENA */
@ -80,7 +80,6 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
#if EFSYS_OPT_DIAG
ef10_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
ef10_nvram_set_version, /* envo_set_version */
ef10_nvram_type_to_partn, /* envo_type_to_partn */
ef10_nvram_partn_size, /* envo_partn_size */
ef10_nvram_partn_rw_start, /* envo_partn_rw_start */
@ -89,6 +88,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
ef10_nvram_partn_write, /* envo_partn_write */
ef10_nvram_partn_rw_finish, /* envo_partn_rw_finish */
ef10_nvram_partn_get_version, /* envo_partn_get_version */
ef10_nvram_partn_set_version, /* envo_partn_set_version */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@ -414,6 +414,7 @@ efx_nvram_set_version(
__in_ecount(4) uint16_t version[4])
{
efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@ -429,11 +430,16 @@ efx_nvram_set_version(
*/
EFSYS_ASSERT3U(enp->en_nvram_locked, ==, EFX_NVRAM_INVALID);
if ((rc = envop->envo_set_version(enp, type, version)) != 0)
if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
if ((rc = envop->envo_partn_set_version(enp, partn, version)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);

View File

@ -386,18 +386,6 @@ ef10_nvram_test(
#endif /* EFSYS_OPT_DIAG */
extern __checkReturn efx_rc_t
ef10_nvram_partn_set_version(
__in efx_nic_t *enp,
__in uint32_t partn,
__in_ecount(4) uint16_t version[4]);
extern __checkReturn efx_rc_t
ef10_nvram_set_version(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__in_ecount(4) uint16_t version[4]);
extern __checkReturn efx_rc_t
ef10_nvram_type_to_partn(
__in efx_nic_t *enp,
@ -451,6 +439,12 @@ ef10_nvram_partn_get_version(
__out uint32_t *subtypep,
__out_ecount(4) uint16_t version[4]);
extern __checkReturn efx_rc_t
ef10_nvram_partn_set_version(
__in efx_nic_t *enp,
__in uint32_t partn,
__in_ecount(4) uint16_t version[4]);
#endif /* EFSYS_OPT_NVRAM */

View File

@ -1770,31 +1770,6 @@ ef10_nvram_partn_rw_finish(
ef10_nvram_partn_unlock(enp, partn);
}
__checkReturn efx_rc_t
ef10_nvram_set_version(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__in_ecount(4) uint16_t version[4])
{
uint32_t partn;
efx_rc_t rc;
if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
if ((rc = ef10_nvram_partn_set_version(enp, partn, version)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
#endif /* EFSYS_OPT_NVRAM */
#endif /* EFSYS_OPT_HUNTINGTON */

View File

@ -186,12 +186,6 @@ siena_nvram_get_subtype(
__in uint32_t partn,
__out uint32_t *subtypep);
extern __checkReturn efx_rc_t
siena_nvram_set_version(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__in_ecount(4) uint16_t version[4]);
extern __checkReturn efx_rc_t
siena_nvram_type_to_partn(
__in efx_nic_t *enp,
@ -245,6 +239,11 @@ siena_nvram_partn_get_version(
__out uint32_t *subtypep,
__out_ecount(4) uint16_t version[4]);
extern __checkReturn efx_rc_t
siena_nvram_partn_set_version(
__in efx_nic_t *enp,
__in uint32_t partn,
__in_ecount(4) uint16_t version[4]);
#endif /* EFSYS_OPT_NVRAM */

View File

@ -594,15 +594,15 @@ siena_nvram_partn_rw_finish(
}
__checkReturn efx_rc_t
siena_nvram_set_version(
siena_nvram_partn_set_version(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__in uint32_t partn,
__in_ecount(4) uint16_t version[4])
{
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
siena_mc_dynamic_config_hdr_t *dcfg = NULL;
siena_mc_fw_version_t *fwverp;
uint32_t dcfg_partn, partn;
uint32_t dcfg_partn;
size_t dcfg_size;
unsigned int hdr_length;
unsigned int vpd_length;
@ -615,15 +615,12 @@ siena_nvram_set_version(
size_t length;
efx_rc_t rc;
if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
dcfg_partn = (emip->emi_port == 1)
? MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT0
: MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT1;
if ((rc = siena_nvram_partn_size(enp, dcfg_partn, &dcfg_size)) != 0)
goto fail2;
goto fail1;
if ((rc = siena_nvram_partn_lock(enp, dcfg_partn)) != 0)
goto fail2;