162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __CVMX_CONFIG_H__
362306a36Sopenharmony_ci#define __CVMX_CONFIG_H__
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/************************* Config Specific Defines ************************/
662306a36Sopenharmony_ci#define CVMX_LLM_NUM_PORTS 1
762306a36Sopenharmony_ci#define CVMX_NULL_POINTER_PROTECT 1
862306a36Sopenharmony_ci#define CVMX_ENABLE_DEBUG_PRINTS 1
962306a36Sopenharmony_ci/* PKO queues per port for interface 0 (ports 0-15) */
1062306a36Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 1
1162306a36Sopenharmony_ci/* PKO queues per port for interface 1 (ports 16-31) */
1262306a36Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 1
1362306a36Sopenharmony_ci/* Limit on the number of PKO ports enabled for interface 0 */
1462306a36Sopenharmony_ci#define CVMX_PKO_MAX_PORTS_INTERFACE0 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0
1562306a36Sopenharmony_ci/* Limit on the number of PKO ports enabled for interface 1 */
1662306a36Sopenharmony_ci#define CVMX_PKO_MAX_PORTS_INTERFACE1 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1
1762306a36Sopenharmony_ci/* PKO queues per port for PCI (ports 32-35) */
1862306a36Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_PCI 1
1962306a36Sopenharmony_ci/* PKO queues per port for Loop devices (ports 36-39) */
2062306a36Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_LOOP 1
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/************************* FPA allocation *********************************/
2362306a36Sopenharmony_ci/* Pool sizes in bytes, must be multiple of a cache line */
2462306a36Sopenharmony_ci#define CVMX_FPA_POOL_0_SIZE (16 * CVMX_CACHE_LINE_SIZE)
2562306a36Sopenharmony_ci#define CVMX_FPA_POOL_1_SIZE (1 * CVMX_CACHE_LINE_SIZE)
2662306a36Sopenharmony_ci#define CVMX_FPA_POOL_2_SIZE (8 * CVMX_CACHE_LINE_SIZE)
2762306a36Sopenharmony_ci#define CVMX_FPA_POOL_3_SIZE (0 * CVMX_CACHE_LINE_SIZE)
2862306a36Sopenharmony_ci#define CVMX_FPA_POOL_4_SIZE (0 * CVMX_CACHE_LINE_SIZE)
2962306a36Sopenharmony_ci#define CVMX_FPA_POOL_5_SIZE (0 * CVMX_CACHE_LINE_SIZE)
3062306a36Sopenharmony_ci#define CVMX_FPA_POOL_6_SIZE (0 * CVMX_CACHE_LINE_SIZE)
3162306a36Sopenharmony_ci#define CVMX_FPA_POOL_7_SIZE (0 * CVMX_CACHE_LINE_SIZE)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* Pools in use */
3462306a36Sopenharmony_ci/* Packet buffers */
3562306a36Sopenharmony_ci#define CVMX_FPA_PACKET_POOL		    (0)
3662306a36Sopenharmony_ci#define CVMX_FPA_PACKET_POOL_SIZE	    CVMX_FPA_POOL_0_SIZE
3762306a36Sopenharmony_ci/* Work queue entries */
3862306a36Sopenharmony_ci#define CVMX_FPA_WQE_POOL		    (1)
3962306a36Sopenharmony_ci#define CVMX_FPA_WQE_POOL_SIZE		    CVMX_FPA_POOL_1_SIZE
4062306a36Sopenharmony_ci/* PKO queue command buffers */
4162306a36Sopenharmony_ci#define CVMX_FPA_OUTPUT_BUFFER_POOL	    (2)
4262306a36Sopenharmony_ci#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    CVMX_FPA_POOL_2_SIZE
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/*************************  FAU allocation ********************************/
4562306a36Sopenharmony_ci/* The fetch and add registers are allocated here.  They are arranged
4662306a36Sopenharmony_ci * in order of descending size so that all alignment constraints are
4762306a36Sopenharmony_ci * automatically met.  The enums are linked so that the following enum
4862306a36Sopenharmony_ci * continues allocating where the previous one left off, so the
4962306a36Sopenharmony_ci * numbering within each enum always starts with zero.	The macros
5062306a36Sopenharmony_ci * take care of the address increment size, so the values entered
5162306a36Sopenharmony_ci * always increase by 1.  FAU registers are accessed with byte
5262306a36Sopenharmony_ci * addresses.
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define CVMX_FAU_REG_64_ADDR(x) ((x << 3) + CVMX_FAU_REG_64_START)
5662306a36Sopenharmony_citypedef enum {
5762306a36Sopenharmony_ci	CVMX_FAU_REG_64_START	= 0,
5862306a36Sopenharmony_ci	CVMX_FAU_REG_64_END	= CVMX_FAU_REG_64_ADDR(0),
5962306a36Sopenharmony_ci} cvmx_fau_reg_64_t;
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define CVMX_FAU_REG_32_ADDR(x) ((x << 2) + CVMX_FAU_REG_32_START)
6262306a36Sopenharmony_citypedef enum {
6362306a36Sopenharmony_ci	CVMX_FAU_REG_32_START	= CVMX_FAU_REG_64_END,
6462306a36Sopenharmony_ci	CVMX_FAU_REG_32_END	= CVMX_FAU_REG_32_ADDR(0),
6562306a36Sopenharmony_ci} cvmx_fau_reg_32_t;
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define CVMX_FAU_REG_16_ADDR(x) ((x << 1) + CVMX_FAU_REG_16_START)
6862306a36Sopenharmony_citypedef enum {
6962306a36Sopenharmony_ci	CVMX_FAU_REG_16_START	= CVMX_FAU_REG_32_END,
7062306a36Sopenharmony_ci	CVMX_FAU_REG_16_END	= CVMX_FAU_REG_16_ADDR(0),
7162306a36Sopenharmony_ci} cvmx_fau_reg_16_t;
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#define CVMX_FAU_REG_8_ADDR(x) ((x) + CVMX_FAU_REG_8_START)
7462306a36Sopenharmony_citypedef enum {
7562306a36Sopenharmony_ci	CVMX_FAU_REG_8_START	= CVMX_FAU_REG_16_END,
7662306a36Sopenharmony_ci	CVMX_FAU_REG_8_END	= CVMX_FAU_REG_8_ADDR(0),
7762306a36Sopenharmony_ci} cvmx_fau_reg_8_t;
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/*
8062306a36Sopenharmony_ci * The name CVMX_FAU_REG_AVAIL_BASE is provided to indicate the first
8162306a36Sopenharmony_ci * available FAU address that is not allocated in cvmx-config.h. This
8262306a36Sopenharmony_ci * is 64 bit aligned.
8362306a36Sopenharmony_ci */
8462306a36Sopenharmony_ci#define CVMX_FAU_REG_AVAIL_BASE ((CVMX_FAU_REG_8_END + 0x7) & (~0x7ULL))
8562306a36Sopenharmony_ci#define CVMX_FAU_REG_END (2048)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/********************** scratch memory allocation *************************/
8862306a36Sopenharmony_ci/* Scratchpad memory allocation.  Note that these are byte memory
8962306a36Sopenharmony_ci * addresses.  Some uses of scratchpad (IOBDMA for example) require
9062306a36Sopenharmony_ci * the use of 8-byte aligned addresses, so proper alignment needs to
9162306a36Sopenharmony_ci * be taken into account.
9262306a36Sopenharmony_ci */
9362306a36Sopenharmony_ci/* Generic scratch iobdma area */
9462306a36Sopenharmony_ci#define CVMX_SCR_SCRATCH	       (0)
9562306a36Sopenharmony_ci/* First location available after cvmx-config.h allocated region. */
9662306a36Sopenharmony_ci#define CVMX_SCR_REG_AVAIL_BASE	       (8)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/*
9962306a36Sopenharmony_ci * CVMX_HELPER_FIRST_MBUFF_SKIP is the number of bytes to reserve
10062306a36Sopenharmony_ci * before the beginning of the packet. If necessary, override the
10162306a36Sopenharmony_ci * default here.  See the IPD section of the hardware manual for MBUFF
10262306a36Sopenharmony_ci * SKIP details.
10362306a36Sopenharmony_ci */
10462306a36Sopenharmony_ci#define CVMX_HELPER_FIRST_MBUFF_SKIP 184
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/*
10762306a36Sopenharmony_ci * CVMX_HELPER_NOT_FIRST_MBUFF_SKIP is the number of bytes to reserve
10862306a36Sopenharmony_ci * in each chained packet element. If necessary, override the default
10962306a36Sopenharmony_ci * here.
11062306a36Sopenharmony_ci */
11162306a36Sopenharmony_ci#define CVMX_HELPER_NOT_FIRST_MBUFF_SKIP 0
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/*
11462306a36Sopenharmony_ci * CVMX_HELPER_ENABLE_BACK_PRESSURE controls whether back pressure is
11562306a36Sopenharmony_ci * enabled for all input ports. This controls if IPD sends
11662306a36Sopenharmony_ci * backpressure to all ports if Octeon's FPA pools don't have enough
11762306a36Sopenharmony_ci * packet or work queue entries. Even when this is off, it is still
11862306a36Sopenharmony_ci * possible to get backpressure from individual hardware ports. When
11962306a36Sopenharmony_ci * configuring backpressure, also check
12062306a36Sopenharmony_ci * CVMX_HELPER_DISABLE_*_BACKPRESSURE below. If necessary, override
12162306a36Sopenharmony_ci * the default here.
12262306a36Sopenharmony_ci */
12362306a36Sopenharmony_ci#define CVMX_HELPER_ENABLE_BACK_PRESSURE 1
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/*
12662306a36Sopenharmony_ci * CVMX_HELPER_ENABLE_IPD controls if the IPD is enabled in the helper
12762306a36Sopenharmony_ci * function. Once it is enabled the hardware starts accepting
12862306a36Sopenharmony_ci * packets. You might want to skip the IPD enable if configuration
12962306a36Sopenharmony_ci * changes are need from the default helper setup. If necessary,
13062306a36Sopenharmony_ci * override the default here.
13162306a36Sopenharmony_ci */
13262306a36Sopenharmony_ci#define CVMX_HELPER_ENABLE_IPD 0
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/*
13562306a36Sopenharmony_ci * CVMX_HELPER_INPUT_TAG_TYPE selects the type of tag that the IPD assigns
13662306a36Sopenharmony_ci * to incoming packets.
13762306a36Sopenharmony_ci */
13862306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_TYPE CVMX_POW_TAG_TYPE_ORDERED
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define CVMX_ENABLE_PARAMETER_CHECKING 0
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci/*
14362306a36Sopenharmony_ci * The following select which fields are used by the PIP to generate
14462306a36Sopenharmony_ci * the tag on INPUT
14562306a36Sopenharmony_ci * 0: don't include
14662306a36Sopenharmony_ci * 1: include
14762306a36Sopenharmony_ci */
14862306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_IP	0
14962306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_DST_IP	0
15062306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_PORT	0
15162306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_DST_PORT	0
15262306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_NEXT_HEADER	0
15362306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_IP	0
15462306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_DST_IP	0
15562306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_PORT	0
15662306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_DST_PORT	0
15762306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_PROTOCOL	0
15862306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_INPUT_PORT	1
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/* Select skip mode for input ports */
16162306a36Sopenharmony_ci#define CVMX_HELPER_INPUT_PORT_SKIP_MODE	CVMX_PIP_PORT_CFG_MODE_SKIPL2
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci/*
16462306a36Sopenharmony_ci * Force backpressure to be disabled.  This overrides all other
16562306a36Sopenharmony_ci * backpressure configuration.
16662306a36Sopenharmony_ci */
16762306a36Sopenharmony_ci#define CVMX_HELPER_DISABLE_RGMII_BACKPRESSURE 0
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#endif /* __CVMX_CONFIG_H__ */
170