Commit 6bff861d authored by Ben Hutchings's avatar Ben Hutchings

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: default avatarBen Hutchings <bhutchings@solarflare.com>
parent 338f74df
...@@ -1087,7 +1087,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode) ...@@ -1087,7 +1087,7 @@ void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode)
__func__, rc); __func__, rc);
} }
int efx_mcdi_reset_port(struct efx_nic *efx) static int efx_mcdi_reset_port(struct efx_nic *efx)
{ {
int rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, NULL, 0, NULL, 0, NULL); int rc = efx_mcdi_rpc(efx, MC_CMD_ENTITY_RESET, NULL, 0, NULL, 0, NULL);
if (rc) if (rc)
...@@ -1096,7 +1096,7 @@ int efx_mcdi_reset_port(struct efx_nic *efx) ...@@ -1096,7 +1096,7 @@ int efx_mcdi_reset_port(struct efx_nic *efx)
return rc; return rc;
} }
int efx_mcdi_reset_mc(struct efx_nic *efx) static int efx_mcdi_reset_mc(struct efx_nic *efx)
{ {
MCDI_DECLARE_BUF(inbuf, MC_CMD_REBOOT_IN_LEN); MCDI_DECLARE_BUF(inbuf, MC_CMD_REBOOT_IN_LEN);
int rc; int rc;
...@@ -1114,6 +1114,26 @@ int efx_mcdi_reset_mc(struct efx_nic *efx) ...@@ -1114,6 +1114,26 @@ int efx_mcdi_reset_mc(struct efx_nic *efx)
return rc; return rc;
} }
enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason)
{
return RESET_TYPE_RECOVER_OR_ALL;
}
int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method)
{
int rc;
/* Recover from a failed assertion pre-reset */
rc = efx_mcdi_handle_assertion(efx);
if (rc)
return rc;
if (method == RESET_TYPE_WORLD)
return efx_mcdi_reset_mc(efx);
else
return efx_mcdi_reset_port(efx);
}
static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type, static int efx_mcdi_wol_filter_set(struct efx_nic *efx, u32 type,
const u8 *mac, int *id_out) const u8 *mac, int *id_out)
{ {
......
...@@ -190,8 +190,6 @@ extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx, ...@@ -190,8 +190,6 @@ extern int efx_mcdi_nvram_update_finish(struct efx_nic *efx,
extern int efx_mcdi_nvram_test_all(struct efx_nic *efx); extern int efx_mcdi_nvram_test_all(struct efx_nic *efx);
extern int efx_mcdi_handle_assertion(struct efx_nic *efx); extern int efx_mcdi_handle_assertion(struct efx_nic *efx);
extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); extern void efx_mcdi_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
extern int efx_mcdi_reset_port(struct efx_nic *efx);
extern int efx_mcdi_reset_mc(struct efx_nic *efx);
extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx, extern int efx_mcdi_wol_filter_set_magic(struct efx_nic *efx,
const u8 *mac, int *id_out); const u8 *mac, int *id_out);
extern int efx_mcdi_wol_filter_get_magic(struct efx_nic *efx, int *id_out); extern 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,6 +201,8 @@ extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
u32 dma_len, int enable, int clear); u32 dma_len, int enable, int clear);
extern int efx_mcdi_mac_reconfigure(struct efx_nic *efx); extern int efx_mcdi_mac_reconfigure(struct efx_nic *efx);
extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx); extern bool efx_mcdi_mac_check_fault(struct efx_nic *efx);
extern enum reset_type efx_mcdi_map_reset_reason(enum reset_type reason);
extern int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method);
#ifdef CONFIG_SFC_MCDI_MON #ifdef CONFIG_SFC_MCDI_MON
extern int efx_mcdi_mon_probe(struct efx_nic *efx); extern int efx_mcdi_mon_probe(struct efx_nic *efx);
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
/* Hardware control for SFC9000 family including SFL9021 (aka Siena). */ /* Hardware control for SFC9000 family including SFL9021 (aka Siena). */
static void siena_init_wol(struct efx_nic *efx); static void siena_init_wol(struct efx_nic *efx);
static int siena_reset_hw(struct efx_nic *efx, enum reset_type method);
static void siena_push_irq_moderation(struct efx_channel *channel) static 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,7 +177,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
/* Reset the chip immediately so that it is completely /* Reset the chip immediately so that it is completely
* quiescent regardless of what any VF driver does. * quiescent regardless of what any VF driver does.
*/ */
rc = siena_reset_hw(efx, reset_method); rc = efx_mcdi_reset(efx, reset_method);
if (rc) if (rc)
goto out; goto out;
...@@ -187,7 +186,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) ...@@ -187,7 +186,7 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
ARRAY_SIZE(siena_register_tests)) ARRAY_SIZE(siena_register_tests))
? -1 : 1; ? -1 : 1;
rc = siena_reset_hw(efx, reset_method); rc = efx_mcdi_reset(efx, reset_method);
out: out:
rc2 = efx_reset_up(efx, reset_method, rc == 0); rc2 = efx_reset_up(efx, reset_method, rc == 0);
return rc ? rc : rc2; return rc ? rc : rc2;
...@@ -200,11 +199,6 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) ...@@ -200,11 +199,6 @@ static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
************************************************************************** **************************************************************************
*/ */
static enum reset_type siena_map_reset_reason(enum reset_type reason)
{
return RESET_TYPE_RECOVER_OR_ALL;
}
static int siena_map_reset_flags(u32 *flags) static int siena_map_reset_flags(u32 *flags)
{ {
enum { enum {
...@@ -230,21 +224,6 @@ static int siena_map_reset_flags(u32 *flags) ...@@ -230,21 +224,6 @@ static int siena_map_reset_flags(u32 *flags)
return -EINVAL; return -EINVAL;
} }
static int siena_reset_hw(struct efx_nic *efx, enum reset_type method)
{
int rc;
/* Recover from a failed assertion pre-reset */
rc = efx_mcdi_handle_assertion(efx);
if (rc)
return rc;
if (method == RESET_TYPE_WORLD)
return efx_mcdi_reset_mc(efx);
else
return efx_mcdi_reset_port(efx);
}
#ifdef CONFIG_EEH #ifdef CONFIG_EEH
/* When a PCI device is isolated from the bus, a subsequent MMIO read is /* When a PCI device is isolated from the bus, a subsequent MMIO read is
* required for the kernel EEH mechanisms to notice. As the Solarflare driver * 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,7 +306,7 @@ static int siena_probe_nic(struct efx_nic *efx)
"Host already registered with MCPU\n"); "Host already registered with MCPU\n");
/* Now we can reset the NIC */ /* Now we can reset the NIC */
rc = siena_reset_hw(efx, RESET_TYPE_ALL); rc = efx_mcdi_reset(efx, RESET_TYPE_ALL);
if (rc) { if (rc) {
netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n"); netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n");
goto fail3; goto fail3;
...@@ -458,7 +437,7 @@ static void siena_remove_nic(struct efx_nic *efx) ...@@ -458,7 +437,7 @@ static void siena_remove_nic(struct efx_nic *efx)
efx_nic_free_buffer(efx, &efx->irq_status); efx_nic_free_buffer(efx, &efx->irq_status);
siena_reset_hw(efx, RESET_TYPE_ALL); efx_mcdi_reset(efx, RESET_TYPE_ALL);
/* Relinquish the device back to the BMC */ /* Relinquish the device back to the BMC */
efx_mcdi_drv_attach(efx, false, NULL); efx_mcdi_drv_attach(efx, false, NULL);
...@@ -688,9 +667,9 @@ const struct efx_nic_type siena_a0_nic_type = { ...@@ -688,9 +667,9 @@ const struct efx_nic_type siena_a0_nic_type = {
#else #else
.monitor = NULL, .monitor = NULL,
#endif #endif
.map_reset_reason = siena_map_reset_reason, .map_reset_reason = efx_mcdi_map_reset_reason,
.map_reset_flags = siena_map_reset_flags, .map_reset_flags = siena_map_reset_flags,
.reset = siena_reset_hw, .reset = efx_mcdi_reset,
.probe_port = siena_probe_port, .probe_port = siena_probe_port,
.remove_port = siena_remove_port, .remove_port = siena_remove_port,
.prepare_flush = siena_prepare_flush, .prepare_flush = siena_prepare_flush,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment