linux/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2022 NVIDIA Corporation and Mellanox Technologies. All rights reserved */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/workqueue.h>
#include <linux/gfp.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/vmalloc.h>

#include "core.h"
#include "../mlxfw/mlxfw.h"

struct mlxsw_linecard_ini_file {};

struct mlxsw_linecard_types_info {};

#define MLXSW_LINECARD_STATUS_EVENT_TO

static void
mlxsw_linecard_status_event_to_schedule(struct mlxsw_linecard *linecard,
					enum mlxsw_linecard_status_event_type status_event_type)
{}

static void
mlxsw_linecard_status_event_done(struct mlxsw_linecard *linecard,
				 enum mlxsw_linecard_status_event_type status_event_type)
{}

static const char *
mlxsw_linecard_types_lookup(struct mlxsw_linecards *linecards, u8 card_type)
{}

static const char *mlxsw_linecard_type_name(struct mlxsw_linecard *linecard)
{}

struct mlxsw_linecard_device_fw_info {};

static int mlxsw_linecard_device_fw_component_query(struct mlxfw_dev *mlxfw_dev,
						    u16 component_index,
						    u32 *p_max_size,
						    u8 *p_align_bits,
						    u16 *p_max_write_size)
{}

static int mlxsw_linecard_device_fw_fsm_lock(struct mlxfw_dev *mlxfw_dev,
					     u32 *fwhandle)
{}

static int
mlxsw_linecard_device_fw_fsm_component_update(struct mlxfw_dev *mlxfw_dev,
					      u32 fwhandle,
					      u16 component_index,
					      u32 component_size)
{}

static int
mlxsw_linecard_device_fw_fsm_block_download(struct mlxfw_dev *mlxfw_dev,
					    u32 fwhandle, u8 *data,
					    u16 size, u32 offset)
{}

static int
mlxsw_linecard_device_fw_fsm_component_verify(struct mlxfw_dev *mlxfw_dev,
					      u32 fwhandle, u16 component_index)
{}

static int mlxsw_linecard_device_fw_fsm_activate(struct mlxfw_dev *mlxfw_dev,
						 u32 fwhandle)
{}

static int
mlxsw_linecard_device_fw_fsm_query_state(struct mlxfw_dev *mlxfw_dev,
					 u32 fwhandle,
					 enum mlxfw_fsm_state *fsm_state,
					 enum mlxfw_fsm_state_err *fsm_state_err)
{}

static void mlxsw_linecard_device_fw_fsm_cancel(struct mlxfw_dev *mlxfw_dev,
						u32 fwhandle)
{}

static void mlxsw_linecard_device_fw_fsm_release(struct mlxfw_dev *mlxfw_dev,
						 u32 fwhandle)
{}

static const struct mlxfw_dev_ops mlxsw_linecard_device_dev_ops =;

int mlxsw_linecard_flash_update(struct devlink *linecard_devlink,
				struct mlxsw_linecard *linecard,
				const struct firmware *firmware,
				struct netlink_ext_ack *extack)
{}

static int mlxsw_linecard_device_psid_get(struct mlxsw_linecard *linecard,
					  u8 device_index, char *psid)
{}

static int mlxsw_linecard_device_info_update(struct mlxsw_linecard *linecard)
{}

static void mlxsw_linecard_provision_fail(struct mlxsw_linecard *linecard)
{}

struct mlxsw_linecards_event_ops_item {};

static void
mlxsw_linecard_event_op_call(struct mlxsw_linecard *linecard,
			     mlxsw_linecards_event_op_t *op, void *priv)
{}

static void
mlxsw_linecard_active_ops_call(struct mlxsw_linecard *linecard)
{}

static void
mlxsw_linecard_inactive_ops_call(struct mlxsw_linecard *linecard)
{}

static void
mlxsw_linecards_event_ops_register_call(struct mlxsw_linecards *linecards,
					const struct mlxsw_linecards_event_ops_item *item)
{}

