linux/drivers/net/ethernet/meta/fbnic/fbnic_fw.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) Meta Platforms, Inc. and affiliates. */

#include <linux/bitfield.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/dev_printk.h>
#include <linux/dma-mapping.h>
#include <linux/gfp.h>
#include <linux/types.h>

#include "fbnic.h"
#include "fbnic_tlv.h"

static void __fbnic_mbx_wr_desc(struct fbnic_dev *fbd, int mbx_idx,
				int desc_idx, u64 desc)
{}

static u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx)
{}

static void fbnic_mbx_init_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
{}

void fbnic_mbx_init(struct fbnic_dev *fbd)
{}

static int fbnic_mbx_map_msg(struct fbnic_dev *fbd, int mbx_idx,
			     struct fbnic_tlv_msg *msg, u16 length, u8 eom)
{}

static void fbnic_mbx_unmap_and_free_msg(struct fbnic_dev *fbd, int mbx_idx,
					 int desc_idx)
{}

static void fbnic_mbx_clean_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
{}

void fbnic_mbx_clean(struct fbnic_dev *fbd)
{}

#define FBNIC_MBX_MAX_PAGE_SIZE
#define FBNIC_RX_PAGE_SIZE

static int fbnic_mbx_alloc_rx_msgs(struct fbnic_dev *fbd)
{}

static int fbnic_mbx_map_tlv_msg(struct fbnic_dev *fbd,
				 struct fbnic_tlv_msg *msg)
{}

static void fbnic_mbx_process_tx_msgs(struct fbnic_dev *fbd)
{}

/**
 * fbnic_fw_xmit_simple_msg - Transmit a simple single TLV message w/o data
 * @fbd: FBNIC device structure
 * @msg_type: ENUM value indicating message type to send
 *
 * Return:
 *   One the following values:
 *     -EOPNOTSUPP: Is not ASIC so mailbox is not supported
 *     -ENODEV: Device I/O error
 *     -ENOMEM: Failed to allocate message
 *     -EBUSY: No space in mailbox
 *     -ENOSPC: DMA mapping failed
 *
 * This function sends a single TLV header indicating the host wants to take
 * some action. However there are no other side effects which means that any
 * response will need to be caught via a completion if this action is
 * expected to kick off a resultant action.
 */
static int fbnic_fw_xmit_simple_msg(struct fbnic_dev *fbd, u32 msg_type)
{}

/**
 * fbnic_fw_xmit_cap_msg - Allocate and populate a FW capabilities message
 * @fbd: FBNIC device structure
 *
 * Return: NULL on failure to allocate, error pointer on error, or pointer
 * to new TLV test message.
 *
 * Sends a single TLV header indicating the host wants the firmware to
 * confirm the capabilities and version.
 **/
static int fbnic_fw_xmit_cap_msg(struct fbnic_dev *fbd)
{}

static void fbnic_mbx_postinit_desc_ring(struct fbnic_dev *fbd, int mbx_idx)
{}

static void fbnic_mbx_postinit(struct fbnic_dev *fbd)
{}

/**
 * fbnic_fw_xmit_ownership_msg - Create and transmit a host ownership message
 * to FW mailbox
 *
 * @fbd: FBNIC device structure
 * @take_ownership: take/release the ownership
 *
 * Return: zero on success, negative value on failure
 *
 * Notifies the firmware that the driver either takes ownership of the NIC
 * (when @take_ownership is true) or releases it.
 */
int fbnic_fw_xmit_ownership_msg(struct fbnic_dev *fbd, bool take_ownership)
{}

static const struct fbnic_tlv_index fbnic_fw_cap_resp_index[] =;

static int fbnic_fw_parse_bmc_addrs(u8 bmc_mac_addr[][ETH_ALEN],
				    struct fbnic_tlv_msg *attr, int len)
{}

static int fbnic_fw_parse_cap_resp(void *opaque, struct fbnic_tlv_msg **results)
{}

static const struct fbnic_tlv_index fbnic_ownership_resp_index[] =;

static int fbnic_fw_parse_ownership_resp(void *opaque,
					 struct fbnic_tlv_msg **results)
{}

static const struct fbnic_tlv_index fbnic_heartbeat_resp_index[] =;

static int fbnic_fw_parse_heartbeat_resp(void *opaque,
					 struct fbnic_tlv_msg **results)
{}

static int fbnic_fw_xmit_heartbeat_message(struct fbnic_dev *fbd)
{}

static bool fbnic_fw_heartbeat_current(struct fbnic_dev *fbd)
{}

int fbnic_fw_init_heartbeat(struct fbnic_dev *fbd, bool poll)
{}

void fbnic_fw_check_heartbeat(struct fbnic_dev *fbd)
{}

static const struct fbnic_tlv_parser fbnic_fw_tlv_parser[] =;

static void fbnic_mbx_process_rx_msgs(struct fbnic_dev *fbd)
{}

void fbnic_mbx_poll(struct fbnic_dev *fbd)
{}

int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd)
{}

void fbnic_mbx_flush_tx(struct fbnic_dev *fbd)
{}

void fbnic_get_fw_ver_commit_str(struct fbnic_dev *fbd, char *fw_version,
				 const size_t str_sz)
{}