aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-09-17 21:33:52 -0400
committerBen Hutchings <bhutchings@solarflare.com>2013-08-21 14:35:41 -0400
commit6bff861dc798ed36da0cb80f0201da2fe9d9dc69 (patch)
tree6f4dc2704dd22cf8d4134a2632da4d258d0560d4 /drivers/net/ethernet/sfc
parent338f74df399d652788cf3bab247257ae90419c7d (diff)
sfc: Move siena_reset_hw() and siena_map_reset_reason() into MCDI module
These implementations should work for EF10 too. Rename them accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/mcdi.c24
-rw-r--r--drivers/net/ethernet/sfc/mcdi.h4
-rw-r--r--drivers/net/ethernet/sfc/siena.c33
3 files changed, 30 insertions, 31 deletions
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 3f55b16265fc..4781e02c4f05 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -1087,7 +1087,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
1087 __func__, rc); 1087 __func__, rc);
1088} 1088}
1089 1089
1090int efx_mcdi_reset_port(struct efx_nic *efx) 1090static int efx_mcdi_reset_port(struct efx_nic *efx)
1091{ 1091{
1092 int rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, NULL, 0, NULL, 0, NULL); 1092 int rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, NULL, 0, NULL, 0, NULL);
1093 if (rc) 1093 if (rc)
@@ -1096,7 +1096,7 @@ int efx_mcdi_reset_port(struct efx_nic *efx)
1096 return rc; 1096 return rc;
1097} 1097}
1098 1098
1099int efx_mcdi_reset_mc(struct efx_nic *efx) 1099static int efx_mcdi_reset_mc(struct efx_nic *efx)
1100{ 1100{
1101 MCDI_DECLARE_BUF(inbuf, MC_CMD_REBOOT_IN_LEN); 1101 MCDI_DECLARE_BUF(inbuf, MC_CMD_REBOOT_IN_LEN);
1102 int rc; 1102 int rc;
@@ -1114,6 +1114,26 @@ int efx_mcdi_reset_mc(struct efx_nic *efx)
1114 return rc; 1114 return rc;
1115} 1115}
1116 1116
1117enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason)
1118{
1119 return RESET_TYPE_RECOVER_OR_ALL;
1120}
1121
1122int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method)
1123{
1124 int rc;
1125
1126 /* Recover from a failed assertion pre-reset */
1127 rc = efx_mcdi_handle_assertion(efx);
1128 if (rc)
1129 return rc;
1130
1131 if (method == RESET_TYPE_WORLD)
1132 return efx_mcdi_reset_mc(efx);
1133 else
1134 return efx_mcdi_reset_port(efx);
1135}
1136
1117static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type, 1137static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
1118 const u8 *mac, int *id_out) 1138 const u8 *mac, int *id_out)
1119{ 1139{
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index 899f094dfb2a..e62dc04d101a 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -190,8 +190,6 @@ extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx,
190extern int efx_mcdi_nvram_test_all(struct efx_nic *efx); 190extern int efx_mcdi_nvram_test_all(struct efx_nic *efx);
191extern int efx_mcdi_handle_assertion(struct efx_nic *efx); 191extern int efx_mcdi_handle_assertion(struct efx_nic *efx);
192extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); 192extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
193extern int efx_mcdi_reset_port(struct efx_nic *efx);
194extern int efx_mcdi_reset_mc(struct efx_nic *efx);
195extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, 193extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx,
196 const u8 *mac, int *id_out); 194 const u8 *mac, int *id_out);
197extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); 195extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out);
@@ -203,6 +201,8 @@ extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
203 u32 dma_len, int enable, int clear); 201 u32 dma_len, int enable, int clear);
204extern int efx_mcdi_mac_reconfigure(struct efx_nic *efx); 202extern int efx_mcdi_mac_reconfigure(struct efx_nic *efx);
205extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx); 203extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx);
204extern enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason);
205extern int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method);
206 206
207#ifdef CONFIG_SFC_MCDI_MON 207#ifdef CONFIG_SFC_MCDI_MON
208extern int efx_mcdi_mon_probe(struct efx_nic *efx); 208extern int efx_mcdi_mon_probe(struct efx_nic *efx);
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index 8c91775e3c5f..6babc8eb984d 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -30,7 +30,6 @@
30/* Hardware control for SFC9000 family including SFL9021 (aka Siena). */ 30/* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
31 31
32static void siena_init_wol(struct efx_nic *efx); 32static void siena_init_wol(struct efx_nic *efx);
33static int siena_reset_hw(struct efx_nic *efx, enum reset_type method);
34 33
35 34
36static void siena_push_irq_moderation(struct efx_channel *channel) 35static void siena_push_irq_moderation(struct efx_channel *channel)
@@ -178,7 +177,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
178 /* Reset the chip immediately so that it is completely 177 /* Reset the chip immediately so that it is completely
179 * quiescent regardless of what any VF driver does. 178 * quiescent regardless of what any VF driver does.
180 */ 179 */
181 rc = siena_reset_hw(efx, reset_method); 180 rc = efx_mcdi_reset(efx, reset_method);
182 if (rc) 181 if (rc)
183 goto out; 182 goto out;
184 183
@@ -187,7 +186,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
187 ARRAY_SIZE(siena_register_tests)) 186 ARRAY_SIZE(siena_register_tests))
188 ? -1 : 1; 187 ? -1 : 1;
189 188
190 rc = siena_reset_hw(efx, reset_method); 189 rc = efx_mcdi_reset(efx, reset_method);
191out: 190out:
192 rc2 = efx_reset_up(efx, reset_method, rc == 0); 191 rc2 = efx_reset_up(efx, reset_method, rc == 0);
193 return rc ? rc : rc2; 192 return rc ? rc : rc2;
@@ -200,11 +199,6 @@ out:
200 ************************************************************************** 199 **************************************************************************
201 */ 200 */
202 201
203static enum reset_type siena_map_reset_reason(enum reset_type reason)
204{
205 return RESET_TYPE_RECOVER_OR_ALL;
206}
207
208static int siena_map_reset_flags(u32 *flags) 202static int siena_map_reset_flags(u32 *flags)
209{ 203{
210 enum { 204 enum {
@@ -230,21 +224,6 @@ static int siena_map_reset_flags(u32 *flags)
230 return -EINVAL; 224 return -EINVAL;
231} 225}
232 226
233static int siena_reset_hw(struct efx_nic *efx, enum reset_type method)
234{
235 int rc;
236
237 /* Recover from a failed assertion pre-reset */
238 rc = efx_mcdi_handle_assertion(efx);
239 if (rc)
240 return rc;
241
242 if (method == RESET_TYPE_WORLD)
243 return efx_mcdi_reset_mc(efx);
244 else
245 return efx_mcdi_reset_port(efx);
246}
247
248#ifdef CONFIG_EEH 227#ifdef CONFIG_EEH
249/* When a PCI device is isolated from the bus, a subsequent MMIO read is 228/* When a PCI device is isolated from the bus, a subsequent MMIO read is
250 * required for the kernel EEH mechanisms to notice. As the Solarflare driver 229 * required for the kernel EEH mechanisms to notice. As the Solarflare driver
@@ -327,7 +306,7 @@ static int siena_probe_nic(struct efx_nic *efx)
327 "Host already registered with MCPU\n"); 306 "Host already registered with MCPU\n");
328 307
329 /* Now we can reset the NIC */ 308 /* Now we can reset the NIC */
330 rc = siena_reset_hw(efx, RESET_TYPE_ALL); 309 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL);
331 if (rc) { 310 if (rc) {
332 netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n"); 311 netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n");
333 goto fail3; 312 goto fail3;
@@ -458,7 +437,7 @@ static void siena_remove_nic(struct efx_nic *efx)
458 437
459 efx_nic_free_buffer(efx, &efx->irq_status); 438 efx_nic_free_buffer(efx, &efx->irq_status);
460 439
461 siena_reset_hw(efx, RESET_TYPE_ALL); 440 efx_mcdi_reset(efx, RESET_TYPE_ALL);
462 441
463 /* Relinquish the device back to the BMC */ 442 /* Relinquish the device back to the BMC */
464 efx_mcdi_drv_attach(efx, false, NULL); 443 efx_mcdi_drv_attach(efx, false, NULL);
@@ -688,9 +667,9 @@ const struct efx_nic_type siena_a0_nic_type = {
688#else 667#else
689 .monitor = NULL, 668 .monitor = NULL,
690#endif 669#endif
691 .map_reset_reason = siena_map_reset_reason, 670 .map_reset_reason = efx_mcdi_map_reset_reason,
692 .map_reset_flags = siena_map_reset_flags, 671 .map_reset_flags = siena_map_reset_flags,
693 .reset = siena_reset_hw, 672 .reset = efx_mcdi_reset,
694 .probe_port = siena_probe_port, 673 .probe_port = siena_probe_port,
695 .remove_port = siena_remove_port, 674 .remove_port = siena_remove_port,
696 .prepare_flush = siena_prepare_flush, 675 .prepare_flush = siena_prepare_flush,