From: Richard Houldsworth Date: Mon, 10 Jun 2019 07:38:28 +0000 (+0100) Subject: net/sfc/base: transition to the extensible NVRAM info API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=55e569ebc6fa8d9aad80a629ff0afcf823b41d47;p=dpdk.git net/sfc/base: transition to the extensible NVRAM info API Old NVRAM info API required function prototype too often. Signed-off-by: Richard Houldsworth Signed-off-by: Andrew Rybchenko --- diff --git a/drivers/net/sfc/base/ef10_nvram.c b/drivers/net/sfc/base/ef10_nvram.c index a618c75daf..1fb7185f79 100644 --- a/drivers/net/sfc/base/ef10_nvram.c +++ b/drivers/net/sfc/base/ef10_nvram.c @@ -1946,11 +1946,13 @@ ef10_nvram_partn_size( __out size_t *sizep) { efx_rc_t rc; + efx_nvram_info_t eni = { 0 }; - if ((rc = efx_mcdi_nvram_info(enp, partn, sizep, - NULL, NULL, NULL)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0) goto fail1; + *sizep = eni.eni_partn_size; + return (0); fail1: @@ -1967,7 +1969,7 @@ ef10_nvram_partn_info( { efx_rc_t rc; - if ((rc = efx_mcdi_nvram_info_ex(enp, partn, enip)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, partn, enip)) != 0) goto fail1; if (enip->eni_write_size == 0) @@ -2080,12 +2082,14 @@ ef10_nvram_partn_erase( __in size_t size) { efx_rc_t rc; + efx_nvram_info_t eni = { 0 }; uint32_t erase_size; - if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL, - &erase_size, NULL)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0) goto fail1; + erase_size = eni.eni_erase_size; + if (erase_size == 0) { if ((rc = efx_mcdi_nvram_erase(enp, partn, offset, size)) != 0) goto fail2; @@ -2126,13 +2130,15 @@ ef10_nvram_partn_write( __in size_t size) { size_t chunk; + efx_nvram_info_t eni = { 0 }; uint32_t write_size; efx_rc_t rc; - if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL, - NULL, &write_size)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0) goto fail1; + write_size = eni.eni_write_size; + if (write_size != 0) { /* * Check that the size is a multiple of the write chunk size if diff --git a/drivers/net/sfc/base/ef10_vpd.c b/drivers/net/sfc/base/ef10_vpd.c index d56747b7dd..c64193691f 100644 --- a/drivers/net/sfc/base/ef10_vpd.c +++ b/drivers/net/sfc/base/ef10_vpd.c @@ -79,6 +79,7 @@ ef10_vpd_size( __out size_t *sizep) { efx_rc_t rc; + efx_nvram_info_t eni = { 0 }; EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); @@ -88,10 +89,12 @@ ef10_vpd_size( * so we just need to return an upper bound on the dynamic vpd, * which is the size of the DYNAMIC_CONFIG partition. */ - if ((rc = efx_mcdi_nvram_info(enp, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, - sizep, NULL, NULL, NULL)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, + NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG, &eni)) != 0) goto fail1; + *sizep = eni.eni_partn_size; + return (0); fail1: diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h index 577d5aaa05..d8cadda892 100644 --- a/drivers/net/sfc/base/efx_impl.h +++ b/drivers/net/sfc/base/efx_impl.h @@ -561,15 +561,6 @@ efx_mcdi_nvram_metadata( __checkReturn efx_rc_t efx_mcdi_nvram_info( - __in efx_nic_t *enp, - __in uint32_t partn, - __out_opt size_t *sizep, - __out_opt uint32_t *addressp, - __out_opt uint32_t *erase_sizep, - __out_opt uint32_t *write_sizep); - - __checkReturn efx_rc_t -efx_mcdi_nvram_info_ex( __in efx_nic_t *enp, __in uint32_t partn, __out efx_nvram_info_t *eni); diff --git a/drivers/net/sfc/base/efx_nvram.c b/drivers/net/sfc/base/efx_nvram.c index b817cb688b..74dac41520 100644 --- a/drivers/net/sfc/base/efx_nvram.c +++ b/drivers/net/sfc/base/efx_nvram.c @@ -691,7 +691,7 @@ fail1: } __checkReturn efx_rc_t -efx_mcdi_nvram_info_ex( +efx_mcdi_nvram_info( __in efx_nic_t *enp, __in uint32_t partn, __out efx_nvram_info_t *enip) @@ -752,42 +752,6 @@ fail1: return (rc); } - __checkReturn efx_rc_t -efx_mcdi_nvram_info( - __in efx_nic_t *enp, - __in uint32_t partn, - __out_opt size_t *sizep, - __out_opt uint32_t *addressp, - __out_opt uint32_t *erase_sizep, - __out_opt uint32_t *write_sizep) -{ - efx_nvram_info_t eni; - efx_rc_t rc; - - if ((rc = efx_mcdi_nvram_info_ex(enp, partn, &eni)) != 0) - goto fail1; - - if (sizep) - *sizep = eni.eni_partn_size; - - if (addressp) - *addressp = eni.eni_address; - - if (erase_sizep) - *erase_sizep = eni.eni_erase_size; - - if (write_sizep) - *write_sizep = eni.eni_write_size; - - return (0); - -fail1: - EFSYS_PROBE1(fail1, efx_rc_t, rc); - - return (rc); -} - - /* * MC_CMD_NVRAM_UPDATE_START_V2 must be used to support firmware-verified * NVRAM updates. Older firmware will ignore the flags field in the request. diff --git a/drivers/net/sfc/base/siena_nvram.c b/drivers/net/sfc/base/siena_nvram.c index 7d423d226b..47a8ca20a6 100644 --- a/drivers/net/sfc/base/siena_nvram.c +++ b/drivers/net/sfc/base/siena_nvram.c @@ -18,16 +18,17 @@ siena_nvram_partn_size( __out size_t *sizep) { efx_rc_t rc; + efx_nvram_info_t eni = { 0 }; if ((1 << partn) & ~enp->en_u.siena.enu_partn_mask) { rc = ENOTSUP; goto fail1; } - if ((rc = efx_mcdi_nvram_info(enp, partn, sizep, - NULL, NULL, NULL)) != 0) { + if ((rc = efx_mcdi_nvram_info(enp, partn, &eni)) != 0) goto fail2; - } + + *sizep = eni.eni_partn_size; return (0); @@ -47,7 +48,7 @@ siena_nvram_partn_info( { efx_rc_t rc; - if ((rc = efx_mcdi_nvram_info_ex(enp, partn, enip)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, partn, enip)) != 0) goto fail1; if (enip->eni_write_size == 0)