sfxge: convert nvram rw_finish 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:14:43 +00:00
parent 134c4c4a6c
commit eb9703da94
6 changed files with 24 additions and 29 deletions

View File

@ -486,7 +486,6 @@ typedef struct efx_nvram_ops_s {
#endif /* EFSYS_OPT_DIAG */ #endif /* EFSYS_OPT_DIAG */
efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t, efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t,
uint32_t *, uint16_t *); uint32_t *, uint16_t *);
void (*envo_rw_finish)(efx_nic_t *, efx_nvram_type_t);
efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t, efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t,
uint16_t *); uint16_t *);
@ -500,6 +499,7 @@ typedef struct efx_nvram_ops_s {
unsigned int, size_t); unsigned int, size_t);
efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t, efx_rc_t (*envo_partn_write)(efx_nic_t *, uint32_t,
unsigned int, caddr_t, size_t); unsigned int, caddr_t, size_t);
void (*envo_partn_rw_finish)(efx_nic_t *, uint32_t);
} efx_nvram_ops_t; } efx_nvram_ops_t;
#endif /* EFSYS_OPT_NVRAM */ #endif /* EFSYS_OPT_NVRAM */

View File

@ -43,7 +43,6 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
falcon_nvram_test, /* envo_test */ falcon_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */ #endif /* EFSYS_OPT_DIAG */
falcon_nvram_get_version, /* envo_get_version */ falcon_nvram_get_version, /* envo_get_version */
falcon_nvram_rw_finish, /* envo_rw_finish */
falcon_nvram_set_version, /* envo_set_version */ falcon_nvram_set_version, /* envo_set_version */
falcon_nvram_type_to_partn, /* envo_type_to_partn */ falcon_nvram_type_to_partn, /* envo_type_to_partn */
falcon_nvram_partn_size, /* envo_partn_size */ falcon_nvram_partn_size, /* envo_partn_size */
@ -51,6 +50,7 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = {
falcon_nvram_partn_read, /* envo_partn_read */ falcon_nvram_partn_read, /* envo_partn_read */
falcon_nvram_partn_erase, /* envo_partn_erase */ falcon_nvram_partn_erase, /* envo_partn_erase */
falcon_nvram_partn_write, /* envo_partn_write */ falcon_nvram_partn_write, /* envo_partn_write */
falcon_nvram_partn_rw_finish, /* envo_partn_rw_finish */
}; };
#endif /* EFSYS_OPT_FALCON */ #endif /* EFSYS_OPT_FALCON */
@ -62,7 +62,6 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
siena_nvram_test, /* envo_test */ siena_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */ #endif /* EFSYS_OPT_DIAG */
siena_nvram_get_version, /* envo_get_version */ siena_nvram_get_version, /* envo_get_version */
siena_nvram_rw_finish, /* envo_rw_finish */
siena_nvram_set_version, /* envo_set_version */ siena_nvram_set_version, /* envo_set_version */
siena_nvram_type_to_partn, /* envo_type_to_partn */ siena_nvram_type_to_partn, /* envo_type_to_partn */
siena_nvram_partn_size, /* envo_partn_size */ siena_nvram_partn_size, /* envo_partn_size */
@ -70,6 +69,7 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = {
siena_nvram_partn_read, /* envo_partn_read */ siena_nvram_partn_read, /* envo_partn_read */
siena_nvram_partn_erase, /* envo_partn_erase */ siena_nvram_partn_erase, /* envo_partn_erase */
siena_nvram_partn_write, /* envo_partn_write */ siena_nvram_partn_write, /* envo_partn_write */
siena_nvram_partn_rw_finish, /* envo_partn_rw_finish */
}; };
#endif /* EFSYS_OPT_SIENA */ #endif /* EFSYS_OPT_SIENA */
@ -81,7 +81,6 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
ef10_nvram_test, /* envo_test */ ef10_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */ #endif /* EFSYS_OPT_DIAG */
ef10_nvram_get_version, /* envo_get_version */ ef10_nvram_get_version, /* envo_get_version */
ef10_nvram_rw_finish, /* envo_rw_finish */
ef10_nvram_set_version, /* envo_set_version */ ef10_nvram_set_version, /* envo_set_version */
ef10_nvram_type_to_partn, /* envo_type_to_partn */ ef10_nvram_type_to_partn, /* envo_type_to_partn */
ef10_nvram_partn_size, /* envo_partn_size */ ef10_nvram_partn_size, /* envo_partn_size */
@ -89,6 +88,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = {
ef10_nvram_partn_read, /* envo_partn_read */ ef10_nvram_partn_read, /* envo_partn_read */
ef10_nvram_partn_erase, /* envo_partn_erase */ ef10_nvram_partn_erase, /* envo_partn_erase */
ef10_nvram_partn_write, /* envo_partn_write */ ef10_nvram_partn_write, /* envo_partn_write */
ef10_nvram_partn_rw_finish, /* envo_partn_rw_finish */
}; };
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@ -384,6 +384,7 @@ efx_nvram_rw_finish(
__in efx_nvram_type_t type) __in efx_nvram_type_t type)
{ {
efx_nvram_ops_t *envop = enp->en_envop; efx_nvram_ops_t *envop = enp->en_envop;
uint32_t partn;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM); EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
@ -393,7 +394,8 @@ efx_nvram_rw_finish(
EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type); EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type);
envop->envo_rw_finish(enp, type); if (envop->envo_type_to_partn(enp, type, &partn) == 0)
envop->envo_partn_rw_finish(enp, partn);
enp->en_nvram_locked = EFX_NVRAM_INVALID; enp->en_nvram_locked = EFX_NVRAM_INVALID;
} }

