Author: arybchik Date: Thu Jan 14 15:12:48 2016 New Revision: 293952 URL: https://svnweb.freebsd.org/changeset/base/293952
Log: MFC r291862 sfxge: erase nvram partitions in chunks equal to their erase size The erase size is reported by the nvram info command. Submitted by: Paul Fox <pfox at solarflare.com> Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/common/hunt_nvram.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/common/hunt_nvram.c ============================================================================== --- stable/10/sys/dev/sfxge/common/hunt_nvram.c Thu Jan 14 15:11:56 2016 (r293951) +++ stable/10/sys/dev/sfxge/common/hunt_nvram.c Thu Jan 14 15:12:48 2016 (r293952) @@ -1363,12 +1363,37 @@ hunt_nvram_partn_erase( __in size_t size) { efx_rc_t rc; + uint32_t erase_size; - if ((rc = efx_mcdi_nvram_erase(enp, partn, offset, size)) != 0) + if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL, + &erase_size, NULL)) != 0) goto fail1; + if (erase_size == 0) { + if ((rc = efx_mcdi_nvram_erase(enp, partn, offset, size)) != 0) + goto fail2; + } else { + if (size % erase_size != 0) { + rc = EINVAL; + goto fail3; + } + while (size > 0) { + if ((rc = efx_mcdi_nvram_erase(enp, partn, offset, + erase_size)) != 0) + goto fail4; + offset += erase_size; + size -= erase_size; + } + } + return (0); +fail4: + EFSYS_PROBE(fail4); +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); fail1: EFSYS_PROBE1(fail1, efx_rc_t, rc); _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"