root/drivers/net/ethernet/mellanox/mlxfw/mlxfw.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. mlxfw_firmware_flash

   1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
   2 /* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */
   3 
   4 #ifndef _MLXFW_H
   5 #define _MLXFW_H
   6 
   7 #include <linux/firmware.h>
   8 #include <linux/netlink.h>
   9 
  10 enum mlxfw_fsm_state {
  11         MLXFW_FSM_STATE_IDLE,
  12         MLXFW_FSM_STATE_LOCKED,
  13         MLXFW_FSM_STATE_INITIALIZE,
  14         MLXFW_FSM_STATE_DOWNLOAD,
  15         MLXFW_FSM_STATE_VERIFY,
  16         MLXFW_FSM_STATE_APPLY,
  17         MLXFW_FSM_STATE_ACTIVATE,
  18 };
  19 
  20 enum mlxfw_fsm_state_err {
  21         MLXFW_FSM_STATE_ERR_OK,
  22         MLXFW_FSM_STATE_ERR_ERROR,
  23         MLXFW_FSM_STATE_ERR_REJECTED_DIGEST_ERR,
  24         MLXFW_FSM_STATE_ERR_REJECTED_NOT_APPLICABLE,
  25         MLXFW_FSM_STATE_ERR_REJECTED_UNKNOWN_KEY,
  26         MLXFW_FSM_STATE_ERR_REJECTED_AUTH_FAILED,
  27         MLXFW_FSM_STATE_ERR_REJECTED_UNSIGNED,
  28         MLXFW_FSM_STATE_ERR_REJECTED_KEY_NOT_APPLICABLE,
  29         MLXFW_FSM_STATE_ERR_REJECTED_BAD_FORMAT,
  30         MLXFW_FSM_STATE_ERR_BLOCKED_PENDING_RESET,
  31         MLXFW_FSM_STATE_ERR_MAX,
  32 };
  33 
  34 struct mlxfw_dev;
  35 
  36 struct mlxfw_dev_ops {
  37         int (*component_query)(struct mlxfw_dev *mlxfw_dev, u16 component_index,
  38                                u32 *p_max_size, u8 *p_align_bits,
  39                                u16 *p_max_write_size);
  40 
  41         int (*fsm_lock)(struct mlxfw_dev *mlxfw_dev, u32 *fwhandle);
  42 
  43         int (*fsm_component_update)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle,
  44                                     u16 component_index, u32 component_size);
  45 
  46         int (*fsm_block_download)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle,
  47                                   u8 *data, u16 size, u32 offset);
  48 
  49         int (*fsm_component_verify)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle,
  50                                     u16 component_index);
  51 
  52         int (*fsm_activate)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle);
  53 
  54         int (*fsm_query_state)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle,
  55                                enum mlxfw_fsm_state *fsm_state,
  56                                enum mlxfw_fsm_state_err *fsm_state_err);
  57 
  58         void (*fsm_cancel)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle);
  59 
  60         void (*fsm_release)(struct mlxfw_dev *mlxfw_dev, u32 fwhandle);
  61 
  62         void (*status_notify)(struct mlxfw_dev *mlxfw_dev,
  63                               const char *msg, const char *comp_name,
  64                               u32 done_bytes, u32 total_bytes);
  65 };
  66 
  67 struct mlxfw_dev {
  68         const struct mlxfw_dev_ops *ops;
  69         const char *psid;
  70         u16 psid_size;
  71 };
  72 
  73 #if IS_REACHABLE(CONFIG_MLXFW)
  74 int mlxfw_firmware_flash(struct mlxfw_dev *mlxfw_dev,
  75                          const struct firmware *firmware,
  76                          struct netlink_ext_ack *extack);
  77 #else
  78 static inline
  79 int mlxfw_firmware_flash(struct mlxfw_dev *mlxfw_dev,
  80                          const struct firmware *firmware,
  81                          struct netlink_ext_ack *extack)
  82 {
  83         return -EOPNOTSUPP;
  84 }
  85 #endif
  86 
  87 #endif

/* [<][>][^][v][top][bottom][index][help] */