Date: Thu, 14 Jan 2016 15:12:48 +0000 (UTC) From: Andrew Rybchenko <arybchik@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293952 - stable/10/sys/dev/sfxge/common Message-ID: <201601141512.u0EFCmpV039534@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601141512.u0EFCmpV039534>