Author: arybchik
Date: Fri Dec  4 06:51:37 2015
New Revision: 291746
URL: https://svnweb.freebsd.org/changeset/base/291746

Log:
  sfxge: add additional WRITESIZE value for NVRAM_INFO command
  
  Submitted by:   Paul Fox <pfox at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision: https://reviews.freebsd.org/D4353

Modified:
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nvram.c
  head/sys/dev/sfxge/common/hunt_nvram.c
  head/sys/dev/sfxge/common/hunt_vpd.c
  head/sys/dev/sfxge/common/siena_nvram.c

Modified: head/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/efx_impl.h        Fri Dec  4 05:00:51 2015        
(r291745)
+++ head/sys/dev/sfxge/common/efx_impl.h        Fri Dec  4 06:51:37 2015        
(r291746)
@@ -536,7 +536,8 @@ efx_mcdi_nvram_info(
        __in                    uint32_t partn,
        __out_opt               size_t *sizep,
        __out_opt               uint32_t *addressp,
-       __out_opt               uint32_t *erase_sizep);
+       __out_opt               uint32_t *erase_sizep,
+       __out_opt               uint32_t *write_sizep);
 
        __checkReturn           efx_rc_t
 efx_mcdi_nvram_update_start(

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_nvram.c       Fri Dec  4 05:00:51 2015        
(r291745)
+++ head/sys/dev/sfxge/common/efx_nvram.c       Fri Dec  4 06:51:37 2015        
(r291746)
@@ -567,10 +567,11 @@ efx_mcdi_nvram_info(
        __in                    uint32_t partn,
        __out_opt               size_t *sizep,
        __out_opt               uint32_t *addressp,
-       __out_opt               uint32_t *erase_sizep)
+       __out_opt               uint32_t *erase_sizep,
+       __out_opt               uint32_t *write_sizep)
 {
        uint8_t payload[MAX(MC_CMD_NVRAM_INFO_IN_LEN,
-                           MC_CMD_NVRAM_INFO_OUT_LEN)];
+                           MC_CMD_NVRAM_INFO_V2_OUT_LEN)];
        efx_mcdi_req_t req;
        efx_rc_t rc;
 
@@ -579,7 +580,7 @@ efx_mcdi_nvram_info(
        req.emr_in_buf = payload;
        req.emr_in_length = MC_CMD_NVRAM_INFO_IN_LEN;
        req.emr_out_buf = payload;
-       req.emr_out_length = MC_CMD_NVRAM_INFO_OUT_LEN;
+       req.emr_out_length = MC_CMD_NVRAM_INFO_V2_OUT_LEN;
 
        MCDI_IN_SET_DWORD(req, NVRAM_INFO_IN_TYPE, partn);
 
@@ -604,6 +605,13 @@ efx_mcdi_nvram_info(
        if (erase_sizep)
                *erase_sizep = MCDI_OUT_DWORD(req, NVRAM_INFO_OUT_ERASESIZE);
 
+       if (write_sizep) {
+               *write_sizep =
+                       (req.emr_out_length_used <
+                           MC_CMD_NVRAM_INFO_V2_OUT_LEN) ?
+                       0 : MCDI_OUT_DWORD(req, NVRAM_INFO_V2_OUT_WRITESIZE);
+       }
+
        return (0);
 
 fail2:

Modified: head/sys/dev/sfxge/common/hunt_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/hunt_nvram.c      Fri Dec  4 05:00:51 2015        
(r291745)
+++ head/sys/dev/sfxge/common/hunt_nvram.c      Fri Dec  4 06:51:37 2015        
(r291746)
@@ -1295,7 +1295,8 @@ hunt_nvram_partn_size(
 {
        efx_rc_t rc;
 
-       if ((rc = efx_mcdi_nvram_info(enp, partn, sizep, NULL, NULL)) != 0)
+       if ((rc = efx_mcdi_nvram_info(enp, partn, sizep,
+           NULL, NULL, NULL)) != 0)
                goto fail1;
 
        return (0);

Modified: head/sys/dev/sfxge/common/hunt_vpd.c
==============================================================================
--- head/sys/dev/sfxge/common/hunt_vpd.c        Fri Dec  4 05:00:51 2015        
(r291745)
+++ head/sys/dev/sfxge/common/hunt_vpd.c        Fri Dec  4 06:51:37 2015        
(r291746)
@@ -113,7 +113,7 @@ hunt_vpd_size(
         * which is the size of the DYNAMIC_CONFIG partition.
         */
        if ((rc = efx_mcdi_nvram_info(enp, NVRAM_PARTITION_TYPE_DYNAMIC_CONFIG,
-                   sizep, NULL, NULL)) != 0)
+                   sizep, NULL, NULL, NULL)) != 0)
                goto fail1;
 
        return (0);

Modified: head/sys/dev/sfxge/common/siena_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/siena_nvram.c     Fri Dec  4 05:00:51 2015        
(r291745)
+++ head/sys/dev/sfxge/common/siena_nvram.c     Fri Dec  4 06:51:37 2015        
(r291746)
@@ -54,7 +54,8 @@ siena_nvram_partn_size(
                goto fail1;
        }
 
-       if ((rc = efx_mcdi_nvram_info(enp, partn, sizep, NULL, NULL)) != 0) {
+       if ((rc = efx_mcdi_nvram_info(enp, partn, sizep,
+           NULL, NULL, NULL)) != 0) {
                goto fail2;
        }
 
_______________________________________________
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