static void
mlxsw_linecards_event_ops_unregister_call(struct mlxsw_linecards *linecards,
					  const struct mlxsw_linecards_event_ops_item *item)
{}

int mlxsw_linecards_event_ops_register(struct mlxsw_core *mlxsw_core,
				       struct mlxsw_linecards_event_ops *ops,
				       void *priv)
{}
EXPORT_SYMBOL();

void mlxsw_linecards_event_ops_unregister(struct mlxsw_core *mlxsw_core,
					  struct mlxsw_linecards_event_ops *ops,
					  void *priv)
{}
EXPORT_SYMBOL();

int mlxsw_linecard_devlink_info_get(struct mlxsw_linecard *linecard,
				    struct devlink_info_req *req,
				    struct netlink_ext_ack *extack)
{}

static int
mlxsw_linecard_provision_set(struct mlxsw_linecard *linecard, u8 card_type,
			     u16 hw_revision, u16 ini_version)
{}

static void mlxsw_linecard_provision_clear(struct mlxsw_linecard *linecard)
{}

static int mlxsw_linecard_ready_set(struct mlxsw_linecard *linecard)
{}

static int mlxsw_linecard_ready_clear(struct mlxsw_linecard *linecard)
{}

static void mlxsw_linecard_active_set(struct mlxsw_linecard *linecard)
{}

static void mlxsw_linecard_active_clear(struct mlxsw_linecard *linecard)
{}

static int mlxsw_linecard_status_process(struct mlxsw_linecards *linecards,
					 struct mlxsw_linecard *linecard,
					 const char *mddq_pl)
{}

static int mlxsw_linecard_status_get_and_process(struct mlxsw_core *mlxsw_core,
						 struct mlxsw_linecards *linecards,
						 struct mlxsw_linecard *linecard)
{}

static void mlxsw_linecards_irq_event_handler(struct mlxsw_core *mlxsw_core)
{}

static const char * const mlxsw_linecard_status_event_type_name[] =;

static void mlxsw_linecard_status_event_to_work(struct work_struct *work)
{}

static int __mlxsw_linecard_fix_fsm_state(struct mlxsw_linecard *linecard)
{}

static int mlxsw_linecard_fix_fsm_state(struct mlxsw_linecard *linecard,
					enum mlxsw_reg_mbct_fsm_state fsm_state)
{}

static int
mlxsw_linecard_query_ini_status(struct mlxsw_linecard *linecard,
				enum mlxsw_reg_mbct_status *status,
				enum mlxsw_reg_mbct_fsm_state *fsm_state,
				struct netlink_ext_ack *extack)
{}

static int
mlxsw_linecard_ini_transfer(struct mlxsw_core *mlxsw_core,
			    struct mlxsw_linecard *linecard,
			    const struct mlxsw_linecard_ini_file *ini_file,
			    struct netlink_ext_ack *extack)
{}

static int
mlxsw_linecard_ini_erase(struct mlxsw_core *mlxsw_core,
			 struct mlxsw_linecard *linecard,
			 struct netlink_ext_ack *extack)
{}

static void mlxsw_linecard_bct_process(struct mlxsw_core *mlxsw_core,
				       const char *mbct_pl)
{}

static int
mlxsw_linecard_ini_activate(struct mlxsw_core *mlxsw_core,
			    struct mlxsw_linecard *linecard,
			    struct netlink_ext_ack *extack)
{}

#define MLXSW_LINECARD_INI_WAIT_RETRIES
#define MLXSW_LINECARD_INI_WAIT_MS

static int
mlxsw_linecard_ini_in_use_wait(struct mlxsw_core *mlxsw_core,
			       struct mlxsw_linecard *linecard,
			       struct netlink_ext_ack *extack)
{}

static bool mlxsw_linecard_port_selector(void *priv, u16 local_port)
{}

static int mlxsw_linecard_provision(struct devlink_linecard *devlink_linecard,
				    void *priv, const char *type,
				    const void *type_priv,
				    struct netlink_ext_ack *extack)
{}

