summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarybchik <arybchik@FreeBSD.org>2016-12-31 11:26:29 +0000
committerarybchik <arybchik@FreeBSD.org>2016-12-31 11:26:29 +0000
commit8b8353b4dfaee050d7de839f32b710da1029af59 (patch)
treea1a2217ce2174d6affd496b3d62f6e9b2d2c689b
parent6e8dffa0953f143970bdab65940618976736082d (diff)
downloadFreeBSD-src-8b8353b4dfaee050d7de839f32b710da1029af59.zip
FreeBSD-src-8b8353b4dfaee050d7de839f32b710da1029af59.tar.gz
MFC r310717
sfxge(4): move BIST methods from hunt_phy.c to ef10_phy.c Submitted by: Mark Spender <mspender at solarflare.com> Sponsored by: Solarflare Communications, Inc.
-rw-r--r--sys/dev/sfxge/common/ef10_impl.h28
-rw-r--r--sys/dev/sfxge/common/ef10_phy.c153
-rw-r--r--sys/dev/sfxge/common/hunt_impl.h33
-rw-r--r--sys/dev/sfxge/common/hunt_phy.c153
4 files changed, 181 insertions, 186 deletions
diff --git a/sys/dev/sfxge/common/ef10_impl.h b/sys/dev/sfxge/common/ef10_impl.h
index be1be21..4a8a3b7 100644
--- a/sys/dev/sfxge/common/ef10_impl.h
+++ b/sys/dev/sfxge/common/ef10_impl.h
@@ -602,6 +602,34 @@ ef10_phy_stats_update(
#endif /* EFSYS_OPT_PHY_STATS */
+#if EFSYS_OPT_BIST
+
+extern __checkReturn efx_rc_t
+ef10_bist_enable_offline(
+ __in efx_nic_t *enp);
+
+extern __checkReturn efx_rc_t
+ef10_bist_start(
+ __in efx_nic_t *enp,
+ __in efx_bist_type_t type);
+
+extern __checkReturn efx_rc_t
+ef10_bist_poll(
+ __in efx_nic_t *enp,
+ __in efx_bist_type_t type,
+ __out efx_bist_result_t *resultp,
+ __out_opt __drv_when(count > 0, __notnull)
+ uint32_t *value_maskp,
+ __out_ecount_opt(count) __drv_when(count > 0, __notnull)
+ unsigned long *valuesp,
+ __in size_t count);
+
+extern void
+ef10_bist_stop(
+ __in efx_nic_t *enp,
+ __in efx_bist_type_t type);
+
+#endif /* EFSYS_OPT_BIST */
/* TX */
diff --git a/sys/dev/sfxge/common/ef10_phy.c b/sys/dev/sfxge/common/ef10_phy.c
index 77b2846..c1cb250 100644
--- a/sys/dev/sfxge/common/ef10_phy.c
+++ b/sys/dev/sfxge/common/ef10_phy.c
@@ -474,4 +474,157 @@ ef10_phy_stats_update(
#endif /* EFSYS_OPT_PHY_STATS */
+#if EFSYS_OPT_BIST
+
+ __checkReturn efx_rc_t
+ef10_bist_enable_offline(
+ __in efx_nic_t *enp)
+{
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_bist_enable_offline(enp)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_bist_start(
+ __in efx_nic_t *enp,
+ __in efx_bist_type_t type)
+{
+ efx_rc_t rc;
+
+ if ((rc = efx_mcdi_bist_start(enp, type)) != 0)
+ goto fail1;
+
+ return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_bist_poll(
+ __in efx_nic_t *enp,
+ __in efx_bist_type_t type,
+ __out efx_bist_result_t *resultp,
+ __out_opt __drv_when(count > 0, __notnull)
+ uint32_t *value_maskp,
+ __out_ecount_opt(count) __drv_when(count > 0, __notnull)
+ unsigned long *valuesp,
+ __in size_t count)
+{
+ efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
+ efx_mcdi_req_t req;
+ uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN,
+ MCDI_CTL_SDU_LEN_MAX)];
+ uint32_t value_mask = 0;
+ uint32_t result;
+ efx_rc_t rc;
+
+ _NOTE(ARGUNUSED(type))
+
+ (void) memset(payload, 0, sizeof (payload));
+ req.emr_cmd = MC_CMD_POLL_BIST;
+ req.emr_in_buf = payload;
+ req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
+ req.emr_out_buf = payload;
+ req.emr_out_length = MCDI_CTL_SDU_LEN_MAX;
+
+ efx_mcdi_execute(enp, &req);
+
+ if (req.emr_rc != 0) {
+ rc = req.emr_rc;
+ goto fail1;
+ }
+
+ if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) {
+ rc = EMSGSIZE;
+ goto fail2;
+ }
+
+ if (count > 0)
+ (void) memset(valuesp, '\0', count * sizeof (unsigned long));
+
+ result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT);
+
+ if (result == MC_CMD_POLL_BIST_FAILED &&
+ req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MEM_LEN &&
+ count > EFX_BIST_MEM_ECC_FATAL) {
+ if (valuesp != NULL) {
+ valuesp[EFX_BIST_MEM_TEST] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_TEST);
+ valuesp[EFX_BIST_MEM_ADDR] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ADDR);
+ valuesp[EFX_BIST_MEM_BUS] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_BUS);
+ valuesp[EFX_BIST_MEM_EXPECT] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_EXPECT);
+ valuesp[EFX_BIST_MEM_ACTUAL] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ACTUAL);
+ valuesp[EFX_BIST_MEM_ECC] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC);
+ valuesp[EFX_BIST_MEM_ECC_PARITY] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_PARITY);
+ valuesp[EFX_BIST_MEM_ECC_FATAL] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_FATAL);
+ }
+ value_mask |= (1 << EFX_BIST_MEM_TEST) |
+ (1 << EFX_BIST_MEM_ADDR) |
+ (1 << EFX_BIST_MEM_BUS) |
+ (1 << EFX_BIST_MEM_EXPECT) |
+ (1 << EFX_BIST_MEM_ACTUAL) |
+ (1 << EFX_BIST_MEM_ECC) |
+ (1 << EFX_BIST_MEM_ECC_PARITY) |
+ (1 << EFX_BIST_MEM_ECC_FATAL);
+ } else if (result == MC_CMD_POLL_BIST_FAILED &&
+ encp->enc_phy_type == EFX_PHY_XFI_FARMI &&
+ req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN &&
+ count > EFX_BIST_FAULT_CODE) {
+ if (valuesp != NULL)
+ valuesp[EFX_BIST_FAULT_CODE] =
+ MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST);
+ value_mask |= 1 << EFX_BIST_FAULT_CODE;
+ }
+
+ if (value_maskp != NULL)
+ *value_maskp = value_mask;
+
+ EFSYS_ASSERT(resultp != NULL);
+ if (result == MC_CMD_POLL_BIST_RUNNING)
+ *resultp = EFX_BIST_RESULT_RUNNING;
+ else if (result == MC_CMD_POLL_BIST_PASSED)
+ *resultp = EFX_BIST_RESULT_PASSED;
+ else
+ *resultp = EFX_BIST_RESULT_FAILED;
+
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
+}
+
+ void
+ef10_bist_stop(
+ __in efx_nic_t *enp,
+ __in efx_bist_type_t type)
+{
+ /* There is no way to stop BIST on EF10. */
+ _NOTE(ARGUNUSED(enp, type))
+}
+
+#endif /* EFSYS_OPT_BIST */
+
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h
index a699ca6..06904c66 100644
--- a/sys/dev/sfxge/common/hunt_impl.h
+++ b/sys/dev/sfxge/common/hunt_impl.h
@@ -69,39 +69,6 @@ extern __checkReturn efx_rc_t
hunt_board_cfg(
__in efx_nic_t *enp);
-
-/* PHY */
-
-#if EFSYS_OPT_BIST
-
-extern __checkReturn efx_rc_t
-ef10_bist_enable_offline(
- __in efx_nic_t *enp);
-
-extern __checkReturn efx_rc_t
-ef10_bist_start(
- __in efx_nic_t *enp,
- __in efx_bist_type_t type);
-
-extern __checkReturn efx_rc_t
-ef10_bist_poll(
- __in efx_nic_t *enp,
- __in efx_bist_type_t type,
- __out efx_bist_result_t *resultp,
- __out_opt __drv_when(count > 0, __notnull)
- uint32_t *value_maskp,
- __out_ecount_opt(count) __drv_when(count > 0, __notnull)
- unsigned long *valuesp,
- __in size_t count);
-
-extern void
-ef10_bist_stop(
- __in efx_nic_t *enp,
- __in efx_bist_type_t type);
-
-#endif /* EFSYS_OPT_BIST */
-
-
#ifdef __cplusplus
}
#endif
diff --git a/sys/dev/sfxge/common/hunt_phy.c b/sys/dev/sfxge/common/hunt_phy.c
index fd813b3a..5d81b59 100644
--- a/sys/dev/sfxge/common/hunt_phy.c
+++ b/sys/dev/sfxge/common/hunt_phy.c
@@ -36,157 +36,4 @@ __FBSDID("$FreeBSD$");
#if EFSYS_OPT_HUNTINGTON
-#if EFSYS_OPT_BIST
-
- __checkReturn efx_rc_t
-ef10_bist_enable_offline(
- __in efx_nic_t *enp)
-{
- efx_rc_t rc;
-
- if ((rc = efx_mcdi_bist_enable_offline(enp)) != 0)
- goto fail1;
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_bist_start(
- __in efx_nic_t *enp,
- __in efx_bist_type_t type)
-{
- efx_rc_t rc;
-
- if ((rc = efx_mcdi_bist_start(enp, type)) != 0)
- goto fail1;
-
- return (0);
-
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- __checkReturn efx_rc_t
-ef10_bist_poll(
- __in efx_nic_t *enp,
- __in efx_bist_type_t type,
- __out efx_bist_result_t *resultp,
- __out_opt __drv_when(count > 0, __notnull)
- uint32_t *value_maskp,
- __out_ecount_opt(count) __drv_when(count > 0, __notnull)
- unsigned long *valuesp,
- __in size_t count)
-{
- efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
- efx_mcdi_req_t req;
- uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN,
- MCDI_CTL_SDU_LEN_MAX)];
- uint32_t value_mask = 0;
- uint32_t result;
- efx_rc_t rc;
-
- _NOTE(ARGUNUSED(type))
-
- (void) memset(payload, 0, sizeof (payload));
- req.emr_cmd = MC_CMD_POLL_BIST;
- req.emr_in_buf = payload;
- req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
- req.emr_out_buf = payload;
- req.emr_out_length = MCDI_CTL_SDU_LEN_MAX;
-
- efx_mcdi_execute(enp, &req);
-
- if (req.emr_rc != 0) {
- rc = req.emr_rc;
- goto fail1;
- }
-
- if (req.emr_out_length_used < MC_CMD_POLL_BIST_OUT_RESULT_OFST + 4) {
- rc = EMSGSIZE;
- goto fail2;
- }
-
- if (count > 0)
- (void) memset(valuesp, '\0', count * sizeof (unsigned long));
-
- result = MCDI_OUT_DWORD(req, POLL_BIST_OUT_RESULT);
-
- if (result == MC_CMD_POLL_BIST_FAILED &&
- req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MEM_LEN &&
- count > EFX_BIST_MEM_ECC_FATAL) {
- if (valuesp != NULL) {
- valuesp[EFX_BIST_MEM_TEST] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_TEST);
- valuesp[EFX_BIST_MEM_ADDR] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ADDR);
- valuesp[EFX_BIST_MEM_BUS] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_BUS);
- valuesp[EFX_BIST_MEM_EXPECT] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_EXPECT);
- valuesp[EFX_BIST_MEM_ACTUAL] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ACTUAL);
- valuesp[EFX_BIST_MEM_ECC] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC);
- valuesp[EFX_BIST_MEM_ECC_PARITY] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_PARITY);
- valuesp[EFX_BIST_MEM_ECC_FATAL] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MEM_ECC_FATAL);
- }
- value_mask |= (1 << EFX_BIST_MEM_TEST) |
- (1 << EFX_BIST_MEM_ADDR) |
- (1 << EFX_BIST_MEM_BUS) |
- (1 << EFX_BIST_MEM_EXPECT) |
- (1 << EFX_BIST_MEM_ACTUAL) |
- (1 << EFX_BIST_MEM_ECC) |
- (1 << EFX_BIST_MEM_ECC_PARITY) |
- (1 << EFX_BIST_MEM_ECC_FATAL);
- } else if (result == MC_CMD_POLL_BIST_FAILED &&
- encp->enc_phy_type == EFX_PHY_XFI_FARMI &&
- req.emr_out_length >= MC_CMD_POLL_BIST_OUT_MRSFP_LEN &&
- count > EFX_BIST_FAULT_CODE) {
- if (valuesp != NULL)
- valuesp[EFX_BIST_FAULT_CODE] =
- MCDI_OUT_DWORD(req, POLL_BIST_OUT_MRSFP_TEST);
- value_mask |= 1 << EFX_BIST_FAULT_CODE;
- }
-
- if (value_maskp != NULL)
- *value_maskp = value_mask;
-
- EFSYS_ASSERT(resultp != NULL);
- if (result == MC_CMD_POLL_BIST_RUNNING)
- *resultp = EFX_BIST_RESULT_RUNNING;
- else if (result == MC_CMD_POLL_BIST_PASSED)
- *resultp = EFX_BIST_RESULT_PASSED;
- else
- *resultp = EFX_BIST_RESULT_FAILED;
-
- return (0);
-
-fail2:
- EFSYS_PROBE(fail2);
-fail1:
- EFSYS_PROBE1(fail1, efx_rc_t, rc);
-
- return (rc);
-}
-
- void
-ef10_bist_stop(
- __in efx_nic_t *enp,
- __in efx_bist_type_t type)
-{
- /* There is no way to stop BIST on EF10. */
- _NOTE(ARGUNUSED(enp, type))
-}
-
-#endif /* EFSYS_OPT_BIST */
-
#endif /* EFSYS_OPT_HUNTINGTON */
OpenPOWER on IntegriCloud