]> CyberLeo.Net >> Repos - FreeBSD/releng/8.2.git/blob - sys/mips/cavium/dev/rgmii/octeon_ipd.h
Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.
[FreeBSD/releng/8.2.git] / sys / mips / cavium / dev / rgmii / octeon_ipd.h
1 /***********************license start***************
2  *  Copyright (c) 2003-2008 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  *  TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24  *  AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25  *  OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26  *  RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27  *  REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28  *  DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29  *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30  *  PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31  *  POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
32  *  OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
33  *
34  *
35  *  For any questions regarding licensing please contact marketing@caviumnetworks.com
36  *
37  ***********************license end**************************************/
38
39 /* $FreeBSD$ */
40
41 /*------------------------------------------------------------------
42  * octeon_ipd.h      Input Packet Unit
43  *
44  *------------------------------------------------------------------
45  */
46
47
48 #ifndef ___OCTEON_IPD__H___
49 #define ___OCTEON_IPD__H___
50
51
52
53 typedef enum {
54    OCTEON_IPD_OPC_MODE_STT = 0LL,   /* All blocks DRAM, not cached in L2 */
55    OCTEON_IPD_OPC_MODE_STF = 1LL,   /* All blocks into  L2 */
56    OCTEON_IPD_OPC_MODE_STF1_STT = 2LL,   /* 1st block L2, rest DRAM */
57    OCTEON_IPD_OPC_MODE_STF2_STT = 3LL    /* 1st, 2nd blocks L2, rest DRAM */
58 } octeon_ipd_mode_t;
59
60
61
62
63 /*
64  * IPD_CTL_STATUS = IPS'd Control Status Register
65  *  The number of words in a MBUFF used for packet data store.
66  */
67 typedef union {
68     uint64_t word64;
69     struct {
70         uint64_t reserved       : 58;      /* Reserved */
71         uint64_t pkt_lend       : 1;       /* Pkt Lil-Endian Writes to L2C */
72         uint64_t wqe_lend       : 1;       /* WQE Lik-Endian Writes to L2C */
73         uint64_t pbp_en         : 1;       /* Enable Back-Pressure */
74         octeon_ipd_mode_t opc_mode : 2;       /* Pkt data in Mem/L2-cache ? */
75         uint64_t ipd_en         : 1;       /* Enable IPD */
76     } bits;
77 } octeon_ipd_ctl_status_t;
78
79
80 /*
81  * IPD_1ST_NEXT_PTR_BACK = IPD First Next Pointer Back Values
82  *
83  * Contains the Back Field for use in creating the Next Pointer Header
84  *    for the First MBUF
85  */
86 typedef union {
87     uint64_t word64;
88     struct {
89         uint64_t reserved       : 60;      /* Must be zero */
90         uint64_t back           : 4;       /* Used to find head of buffer from the nxt-hdr-ptr. */
91     } bits;
92 } octeon_ipd_first_next_ptr_back_t;
93
94
95 /*
96  * IPD_INTERRUPT_ENB = IPD Interrupt Enable Register
97  *
98  * Used to enable the various interrupting conditions of IPD
99  */
100 typedef union {
101     uint64_t word64;
102     struct {
103         uint64_t reserved       : 59;      /* Must be zero */
104         uint64_t bp_sub         : 1;       /* BP subtract is illegal val */
105         uint64_t prc_par3       : 1;       /* PBM Bits [127:96] Parity Err */
106         uint64_t prc_par2       : 1;       /* PBM Bits [ 95:64] Parity Err */
107         uint64_t prc_par1       : 1;       /* PBM Bits [ 63:32] Parity Err */
108         uint64_t prc_par0       : 1;       /* PBM Bits [ 31:0 ] Parity Err */
109     } bits;
110 } octeon_ipd_int_enb_t;
111
112
113 /*
114  * IPD_INTERRUPT_SUM = IPD Interrupt Summary Register
115  *
116  * Set when an interrupt condition occurs, write '1' to clear.
117  */
118 typedef union {
119     uint64_t word64;
120     struct {
121         uint64_t reserved       : 59;      /* Must be zero */
122         uint64_t bp_sub         : 1;       /* BP subtract is illegal val */
123         uint64_t prc_par3       : 1;       /* PBM Bits [127:96] Parity Err */
124         uint64_t prc_par2       : 1;       /* PBM Bits [ 95:64] Parity Err */
125         uint64_t prc_par1       : 1;       /* PBM Bits [ 63:32] Parity Err */
126         uint64_t prc_par0       : 1;       /* PBM Bits [ 31:0 ] Parity Err */
127     } bits;
128 } octeon_ipd_int_sum_t;
129
130
131 /**
132  * IPD_1ST_MBUFF_SKIP = IPD First MBUFF Word Skip Size
133  *
134  * The number of words that the IPD will skip when writing the first MBUFF.
135  */
136 typedef union {
137     uint64_t word64;
138     struct {
139         uint64_t reserved       : 58;      /* Must be zero */
140         uint64_t skip_sz        : 6;       /* 64bit words from the top of */
141                                            /*  1st MBUFF that the IPD will */
142                                            /*  store the next-pointer. */
143                                            /*  [0..32]  &&             */
144                                            /*    (skip_sz + 16) <= IPD_PACKET_MBUFF_SIZE[MB_SIZE]. */
145     } bits;
146 } octeon_ipd_mbuff_first_skip_t;
147
148
149 /*
150  * IPD_PACKET_MBUFF_SIZE = IPD's PACKET MUBUF Size In Words
151  *
152  * The number of words in a MBUFF used for packet data store.
153  */
154 typedef union {
155     uint64_t word64;
156     struct {
157         uint64_t reserved       : 52;      /* Must be zero */
158         uint64_t mb_size        : 12;      /* 64bit words in a MBUF. */
159                                            /* Must be [32..2048] */
160                                            /* Is also the size of the FPA's */
161                                            /*   Queue-0 Free-Page */
162     } bits;
163 } octeon_ipd_mbuff_size_t;
164
165
166 /*
167  * IPD_WQE_FPA_QUEUE = IPD Work-Queue-Entry FPA Page Size
168  *
169  * Which FPA Queue (0-7) to fetch page-pointers from for WQE's
170  */
171 typedef union {
172     uint64_t word64;
173     struct {
174         uint64_t reserved       : 61;    /* Must be zero */
175         uint64_t wqe_pool       : 3;     /* FPA Pool to fetch WQE Page-ptrs */
176     } bits;
177 } octeon_ipd_wqe_fpa_pool_t;
178
179
180
181
182 /* End of Control and Status Register (CSR) definitions */
183
184 typedef octeon_ipd_mbuff_first_skip_t octeon_ipd_mbuff_not_first_skip_t;
185 typedef octeon_ipd_first_next_ptr_back_t octeon_ipd_second_next_ptr_back_t;
186
187
188 /*
189  * Externs
190  */
191 extern void octeon_ipd_enable(void);
192 extern void octeon_ipd_disable(void);
193 extern void octeon_ipd_config(u_int mbuff_size,
194                               u_int first_mbuff_skip,
195                               u_int not_first_mbuff_skip,
196                               u_int first_back,
197                               u_int second_back,
198                               u_int wqe_fpa_pool,
199                               octeon_ipd_mode_t cache_mode,
200                               u_int back_pres_enable_flag);
201
202
203
204 #endif   /*  ___OCTEON_IPD__H___ */