aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-11-28 22:43:33 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-29 19:46:31 -0500
commit0aa3fbaa3f2d29a14231ebb0c8e521c23701d41f (patch)
tree11ab228583d64eae81abe02f49e233fdab5cfb54 /drivers/net
parent9bfc4bb1f9b5863b177752b88e8bfa364e83a4fa (diff)
sfc: Add efx_nic_type operation for NVRAM self-test
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/sfc/falcon.c10
-rw-r--r--drivers/net/sfc/falcon.h3
-rw-r--r--drivers/net/sfc/net_driver.h2
-rw-r--r--drivers/net/sfc/selftest.c9
4 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index bcdc5452bfd0..d4d13c13f8ae 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -2345,7 +2345,8 @@ static void falcon_remove_port(struct efx_nic *efx)
2345 * 2345 *
2346 **************************************************************************/ 2346 **************************************************************************/
2347 2347
2348int falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out) 2348static int
2349falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
2349{ 2350{
2350 struct falcon_nvconfig *nvconfig; 2351 struct falcon_nvconfig *nvconfig;
2351 struct efx_spi_device *spi; 2352 struct efx_spi_device *spi;
@@ -2408,6 +2409,11 @@ int falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
2408 return rc; 2409 return rc;
2409} 2410}
2410 2411
2412static int falcon_test_nvram(struct efx_nic *efx)
2413{
2414 return falcon_read_nvram(efx, NULL);
2415}
2416
2411/* Registers tested in the falcon register test */ 2417/* Registers tested in the falcon register test */
2412static struct { 2418static struct {
2413 unsigned address; 2419 unsigned address;
@@ -3290,6 +3296,7 @@ struct efx_nic_type falcon_a1_nic_type = {
3290 .get_wol = falcon_get_wol, 3296 .get_wol = falcon_get_wol,
3291 .set_wol = falcon_set_wol, 3297 .set_wol = falcon_set_wol,
3292 .resume_wol = efx_port_dummy_op_void, 3298 .resume_wol = efx_port_dummy_op_void,
3299 .test_nvram = falcon_test_nvram,
3293 .default_mac_ops = &falcon_xmac_operations, 3300 .default_mac_ops = &falcon_xmac_operations,
3294 3301
3295 .revision = EFX_REV_FALCON_A1, 3302 .revision = EFX_REV_FALCON_A1,
@@ -3328,6 +3335,7 @@ struct efx_nic_type falcon_b0_nic_type = {
3328 .set_wol = falcon_set_wol, 3335 .set_wol = falcon_set_wol,
3329 .resume_wol = efx_port_dummy_op_void, 3336 .resume_wol = efx_port_dummy_op_void,
3330 .test_registers = falcon_b0_test_registers, 3337 .test_registers = falcon_b0_test_registers,
3338 .test_nvram = falcon_test_nvram,
3331 .default_mac_ops = &falcon_xmac_operations, 3339 .default_mac_ops = &falcon_xmac_operations,
3332 3340
3333 .revision = EFX_REV_FALCON_B0, 3341 .revision = EFX_REV_FALCON_B0,
diff --git a/drivers/net/sfc/falcon.h b/drivers/net/sfc/falcon.h
index cfcc2a38366f..464c2747260f 100644
--- a/drivers/net/sfc/falcon.h
+++ b/drivers/net/sfc/falcon.h
@@ -151,9 +151,6 @@ extern void falcon_stop_nic_stats(struct efx_nic *efx);
151extern int falcon_reset_xaui(struct efx_nic *efx); 151extern int falcon_reset_xaui(struct efx_nic *efx);
152 152
153/* Tests */ 153/* Tests */
154struct falcon_nvconfig;
155extern int falcon_read_nvram(struct efx_nic *efx,
156 struct falcon_nvconfig *nvconfig);
157 154
158/************************************************************************** 155/**************************************************************************
159 * 156 *
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 9d353d923eec..de7cf17f4a45 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -865,6 +865,7 @@ static inline const char *efx_dev_name(struct efx_nic *efx)
865 * @set_wol: Push WoL configuration to the NIC 865 * @set_wol: Push WoL configuration to the NIC
866 * @resume_wol: Synchronise WoL state between driver and MC (e.g. after resume) 866 * @resume_wol: Synchronise WoL state between driver and MC (e.g. after resume)
867 * @test_registers: Test read/write functionality of control registers 867 * @test_registers: Test read/write functionality of control registers
868 * @test_nvram: Test validity of NVRAM contents
868 * @default_mac_ops: efx_mac_operations to set at startup 869 * @default_mac_ops: efx_mac_operations to set at startup
869 * @revision: Hardware architecture revision 870 * @revision: Hardware architecture revision
870 * @mem_map_size: Memory BAR mapped size 871 * @mem_map_size: Memory BAR mapped size
@@ -904,6 +905,7 @@ struct efx_nic_type {
904 int (*set_wol)(struct efx_nic *efx, u32 type); 905 int (*set_wol)(struct efx_nic *efx, u32 type);
905 void (*resume_wol)(struct efx_nic *efx); 906 void (*resume_wol)(struct efx_nic *efx);
906 int (*test_registers)(struct efx_nic *efx); 907 int (*test_registers)(struct efx_nic *efx);
908 int (*test_nvram)(struct efx_nic *efx);
907 struct efx_mac_operations *default_mac_ops; 909 struct efx_mac_operations *default_mac_ops;
908 910
909 int revision; 911 int revision;
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index f30355210044..fa56e2e8e9c5 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -113,10 +113,13 @@ out:
113 113
114static int efx_test_nvram(struct efx_nic *efx, struct efx_self_tests *tests) 114static int efx_test_nvram(struct efx_nic *efx, struct efx_self_tests *tests)
115{ 115{
116 int rc; 116 int rc = 0;
117
118 if (efx->type->test_nvram) {
119 rc = efx->type->test_nvram(efx);
120 tests->nvram = rc ? -1 : 1;
121 }
117 122
118 rc = falcon_read_nvram(efx, NULL);
119 tests->nvram = rc ? -1 : 1;
120 return rc; 123 return rc;
121} 124}
122 125