Author: arybchik
Date: Fri Jan 15 15:19:18 2016
New Revision: 294093
URL: https://svnweb.freebsd.org/changeset/base/294093

Log:
  sfxge: convert nvram read method to use partition id
  
  Submitted by:   Andy Moreton <amoreton at solarflare.com>
  Reviewed by:    gnn
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      2 days
  Differential Revision: https://reviews.freebsd.org/D4951

Modified:
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_nvram.c
  head/sys/dev/sfxge/common/hunt_impl.h
  head/sys/dev/sfxge/common/hunt_nvram.c
  head/sys/dev/sfxge/common/siena_impl.h
  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 Jan 15 15:17:44 2016        
(r294092)
+++ head/sys/dev/sfxge/common/efx_impl.h        Fri Jan 15 15:19:18 2016        
(r294093)
@@ -486,8 +486,6 @@ typedef struct efx_nvram_ops_s {
 #endif /* EFSYS_OPT_DIAG */
        efx_rc_t        (*envo_get_version)(efx_nic_t *, efx_nvram_type_t,
                                            uint32_t *, uint16_t *);
-       efx_rc_t        (*envo_read_chunk)(efx_nic_t *, efx_nvram_type_t,
-                                           unsigned int, caddr_t, size_t);
        efx_rc_t        (*envo_erase)(efx_nic_t *, efx_nvram_type_t);
        efx_rc_t        (*envo_write_chunk)(efx_nic_t *, efx_nvram_type_t,
                                            unsigned int, caddr_t, size_t);
@@ -499,6 +497,8 @@ typedef struct efx_nvram_ops_s {
                                            uint32_t *);
        efx_rc_t        (*envo_partn_size)(efx_nic_t *, uint32_t, size_t *);
        efx_rc_t        (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *);
+       efx_rc_t        (*envo_partn_read)(efx_nic_t *, uint32_t,
+                                           unsigned int, caddr_t, size_t);
 } efx_nvram_ops_t;
 #endif /* EFSYS_OPT_NVRAM */
 

Modified: head/sys/dev/sfxge/common/efx_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_nvram.c       Fri Jan 15 15:17:44 2016        
(r294092)
+++ head/sys/dev/sfxge/common/efx_nvram.c       Fri Jan 15 15:19:18 2016        
(r294093)
@@ -43,7 +43,6 @@ static efx_nvram_ops_t        __efx_nvram_falco
        falcon_nvram_test,              /* envo_test */
 #endif /* EFSYS_OPT_DIAG */
        falcon_nvram_get_version,       /* envo_get_version */
-       falcon_nvram_read_chunk,        /* envo_read_chunk */
        falcon_nvram_erase,             /* envo_erase */
        falcon_nvram_write_chunk,       /* envo_write_chunk */
        falcon_nvram_rw_finish,         /* envo_rw_finish */
@@ -51,6 +50,7 @@ static efx_nvram_ops_t        __efx_nvram_falco
        falcon_nvram_type_to_partn,     /* envo_type_to_partn */
        falcon_nvram_partn_size,        /* envo_partn_size */
        falcon_nvram_partn_rw_start,    /* envo_partn_rw_start */
+       falcon_nvram_partn_read,        /* envo_partn_read */
 };
 
 #endif /* EFSYS_OPT_FALCON */
@@ -62,7 +62,6 @@ static efx_nvram_ops_t        __efx_nvram_siena
        siena_nvram_test,               /* envo_test */
 #endif /* EFSYS_OPT_DIAG */
        siena_nvram_get_version,        /* envo_get_version */
-       siena_nvram_read_chunk,         /* envo_read_chunk */
        siena_nvram_erase,              /* envo_erase */
        siena_nvram_write_chunk,        /* envo_write_chunk */
        siena_nvram_rw_finish,          /* envo_rw_finish */
@@ -70,6 +69,7 @@ static efx_nvram_ops_t        __efx_nvram_siena
        siena_nvram_type_to_partn,      /* envo_type_to_partn */
        siena_nvram_partn_size,         /* envo_partn_size */
        siena_nvram_partn_rw_start,     /* envo_partn_rw_start */
