18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __CVMX_CONFIG_H__
38c2ecf20Sopenharmony_ci#define __CVMX_CONFIG_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/************************* Config Specific Defines ************************/
68c2ecf20Sopenharmony_ci#define CVMX_LLM_NUM_PORTS 1
78c2ecf20Sopenharmony_ci#define CVMX_NULL_POINTER_PROTECT 1
88c2ecf20Sopenharmony_ci#define CVMX_ENABLE_DEBUG_PRINTS 1
98c2ecf20Sopenharmony_ci/* PKO queues per port for interface 0 (ports 0-15) */
108c2ecf20Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 1
118c2ecf20Sopenharmony_ci/* PKO queues per port for interface 1 (ports 16-31) */
128c2ecf20Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 1
138c2ecf20Sopenharmony_ci/* Limit on the number of PKO ports enabled for interface 0 */
148c2ecf20Sopenharmony_ci#define CVMX_PKO_MAX_PORTS_INTERFACE0 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0
158c2ecf20Sopenharmony_ci/* Limit on the number of PKO ports enabled for interface 1 */
168c2ecf20Sopenharmony_ci#define CVMX_PKO_MAX_PORTS_INTERFACE1 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1
178c2ecf20Sopenharmony_ci/* PKO queues per port for PCI (ports 32-35) */
188c2ecf20Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_PCI 1
198c2ecf20Sopenharmony_ci/* PKO queues per port for Loop devices (ports 36-39) */
208c2ecf20Sopenharmony_ci#define CVMX_PKO_QUEUES_PER_PORT_LOOP 1
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/************************* FPA allocation *********************************/
238c2ecf20Sopenharmony_ci/* Pool sizes in bytes, must be multiple of a cache line */
248c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_0_SIZE (16 * CVMX_CACHE_LINE_SIZE)
258c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_1_SIZE (1 * CVMX_CACHE_LINE_SIZE)
268c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_2_SIZE (8 * CVMX_CACHE_LINE_SIZE)
278c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_3_SIZE (0 * CVMX_CACHE_LINE_SIZE)
288c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_4_SIZE (0 * CVMX_CACHE_LINE_SIZE)
298c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_5_SIZE (0 * CVMX_CACHE_LINE_SIZE)
308c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_6_SIZE (0 * CVMX_CACHE_LINE_SIZE)
318c2ecf20Sopenharmony_ci#define CVMX_FPA_POOL_7_SIZE (0 * CVMX_CACHE_LINE_SIZE)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Pools in use */
348c2ecf20Sopenharmony_ci/* Packet buffers */
358c2ecf20Sopenharmony_ci#define CVMX_FPA_PACKET_POOL		    (0)
368c2ecf20Sopenharmony_ci#define CVMX_FPA_PACKET_POOL_SIZE	    CVMX_FPA_POOL_0_SIZE
378c2ecf20Sopenharmony_ci/* Work queue entries */
388c2ecf20Sopenharmony_ci#define CVMX_FPA_WQE_POOL		    (1)
398c2ecf20Sopenharmony_ci#define CVMX_FPA_WQE_POOL_SIZE		    CVMX_FPA_POOL_1_SIZE
408c2ecf20Sopenharmony_ci/* PKO queue command buffers */
418c2ecf20Sopenharmony_ci#define CVMX_FPA_OUTPUT_BUFFER_POOL	    (2)
428c2ecf20Sopenharmony_ci#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    CVMX_FPA_POOL_2_SIZE
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*************************  FAU allocation ********************************/
458c2ecf20Sopenharmony_ci/* The fetch and add registers are allocated here.  They are arranged
468c2ecf20Sopenharmony_ci * in order of descending size so that all alignment constraints are
478c2ecf20Sopenharmony_ci * automatically met.  The enums are linked so that the following enum
488c2ecf20Sopenharmony_ci * continues allocating where the previous one left off, so the
498c2ecf20Sopenharmony_ci * numbering within each enum always starts with zero.	The macros
508c2ecf20Sopenharmony_ci * take care of the address increment size, so the values entered
518c2ecf20Sopenharmony_ci * always increase by 1.  FAU registers are accessed with byte
528c2ecf20Sopenharmony_ci * addresses.
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define CVMX_FAU_REG_64_ADDR(x) ((x << 3) + CVMX_FAU_REG_64_START)
568c2ecf20Sopenharmony_citypedef enum {
578c2ecf20Sopenharmony_ci	CVMX_FAU_REG_64_START	= 0,
588c2ecf20Sopenharmony_ci	CVMX_FAU_REG_64_END	= CVMX_FAU_REG_64_ADDR(0),
598c2ecf20Sopenharmony_ci} cvmx_fau_reg_64_t;
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define CVMX_FAU_REG_32_ADDR(x) ((x << 2) + CVMX_FAU_REG_32_START)
628c2ecf20Sopenharmony_citypedef enum {
638c2ecf20Sopenharmony_ci	CVMX_FAU_REG_32_START	= CVMX_FAU_REG_64_END,
648c2ecf20Sopenharmony_ci	CVMX_FAU_REG_32_END	= CVMX_FAU_REG_32_ADDR(0),
658c2ecf20Sopenharmony_ci} cvmx_fau_reg_32_t;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define CVMX_FAU_REG_16_ADDR(x) ((x << 1) + CVMX_FAU_REG_16_START)
688c2ecf20Sopenharmony_citypedef enum {
698c2ecf20Sopenharmony_ci	CVMX_FAU_REG_16_START	= CVMX_FAU_REG_32_END,
708c2ecf20Sopenharmony_ci	CVMX_FAU_REG_16_END	= CVMX_FAU_REG_16_ADDR(0),
718c2ecf20Sopenharmony_ci} cvmx_fau_reg_16_t;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define CVMX_FAU_REG_8_ADDR(x) ((x) + CVMX_FAU_REG_8_START)
748c2ecf20Sopenharmony_citypedef enum {
758c2ecf20Sopenharmony_ci	CVMX_FAU_REG_8_START	= CVMX_FAU_REG_16_END,
768c2ecf20Sopenharmony_ci	CVMX_FAU_REG_8_END	= CVMX_FAU_REG_8_ADDR(0),
778c2ecf20Sopenharmony_ci} cvmx_fau_reg_8_t;
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/*
808c2ecf20Sopenharmony_ci * The name CVMX_FAU_REG_AVAIL_BASE is provided to indicate the first
818c2ecf20Sopenharmony_ci * available FAU address that is not allocated in cvmx-config.h. This
828c2ecf20Sopenharmony_ci * is 64 bit aligned.
838c2ecf20Sopenharmony_ci */
848c2ecf20Sopenharmony_ci#define CVMX_FAU_REG_AVAIL_BASE ((CVMX_FAU_REG_8_END + 0x7) & (~0x7ULL))
858c2ecf20Sopenharmony_ci#define CVMX_FAU_REG_END (2048)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/********************** scratch memory allocation *************************/
888c2ecf20Sopenharmony_ci/* Scratchpad memory allocation.  Note that these are byte memory
898c2ecf20Sopenharmony_ci * addresses.  Some uses of scratchpad (IOBDMA for example) require
908c2ecf20Sopenharmony_ci * the use of 8-byte aligned addresses, so proper alignment needs to
918c2ecf20Sopenharmony_ci * be taken into account.
928c2ecf20Sopenharmony_ci */
938c2ecf20Sopenharmony_ci/* Generic scratch iobdma area */
948c2ecf20Sopenharmony_ci#define CVMX_SCR_SCRATCH	       (0)
958c2ecf20Sopenharmony_ci/* First location available after cvmx-config.h allocated region. */
968c2ecf20Sopenharmony_ci#define CVMX_SCR_REG_AVAIL_BASE	       (8)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/*
998c2ecf20Sopenharmony_ci * CVMX_HELPER_FIRST_MBUFF_SKIP is the number of bytes to reserve
1008c2ecf20Sopenharmony_ci * before the beginning of the packet. If necessary, override the
1018c2ecf20Sopenharmony_ci * default here.  See the IPD section of the hardware manual for MBUFF
1028c2ecf20Sopenharmony_ci * SKIP details.
1038c2ecf20Sopenharmony_ci */
1048c2ecf20Sopenharmony_ci#define CVMX_HELPER_FIRST_MBUFF_SKIP 184
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/*
1078c2ecf20Sopenharmony_ci * CVMX_HELPER_NOT_FIRST_MBUFF_SKIP is the number of bytes to reserve
1088c2ecf20Sopenharmony_ci * in each chained packet element. If necessary, override the default
1098c2ecf20Sopenharmony_ci * here.
1108c2ecf20Sopenharmony_ci */
1118c2ecf20Sopenharmony_ci#define CVMX_HELPER_NOT_FIRST_MBUFF_SKIP 0
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/*
1148c2ecf20Sopenharmony_ci * CVMX_HELPER_ENABLE_BACK_PRESSURE controls whether back pressure is
1158c2ecf20Sopenharmony_ci * enabled for all input ports. This controls if IPD sends
1168c2ecf20Sopenharmony_ci * backpressure to all ports if Octeon's FPA pools don't have enough
1178c2ecf20Sopenharmony_ci * packet or work queue entries. Even when this is off, it is still
1188c2ecf20Sopenharmony_ci * possible to get backpressure from individual hardware ports. When
1198c2ecf20Sopenharmony_ci * configuring backpressure, also check
1208c2ecf20Sopenharmony_ci * CVMX_HELPER_DISABLE_*_BACKPRESSURE below. If necessary, override
1218c2ecf20Sopenharmony_ci * the default here.
1228c2ecf20Sopenharmony_ci */
1238c2ecf20Sopenharmony_ci#define CVMX_HELPER_ENABLE_BACK_PRESSURE 1
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/*
1268c2ecf20Sopenharmony_ci * CVMX_HELPER_ENABLE_IPD controls if the IPD is enabled in the helper
1278c2ecf20Sopenharmony_ci * function. Once it is enabled the hardware starts accepting
1288c2ecf20Sopenharmony_ci * packets. You might want to skip the IPD enable if configuration
1298c2ecf20Sopenharmony_ci * changes are need from the default helper setup. If necessary,
1308c2ecf20Sopenharmony_ci * override the default here.
1318c2ecf20Sopenharmony_ci */
1328c2ecf20Sopenharmony_ci#define CVMX_HELPER_ENABLE_IPD 0
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/*
1358c2ecf20Sopenharmony_ci * CVMX_HELPER_INPUT_TAG_TYPE selects the type of tag that the IPD assigns
1368c2ecf20Sopenharmony_ci * to incoming packets.
1378c2ecf20Sopenharmony_ci */
1388c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_TYPE CVMX_POW_TAG_TYPE_ORDERED
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define CVMX_ENABLE_PARAMETER_CHECKING 0
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/*
1438c2ecf20Sopenharmony_ci * The following select which fields are used by the PIP to generate
1448c2ecf20Sopenharmony_ci * the tag on INPUT
1458c2ecf20Sopenharmony_ci * 0: don't include
1468c2ecf20Sopenharmony_ci * 1: include
1478c2ecf20Sopenharmony_ci */
1488c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_IP	0
1498c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_DST_IP	0
1508c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_PORT	0
1518c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_DST_PORT	0
1528c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV6_NEXT_HEADER	0
1538c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_IP	0
1548c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_DST_IP	0
1558c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_PORT	0
1568c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_DST_PORT	0
1578c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_IPV4_PROTOCOL	0
1588c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_TAG_INPUT_PORT	1
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* Select skip mode for input ports */
1618c2ecf20Sopenharmony_ci#define CVMX_HELPER_INPUT_PORT_SKIP_MODE	CVMX_PIP_PORT_CFG_MODE_SKIPL2
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/*
1648c2ecf20Sopenharmony_ci * Force backpressure to be disabled.  This overrides all other
1658c2ecf20Sopenharmony_ci * backpressure configuration.
1668c2ecf20Sopenharmony_ci */
1678c2ecf20Sopenharmony_ci#define CVMX_HELPER_DISABLE_RGMII_BACKPRESSURE 0
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#endif /* __CVMX_CONFIG_H__ */
170