From d5106d050371fe3d9f1f2101ca3274e76804a90f Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Fri, 23 Nov 2018 10:20:32 +0000 Subject: sfxge(4): extend NVRAM RW finish to return verify result Extend efx_nvram_rw_finish() to return firmware verify result code. Submitted by: Andy Moreton Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18087 --- sys/dev/sfxge/common/efx.h | 3 ++- sys/dev/sfxge/common/efx_bootcfg.c | 8 ++++---- sys/dev/sfxge/common/efx_nvram.c | 12 ++++++++++-- sys/dev/sfxge/sfxge_nvram.c | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index 6a29d07b8a43..e9ee574d486b 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -1418,7 +1418,8 @@ efx_nvram_rw_start( extern __checkReturn efx_rc_t efx_nvram_rw_finish( __in efx_nic_t *enp, - __in efx_nvram_type_t type); + __in efx_nvram_type_t type, + __out_opt uint32_t *verify_resultp); extern __checkReturn efx_rc_t efx_nvram_get_version( diff --git a/sys/dev/sfxge/common/efx_bootcfg.c b/sys/dev/sfxge/common/efx_bootcfg.c index f7b562e9d73c..7d01bd8ff638 100644 --- a/sys/dev/sfxge/common/efx_bootcfg.c +++ b/sys/dev/sfxge/common/efx_bootcfg.c @@ -350,11 +350,11 @@ efx_bootcfg_read( if ((rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG, sector_offset, (caddr_t)payload, sector_length)) != 0) { - (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); + (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL); goto fail6; } - if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG)) != 0) + if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0) goto fail7; /* Verify that the area is correctly formatted and checksummed */ @@ -526,7 +526,7 @@ efx_bootcfg_write( 0, (caddr_t)partn_data, partn_length)) != 0) goto fail11; - if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG)) != 0) + if ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0) goto fail12; EFSYS_KMEM_FREE(enp->en_esip, partn_length, partn_data); @@ -542,7 +542,7 @@ fail10: fail9: EFSYS_PROBE(fail9); - (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG); + (void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL); fail8: EFSYS_PROBE(fail8); diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c index be71da627122..07bdd61ddf74 100644 --- a/sys/dev/sfxge/common/efx_nvram.c +++ b/sys/dev/sfxge/common/efx_nvram.c @@ -367,11 +367,12 @@ fail1: __checkReturn efx_rc_t efx_nvram_rw_finish( __in efx_nic_t *enp, - __in efx_nvram_type_t type) + __in efx_nvram_type_t type, + __out_opt uint32_t *verify_resultp) { const efx_nvram_ops_t *envop = enp->en_envop; uint32_t partn; - uint32_t verify_result; + uint32_t verify_result = 0; efx_rc_t rc; EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); @@ -390,6 +391,9 @@ efx_nvram_rw_finish( enp->en_nvram_locked = EFX_NVRAM_INVALID; + if (verify_resultp != NULL) + *verify_resultp = verify_result; + return (0); fail2: @@ -399,6 +403,10 @@ fail2: fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); + /* Always report verification result */ + if (verify_resultp != NULL) + *verify_resultp = verify_result; + return (rc); } diff --git a/sys/dev/sfxge/sfxge_nvram.c b/sys/dev/sfxge/sfxge_nvram.c index 4c2fecdd59da..d9bbc68570b5 100644 --- a/sys/dev/sfxge/sfxge_nvram.c +++ b/sys/dev/sfxge/sfxge_nvram.c @@ -104,7 +104,7 @@ sfxge_nvram_rw(struct sfxge_softc *sc, sfxge_ioc_t *ip, efx_nvram_type_t type, fail3: free(buf, M_TEMP); - efx_nvram_rw_finish(enp, type); + efx_nvram_rw_finish(enp, type, NULL); fail1: return (rc); } @@ -125,7 +125,7 @@ sfxge_nvram_erase(struct sfxge_softc *sc, efx_nvram_type_t type) rc = efx_nvram_erase(enp, type); - efx_nvram_rw_finish(enp, type); + efx_nvram_rw_finish(enp, type, NULL); return (rc); } -- cgit v1.2.3