linux/drivers/net/ethernet/freescale/fman/fman_port.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
/*
 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
 */

#define pr_fmt(fmt)

#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
#include <linux/delay.h>
#include <linux/libfdt_env.h>

#include "fman.h"
#include "fman_port.h"
#include "fman_sp.h"
#include "fman_keygen.h"

/* Queue ID */
#define DFLT_FQ_ID

/* General defines */
#define PORT_BMI_FIFO_UNITS

#define MAX_PORT_FIFO_SIZE(bmi_max_fifo_size)

#define PORT_CG_MAP_NUM
#define PORT_PRS_RESULT_WORDS_NUM
#define PORT_IC_OFFSET_UNITS

#define MIN_EXT_BUF_SIZE

#define BMI_PORT_REGS_OFFSET
#define QMI_PORT_REGS_OFFSET
#define HWP_PORT_REGS_OFFSET

/* Default values */
#define DFLT_PORT_BUFFER_PREFIX_CONTEXT_DATA_ALIGN

#define DFLT_PORT_CUT_BYTES_FROM_END

#define DFLT_PORT_ERRORS_TO_DISCARD
#define DFLT_PORT_MAX_FRAME_LENGTH

#define DFLT_PORT_RX_FIFO_PRI_ELEVATION_LEV(bmi_max_fifo_size)

#define DFLT_PORT_RX_FIFO_THRESHOLD(major, bmi_max_fifo_size)	\

#define DFLT_PORT_EXTRA_NUM_OF_FIFO_BUFS

/* QMI defines */
#define QMI_DEQ_CFG_SUBPORTAL_MASK

#define QMI_PORT_CFG_EN
#define QMI_PORT_STATUS_DEQ_FD_BSY

#define QMI_DEQ_CFG_PRI
#define QMI_DEQ_CFG_TYPE1
#define QMI_DEQ_CFG_TYPE2
#define QMI_DEQ_CFG_TYPE3
#define QMI_DEQ_CFG_PREFETCH_PARTIAL
#define QMI_DEQ_CFG_PREFETCH_FULL
#define QMI_DEQ_CFG_SP_MASK
#define QMI_DEQ_CFG_SP_SHIFT

#define QMI_BYTE_COUNT_LEVEL_CONTROL(_type)

/* BMI defins */
#define BMI_EBD_EN

#define BMI_PORT_CFG_EN

#define BMI_PORT_STATUS_BSY

#define BMI_DMA_ATTR_SWP_SHIFT
#define BMI_DMA_ATTR_WRITE_OPTIMIZE

#define BMI_RX_FIFO_PRI_ELEVATION_SHIFT
#define BMI_RX_FIFO_THRESHOLD_ETHE

#define BMI_FRAME_END_CS_IGNORE_SHIFT
#define BMI_FRAME_END_CS_IGNORE_MASK

#define BMI_RX_FRAME_END_CUT_SHIFT
#define BMI_RX_FRAME_END_CUT_MASK

#define BMI_IC_TO_EXT_SHIFT
#define BMI_IC_TO_EXT_MASK
#define BMI_IC_FROM_INT_SHIFT
#define BMI_IC_FROM_INT_MASK
#define BMI_IC_SIZE_MASK

#define BMI_INT_BUF_MARG_SHIFT
#define BMI_INT_BUF_MARG_MASK
#define BMI_EXT_BUF_MARG_START_SHIFT
#define BMI_EXT_BUF_MARG_START_MASK
#define BMI_EXT_BUF_MARG_END_MASK

#define BMI_CMD_MR_LEAC
#define BMI_CMD_MR_SLEAC
#define BMI_CMD_MR_MA
#define BMI_CMD_MR_DEAS
#define BMI_CMD_RX_MR_DEF
#define BMI_CMD_TX_MR_DEF

#define BMI_CMD_ATTR_ORDER
#define BMI_CMD_ATTR_SYNC
#define BMI_CMD_ATTR_COLOR_SHIFT

#define BMI_FIFO_PIPELINE_DEPTH_SHIFT
#define BMI_FIFO_PIPELINE_DEPTH_MASK
#define BMI_NEXT_ENG_FD_BITS_SHIFT

#define BMI_EXT_BUF_POOL_VALID
#define BMI_EXT_BUF_POOL_EN_COUNTER
#define BMI_EXT_BUF_POOL_BACKUP
#define BMI_EXT_BUF_POOL_ID_SHIFT
#define BMI_EXT_BUF_POOL_ID_MASK
#define BMI_POOL_DEP_NUM_OF_POOLS_SHIFT