+       siena_nvram_partn_read,         /* envo_partn_read */
 };
 
 #endif /* EFSYS_OPT_SIENA */
@@ -81,7 +81,6 @@ static efx_nvram_ops_t        __efx_nvram_ef10_
        ef10_nvram_test,                /* envo_test */
 #endif /* EFSYS_OPT_DIAG */
        ef10_nvram_get_version,         /* envo_get_version */
-       ef10_nvram_read_chunk,          /* envo_read_chunk */
        ef10_nvram_erase,               /* envo_erase */
        ef10_nvram_write_chunk,         /* envo_write_chunk */
        ef10_nvram_rw_finish,           /* envo_rw_finish */
@@ -89,6 +88,7 @@ static efx_nvram_ops_t        __efx_nvram_ef10_
        ef10_nvram_type_to_partn,       /* envo_type_to_partn */
        ef10_nvram_partn_size,          /* envo_partn_size */
        ef10_nvram_partn_rw_start,      /* envo_partn_rw_start */
+       ef10_nvram_partn_read,          /* envo_partn_read */
 };
 
 #endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@@ -275,6 +275,7 @@ efx_nvram_read_chunk(
        __in                    size_t size)
 {
        efx_nvram_ops_t *envop = enp->en_envop;
+       uint32_t partn;
        efx_rc_t rc;
 
        EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -285,11 +286,16 @@ efx_nvram_read_chunk(
 
        EFSYS_ASSERT3U(enp->en_nvram_locked, ==, type);
 
-       if ((rc = envop->envo_read_chunk(enp, type, offset, data, size)) != 0)
+       if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
                goto fail1;
 
+       if ((rc = envop->envo_partn_read(enp, partn, offset, data, size)) != 0)
+               goto fail2;
+
        return (0);
 
+fail2:
+       EFSYS_PROBE(fail2);
 fail1:
        EFSYS_PROBE1(fail1, efx_rc_t, rc);
 

Modified: head/sys/dev/sfxge/common/hunt_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/hunt_impl.h       Fri Jan 15 15:17:44 2016        
(r294092)
+++ head/sys/dev/sfxge/common/hunt_impl.h       Fri Jan 15 15:19:18 2016        
(r294093)
@@ -370,14 +370,6 @@ ef10_nvram_partn_lock(
        __in                    uint32_t partn);
 
 extern __checkReturn           efx_rc_t
-ef10_nvram_partn_read(
-       __in                    efx_nic_t *enp,
-       __in                    uint32_t partn,
-       __in                    unsigned int offset,
-       __out_bcount(size)      caddr_t data,
-       __in                    size_t size);
-
-extern __checkReturn           efx_rc_t
 ef10_nvram_partn_erase(
        __in                    efx_nic_t *enp,
        __in                    uint32_t partn,
@@ -416,14 +408,6 @@ ef10_nvram_get_version(
        __out                   uint32_t *subtypep,
        __out_ecount(4)         uint16_t version[4]);
 
-extern __checkReturn           efx_rc_t
-ef10_nvram_read_chunk(
-       __in                    efx_nic_t *enp,
-       __in                    efx_nvram_type_t type,
-       __in                    unsigned int offset,
-       __out_bcount(size)      caddr_t data,
-       __in                    size_t size);
-
 extern  __checkReturn          efx_rc_t
 ef10_nvram_erase(
        __in                    efx_nic_t *enp,
@@ -472,6 +456,14 @@ ef10_nvram_partn_rw_start(
        __in                    uint32_t partn,
        __out                   size_t *chunk_sizep);
 
+extern __checkReturn           efx_rc_t
+ef10_nvram_partn_read(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __in                    unsigned int offset,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size);
+
 #endif /* EFSYS_OPT_NVRAM */
 
 

Modified: head/sys/dev/sfxge/common/hunt_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/hunt_nvram.c      Fri Jan 15 15:17:44 2016        
(r294092)
+++ head/sys/dev/sfxge/common/hunt_nvram.c      Fri Jan 15 15:19:18 2016        
(r294093)
@@ -1769,33 +1769,6 @@ fail1:
 }
 
        __checkReturn           efx_rc_t
-ef10_nvram_read_chunk(
-       __in                    efx_nic_t *enp,
-       __in                    efx_nvram_type_t type,
-       __in                    unsigned int offset,
-       __out_bcount(size)      caddr_t data,
-       __in                    size_t size)
-{
-       uint32_t partn;
-       efx_rc_t rc;
-
-       if ((rc = ef10_nvram_type_to_partn(enp, type, &partn)) != 0)
-               goto fail1;
-
-       if ((rc = ef10_nvram_partn_read(enp, partn, offset, data, size)) != 0)
-               goto fail2;
-
-       return (0);
-
-fail2:
-       EFSYS_PROBE(fail2);
-fail1:
-       EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
-       return (rc);
-}
-
-       __checkReturn           efx_rc_t
 ef10_nvram_erase(
        __in                    efx_nic_t *enp,
        __in                    efx_nvram_type_t type)

Modified: head/sys/dev/sfxge/common/siena_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/siena_impl.h      Fri Jan 15 15:17:44 2016        
(r294092)
+++ head/sys/dev/sfxge/common/siena_impl.h      Fri Jan 15 15:19:18 2016        
(r294093)
@@ -156,14 +156,6 @@ siena_nvram_partn_lock(
        __in                    uint32_t partn);
 
 extern __checkReturn           efx_rc_t
-siena_nvram_partn_read(
-       __in                    efx_nic_t *enp,
-       __in                    uint32_t partn,
-       __in                    unsigned int offset,
-       __out_bcount(size)      caddr_t data,
-       __in                    size_t size);
-
-extern __checkReturn           efx_rc_t
 siena_nvram_partn_erase(
        __in                    efx_nic_t *enp,
        __in                    uint32_t partn,
@@ -216,14 +208,6 @@ siena_nvram_get_version(
        __out                   uint32_t *subtypep,
        __out_ecount(4)         uint16_t version[4]);
 
-extern __checkReturn           efx_rc_t
-siena_nvram_read_chunk(
-       __in                    efx_nic_t *enp,
-       __in                    efx_nvram_type_t type,
-       __in                    unsigned int offset,
-       __out_bcount(size)      caddr_t data,
-       __in                    size_t size);
-
 extern  __checkReturn          efx_rc_t
 siena_nvram_erase(
        __in                    efx_nic_t *enp,
@@ -266,6 +250,14 @@ siena_nvram_partn_rw_start(
        __in                    uint32_t partn,
        __out                   size_t *chunk_sizep);
 
+extern __checkReturn           efx_rc_t
+siena_nvram_partn_read(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __in                    unsigned int offset,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size);
+
 #endif /* EFSYS_OPT_NVRAM */
 
 #if EFSYS_OPT_VPD

Modified: head/sys/dev/sfxge/common/siena_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/siena_nvram.c     Fri Jan 15 15:17:44 2016        
(r294092)
+++ head/sys/dev/sfxge/common/siena_nvram.c     Fri Jan 15 15:19:18 2016        
(r294093)
@@ -594,33 +594,6 @@ fail1:
 }
 
        __checkReturn           efx_rc_t
-siena_nvram_read_chunk(
-       __in                    efx_nic_t *enp,
-       __in                    efx_nvram_type_t type,
-       __in                    unsigned int offset,
-       __out_bcount(size)      caddr_t data,
-       __in                    size_t size)
-{
-       uint32_t partn;
-       efx_rc_t rc;
-
-       if ((rc = siena_nvram_type_to_partn(enp, type, &partn)) != 0)
-               goto fail1;
-
-       if ((rc = siena_nvram_partn_read(enp, partn, offset, data, size)) != 0)
-               goto fail2;
-
-       return (0);
-
-fail2:
-       EFSYS_PROBE(fail2);
-fail1:
-       EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
-       return (rc);
-}
-
-       __checkReturn           efx_rc_t
 siena_nvram_erase(
        __in                    efx_nic_t *enp,
        __in                    efx_nvram_type_t type)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to