return (rc);
}
+ __checkReturn efx_rc_t
+ef10_nvram_partn_info(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __out efx_nvram_info_t *enip)
+{
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_nvram_info_ex(enp, partn, enip)) != 0)
+ goto fail1;
+
+ if (enip->eni_write_size == 0)
+ enip->eni_write_size = EF10_NVRAM_CHUNK;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
__checkReturn efx_rc_t
ef10_nvram_partn_lock(
__in efx_nic_t *enp,
__in uint32_t partn,
__out size_t *chunk_sizep)
{
- uint32_t write_size = 0;
+ efx_nvram_info_t eni = { 0 };
efx_rc_t rc;
- if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
- NULL, &write_size)) != 0)
+ if ((rc = ef10_nvram_partn_info(enp, partn, &eni)) != 0)
goto fail1;
if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0)
goto fail2;
- if (chunk_sizep != NULL) {
- if (write_size == 0)
- *chunk_sizep = EF10_NVRAM_CHUNK;
- else
- *chunk_sizep = write_size;
- }
+ if (chunk_sizep != NULL)
+ *chunk_sizep = eni.eni_write_size;
return (0);
#endif /* EFSYS_OPT_DIAG */
efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
uint32_t *);
- efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *);
+ efx_rc_t (*envo_partn_info)(efx_nic_t *, uint32_t,
+ efx_nvram_info_t *);
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);
siena_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
siena_nvram_type_to_partn, /* envo_type_to_partn */
- siena_nvram_partn_size, /* envo_partn_size */
+ siena_nvram_partn_info, /* envo_partn_info */
siena_nvram_partn_rw_start, /* envo_partn_rw_start */
siena_nvram_partn_read, /* envo_partn_read */
siena_nvram_partn_read, /* envo_partn_read_backup */
ef10_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
ef10_nvram_type_to_partn, /* envo_type_to_partn */
- ef10_nvram_partn_size, /* envo_partn_size */
+ ef10_nvram_partn_info, /* envo_partn_info */
ef10_nvram_partn_rw_start, /* envo_partn_rw_start */
ef10_nvram_partn_read, /* envo_partn_read */
ef10_nvram_partn_read_backup, /* envo_partn_read_backup */
__out size_t *sizep)
{
const efx_nvram_ops_t *envop = enp->en_envop;
+ efx_nvram_info_t eni = { 0 };
uint32_t partn;
efx_rc_t rc;
if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
- if ((rc = envop->envo_partn_size(enp, partn, sizep)) != 0)
+ if ((rc = envop->envo_partn_info(enp, partn, &eni)) != 0)
goto fail2;
+ *sizep = eni.eni_partn_size;
+
return (0);
fail2:
return (rc);
}
+extern __checkReturn efx_rc_t
+efx_nvram_info(
+ __in efx_nic_t *enp,
+ __in efx_nvram_type_t type,
+ __out efx_nvram_info_t *enip)
+{
+ const efx_nvram_ops_t *envop = enp->en_envop;
+ uint32_t partn;
+ efx_rc_t rc;
+
+ EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+ EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_NVRAM);
+
+ if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
+ goto fail1;
+
+ if ((rc = envop->envo_partn_info(enp, partn, enip)) != 0)
+ goto fail2;
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+
__checkReturn efx_rc_t
efx_nvram_get_version(
__in efx_nic_t *enp,
{
const efx_nvram_ops_t *envop = enp->en_envop;
unsigned int offset = 0;
- size_t size = 0;
+ efx_nvram_info_t eni = { 0 };
uint32_t partn;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_nvram_partn_locked, ==, partn);
- if ((rc = envop->envo_partn_size(enp, partn, &size)) != 0)
+ if ((rc = envop->envo_partn_info(enp, partn, &eni)) != 0)
goto fail2;
- if ((rc = envop->envo_partn_erase(enp, partn, offset, size)) != 0)
+ if ((rc = envop->envo_partn_erase(enp, partn, offset,
+ eni.eni_partn_size)) != 0)
goto fail3;
return (0);