diff options
author | arybchik <arybchik@FreeBSD.org> | 2016-01-14 16:24:18 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2016-01-14 16:24:18 +0000 |
commit | 28ecd287fecf59517a8a9786e4170d10a3ef85fe (patch) | |
tree | 9778fe5c37beb0f7a6c1f13786d267aec5de9317 /sys/dev/sfxge/common | |
parent | 434136afdbd094ca9adaf26e5c1034502e447f39 (diff) | |
download | FreeBSD-src-28ecd287fecf59517a8a9786e4170d10a3ef85fe.zip FreeBSD-src-28ecd287fecf59517a8a9786e4170d10a3ef85fe.tar.gz |
MFC r293810
sfxge: simplify conversion of NVRAM types to/from partition ids
Submitted by: Andy Moreton <amoreton at solarflare.com>
Reviewed by: gnn
Sponsored by: Solarflare Communications, Inc.
Diffstat (limited to 'sys/dev/sfxge/common')
-rw-r--r-- | sys/dev/sfxge/common/efx_impl.h | 2 | ||||
-rw-r--r-- | sys/dev/sfxge/common/efx_nvram.c | 3 | ||||
-rw-r--r-- | sys/dev/sfxge/common/hunt_impl.h | 6 | ||||
-rw-r--r-- | sys/dev/sfxge/common/hunt_nvram.c | 193 | ||||
-rw-r--r-- | sys/dev/sfxge/common/siena_impl.h | 6 | ||||
-rw-r--r-- | sys/dev/sfxge/common/siena_nvram.c | 117 |
6 files changed, 155 insertions, 172 deletions
diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index b5a7ec1..16c0898 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -492,6 +492,8 @@ typedef struct efx_nvram_ops_s { efx_rc_t (*envo_set_version)(efx_nic_t *, efx_nvram_type_t, uint16_t *); + efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t, + uint32_t *); } efx_nvram_ops_t; #endif /* EFSYS_OPT_NVRAM */ diff --git a/sys/dev/sfxge/common/efx_nvram.c b/sys/dev/sfxge/common/efx_nvram.c index 78f4be4..1809b30 100644 --- a/sys/dev/sfxge/common/efx_nvram.c +++ b/sys/dev/sfxge/common/efx_nvram.c @@ -53,6 +53,7 @@ static efx_nvram_ops_t __efx_nvram_falcon_ops = { falcon_nvram_write_chunk, /* envo_write_chunk */ falcon_nvram_rw_finish, /* envo_rw_finish */ falcon_nvram_set_version, /* envo_set_version */ + falcon_nvram_type_to_partn, /* envo_type_to_partn */ }; #endif /* EFSYS_OPT_FALCON */ @@ -71,6 +72,7 @@ static efx_nvram_ops_t __efx_nvram_siena_ops = { siena_nvram_write_chunk, /* envo_write_chunk */ siena_nvram_rw_finish, /* envo_rw_finish */ siena_nvram_set_version, /* envo_set_version */ + siena_nvram_type_to_partn, /* envo_type_to_partn */ }; #endif /* EFSYS_OPT_SIENA */ @@ -89,6 +91,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_ops = { ef10_nvram_write_chunk, /* envo_write_chunk */ ef10_nvram_rw_finish, /* envo_rw_finish */ ef10_nvram_set_version, /* envo_set_version */ + ef10_nvram_type_to_partn, /* envo_type_to_partn */ }; #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */ diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index 6d65bc0..ab5857f 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -466,6 +466,12 @@ ef10_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]); +extern __checkReturn efx_rc_t +ef10_nvram_type_to_partn( + __in efx_nic_t *enp, + __in efx_nvram_type_t type, + __out uint32_t *partnp); + #endif /* EFSYS_OPT_NVRAM */ diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 0248221..1a96bcc 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -1578,68 +1578,101 @@ static ef10_parttbl_entry_t medford_parttbl[] = { {NVRAM_PARTITION_TYPE_FPGA_BACKUP, 4, EFX_NVRAM_FPGA_BACKUP} }; -static __checkReturn ef10_parttbl_entry_t * -ef10_parttbl_entry( +static __checkReturn efx_rc_t +ef10_parttbl_get( __in efx_nic_t *enp, - __in efx_nvram_type_t type) + __out ef10_parttbl_entry_t **parttblp, + __out size_t *parttbl_rowsp) { - efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - ef10_parttbl_entry_t *entry; - ef10_parttbl_entry_t *parttbl; - size_t parttbl_size = 0; - unsigned int i; - - EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); - switch (enp->en_family) { case EFX_FAMILY_HUNTINGTON: - parttbl = hunt_parttbl; - parttbl_size = EFX_ARRAY_SIZE(hunt_parttbl); + *parttblp = hunt_parttbl; + *parttbl_rowsp = EFX_ARRAY_SIZE(hunt_parttbl); break; case EFX_FAMILY_MEDFORD: - parttbl = medford_parttbl; - parttbl_size = EFX_ARRAY_SIZE(medford_parttbl); + *parttblp = medford_parttbl; + *parttbl_rowsp = EFX_ARRAY_SIZE(medford_parttbl); break; default: EFSYS_ASSERT(B_FALSE); - goto not_found; + return (EINVAL); } + return (0); +} - if (parttbl != NULL) { - for (i = 0; i < parttbl_size; i++) { - entry = &parttbl[i]; + __checkReturn efx_rc_t +ef10_nvram_type_to_partn( + __in efx_nic_t *enp, + __in efx_nvram_type_t type, + __out uint32_t *partnp) +{ + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); + ef10_parttbl_entry_t *parttbl = NULL; + size_t parttbl_rows = 0; + unsigned int i; + + EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); + EFSYS_ASSERT(partnp != NULL); - if (entry->port == emip->emi_port && - entry->nvtype == type) { - return (entry); + if (ef10_parttbl_get(enp, &parttbl, &parttbl_rows) == 0) { + for (i = 0; i < parttbl_rows; i++) { + ef10_parttbl_entry_t *entry = &parttbl[i]; + + if (entry->nvtype == type && + entry->port == emip->emi_port) { + *partnp = entry->partn; + return (0); } } } -not_found: - return (NULL); -} + return (ENOTSUP); +} #if EFSYS_OPT_DIAG +static __checkReturn efx_rc_t +ef10_nvram_partn_to_type( + __in efx_nic_t *enp, + __in uint32_t partn, + __out efx_nvram_type_t *typep) +{ + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); + ef10_parttbl_entry_t *parttbl = NULL; + size_t parttbl_rows = 0; + unsigned int i; + + EFSYS_ASSERT(typep != NULL); + + if (ef10_parttbl_get(enp, &parttbl, &parttbl_rows) == 0) { + for (i = 0; i < parttbl_rows; i++) { + ef10_parttbl_entry_t *entry = &parttbl[i]; + + if (entry->partn == partn && + entry->port == emip->emi_port) { + *typep = entry->nvtype; + return (0); + } + } + } + + return (ENOTSUP); +} + __checkReturn efx_rc_t ef10_nvram_test( __in efx_nic_t *enp) { - efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - ef10_parttbl_entry_t *entry; - ef10_parttbl_entry_t *parttbl; - size_t parttbl_size = 0; + efx_nvram_type_t type; unsigned int npartns = 0; uint32_t *partns = NULL; size_t size; unsigned int i; - unsigned int j; efx_rc_t rc; - /* Find supported partitions */ + /* Read available partitions from NVRAM partition map */ size = MC_CMD_NVRAM_PARTITIONS_OUT_TYPE_ID_MAXNUM * sizeof (uint32_t); EFSYS_KMEM_ALLOC(enp->en_esip, size, partns); if (partns == NULL) { @@ -1652,46 +1685,18 @@ ef10_nvram_test( goto fail2; } - /* - * Iterate over the list of supported partition types - * applicable to *this* port - */ - switch (enp->en_family) { - case EFX_FAMILY_HUNTINGTON: - parttbl = hunt_parttbl; - parttbl_size = EFX_ARRAY_SIZE(hunt_parttbl); - break; - - case EFX_FAMILY_MEDFORD: - parttbl = medford_parttbl; - parttbl_size = EFX_ARRAY_SIZE(medford_parttbl); - break; - - default: - EFSYS_ASSERT(B_FALSE); - goto fail3; - } - - for (i = 0; i < parttbl_size; i++) { - entry = &parttbl[i]; - - if (entry->port != emip->emi_port) + for (i = 0; i < npartns; i++) { + /* Check if the partition is supported for this port */ + if ((rc = ef10_nvram_partn_to_type(enp, partns[i], &type)) != 0) continue; - for (j = 0; j < npartns; j++) { - if (entry->partn == partns[j]) { - rc = efx_mcdi_nvram_test(enp, entry->partn); - if (rc != 0) - goto fail4; - } - } + if ((rc = efx_mcdi_nvram_test(enp, partns[i])) != 0) + goto fail3; } EFSYS_KMEM_FREE(enp->en_esip, size, partns); return (0); -fail4: - EFSYS_PROBE(fail3); fail3: EFSYS_PROBE(fail3); fail2: @@ -1710,15 +1715,11 @@ ef10_nvram_size( __in efx_nvram_type_t type, __out size_t *sizep) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((rc = ef10_nvram_partn_size(enp, partn, sizep)) != 0) goto fail2; @@ -1742,15 +1743,11 @@ ef10_nvram_get_version( __out uint32_t *subtypep, __out_ecount(4) uint16_t version[4]) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; /* FIXME: get highest partn version from all ports */ /* FIXME: return partn description if available */ @@ -1775,15 +1772,11 @@ ef10_nvram_rw_start( __in efx_nvram_type_t type, __out size_t *chunk_sizep) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0) goto fail2; @@ -1809,16 +1802,13 @@ ef10_nvram_read_chunk( __out_bcount(size) caddr_t data, __in size_t size) { - ef10_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = ef10_nvram_partn_read(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = ef10_nvram_partn_read(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -1836,19 +1826,17 @@ ef10_nvram_erase( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - ef10_parttbl_entry_t *entry; + uint32_t partn; size_t size; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = ef10_nvram_partn_size(enp, entry->partn, &size)) != 0) + if ((rc = ef10_nvram_partn_size(enp, partn, &size)) != 0) goto fail2; - if ((rc = ef10_nvram_partn_erase(enp, entry->partn, 0, size)) != 0) + if ((rc = ef10_nvram_partn_erase(enp, partn, 0, size)) != 0) goto fail3; return (0); @@ -1871,16 +1859,13 @@ ef10_nvram_write_chunk( __in_bcount(size) caddr_t data, __in size_t size) { - ef10_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = ef10_nvram_partn_write(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = ef10_nvram_partn_write(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -1898,10 +1883,11 @@ ef10_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - ef10_parttbl_entry_t *entry; + uint32_t partn; + efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) != NULL) - ef10_nvram_partn_unlock(enp, entry->partn); + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) == 0) + ef10_nvram_partn_unlock(enp, partn); } __checkReturn efx_rc_t @@ -1910,15 +1896,11 @@ ef10_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]) { - ef10_parttbl_entry_t *entry; uint32_t partn; efx_rc_t rc; - if ((entry = ef10_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((rc = ef10_nvram_partn_set_version(enp, partn, version)) != 0) goto fail2; @@ -1927,7 +1909,6 @@ ef10_nvram_set_version( fail2: EFSYS_PROBE(fail2); - fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); diff --git a/sys/dev/sfxge/common/siena_impl.h b/sys/dev/sfxge/common/siena_impl.h index a6afcf8..effa113 100644 --- a/sys/dev/sfxge/common/siena_impl.h +++ b/sys/dev/sfxge/common/siena_impl.h @@ -271,6 +271,12 @@ siena_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]); +extern __checkReturn efx_rc_t +siena_nvram_type_to_partn( + __in efx_nic_t *enp, + __in efx_nvram_type_t type, + __out uint32_t *partnp); + #endif /* EFSYS_OPT_NVRAM */ #if EFSYS_OPT_VPD diff --git a/sys/dev/sfxge/common/siena_nvram.c b/sys/dev/sfxge/common/siena_nvram.c index b1406dd..9eb5bfb 100644 --- a/sys/dev/sfxge/common/siena_nvram.c +++ b/sys/dev/sfxge/common/siena_nvram.c @@ -232,27 +232,31 @@ static siena_parttbl_entry_t siena_parttbl[] = { {MC_CMD_NVRAM_TYPE_CPLD, 2, EFX_NVRAM_CPLD}, }; -static __checkReturn siena_parttbl_entry_t * -siena_parttbl_entry( + __checkReturn efx_rc_t +siena_nvram_type_to_partn( __in efx_nic_t *enp, - __in efx_nvram_type_t type) + __in efx_nvram_type_t type, + __out uint32_t *partnp) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); - siena_parttbl_entry_t *entry; unsigned int i; EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES); + EFSYS_ASSERT(partnp != NULL); for (i = 0; i < EFX_ARRAY_SIZE(siena_parttbl); i++) { - entry = &siena_parttbl[i]; + siena_parttbl_entry_t *entry = &siena_parttbl[i]; - if (entry->port == emip->emi_port && entry->nvtype == type) - return (entry); + if (entry->port == emip->emi_port && entry->nvtype == type) { + *partnp = entry->partn; + return (0); + } } - return (NULL); + return (ENOTSUP); } + #if EFSYS_OPT_DIAG __checkReturn efx_rc_t @@ -296,15 +300,13 @@ siena_nvram_size( __in efx_nvram_type_t type, __out size_t *sizep) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_size(enp, entry->partn, sizep)) != 0) + if ((rc = siena_nvram_partn_size(enp, partn, sizep)) != 0) goto fail2; return (0); @@ -520,11 +522,8 @@ siena_nvram_get_version( unsigned int i; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - partn = entry->partn; if ((1 << partn) & ~enp->en_u.siena.enu_partn_mask) { rc = ENOTSUP; @@ -605,15 +604,13 @@ siena_nvram_rw_start( __in efx_nvram_type_t type, __out size_t *chunk_sizep) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_lock(enp, entry->partn)) != 0) + if ((rc = siena_nvram_partn_lock(enp, partn)) != 0) goto fail2; if (chunk_sizep != NULL) @@ -637,16 +634,13 @@ siena_nvram_read_chunk( __out_bcount(size) caddr_t data, __in size_t size) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_read(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = siena_nvram_partn_read(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -664,19 +658,17 @@ siena_nvram_erase( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - siena_parttbl_entry_t *entry; size_t size; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_size(enp, entry->partn, &size)) != 0) + if ((rc = siena_nvram_partn_size(enp, partn, &size)) != 0) goto fail2; - if ((rc = siena_nvram_partn_erase(enp, entry->partn, 0, size)) != 0) + if ((rc = siena_nvram_partn_erase(enp, partn, 0, size)) != 0) goto fail3; return (0); @@ -699,16 +691,13 @@ siena_nvram_write_chunk( __in_bcount(size) caddr_t data, __in size_t size) { - siena_parttbl_entry_t *entry; + uint32_t partn; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - if ((rc = siena_nvram_partn_write(enp, entry->partn, - offset, data, size)) != 0) + if ((rc = siena_nvram_partn_write(enp, partn, offset, data, size)) != 0) goto fail2; return (0); @@ -726,10 +715,11 @@ siena_nvram_rw_finish( __in efx_nic_t *enp, __in efx_nvram_type_t type) { - siena_parttbl_entry_t *entry; + uint32_t partn; + efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) != NULL) - siena_nvram_partn_unlock(enp, entry->partn); + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) == 0) + siena_nvram_partn_unlock(enp, partn); } __checkReturn efx_rc_t @@ -738,10 +728,11 @@ siena_nvram_set_version( __in efx_nvram_type_t type, __in_ecount(4) uint16_t version[4]) { + efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); siena_mc_dynamic_config_hdr_t *dcfg = NULL; - siena_parttbl_entry_t *entry; - unsigned int dcfg_partn; - size_t partn_size; + siena_mc_fw_version_t *fwverp; + uint32_t dcfg_partn, partn; + size_t dcfg_size; unsigned int hdr_length; unsigned int vpd_length; unsigned int vpd_offset; @@ -753,16 +744,14 @@ siena_nvram_set_version( size_t length; efx_rc_t rc; - if ((entry = siena_parttbl_entry(enp, type)) == NULL) { - rc = ENOTSUP; + if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0) goto fail1; - } - dcfg_partn = (entry->port == 1) + dcfg_partn = (emip->emi_port == 1) ? MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT0 : MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT1; - if ((rc = siena_nvram_partn_size(enp, dcfg_partn, &partn_size)) != 0) + if ((rc = siena_nvram_partn_size(enp, dcfg_partn, &dcfg_size)) != 0) goto fail2; if ((rc = siena_nvram_partn_lock(enp, dcfg_partn)) != 0) @@ -781,7 +770,7 @@ siena_nvram_set_version( * NOTE: This function will blatt any fields trailing the version * vector, or the VPD chunk. */ - required_hdr_length = SIENA_DYNAMIC_CFG_SIZE(entry->partn + 1); + required_hdr_length = SIENA_DYNAMIC_CFG_SIZE(partn + 1); if (required_hdr_length + vpd_length > length) { rc = ENOSPC; goto fail4; @@ -804,24 +793,20 @@ siena_nvram_set_version( } /* Get the subtype to insert into the fw_subtype array */ - if ((rc = siena_nvram_get_subtype(enp, entry->partn, &subtype)) != 0) + if ((rc = siena_nvram_get_subtype(enp, partn, &subtype)) != 0) goto fail5; /* Fill out the new version */ - EFX_POPULATE_DWORD_1(dcfg->fw_version[entry->partn].fw_subtype, - EFX_DWORD_0, subtype); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_w, - EFX_WORD_0, version[0]); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_x, - EFX_WORD_0, version[1]); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_y, - EFX_WORD_0, version[2]); - EFX_POPULATE_WORD_1(dcfg->fw_version[entry->partn].version_z, - EFX_WORD_0, version[3]); + fwverp = &dcfg->fw_version[partn]; + EFX_POPULATE_DWORD_1(fwverp->fw_subtype, EFX_DWORD_0, subtype); + EFX_POPULATE_WORD_1(fwverp->version_w, EFX_WORD_0, version[0]); + EFX_POPULATE_WORD_1(fwverp->version_x, EFX_WORD_0, version[1]); + EFX_POPULATE_WORD_1(fwverp->version_y, EFX_WORD_0, version[2]); + EFX_POPULATE_WORD_1(fwverp->version_z, EFX_WORD_0, version[3]); /* Update the version count */ - if (nitems < entry->partn + 1) { - nitems = entry->partn + 1; + if (nitems < partn + 1) { + nitems = partn + 1; EFX_POPULATE_DWORD_1(dcfg->num_fw_version_items, EFX_DWORD_0, nitems); } @@ -833,7 +818,7 @@ siena_nvram_set_version( dcfg->csum.eb_u8[0] -= cksum; /* Erase and write the new partition */ - if ((rc = siena_nvram_partn_erase(enp, dcfg_partn, 0, partn_size)) != 0) + if ((rc = siena_nvram_partn_erase(enp, dcfg_partn, 0, dcfg_size)) != 0) goto fail6; /* Write out the new structure to nvram */ |