diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-02-03 04:31:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-03 22:12:45 -0500 |
commit | 2e803407400efe592e5294993a5b1e8251f6dd49 (patch) | |
tree | e325fb4e08e903f1a650086dcfa872e535b3990e /drivers/net/sfc | |
parent | 4f16c0739145476ba37a7fa9eea0c33850efc2ce (diff) |
sfc: Implement NVRAM selftest for SFC9000 family
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/mcdi.c | 46 | ||||
-rw-r--r-- | drivers/net/sfc/mcdi.h | 1 | ||||
-rw-r--r-- | drivers/net/sfc/siena.c | 1 |
3 files changed, 48 insertions, 0 deletions
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c index e9f0e5ee451..86610db2cff 100644 --- a/drivers/net/sfc/mcdi.c +++ b/drivers/net/sfc/mcdi.c | |||
@@ -896,6 +896,52 @@ fail: | |||
896 | return rc; | 896 | return rc; |
897 | } | 897 | } |
898 | 898 | ||
899 | static int efx_mcdi_nvram_test(struct efx_nic *efx, unsigned int type) | ||
900 | { | ||
901 | u8 inbuf[MC_CMD_NVRAM_TEST_IN_LEN]; | ||
902 | u8 outbuf[MC_CMD_NVRAM_TEST_OUT_LEN]; | ||
903 | int rc; | ||
904 | |||
905 | MCDI_SET_DWORD(inbuf, NVRAM_TEST_IN_TYPE, type); | ||
906 | |||
907 | rc = efx_mcdi_rpc(efx, MC_CMD_NVRAM_TEST, inbuf, sizeof(inbuf), | ||
908 | outbuf, sizeof(outbuf), NULL); | ||
909 | if (rc) | ||
910 | return rc; | ||
911 | |||
912 | switch (MCDI_DWORD(outbuf, NVRAM_TEST_OUT_RESULT)) { | ||
913 | case MC_CMD_NVRAM_TEST_PASS: | ||
914 | case MC_CMD_NVRAM_TEST_NOTSUPP: | ||
915 | return 0; | ||
916 | default: | ||
917 | return -EIO; | ||
918 | } | ||
919 | } | ||
920 | |||
921 | int efx_mcdi_nvram_test_all(struct efx_nic *efx) | ||
922 | { | ||
923 | u32 nvram_types; | ||
924 | unsigned int type; | ||
925 | int rc; | ||
926 | |||
927 | rc = efx_mcdi_nvram_types(efx, &nvram_types); | ||
928 | if (rc) | ||
929 | return rc; | ||
930 | |||
931 | type = 0; | ||
932 | while (nvram_types != 0) { | ||
933 | if (nvram_types & 1) { | ||
934 | rc = efx_mcdi_nvram_test(efx, type); | ||
935 | if (rc) | ||
936 | return rc; | ||
937 | } | ||
938 | type++; | ||
939 | nvram_types >>= 1; | ||
940 | } | ||
941 | |||
942 | return 0; | ||
943 | } | ||
944 | |||
899 | static int efx_mcdi_read_assertion(struct efx_nic *efx) | 945 | static int efx_mcdi_read_assertion(struct efx_nic *efx) |
900 | { | 946 | { |
901 | u8 inbuf[MC_CMD_GET_ASSERTS_IN_LEN]; | 947 | u8 inbuf[MC_CMD_GET_ASSERTS_IN_LEN]; |
diff --git a/drivers/net/sfc/mcdi.h b/drivers/net/sfc/mcdi.h index 10ce98f4c0f..f1f89ad4075 100644 --- a/drivers/net/sfc/mcdi.h +++ b/drivers/net/sfc/mcdi.h | |||
@@ -116,6 +116,7 @@ extern int efx_mcdi_nvram_erase(struct efx_nic *efx, unsigned int type, | |||
116 | loff_t offset, size_t length); | 116 | loff_t offset, size_t length); |
117 | extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx, | 117 | extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx, |
118 | unsigned int type); | 118 | unsigned int type); |
119 | extern int efx_mcdi_nvram_test_all(struct efx_nic *efx); | ||
119 | extern int efx_mcdi_handle_assertion(struct efx_nic *efx); | 120 | extern int efx_mcdi_handle_assertion(struct efx_nic *efx); |
120 | extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); | 121 | extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); |
121 | extern int efx_mcdi_reset_port(struct efx_nic *efx); | 122 | extern int efx_mcdi_reset_port(struct efx_nic *efx); |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index f6a53895ff2..8e131128471 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -583,6 +583,7 @@ struct efx_nic_type siena_a0_nic_type = { | |||
583 | .set_wol = siena_set_wol, | 583 | .set_wol = siena_set_wol, |
584 | .resume_wol = siena_init_wol, | 584 | .resume_wol = siena_init_wol, |
585 | .test_registers = siena_test_registers, | 585 | .test_registers = siena_test_registers, |
586 | .test_nvram = efx_mcdi_nvram_test_all, | ||
586 | .default_mac_ops = &efx_mcdi_mac_operations, | 587 | .default_mac_ops = &efx_mcdi_mac_operations, |
587 | 588 | ||
588 | .revision = EFX_REV_SIENA_A0, | 589 | .revision = EFX_REV_SIENA_A0, |