#define BMI_TX_FIFO_MIN_FILL_SHIFT

#define BMI_PRIORITY_ELEVATION_LEVEL
#define BMI_FIFO_THRESHOLD

#define BMI_DEQUEUE_PIPELINE_DEPTH(_type, _speed)

#define RX_ERRS_TO_ENQ

/* NIA defines */
#define NIA_ORDER_RESTOR
#define NIA_ENG_BMI
#define NIA_ENG_QMI_ENQ
#define NIA_ENG_QMI_DEQ
#define NIA_ENG_HWP
#define NIA_ENG_HWK
#define NIA_BMI_AC_ENQ_FRAME
#define NIA_BMI_AC_TX_RELEASE
#define NIA_BMI_AC_RELEASE
#define NIA_BMI_AC_TX
#define NIA_BMI_AC_FETCH_ALL_FRAME

/* Port IDs */
#define TX_10G_PORT_BASE
#define RX_10G_PORT_BASE

/* BMI Rx port register map */
struct fman_port_rx_bmi_regs {};

/* BMI Tx port register map */
struct fman_port_tx_bmi_regs {};

/* BMI port register map */
fman_port_bmi_regs;

/* QMI port register map */
struct fman_port_qmi_regs {};

#define HWP_HXS_COUNT
#define HWP_HXS_PHE_REPORT
#define HWP_HXS_PCAC_PSTAT
#define HWP_HXS_PCAC_PSTOP
#define HWP_HXS_TCP_OFFSET
#define HWP_HXS_UDP_OFFSET
#define HWP_HXS_SH_PAD_REM

struct fman_port_hwp_regs {};

/* QMI dequeue prefetch modes */
enum fman_port_deq_prefetch {};

/* A structure for defining FM port resources */
struct fman_port_rsrc {};

enum fman_port_dma_swap {};

/* Default port color */
enum fman_port_color {};

/* QMI dequeue from the SP channel - types */
enum fman_port_deq_type {};

/* External buffer pools configuration */
struct fman_port_bpools {};

struct fman_port_cfg {};

struct fman_port_rx_pools_params {};

struct fman_port_dts_params {};

struct fman_port {};

static int init_bmi_rx(struct fman_port *port)
{}

static int init_bmi_tx(struct fman_port *port)
{}

static int init_qmi(struct fman_port *port)
{}

static void stop_port_hwp(struct fman_port *port)
{}

static void start_port_hwp(struct fman_port *port)
{}

static void init_hwp(struct fman_port *port)
{}

static int init(struct fman_port *port)
{}

static int set_bpools(const struct fman_port *port,
		      const struct fman_port_bpools *bp)
{}

static bool is_init_done(struct fman_port_cfg *cfg)
{}

static int verify_size_of_fifo(struct fman_port *port)
{}

static int set_ext_buffer_pools(struct fman_port *port)
{}

static int init_low_level_driver(struct fman_port *port)
{}

static int fill_soc_specific_params(struct fman_port *port)
{}

static int get_dflt_fifo_deq_pipeline_depth(u8 major, enum fman_port_type type,
					    u16 speed)
{}

static int get_dflt_num_of_tasks(u8 major, enum fman_port_type type,
				 u16 speed)
{}

static int get_dflt_extra_num_of_tasks(u8 major, enum fman_port_type type,
				       u16 speed)
{}

static int get_dflt_num_of_open_dmas(u8 major, enum fman_port_type type,
				     u16 speed)
{}

static int get_dflt_extra_num_of_open_dmas(u8 major, enum fman_port_type type,
					   u16 speed)
{}

static int get_dflt_num_of_fifo_bufs(u8 major, enum fman_port_type type,
				     u16 speed)
{}

static void set_dflt_cfg(struct fman_port *port,
			 struct fman_port_params *port_params)
{}

static void set_rx_dflt_cfg(struct fman_port *port,
			    struct fman_port_params *port_params)
{}

static void set_tx_dflt_cfg(struct fman_port *port,
			    struct fman_port_params *port_params,
			    struct fman_port_dts_params *dts_params)
{}

/**
 * fman_port_config
 * @port:	Pointer to the port structure
 * @params:	Pointer to data structure of parameters
 *
 * Creates a descriptor for the FM PORT module.
 * The routine returns a pointer to the FM PORT object.
 * This descriptor must be passed as first parameter to all other FM PORT
 * function calls.
 * No actual initialization or configuration of FM hardware is done by this
 * routine.
 *
 * Return: 0 on success; Error code otherwise.
 */
int fman_port_config(struct fman_port *port, struct fman_port_params *params)
{}
EXPORT_SYMBOL();

