-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5: Add functions to set/query MFRL register
Add functions to query and set the MFRL reset options supported by firmware. Signed-off-by: Moshe Shemesh <moshe@mellanox.com> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Moshe Shemesh
authored and
Jakub Kicinski
committed
Oct 9, 2020
1 parent
77069ba
commit 3180472
Showing
3 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB | ||
/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ | ||
|
||
#include "fw_reset.h" | ||
|
||
static int mlx5_reg_mfrl_set(struct mlx5_core_dev *dev, u8 reset_level, | ||
u8 reset_type_sel, u8 sync_resp, bool sync_start) | ||
{ | ||
u32 out[MLX5_ST_SZ_DW(mfrl_reg)] = {}; | ||
u32 in[MLX5_ST_SZ_DW(mfrl_reg)] = {}; | ||
|
||
MLX5_SET(mfrl_reg, in, reset_level, reset_level); | ||
MLX5_SET(mfrl_reg, in, rst_type_sel, reset_type_sel); | ||
MLX5_SET(mfrl_reg, in, pci_sync_for_fw_update_resp, sync_resp); | ||
MLX5_SET(mfrl_reg, in, pci_sync_for_fw_update_start, sync_start); | ||
|
||
return mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), MLX5_REG_MFRL, 0, 1); | ||
} | ||
|
||
static int mlx5_reg_mfrl_query(struct mlx5_core_dev *dev, u8 *reset_level, u8 *reset_type) | ||
{ | ||
u32 out[MLX5_ST_SZ_DW(mfrl_reg)] = {}; | ||
u32 in[MLX5_ST_SZ_DW(mfrl_reg)] = {}; | ||
int err; | ||
|
||
err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), MLX5_REG_MFRL, 0, 0); | ||
if (err) | ||
return err; | ||
|
||
if (reset_level) | ||
*reset_level = MLX5_GET(mfrl_reg, out, reset_level); | ||
if (reset_type) | ||
*reset_type = MLX5_GET(mfrl_reg, out, reset_type); | ||
|
||
return 0; | ||
} | ||
|
||
int mlx5_fw_reset_query(struct mlx5_core_dev *dev, u8 *reset_level, u8 *reset_type) | ||
{ | ||
return mlx5_reg_mfrl_query(dev, reset_level, reset_type); | ||
} | ||
|
||
int mlx5_fw_reset_set_reset_sync(struct mlx5_core_dev *dev, u8 reset_type_sel) | ||
{ | ||
return mlx5_reg_mfrl_set(dev, MLX5_MFRL_REG_RESET_LEVEL3, reset_type_sel, 0, true); | ||
} | ||
|
||
int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev) | ||
{ | ||
return mlx5_reg_mfrl_set(dev, MLX5_MFRL_REG_RESET_LEVEL0, 0, 0, false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ | ||
|
||
#ifndef __MLX5_FW_RESET_H | ||
#define __MLX5_FW_RESET_H | ||
|
||
#include "mlx5_core.h" | ||
|
||
int mlx5_fw_reset_query(struct mlx5_core_dev *dev, u8 *reset_level, u8 *reset_type); | ||
int mlx5_fw_reset_set_reset_sync(struct mlx5_core_dev *dev, u8 reset_type_sel); | ||
int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev); | ||
|
||
#endif |