static int mlxsw_linecard_unprovision(struct devlink_linecard *devlink_linecard,
				      void *priv,
				      struct netlink_ext_ack *extack)
{}

static bool mlxsw_linecard_same_provision(struct devlink_linecard *devlink_linecard,
					  void *priv, const char *type,
					  const void *type_priv)
{}

static unsigned int
mlxsw_linecard_types_count(struct devlink_linecard *devlink_linecard,
			   void *priv)
{}

static void mlxsw_linecard_types_get(struct devlink_linecard *devlink_linecard,
				     void *priv, unsigned int index,
				     const char **type, const void **type_priv)
{}

static const struct devlink_linecard_ops mlxsw_linecard_ops =;

struct mlxsw_linecard_status_event {};

static void mlxsw_linecard_status_event_work(struct work_struct *work)
{}

static void
mlxsw_linecard_status_listener_func(const struct mlxsw_reg_info *reg,
				    char *mddq_pl, void *priv)
{}

struct mlxsw_linecard_bct_event {};

static void mlxsw_linecard_bct_event_work(struct work_struct *work)
{}

static void
mlxsw_linecard_bct_listener_func(const struct mlxsw_reg_info *reg,
				 char *mbct_pl, void *priv)
{}

static const struct mlxsw_listener mlxsw_linecard_listener[] =;

static int mlxsw_linecard_event_delivery_set(struct mlxsw_core *mlxsw_core,
					     struct mlxsw_linecard *linecard,
					     bool enable)
{}

static int mlxsw_linecard_init(struct mlxsw_core *mlxsw_core,
			       struct mlxsw_linecards *linecards,
			       u8 slot_index)
{}

static void mlxsw_linecard_fini(struct mlxsw_core *mlxsw_core,
				struct mlxsw_linecards *linecards,
				u8 slot_index)
{}

static int
mlxsw_linecard_event_delivery_init(struct mlxsw_core *mlxsw_core,
				   struct mlxsw_linecards *linecards,
				   u8 slot_index)
{}

static void
mlxsw_linecard_event_delivery_fini(struct mlxsw_core *mlxsw_core,
				   struct mlxsw_linecards *linecards,
				   u8 slot_index)
{}

/*       LINECARDS INI BUNDLE FILE
 *  +----------------------------------+
 *  |        MAGIC ("NVLCINI+")        |
 *  +----------------------------------+     +--------------------+
 *  |  INI 0                           +---> | __le16 size        |
 *  +----------------------------------+     | __be16 hw_revision |
 *  |  INI 1                           |     | __be16 ini_version |
 *  +----------------------------------+     | u8 __dontcare[3]   |
 *  |  ...                             |     | u8 type            |
 *  +----------------------------------+     | u8 name[20]        |
 *  |  INI N                           |     | ...                |
 *  +----------------------------------+     +--------------------+
 */

#define MLXSW_LINECARDS_INI_BUNDLE_MAGIC

static int
mlxsw_linecard_types_file_validate(struct mlxsw_linecards *linecards,
				   struct mlxsw_linecard_types_info *types_info)
{}

static void
mlxsw_linecard_types_file_parse(struct mlxsw_linecard_types_info *types_info)
{}

#define MLXSW_LINECARDS_INI_BUNDLE_FILENAME_FMT
#define MLXSW_LINECARDS_INI_BUNDLE_FILENAME_LEN

static int mlxsw_linecard_types_init(struct mlxsw_core *mlxsw_core,
				     struct mlxsw_linecards *linecards)
{}

static void mlxsw_linecard_types_fini(struct mlxsw_linecards *linecards)
{}

int mlxsw_linecards_init(struct mlxsw_core *mlxsw_core,
			 const struct mlxsw_bus_info *bus_info)
{}

void mlxsw_linecards_fini(struct mlxsw_core *mlxsw_core)
{}