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/mcdi.c | |
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/mcdi.c')
-rw-r--r-- | drivers/net/sfc/mcdi.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/sfc/mcdi.c b/drivers/net/sfc/mcdi.c index e9f0e5ee4519..86610db2cff5 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]; |