net/sfc/base: transition to the extensible NVRAM info API
authorRichard Houldsworth <rhouldsworth@solarflare.com>
Mon, 10 Jun 2019 07:38:28 +0000 (08:38 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 20 Jun 2019 21:42:04 +0000 (23:42 +0200)
Old NVRAM info API required function prototype too often.

Signed-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/base/ef10_nvram.c
drivers/net/sfc/base/ef10_vpd.c
drivers/net/sfc/base/efx_impl.h
drivers/net/sfc/base/efx_nvram.c
drivers/net/sfc/base/siena_nvram.c

index a618c75..1fb7185 100644 (file)
@@ -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
index d56747b..c641936 100644 (file)
@@ -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:
index 577d5aa..d8cadda 100644 (file)
@@ -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);
index b817cb6..74dac41 100644 (file)
@@ -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.
index 7d423d2..47a8ca2 100644 (file)
@@ -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)