]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/contrib/octeon-sdk/cvmx-srxx-defs.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / contrib / octeon-sdk / cvmx-srxx-defs.h
1 /***********************license start***************
2  * Copyright (c) 2003-2010  Cavium Networks (support@cavium.com). All rights
3  * reserved.
4  *
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  *   * Redistributions of source code must retain the above copyright
11  *     notice, this list of conditions and the following disclaimer.
12  *
13  *   * Redistributions in binary form must reproduce the above
14  *     copyright notice, this list of conditions and the following
15  *     disclaimer in the documentation and/or other materials provided
16  *     with the distribution.
17
18  *   * Neither the name of Cavium Networks nor the names of
19  *     its contributors may be used to endorse or promote products
20  *     derived from this software without specific prior written
21  *     permission.
22
23  * This Software, including technical data, may be subject to U.S. export  control
24  * laws, including the U.S. Export Administration Act and its  associated
25  * regulations, and may be subject to export or import  regulations in other
26  * countries.
27
28  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29  * AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
30  * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31  * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32  * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33  * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34  * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35  * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36  * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
37  * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38  ***********************license end**************************************/
39
40
41 /**
42  * cvmx-srxx-defs.h
43  *
44  * Configuration and status register (CSR) type definitions for
45  * Octeon srxx.
46  *
47  * This file is auto generated. Do not edit.
48  *
49  * <hr>$Revision$<hr>
50  *
51  */
52 #ifndef __CVMX_SRXX_TYPEDEFS_H__
53 #define __CVMX_SRXX_TYPEDEFS_H__
54
55 #if CVMX_ENABLE_CSR_ADDRESS_CHECKING
56 static inline uint64_t CVMX_SRXX_COM_CTL(unsigned long block_id)
57 {
58         if (!(
59               (OCTEON_IS_MODEL(OCTEON_CN38XX) && ((block_id <= 1))) ||
60               (OCTEON_IS_MODEL(OCTEON_CN58XX) && ((block_id <= 1)))))
61                 cvmx_warn("CVMX_SRXX_COM_CTL(%lu) is invalid on this chip\n", block_id);
62         return CVMX_ADD_IO_SEG(0x0001180090000200ull) + ((block_id) & 1) * 0x8000000ull;
63 }
64 #else
65 #define CVMX_SRXX_COM_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000200ull) + ((block_id) & 1) * 0x8000000ull)
66 #endif
67 #if CVMX_ENABLE_CSR_ADDRESS_CHECKING
68 static inline uint64_t CVMX_SRXX_IGN_RX_FULL(unsigned long block_id)
69 {
70         if (!(
71               (OCTEON_IS_MODEL(OCTEON_CN38XX) && ((block_id <= 1))) ||
72               (OCTEON_IS_MODEL(OCTEON_CN58XX) && ((block_id <= 1)))))
73                 cvmx_warn("CVMX_SRXX_IGN_RX_FULL(%lu) is invalid on this chip\n", block_id);
74         return CVMX_ADD_IO_SEG(0x0001180090000218ull) + ((block_id) & 1) * 0x8000000ull;
75 }
76 #else
77 #define CVMX_SRXX_IGN_RX_FULL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000218ull) + ((block_id) & 1) * 0x8000000ull)
78 #endif
79 #if CVMX_ENABLE_CSR_ADDRESS_CHECKING
80 static inline uint64_t CVMX_SRXX_SPI4_CALX(unsigned long offset, unsigned long block_id)
81 {
82         if (!(
83               (OCTEON_IS_MODEL(OCTEON_CN38XX) && (((offset <= 31)) && ((block_id <= 1)))) ||
84               (OCTEON_IS_MODEL(OCTEON_CN58XX) && (((offset <= 31)) && ((block_id <= 1))))))
85                 cvmx_warn("CVMX_SRXX_SPI4_CALX(%lu,%lu) is invalid on this chip\n", offset, block_id);
86         return CVMX_ADD_IO_SEG(0x0001180090000000ull) + (((offset) & 31) + ((block_id) & 1) * 0x1000000ull) * 8;
87 }
88 #else
89 #define CVMX_SRXX_SPI4_CALX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180090000000ull) + (((offset) & 31) + ((block_id) & 1) * 0x1000000ull) * 8)
90 #endif
91 #if CVMX_ENABLE_CSR_ADDRESS_CHECKING
92 static inline uint64_t CVMX_SRXX_SPI4_STAT(unsigned long block_id)
93 {
94         if (!(
95               (OCTEON_IS_MODEL(OCTEON_CN38XX) && ((block_id <= 1))) ||
96               (OCTEON_IS_MODEL(OCTEON_CN58XX) && ((block_id <= 1)))))
97                 cvmx_warn("CVMX_SRXX_SPI4_STAT(%lu) is invalid on this chip\n", block_id);
98         return CVMX_ADD_IO_SEG(0x0001180090000208ull) + ((block_id) & 1) * 0x8000000ull;
99 }
100 #else
101 #define CVMX_SRXX_SPI4_STAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000208ull) + ((block_id) & 1) * 0x8000000ull)
102 #endif
103 #if CVMX_ENABLE_CSR_ADDRESS_CHECKING
104 static inline uint64_t CVMX_SRXX_SW_TICK_CTL(unsigned long block_id)
105 {
106         if (!(
107               (OCTEON_IS_MODEL(OCTEON_CN38XX) && ((block_id <= 1))) ||
108               (OCTEON_IS_MODEL(OCTEON_CN58XX) && ((block_id <= 1)))))
109                 cvmx_warn("CVMX_SRXX_SW_TICK_CTL(%lu) is invalid on this chip\n", block_id);
110         return CVMX_ADD_IO_SEG(0x0001180090000220ull) + ((block_id) & 1) * 0x8000000ull;
111 }
112 #else
113 #define CVMX_SRXX_SW_TICK_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180090000220ull) + ((block_id) & 1) * 0x8000000ull)
114 #endif
115 #if CVMX_ENABLE_CSR_ADDRESS_CHECKING
116 static inline uint64_t CVMX_SRXX_SW_TICK_DAT(unsigned long block_id)
117 {
118         if (!(
119               (OCTEON_IS_MODEL(OCTEON_CN38XX) && ((block_id <= 1))) ||
120               (OCTEON_IS_MODEL(OCTEON_CN58XX) && ((block_id <= 1)))))
121                 cvmx_warn("CVMX_SRXX_SW_TICK_DAT(%lu) is invalid on this chip\n", block_id);
122         return CVMX_ADD_IO_SEG(0x0001180090000228ull) + ((block_id) & 1) * 0x8000000ull;
123 }
124 #else
125 #define CVMX_SRXX_SW_TICK_DAT(block_id) (CVMX_ADD_IO_SEG(0x0001180090000228ull) + ((block_id) & 1) * 0x8000000ull)
126 #endif
127
128 /**
129  * cvmx_srx#_com_ctl
130  *
131  * SRX_COM_CTL - Spi receive common control
132  *
133  *
134  * Notes:
135  * Restrictions:
136  * Both the calendar table and the LEN and M parameters must be completely
137  * setup before writing the Interface enable (INF_EN) and Status channel
138  * enabled (ST_EN) asserted.
139  */
140 union cvmx_srxx_com_ctl
141 {
142         uint64_t u64;
143         struct cvmx_srxx_com_ctl_s
144         {
145 #if __BYTE_ORDER == __BIG_ENDIAN
146         uint64_t reserved_8_63                : 56;
147         uint64_t prts                         : 4;  /**< Number of ports in the receiver (write: ports - 1)
148                                                          - 0:  1 port
149                                                          - 1:  2 ports
150                                                          - 2:  3 ports
151                                                           - ...
152                                                           - 15: 16 ports */
153         uint64_t st_en                        : 1;  /**< Status channel enabled
154                                                          This is to allow configs without a status channel.
155                                                          This bit should not be modified once the
156                                                          interface is enabled. */
157         uint64_t reserved_1_2                 : 2;
158         uint64_t inf_en                       : 1;  /**< Interface enable
159                                                          The master switch that enables the entire
160                                                          interface. SRX will not validiate any data until
161                                                          this bit is set. This bit should not be modified
162                                                          once the interface is enabled. */
163 #else
164         uint64_t inf_en                       : 1;
165         uint64_t reserved_1_2                 : 2;
166         uint64_t st_en                        : 1;
167         uint64_t prts                         : 4;
168         uint64_t reserved_8_63                : 56;
169 #endif
170         } s;
171         struct cvmx_srxx_com_ctl_s            cn38xx;
172         struct cvmx_srxx_com_ctl_s            cn38xxp2;
173         struct cvmx_srxx_com_ctl_s            cn58xx;
174         struct cvmx_srxx_com_ctl_s            cn58xxp1;
175 };
176 typedef union cvmx_srxx_com_ctl cvmx_srxx_com_ctl_t;
177
178 /**
179  * cvmx_srx#_ign_rx_full
180  *
181  * SRX_IGN_RX_FULL - Ignore RX FIFO backpressure
182  *
183  *
184  * Notes:
185  * * IGNORE
186  * If a device can not or should not assert backpressure, then setting DROP
187  * will force STARVING status on the status channel for all ports.  This
188  * eliminates any back pressure from N2.
189  *
190  * This implies that it's ok drop packets when the FIFOS fill up.
191  *
192  * A side effect of this mode is that the TPA Watcher will effectively be
193  * disabled.  Since the DROP mode forces all TPA lines asserted, the TPA
194  * Watcher will never find a cycle where the TPA for the selected port is
195  * deasserted in order to increment its count.
196  */
197 union cvmx_srxx_ign_rx_full
198 {
199         uint64_t u64;
200         struct cvmx_srxx_ign_rx_full_s
201         {
202 #if __BYTE_ORDER == __BIG_ENDIAN
203         uint64_t reserved_16_63               : 48;
204         uint64_t ignore                       : 16; /**< This port should ignore backpressure hints from
205                                                           GMX when the RX FIFO fills up
206                                                          - 0: Use GMX backpressure
207                                                          - 1: Ignore GMX backpressure */
208 #else
209         uint64_t ignore                       : 16;
210         uint64_t reserved_16_63               : 48;
211 #endif
212         } s;
213         struct cvmx_srxx_ign_rx_full_s        cn38xx;
214         struct cvmx_srxx_ign_rx_full_s        cn38xxp2;
215         struct cvmx_srxx_ign_rx_full_s        cn58xx;
216         struct cvmx_srxx_ign_rx_full_s        cn58xxp1;
217 };
218 typedef union cvmx_srxx_ign_rx_full cvmx_srxx_ign_rx_full_t;
219
220 /**
221  * cvmx_srx#_spi4_cal#
222  *
223  * specify the RSL base addresses for the block
224  * SRX_SPI4_CAL - Spi4 Calender table
225  * direct_calendar_write / direct_calendar_read
226  *
227  * Notes:
228  * There are 32 calendar table CSR's, each containing 4 entries for a
229  *     total of 128 entries.  In the above definition...
230  *
231  *           n = calendar table offset * 4
232  *
233  *        Example, offset 0x00 contains the calendar table entries 0, 1, 2, 3
234  *        (with n == 0).  Offset 0x10 is the 16th entry in the calendar table
235  *        and would contain entries (16*4) = 64, 65, 66, and 67.
236  *
237  * Restrictions:
238  *          Calendar table entry accesses (read or write) can only occur
239  *          if the interface is disabled.  All other accesses will be
240  *          unpredictable.
241  *
242  *          Both the calendar table and the LEN and M parameters must be
243  *          completely setup before writing the Interface enable (INF_EN) and
244  *          Status channel enabled (ST_EN) asserted.
245  */
246 union cvmx_srxx_spi4_calx
247 {
248         uint64_t u64;
249         struct cvmx_srxx_spi4_calx_s
250         {
251 #if __BYTE_ORDER == __BIG_ENDIAN
252         uint64_t reserved_17_63               : 47;
253         uint64_t oddpar                       : 1;  /**< Odd parity over SRX_SPI4_CAL[15:0]
254                                                          (^SRX_SPI4_CAL[16:0] === 1'b1)                  |   $NS       NS */
255         uint64_t prt3                         : 4;  /**< Status for port n+3 */
256         uint64_t prt2                         : 4;  /**< Status for port n+2 */
257         uint64_t prt1                         : 4;  /**< Status for port n+1 */
258         uint64_t prt0                         : 4;  /**< Status for port n+0 */
259 #else
260         uint64_t prt0                         : 4;
261         uint64_t prt1                         : 4;
262         uint64_t prt2                         : 4;
263         uint64_t prt3                         : 4;
264         uint64_t oddpar                       : 1;
265         uint64_t reserved_17_63               : 47;
266 #endif
267         } s;
268         struct cvmx_srxx_spi4_calx_s          cn38xx;
269         struct cvmx_srxx_spi4_calx_s          cn38xxp2;
270         struct cvmx_srxx_spi4_calx_s          cn58xx;
271         struct cvmx_srxx_spi4_calx_s          cn58xxp1;
272 };
273 typedef union cvmx_srxx_spi4_calx cvmx_srxx_spi4_calx_t;
274
275 /**
276  * cvmx_srx#_spi4_stat
277  *
278  * SRX_SPI4_STAT - Spi4 status channel control
279  *
280  *
281  * Notes:
282  * Restrictions:
283  *    Both the calendar table and the LEN and M parameters must be
284  *    completely setup before writing the Interface enable (INF_EN) and
285  *    Status channel enabled (ST_EN) asserted.
286  *
287  * Current rev only supports LVTTL status IO
288  */
289 union cvmx_srxx_spi4_stat
290 {
291         uint64_t u64;
292         struct cvmx_srxx_spi4_stat_s
293         {
294 #if __BYTE_ORDER == __BIG_ENDIAN
295         uint64_t reserved_16_63               : 48;
296         uint64_t m                            : 8;  /**< CALENDAR_M (from spi4.2 spec) */
297         uint64_t reserved_7_7                 : 1;
298         uint64_t len                          : 7;  /**< CALENDAR_LEN (from spi4.2 spec) */
299 #else
300         uint64_t len                          : 7;
301         uint64_t reserved_7_7                 : 1;
302         uint64_t m                            : 8;
303         uint64_t reserved_16_63               : 48;
304 #endif
305         } s;
306         struct cvmx_srxx_spi4_stat_s          cn38xx;
307         struct cvmx_srxx_spi4_stat_s          cn38xxp2;
308         struct cvmx_srxx_spi4_stat_s          cn58xx;
309         struct cvmx_srxx_spi4_stat_s          cn58xxp1;
310 };
311 typedef union cvmx_srxx_spi4_stat cvmx_srxx_spi4_stat_t;
312
313 /**
314  * cvmx_srx#_sw_tick_ctl
315  *
316  * SRX_SW_TICK_CTL - Create a software tick of Spi4 data.  A write to this register will create a data tick.
317  *
318  */
319 union cvmx_srxx_sw_tick_ctl
320 {
321         uint64_t u64;
322         struct cvmx_srxx_sw_tick_ctl_s
323         {
324 #if __BYTE_ORDER == __BIG_ENDIAN
325         uint64_t reserved_14_63               : 50;
326         uint64_t eop                          : 1;  /**< SW Tick EOP
327                                                          (PASS3 only) */
328         uint64_t sop                          : 1;  /**< SW Tick SOP
329                                                          (PASS3 only) */
330         uint64_t mod                          : 4;  /**< SW Tick MOD - valid byte count
331                                                          (PASS3 only) */
332         uint64_t opc                          : 4;  /**< SW Tick ERR - packet had an error
333                                                          (PASS3 only) */
334         uint64_t adr                          : 4;  /**< SW Tick port address
335                                                          (PASS3 only) */
336 #else
337         uint64_t adr                          : 4;
338         uint64_t opc                          : 4;
339         uint64_t mod                          : 4;
340         uint64_t sop                          : 1;
341         uint64_t eop                          : 1;
342         uint64_t reserved_14_63               : 50;
343 #endif
344         } s;
345         struct cvmx_srxx_sw_tick_ctl_s        cn38xx;
346         struct cvmx_srxx_sw_tick_ctl_s        cn58xx;
347         struct cvmx_srxx_sw_tick_ctl_s        cn58xxp1;
348 };
349 typedef union cvmx_srxx_sw_tick_ctl cvmx_srxx_sw_tick_ctl_t;
350
351 /**
352  * cvmx_srx#_sw_tick_dat
353  *
354  * SRX_SW_TICK_DAT - Create a software tick of Spi4 data
355  *
356  */
357 union cvmx_srxx_sw_tick_dat
358 {
359         uint64_t u64;
360         struct cvmx_srxx_sw_tick_dat_s
361         {
362 #if __BYTE_ORDER == __BIG_ENDIAN
363         uint64_t dat                          : 64; /**< Data tick when SRX_SW_TICK_CTL is written
364                                                          (PASS3 only) */
365 #else
366         uint64_t dat                          : 64;
367 #endif
368         } s;
369         struct cvmx_srxx_sw_tick_dat_s        cn38xx;
370         struct cvmx_srxx_sw_tick_dat_s        cn58xx;
371         struct cvmx_srxx_sw_tick_dat_s        cn58xxp1;
372 };
373 typedef union cvmx_srxx_sw_tick_dat cvmx_srxx_sw_tick_dat_t;
374
375 #endif