Date: Sun, 17 Jan 2016 05:12:37 +0000 (UTC) From: Andrew Rybchenko <arybchik@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294201 - head/sys/dev/sfxge/common Message-ID: <201601170512.u0H5CbM3055654@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arybchik Date: Sun Jan 17 05:12:37 2016 New Revision: 294201 URL: https://svnweb.freebsd.org/changeset/base/294201 Log: sfxge: convert nvram erase method to use partition id Submitted by: Andy Moreton <amoreton at solarflare.com> Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D4957 Modified: head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_nvram.c head/sys/dev/sfxge/common/hunt_impl.h head/sys/dev/sfxge/common/hunt_nvram.c head/sys/dev/sfxge/common/siena_impl.h head/sys/dev/sfxge/common/siena_nvram.c Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Sun Jan 17 01:04:20 2016 (r294200) +++ head/sys/dev/sfxge/common/efx_impl.h Sun Jan 17 05:12:37 2016 (r294201) @@ -486,7 +486,6 @@ typedef struct efx_nvram_ops_s { #endif /* EFSYS_OPT_DIAG */ efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t, uint32_t *, uint16_t *); - efx_rc_t (*envo_erase)(efx_nic_t *, efx_nvram_type_t); efx_rc_t (*envo_write_chunk)(efx_nic_t *, efx_nvram_type_t, unsigned int, caddr_t, size_t); void (*envo_rw_finish)(efx_nic_t *, efx_nvram_type_t); @@ -499,6 +498,8 @@ typedef struct efx_nvram_ops_s { efx_rc_t (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *); efx_rc_t (*envo_partn_read)(efx_nic_t *, uint32_t, unsigned int, caddr_t, size_t); + efx_rc_t (*envo_partn_erase)(efx_nic_t *, uint32_t, + unsigned int, size_t); } efx_nvram_ops_t; #endif /* EFSYS_OPT_NVRAM */ Modified: head/sys/dev/sfxge/common/efx_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/efx_nvram.c Sun Jan 17 01:04:20 2016 (r294200) +++ head/sys/dev/sfxge/common/efx_nvram.c Sun Jan 17 05:12:37 2016 (r294201) @@ -43,7 +43,6 @@ static efx_nvram_ops_t __efx_nvram_falco falcon_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ falcon_nvram_get_version, /* envo_get_version */ - falcon_nvram_erase, /* envo_erase */ falcon_nvram_write_chunk, /* envo_write_chunk */ falcon_nvram_rw_finish, /* envo_rw_finish */ falcon_nvram_set_version, /* envo_set_version */ @@ -51,6 +50,7 @@ static efx_nvram_ops_t __efx_nvram_falco falcon_nvram_partn_size, /* envo_partn_size */ falcon_nvram_partn_rw_start, /* envo_partn_rw_start */ falcon_nvram_partn_read, /* envo_partn_read */ + falcon_nvram_partn_erase, /* envo_partn_erase */ }; #endif /* EFSYS_OPT_FALCON */ @@ -62,7 +62,6 @@ static efx_nvram_ops_t __efx_nvram_siena siena_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ siena_nvram_get_version, /* envo_get_version */ - siena_nvram_erase, /* envo_erase */ siena_nvram_write_chunk, /* envo_write_chunk */ siena_nvram_rw_finish, /* envo_rw_finish */ siena_nvram_set_version, /* envo_set_version */ @@ -70,6 +69,7 @@ static efx_nvram_ops_t __efx_nvram_siena siena_nvram_partn_size, /* envo_partn_size */ siena_nvram_partn_rw_start, /* envo_partn_rw_start */ siena_nvram_partn_read, /* envo_partn_read */ + siena_nvram_partn_erase, /* envo_partn_erase */ }; #endif /* EFSYS_OPT_SIENA */ @@ -81,7 +81,6 @@ static efx_nvram_ops_t __efx_nvram_ef10_ ef10_nvram_test, /* envo_test */ #endif /* EFSYS_OPT_DIAG */ ef10_nvram_get_version, /* envo_get_version */ - ef10_nvram_erase, /* envo_erase */ ef10_nvram_write_chunk, /* envo_write_chunk */ ef10_nvram_rw_finish, /* envo_rw_finish */ ef10_nvram_set_version, /* envo_set_version */ @@ -89,6 +88,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ ef10_nvram_partn_size, /* envo_partn_size */ ef10_nvram_partn_rw_start, /* envo_partn_rw_start */ ef10_nvram_partn_read, /* envo_partn_read */ + ef10_nvram_partn_erase, /* envo_partn_erase */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ @@ -308,6 +308,9 @@ efx_nvram_erase( __in efx_nvram_type_t type) { efx_nvram_ops_t *envop = enp->en_envop; + unsigned int offset = 0; + size_t size = 0; + uint32_t partn; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -318,11 +321,21 @@ efx_nvram_erase( EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type); - if ((rc = envop->envo_erase(enp, type)) != 0) + if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0) goto fail1; + if ((rc = envop->envo_partn_size(enp, partn, &size)) != 0) + goto fail2; + + if ((rc = envop->envo_partn_erase(enp, partn, offset, size)) != 0) + goto fail3; + return (0); +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); Modified: head/sys/dev/sfxge/common/hunt_impl.h ============================================================================== --- head/sys/dev/sfxge/common/hunt_impl.h Sun Jan 17 01:04:20 2016 (r294200) +++ head/sys/dev/sfxge/common/hunt_impl.h Sun Jan 17 05:12:37 2016 (r294201) @@ -370,13 +370,6 @@ ef10_nvram_partn_lock( __in uint32_t partn); extern __checkReturn efx_rc_t -ef10_nvram_partn_erase( - __in efx_nic_t *enp, - __in uint32_t partn, - __in unsigned int offset, - __in size_t size); - -extern __checkReturn efx_rc_t ef10_nvram_partn_write( __in efx_nic_t *enp, __in uint32_t partn, @@ -408,11 +401,6 @@ ef10_nvram_get_version( __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]); -extern __checkReturn efx_rc_t -ef10_nvram_erase( - __in efx_nic_t *enp, - __in efx_nvram_type_t type); - extern __checkReturn efx_rc_t ef10_nvram_write_chunk( __in efx_nic_t *enp, @@ -464,6 +452,13 @@ ef10_nvram_partn_read( __out_bcount(size) caddr_t data, __in size_t size); +extern __checkReturn efx_rc_t +ef10_nvram_partn_erase( + __in efx_nic_t *enp, + __in uint32_t partn, + __in unsigned int offset, + __in size_t size); + #endif /* EFSYS_OPT_NVRAM */ Modified: head/sys/dev/sfxge/common/hunt_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/hunt_nvram.c Sun Jan 17 01:04:20 2016 (r294200) +++ head/sys/dev/sfxge/common/hunt_nvram.c Sun Jan 17 05:12:37 2016 (r294201) @@ -1769,36 +1769,6 @@ fail1: } __checkReturn efx_rc_t -ef10_nvram_erase( - __in efx_nic_t *enp, - __in efx_nvram_type_t type) -{ - uint32_t partn; - size_t size; - 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, &size)) != 0) - goto fail2; - - if ((rc = ef10_nvram_partn_erase(enp, partn, 0, size)) != 0) - goto fail3; - - return (0); - -fail3: - EFSYS_PROBE(fail3); -fail2: - EFSYS_PROBE(fail2); -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - - __checkReturn efx_rc_t ef10_nvram_write_chunk( __in efx_nic_t *enp, __in efx_nvram_type_t type, Modified: head/sys/dev/sfxge/common/siena_impl.h ============================================================================== --- head/sys/dev/sfxge/common/siena_impl.h Sun Jan 17 01:04:20 2016 (r294200) +++ head/sys/dev/sfxge/common/siena_impl.h Sun Jan 17 05:12:37 2016 (r294201) @@ -156,13 +156,6 @@ siena_nvram_partn_lock( __in uint32_t partn); extern __checkReturn efx_rc_t -siena_nvram_partn_erase( - __in efx_nic_t *enp, - __in uint32_t partn, - __in unsigned int offset, - __in size_t size); - -extern __checkReturn efx_rc_t siena_nvram_partn_write( __in efx_nic_t *enp, __in uint32_t partn, @@ -208,11 +201,6 @@ siena_nvram_get_version( __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]); -extern __checkReturn efx_rc_t -siena_nvram_erase( - __in efx_nic_t *enp, - __in efx_nvram_type_t type); - extern __checkReturn efx_rc_t siena_nvram_write_chunk( __in efx_nic_t *enp, @@ -258,6 +246,13 @@ siena_nvram_partn_read( __out_bcount(size) caddr_t data, __in size_t size); +extern __checkReturn efx_rc_t +siena_nvram_partn_erase( + __in efx_nic_t *enp, + __in uint32_t partn, + __in unsigned int offset, + __in size_t size); + #endif /* EFSYS_OPT_NVRAM */ #if EFSYS_OPT_VPD Modified: head/sys/dev/sfxge/common/siena_nvram.c ============================================================================== --- head/sys/dev/sfxge/common/siena_nvram.c Sun Jan 17 01:04:20 2016 (r294200) +++ head/sys/dev/sfxge/common/siena_nvram.c Sun Jan 17 05:12:37 2016 (r294201) @@ -594,36 +594,6 @@ fail1: } __checkReturn efx_rc_t -siena_nvram_erase( - __in efx_nic_t *enp, - __in efx_nvram_type_t type) -{ - size_t size; - 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, &size)) != 0) - goto fail2; - - if ((rc = siena_nvram_partn_erase(enp, partn, 0, size)) != 0) - goto fail3; - - return (0); - -fail3: - EFSYS_PROBE(fail3); -fail2: - EFSYS_PROBE(fail2); -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - - __checkReturn efx_rc_t siena_nvram_write_chunk( __in efx_nic_t *enp, __in efx_nvram_type_t type,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601170512.u0H5CbM3055654>