Author: arybchik
Date: Fri Nov 23 10:21:17 2018
New Revision: 340821
URL: https://svnweb.freebsd.org/changeset/base/340821

Log:
  sfxge(4): report correct partition write chunk size
  
  If the firmware reports a non-zero write chunk size then nvram writes
  may fail if a different granularity is used (e.g. for MUM firmware on
  Sorrento).
  
  Submitted by:   Andy Moreton <amoreton at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18091

Modified:
  head/sys/dev/sfxge/common/ef10_nvram.c

Modified: head/sys/dev/sfxge/common/ef10_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_nvram.c      Fri Nov 23 10:21:06 2018        
(r340820)
+++ head/sys/dev/sfxge/common/ef10_nvram.c      Fri Nov 23 10:21:17 2018        
(r340821)
@@ -2313,16 +2313,27 @@ ef10_nvram_partn_rw_start(
        __in                    uint32_t partn,
        __out                   size_t *chunk_sizep)
 {
+       uint32_t write_size = 0;
        efx_rc_t rc;
 
-       if ((rc = ef10_nvram_partn_lock(enp, partn)) != 0)
+       if ((rc = efx_mcdi_nvram_info(enp, partn, NULL, NULL,
+           NULL, &write_size)) != 0)
                goto fail1;
 
-       if (chunk_sizep != NULL)
-               *chunk_sizep = EF10_NVRAM_CHUNK;
+       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;
+       }
+
        return (0);
 
+fail2:
+       EFSYS_PROBE(fail2);
 fail1:
        EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to