View File

@ -393,11 +393,6 @@ ef10_nvram_get_version(
__out uint32_t *subtypep, __out uint32_t *subtypep,
__out_ecount(4) uint16_t version[4]); __out_ecount(4) uint16_t version[4]);
extern void
ef10_nvram_rw_finish(
__in efx_nic_t *enp,
__in efx_nvram_type_t type);
extern __checkReturn efx_rc_t extern __checkReturn efx_rc_t
ef10_nvram_partn_set_version( ef10_nvram_partn_set_version(
__in efx_nic_t *enp, __in efx_nic_t *enp,
@ -451,6 +446,11 @@ ef10_nvram_partn_write(
__out_bcount(size) caddr_t data, __out_bcount(size) caddr_t data,
__in size_t size); __in size_t size);
extern void
ef10_nvram_partn_rw_finish(
__in efx_nic_t *enp,
__in uint32_t partn);
#endif /* EFSYS_OPT_NVRAM */ #endif /* EFSYS_OPT_NVRAM */

View File

@ -1769,15 +1769,11 @@ ef10_nvram_partn_rw_start(
} }
void void
ef10_nvram_rw_finish( ef10_nvram_partn_rw_finish(
__in efx_nic_t *enp, __in efx_nic_t *enp,
__in efx_nvram_type_t type) __in uint32_t partn)
{ {
uint32_t partn; ef10_nvram_partn_unlock(enp, partn);
efx_rc_t rc;
if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) == 0)
ef10_nvram_partn_unlock(enp, partn);
} }
__checkReturn efx_rc_t __checkReturn efx_rc_t

View File

@ -193,11 +193,6 @@ siena_nvram_get_version(
__out uint32_t *subtypep, __out uint32_t *subtypep,
__out_ecount(4) uint16_t version[4]); __out_ecount(4) uint16_t version[4]);
extern void
siena_nvram_rw_finish(
__in efx_nic_t *enp,
__in efx_nvram_type_t type);
extern __checkReturn efx_rc_t extern __checkReturn efx_rc_t
siena_nvram_set_version( siena_nvram_set_version(
__in efx_nic_t *enp, __in efx_nic_t *enp,
@ -245,6 +240,12 @@ siena_nvram_partn_write(
__out_bcount(size) caddr_t data, __out_bcount(size) caddr_t data,
__in size_t size); __in size_t size);
extern void
siena_nvram_partn_rw_finish(
__in efx_nic_t *enp,
__in uint32_t partn);
#endif /* EFSYS_OPT_NVRAM */ #endif /* EFSYS_OPT_NVRAM */
#if EFSYS_OPT_VPD #if EFSYS_OPT_VPD

View File

@ -594,15 +594,11 @@ siena_nvram_partn_rw_start(
} }
void void
siena_nvram_rw_finish( siena_nvram_partn_rw_finish(
__in efx_nic_t *enp, __in efx_nic_t *enp,
__in efx_nvram_type_t type) __in uint32_t partn)
{ {
uint32_t partn; siena_nvram_partn_unlock(enp, partn);
efx_rc_t rc;
if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) == 0)
siena_nvram_partn_unlock(enp, partn);
} }
__checkReturn efx_rc_t __checkReturn efx_rc_t