svn commit: r293889 - head/sys/dev/sfxge/common
Andrew Rybchenko
arybchik at FreeBSD.org
Thu Jan 14 09:01:55 UTC 2016
Author: arybchik
Date: Thu Jan 14 09:01:53 2016
New Revision: 293889
URL: https://svnweb.freebsd.org/changeset/base/293889
Log:
sfxge: convert nvram size 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/D4910
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 Thu Jan 14 09:00:35 2016 (r293888)
+++ head/sys/dev/sfxge/common/efx_impl.h Thu Jan 14 09:01:53 2016 (r293889)
@@ -480,7 +480,6 @@ typedef struct efx_nvram_ops_s {
#if EFSYS_OPT_DIAG
efx_rc_t (*envo_test)(efx_nic_t *);
#endif /* EFSYS_OPT_DIAG */
- efx_rc_t (*envo_size)(efx_nic_t *, efx_nvram_type_t, size_t *);
efx_rc_t (*envo_get_version)(efx_nic_t *, efx_nvram_type_t,
uint32_t *, uint16_t *);
efx_rc_t (*envo_rw_start)(efx_nic_t *, efx_nvram_type_t, size_t *);
@@ -495,6 +494,7 @@ typedef struct efx_nvram_ops_s {
efx_rc_t (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
uint32_t *);
+ efx_rc_t (*envo_partn_size)(efx_nic_t *, uint32_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 Thu Jan 14 09:00:35 2016 (r293888)
+++ head/sys/dev/sfxge/common/efx_nvram.c Thu Jan 14 09:01:53 2016 (r293889)
@@ -42,7 +42,6 @@ static efx_nvram_ops_t __efx_nvram_falco
#if EFSYS_OPT_DIAG
falcon_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
- falcon_nvram_size, /* envo_size */
falcon_nvram_get_version, /* envo_get_version */
falcon_nvram_rw_start, /* envo_rw_start */
falcon_nvram_read_chunk, /* envo_read_chunk */
@@ -51,6 +50,7 @@ static efx_nvram_ops_t __efx_nvram_falco
falcon_nvram_rw_finish, /* envo_rw_finish */
falcon_nvram_set_version, /* envo_set_version */
falcon_nvram_type_to_partn, /* envo_type_to_partn */
+ falcon_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_FALCON */
@@ -61,7 +61,6 @@ static efx_nvram_ops_t __efx_nvram_siena
#if EFSYS_OPT_DIAG
siena_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
- siena_nvram_size, /* envo_size */
siena_nvram_get_version, /* envo_get_version */
siena_nvram_rw_start, /* envo_rw_start */
siena_nvram_read_chunk, /* envo_read_chunk */
@@ -70,6 +69,7 @@ static efx_nvram_ops_t __efx_nvram_siena
siena_nvram_rw_finish, /* envo_rw_finish */
siena_nvram_set_version, /* envo_set_version */
siena_nvram_type_to_partn, /* envo_type_to_partn */
+ siena_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_SIENA */
@@ -80,7 +80,6 @@ static efx_nvram_ops_t __efx_nvram_ef10_
#if EFSYS_OPT_DIAG
ef10_nvram_test, /* envo_test */
#endif /* EFSYS_OPT_DIAG */
- ef10_nvram_size, /* envo_size */
ef10_nvram_get_version, /* envo_get_version */
ef10_nvram_rw_start, /* envo_rw_start */
ef10_nvram_read_chunk, /* envo_read_chunk */
@@ -89,6 +88,7 @@ static efx_nvram_ops_t __efx_nvram_ef10_
ef10_nvram_rw_finish, /* envo_rw_finish */
ef10_nvram_set_version, /* envo_set_version */
ef10_nvram_type_to_partn, /* envo_type_to_partn */
+ ef10_nvram_partn_size, /* envo_partn_size */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
@@ -178,6 +178,7 @@ efx_nvram_size(
__out size_t *sizep)
{
efx_nvram_ops_t *envop = enp->en_envop;
+ uint32_t partn;
efx_rc_t rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -185,13 +186,19 @@ efx_nvram_size(
EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
- if ((rc = envop->envo_size(enp, type, sizep)) != 0)
+ if ((rc = envop->envo_type_to_partn(enp, type, &partn)) != 0)
goto fail1;
+ if ((rc = envop->envo_partn_size(enp, partn, sizep)) != 0)
+ goto fail2;
+
return (0);
+fail2:
+ EFSYS_PROBE(fail2);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ *sizep = 0;
return (rc);
}
Modified: head/sys/dev/sfxge/common/hunt_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/hunt_impl.h Thu Jan 14 09:00:35 2016 (r293888)
+++ head/sys/dev/sfxge/common/hunt_impl.h Thu Jan 14 09:01:53 2016 (r293889)
@@ -370,12 +370,6 @@ ef10_nvram_partn_write_segment_tlv(
__in boolean_t all_segments);
extern __checkReturn efx_rc_t
-ef10_nvram_partn_size(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
ef10_nvram_partn_lock(
__in efx_nic_t *enp,
__in uint32_t partn);
@@ -421,12 +415,6 @@ ef10_nvram_test(
#endif /* EFSYS_OPT_DIAG */
extern __checkReturn efx_rc_t
-ef10_nvram_size(
- __in efx_nic_t *enp,
- __in efx_nvram_type_t type,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
ef10_nvram_get_version(
__in efx_nic_t *enp,
__in efx_nvram_type_t type,
@@ -483,6 +471,12 @@ ef10_nvram_type_to_partn(
__in efx_nvram_type_t type,
__out uint32_t *partnp);
+extern __checkReturn efx_rc_t
+ef10_nvram_partn_size(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __out size_t *sizep);
+
#endif /* EFSYS_OPT_NVRAM */
Modified: head/sys/dev/sfxge/common/hunt_nvram.c
==============================================================================
--- head/sys/dev/sfxge/common/hunt_nvram.c Thu Jan 14 09:00:35 2016 (r293888)
+++ head/sys/dev/sfxge/common/hunt_nvram.c Thu Jan 14 09:01:53 2016 (r293889)
@@ -1709,33 +1709,6 @@ fail1:
#endif /* EFSYS_OPT_DIAG */
__checkReturn efx_rc_t
-ef10_nvram_size(
- __in efx_nic_t *enp,
- __in efx_nvram_type_t type,
- __out size_t *sizep)
-{
- 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_size(enp, partn, sizep)) != 0)
- goto fail2;
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- *sizep = 0;
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
ef10_nvram_get_version(
__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 Thu Jan 14 09:00:35 2016 (r293888)
+++ head/sys/dev/sfxge/common/siena_impl.h Thu Jan 14 09:01:53 2016 (r293889)
@@ -156,12 +156,6 @@ siena_mcdi_feature_supported(
#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
extern __checkReturn efx_rc_t
-siena_nvram_partn_size(
- __in efx_nic_t *enp,
- __in uint32_t partn,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
siena_nvram_partn_lock(
__in efx_nic_t *enp,
__in uint32_t partn);
@@ -215,12 +209,6 @@ siena_nvram_test(
#endif /* EFSYS_OPT_DIAG */
extern __checkReturn efx_rc_t
-siena_nvram_size(
- __in efx_nic_t *enp,
- __in efx_nvram_type_t type,
- __out size_t *sizep);
-
-extern __checkReturn efx_rc_t
siena_nvram_get_subtype(
__in efx_nic_t *enp,
__in uint32_t partn,
@@ -277,6 +265,12 @@ siena_nvram_type_to_partn(
__in efx_nvram_type_t type,
__out uint32_t *partnp);
+extern __checkReturn efx_rc_t
+siena_nvram_partn_size(
+ __in efx_nic_t *enp,
+ __in uint32_t partn,
+ __out size_t *sizep);
+
#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 Thu Jan 14 09:00:35 2016 (r293888)
+++ head/sys/dev/sfxge/common/siena_nvram.c Thu Jan 14 09:01:53 2016 (r293889)
@@ -291,32 +291,6 @@ fail1:
#endif /* EFSYS_OPT_DIAG */
- __checkReturn efx_rc_t
-siena_nvram_size(
- __in efx_nic_t *enp,
- __in efx_nvram_type_t type,
- __out size_t *sizep)
-{
- 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_size(enp, partn, sizep)) != 0)
- goto fail2;
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- *sizep = 0;
-
- return (rc);
-}
#define SIENA_DYNAMIC_CFG_SIZE(_nitems) \
(sizeof (siena_mc_dynamic_config_hdr_t) + ((_nitems) * \
More information about the svn-src-head
mailing list