1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2019 Marvell International Ltd.
5 #ifndef __OTX2_SDP_HW_H_
6 #define __OTX2_SDP_HW_H_
9 #define SDP_MIN_RINGS_PER_VF (1)
10 #define SDP_MAX_RINGS_PER_VF (8)
12 /* SDP VF IQ configuration */
13 #define SDP_VF_MAX_IQ_DESCRIPTORS (512)
14 #define SDP_VF_MIN_IQ_DESCRIPTORS (128)
16 #define SDP_VF_DB_MIN (1)
17 #define SDP_VF_DB_TIMEOUT (1)
18 #define SDP_VF_INTR_THRESHOLD (0xFFFFFFFF)
20 #define SDP_VF_64BYTE_INSTR (64)
21 #define SDP_VF_32BYTE_INSTR (32)
23 /* SDP VF OQ configuration */
24 #define SDP_VF_MAX_OQ_DESCRIPTORS (512)
25 #define SDP_VF_MIN_OQ_DESCRIPTORS (128)
26 #define SDP_VF_OQ_BUF_SIZE (2048)
27 #define SDP_VF_OQ_REFIL_THRESHOLD (16)
29 #define SDP_VF_OQ_INFOPTR_MODE (1)
30 #define SDP_VF_OQ_BUFPTR_MODE (0)
32 #define SDP_VF_OQ_INTR_PKT (1)
33 #define SDP_VF_OQ_INTR_TIME (10)
34 #define SDP_VF_CFG_IO_QUEUES SDP_MAX_RINGS_PER_VF
36 /* Wait time in milliseconds for FLR */
37 #define SDP_VF_PCI_FLR_WAIT (100)
38 #define SDP_VF_BUSY_LOOP_COUNT (10000)
40 #define SDP_VF_MAX_IO_QUEUES SDP_MAX_RINGS_PER_VF
41 #define SDP_VF_MIN_IO_QUEUES SDP_MIN_RINGS_PER_VF
43 /* SDP VF IOQs per rawdev */
44 #define SDP_VF_MAX_IOQS_PER_RAWDEV SDP_VF_MAX_IO_QUEUES
45 #define SDP_VF_DEFAULT_IOQS_PER_RAWDEV SDP_VF_MIN_IO_QUEUES
47 /* SDP VF Register definitions */
48 #define SDP_VF_RING_OFFSET (0x1ull << 17)
50 /* SDP VF IQ Registers */
51 #define SDP_VF_R_IN_CONTROL_START (0x10000)
52 #define SDP_VF_R_IN_ENABLE_START (0x10010)
53 #define SDP_VF_R_IN_INSTR_BADDR_START (0x10020)
54 #define SDP_VF_R_IN_INSTR_RSIZE_START (0x10030)
55 #define SDP_VF_R_IN_INSTR_DBELL_START (0x10040)
56 #define SDP_VF_R_IN_CNTS_START (0x10050)
57 #define SDP_VF_R_IN_INT_LEVELS_START (0x10060)
58 #define SDP_VF_R_IN_PKT_CNT_START (0x10080)
59 #define SDP_VF_R_IN_BYTE_CNT_START (0x10090)
61 #define SDP_VF_R_IN_CONTROL(ring) \
62 (SDP_VF_R_IN_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET))
64 #define SDP_VF_R_IN_ENABLE(ring) \
65 (SDP_VF_R_IN_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET))
67 #define SDP_VF_R_IN_INSTR_BADDR(ring) \
68 (SDP_VF_R_IN_INSTR_BADDR_START + ((ring) * SDP_VF_RING_OFFSET))
70 #define SDP_VF_R_IN_INSTR_RSIZE(ring) \
71 (SDP_VF_R_IN_INSTR_RSIZE_START + ((ring) * SDP_VF_RING_OFFSET))
73 #define SDP_VF_R_IN_INSTR_DBELL(ring) \
74 (SDP_VF_R_IN_INSTR_DBELL_START + ((ring) * SDP_VF_RING_OFFSET))
76 #define SDP_VF_R_IN_CNTS(ring) \
77 (SDP_VF_R_IN_CNTS_START + ((ring) * SDP_VF_RING_OFFSET))
79 #define SDP_VF_R_IN_INT_LEVELS(ring) \
80 (SDP_VF_R_IN_INT_LEVELS_START + ((ring) * SDP_VF_RING_OFFSET))
82 #define SDP_VF_R_IN_PKT_CNT(ring) \
83 (SDP_VF_R_IN_PKT_CNT_START + ((ring) * SDP_VF_RING_OFFSET))
85 #define SDP_VF_R_IN_BYTE_CNT(ring) \
86 (SDP_VF_R_IN_BYTE_CNT_START + ((ring) * SDP_VF_RING_OFFSET))
89 #define SDP_VF_R_IN_CTL_RPVF_MASK (0xF)
90 #define SDP_VF_R_IN_CTL_RPVF_POS (48)
92 #define SDP_VF_R_IN_CTL_IDLE (0x1ull << 28)
93 #define SDP_VF_R_IN_CTL_RDSIZE (0x3ull << 25) /* Setting to max(4) */
94 #define SDP_VF_R_IN_CTL_IS_64B (0x1ull << 24)
95 #define SDP_VF_R_IN_CTL_D_NSR (0x1ull << 8)
96 #define SDP_VF_R_IN_CTL_D_ESR (0x1ull << 6)
97 #define SDP_VF_R_IN_CTL_D_ROR (0x1ull << 5)
98 #define SDP_VF_R_IN_CTL_NSR (0x1ull << 3)
99 #define SDP_VF_R_IN_CTL_ESR (0x1ull << 1)
100 #define SDP_VF_R_IN_CTL_ROR (0x1ull << 0)
102 #define SDP_VF_R_IN_CTL_MASK \
103 (SDP_VF_R_IN_CTL_RDSIZE | SDP_VF_R_IN_CTL_IS_64B)
105 /* SDP VF OQ Registers */
106 #define SDP_VF_R_OUT_CNTS_START (0x10100)
107 #define SDP_VF_R_OUT_INT_LEVELS_START (0x10110)
108 #define SDP_VF_R_OUT_SLIST_BADDR_START (0x10120)
109 #define SDP_VF_R_OUT_SLIST_RSIZE_START (0x10130)
110 #define SDP_VF_R_OUT_SLIST_DBELL_START (0x10140)
111 #define SDP_VF_R_OUT_CONTROL_START (0x10150)
112 #define SDP_VF_R_OUT_ENABLE_START (0x10160)
113 #define SDP_VF_R_OUT_PKT_CNT_START (0x10180)
114 #define SDP_VF_R_OUT_BYTE_CNT_START (0x10190)
116 #define SDP_VF_R_OUT_CONTROL(ring) \
117 (SDP_VF_R_OUT_CONTROL_START + ((ring) * SDP_VF_RING_OFFSET))
119 #define SDP_VF_R_OUT_ENABLE(ring) \
120 (SDP_VF_R_OUT_ENABLE_START + ((ring) * SDP_VF_RING_OFFSET))
122 #define SDP_VF_R_OUT_SLIST_BADDR(ring) \
123 (SDP_VF_R_OUT_SLIST_BADDR_START + ((ring) * SDP_VF_RING_OFFSET))
125 #define SDP_VF_R_OUT_SLIST_RSIZE(ring) \
126 (SDP_VF_R_OUT_SLIST_RSIZE_START + ((ring) * SDP_VF_RING_OFFSET))
128 #define SDP_VF_R_OUT_SLIST_DBELL(ring) \
129 (SDP_VF_R_OUT_SLIST_DBELL_START + ((ring) * SDP_VF_RING_OFFSET))
131 #define SDP_VF_R_OUT_CNTS(ring) \
132 (SDP_VF_R_OUT_CNTS_START + ((ring) * SDP_VF_RING_OFFSET))
134 #define SDP_VF_R_OUT_INT_LEVELS(ring) \
135 (SDP_VF_R_OUT_INT_LEVELS_START + ((ring) * SDP_VF_RING_OFFSET))
137 #define SDP_VF_R_OUT_PKT_CNT(ring) \
138 (SDP_VF_R_OUT_PKT_CNT_START + ((ring) * SDP_VF_RING_OFFSET))
140 #define SDP_VF_R_OUT_BYTE_CNT(ring) \
141 (SDP_VF_R_OUT_BYTE_CNT_START + ((ring) * SDP_VF_RING_OFFSET))
143 /* SDP VF OQ Masks */
144 #define SDP_VF_R_OUT_CTL_IDLE (1ull << 40)
145 #define SDP_VF_R_OUT_CTL_ES_I (1ull << 34)
146 #define SDP_VF_R_OUT_CTL_NSR_I (1ull << 33)
147 #define SDP_VF_R_OUT_CTL_ROR_I (1ull << 32)
148 #define SDP_VF_R_OUT_CTL_ES_D (1ull << 30)
149 #define SDP_VF_R_OUT_CTL_NSR_D (1ull << 29)
150 #define SDP_VF_R_OUT_CTL_ROR_D (1ull << 28)
151 #define SDP_VF_R_OUT_CTL_ES_P (1ull << 26)
152 #define SDP_VF_R_OUT_CTL_NSR_P (1ull << 25)
153 #define SDP_VF_R_OUT_CTL_ROR_P (1ull << 24)
154 #define SDP_VF_R_OUT_CTL_IMODE (1ull << 23)
156 #define SDP_VF_R_OUT_INT_LEVELS_BMODE (1ull << 63)
157 #define SDP_VF_R_OUT_INT_LEVELS_TIMET (32)
159 /* SDP Instruction Header */
160 struct sdp_instr_ih {
170 /* Front Data size */
173 /* No. of entries in gather list */
176 /* Gather indicator */
183 #endif /* __OTX2_SDP_HW_H_ */