sfxge: convert nvram size method to use partition id

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4910
This commit is contained in:
Andrew Rybchenko 2016-01-14 09:01:53 +00:00
parent fd7501bf79
commit 56bd83b0c5
6 changed files with 24 additions and 82 deletions

View File

@ -480,7 +480,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_size)(efx_nic_t *, efx_nvram_type_t, size_t *);
efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t,
uint32_t *, uint16_t *);
efx_rc_t (*envo_rw_start)(efx_nic_t *, efx_nvram_type_t, size_t *);
@ -495,6 +494,7 @@ typedef struct efx_nvram_ops_s {
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 *);
} 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_size, /* envo_size */
falcon_nvram_get_version, /* envo_get_version */
falcon_nvram_rw_start, /* envo_rw_start */
falcon_nvram_read_chunk, /* envo_read_chunk */
@ -51,6 +50,7 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
falcon_nvram_rw_finish, /* envo_rw_finish */
falcon_nvram_set_version, /* envo_set_version */
falcon_nvram_type_to_partn, /* envo_type_to_partn */
falcon_nvram_partn_size, /* envo_partn_size */
};
#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_size, /* envo_size */
siena_nvram_get_version, /* envo_get_version */
siena_nvram_rw_start, /* envo_rw_start */
siena_nvram_read_chunk, /* envo_read_chunk */
@ -70,6 +69,7 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
siena_nvram_rw_finish, /* envo_rw_finish */
siena_nvram_set_version, /* envo_set_version */
siena_nvram_type_to_partn, /* envo_type_to_partn */
siena_nvram_partn_size, /* envo_partn_size */
};
#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_size, /* envo_size */
ef10_nvram_get_version, /* envo_get_version */
ef10_nvram_rw_start, /* envo_rw_start */
ef10_nvram_read_chunk, /* envo_read_chunk */
@ -89,6 +88,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
ef10_nvram_rw_finish, /* envo_rw_finish */
ef10_nvram_set_version, /* envo_set_version */
ef10_nvram_type_to_partn, /* envo_type_to_partn */
ef10_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@ -178,6 +178,7 @@ efx_nvram_size(
__out size_t *sizep)
{
efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@ -185,13 +186,19 @@ efx_nvram_size(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
if ((rc = envop->envo_size(enp, type, sizep)) != 0)
if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
if ((rc = envop->envo_partn_size(enp, partn, sizep)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
*sizep = 0;
return (rc);
}

View File

@ -369,12 +369,6 @@ ef10_nvram_partn_write_segment_tlv(
__in size_t size,
__in boolean_t all_segments);
extern __checkReturn efx_rc_t
ef10_nvram_partn_size(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *sizep);
extern __checkReturn efx_rc_t
ef10_nvram_partn_lock(
__in efx_nic_t *enp,
@ -420,12 +414,6 @@ ef10_nvram_test(
#endif /* EFSYS_OPT_DIAG */
extern __checkReturn efx_rc_t
ef10_nvram_size(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__out size_t *sizep);
extern __checkReturn efx_rc_t
ef10_nvram_get_version(
__in efx_nic_t *enp,
@ -483,6 +471,12 @@ ef10_nvram_type_to_partn(
__in efx_nvram_type_t type,
__out uint32_t *partnp);
extern __checkReturn efx_rc_t
ef10_nvram_partn_size(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *sizep);
#endif /* EFSYS_OPT_NVRAM */

View File

@ -1708,33 +1708,6 @@ ef10_nvram_test(
#endif /* EFSYS_OPT_DIAG */
__checkReturn efx_rc_t
ef10_nvram_size(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__out size_t *sizep)
{
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_size(enp, partn, sizep)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
*sizep = 0;
return (rc);
}
__checkReturn efx_rc_t
ef10_nvram_get_version(
__in efx_nic_t *enp,

View File

@ -155,12 +155,6 @@ siena_mcdi_feature_supported(
#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
extern __checkReturn efx_rc_t
siena_nvram_partn_size(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *sizep);
extern __checkReturn efx_rc_t
siena_nvram_partn_lock(
__in efx_nic_t *enp,
@ -214,12 +208,6 @@ siena_nvram_test(
#endif /* EFSYS_OPT_DIAG */
extern __checkReturn efx_rc_t
siena_nvram_size(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__out size_t *sizep);
extern __checkReturn efx_rc_t
siena_nvram_get_subtype(
__in efx_nic_t *enp,
@ -277,6 +265,12 @@ siena_nvram_type_to_partn(
__in efx_nvram_type_t type,
__out uint32_t *partnp);
extern __checkReturn efx_rc_t
siena_nvram_partn_size(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *sizep);
#endif /* EFSYS_OPT_NVRAM */
#if EFSYS_OPT_VPD

View File

@ -291,32 +291,6 @@ siena_nvram_test(
#endif /* EFSYS_OPT_DIAG */
__checkReturn efx_rc_t
siena_nvram_size(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
__out size_t *sizep)
{
uint32_t partn;
efx_rc_t rc;
if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
if ((rc = siena_nvram_partn_size(enp, partn, sizep)) != 0)
goto fail2;
return (0);
fail2:
EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
*sizep = 0;
return (rc);
}
#define SIENA_DYNAMIC_CFG_SIZE(_nitems) \
(sizeof (siena_mc_dynamic_config_hdr_t) + ((_nitems) * \