/*
 * fman_port_use_kg_hash
 * @port: A pointer to a FM Port module.
 * @enable: enable or disable
 *
 * Sets the HW KeyGen or the BMI as HW Parser next engine, enabling
 * or bypassing the KeyGen hashing of Rx traffic
 */
void fman_port_use_kg_hash(struct fman_port *port, bool enable)
{}
EXPORT_SYMBOL();

/**
 * fman_port_init
 * @port:	A pointer to a FM Port module.
 *
 * Initializes the FM PORT module by defining the software structure and
 * configuring the hardware registers.
 *
 * Return: 0 on success; Error code otherwise.
 */
int fman_port_init(struct fman_port *port)
{}
EXPORT_SYMBOL();

/**
 * fman_port_cfg_buf_prefix_content
 * @port:			A pointer to a FM Port module.
 * @buffer_prefix_content:	A structure of parameters describing
 *				the structure of the buffer.
 *				Out parameter:
 *				Start margin - offset of data from
 *				start of external buffer.
 * Defines the structure, size and content of the application buffer.
 * The prefix, in Tx ports, if 'pass_prs_result', the application should set
 * a value to their offsets in the prefix of the FM will save the first
 * 'priv_data_size', than, depending on 'pass_prs_result' and
 * 'pass_time_stamp', copy parse result and timeStamp, and the packet itself
 * (in this order), to the application buffer, and to offset.
 * Calling this routine changes the buffer margins definitions in the internal
 * driver data base from its default configuration:
 * Data size:  [DEFAULT_PORT_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE]
 * Pass Parser result: [DEFAULT_PORT_BUFFER_PREFIX_CONTENT_PASS_PRS_RESULT].
 * Pass timestamp: [DEFAULT_PORT_BUFFER_PREFIX_CONTENT_PASS_TIME_STAMP].
 * May be used for all ports
 *
 * Allowed only following fman_port_config() and before fman_port_init().
 *
 * Return: 0 on success; Error code otherwise.
 */
int fman_port_cfg_buf_prefix_content(struct fman_port *port,
				     struct fman_buffer_prefix_content *
				     buffer_prefix_content)
{}
EXPORT_SYMBOL();

/**
 * fman_port_disable
 * @port:	A pointer to a FM Port module.
 *
 * Gracefully disable an FM port. The port will not start new	tasks after all
 * tasks associated with the port are terminated.
 *
 * This is a blocking routine, it returns after port is gracefully stopped,
 * i.e. the port will not except new frames, but it will finish all frames
 * or tasks which were already began.
 * Allowed only following fman_port_init().
 *
 * Return: 0 on success; Error code otherwise.
 */
int fman_port_disable(struct fman_port *port)
{}
EXPORT_SYMBOL();

/**
 * fman_port_enable
 * @port:	A pointer to a FM Port module.
 *
 * A runtime routine provided to allow disable/enable of port.
 *
 * Allowed only following fman_port_init().
 *
 * Return: 0 on success; Error code otherwise.
 */
int fman_port_enable(struct fman_port *port)
{}
EXPORT_SYMBOL();

/**
 * fman_port_bind
 * @dev:		FMan Port OF device pointer
 *
 * Bind to a specific FMan Port.
 *
 * Allowed only after the port was created.
 *
 * Return: A pointer to the FMan port device.
 */
struct fman_port *fman_port_bind(struct device *dev)
{}
EXPORT_SYMBOL();

/**
 * fman_port_get_qman_channel_id
 * @port:	Pointer to the FMan port devuce
 *
 * Get the QMan channel ID for the specific port
 *
 * Return: QMan channel ID
 */
u32 fman_port_get_qman_channel_id(struct fman_port *port)
{}
EXPORT_SYMBOL();

/**
 * fman_port_get_device
 * @port:	Pointer to the FMan port device
 *
 * Get the 'struct device' associated to the specified FMan port device
 *
 * Return: pointer to associated 'struct device'
 */
struct device *fman_port_get_device(struct fman_port *port)
{}
EXPORT_SYMBOL();

int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset)
{}
EXPORT_SYMBOL();

int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp)
{}
EXPORT_SYMBOL();

static int fman_port_probe(struct platform_device *of_dev)
{}

static const struct of_device_id fman_port_match[] =;

MODULE_DEVICE_TABLE(of, fman_port_match);

static struct platform_driver fman_port_driver =;

static int __init fman_port_load(void)
{}
module_init();

static void __exit fman_port_unload(void)
{}
module_exit(fman_port_unload);

MODULE_LICENSE();
MODULE_DESCRIPTION();