]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/dev/bxe/bxe_init.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / dev / bxe / bxe_init.h
1 /*-
2  * Copyright (c) 2007-2011 Broadcom Corporation. All rights reserved.
3  *
4  *    Gary Zambrano <zambrano@broadcom.com>
5  *    David Christensen <davidch@broadcom.com>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of Broadcom Corporation nor the name of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written consent.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30  * THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33  /*$FreeBSD$*/
34
35 #ifndef BXE_INIT_H
36 #define BXE_INIT_H
37 /*
38  * bxe_init.h: Broadcom Everest network driver.
39  * Structures and macros needed during the initialization.
40  */
41
42 /* RAM0 size in bytes */
43 #define STORM_INTMEM_SIZE_E1            0x5800
44 #define STORM_INTMEM_SIZE_E1H           0x10000
45 #define STORM_INTMEM_SIZE(sc)           \
46         ((CHIP_IS_E1(sc) ? STORM_INTMEM_SIZE_E1 : STORM_INTMEM_SIZE_E1H) / 4)
47
48
49 /* Init operation types and structures */
50 /* Common for both E1 and E1H */
51 #define OP_RD                   0x1 /* read single register */
52 #define OP_WR                   0x2 /* write single register */
53 #define OP_IW                   0x3 /* write single register using mailbox */
54 #define OP_SW                   0x4 /* copy a string to the device */
55 #define OP_SI                   0x5 /* copy a string using mailbox */
56 #define OP_ZR                   0x6 /* clear memory */
57 #define OP_ZP                   0x7 /* unzip then copy with DMAE */
58 #define OP_WR_64                0x8 /* write 64 bit pattern */
59 #define OP_WB                   0x9 /* copy a string using DMAE */
60
61 /* FPGA and EMUL specific operations */
62 #define OP_WR_EMUL              0xa /* write single register on Emulation */
63 #define OP_WR_FPGA              0xb /* write single register on FPGA */
64 #define OP_WR_ASIC              0xc /* write single register on ASIC */
65
66 /* Init stages */
67 /* Never reorder stages !!! */
68 #define COMMON_STAGE            0
69 #define PORT0_STAGE             1
70 #define PORT1_STAGE             2
71 #define FUNC0_STAGE             3
72 #define FUNC1_STAGE             4
73 #define FUNC2_STAGE             5
74 #define FUNC3_STAGE             6
75 #define FUNC4_STAGE             7
76 #define FUNC5_STAGE             8
77 #define FUNC6_STAGE             9
78 #define FUNC7_STAGE             10
79 #define STAGE_IDX_MAX           11
80
81 #define STAGE_START             0
82 #define STAGE_END               1
83
84
85 /* Indices of blocks */
86 #define PRS_BLOCK               0
87 #define SRCH_BLOCK              1
88 #define TSDM_BLOCK              2
89 #define TCM_BLOCK               3
90 #define BRB1_BLOCK              4
91 #define TSEM_BLOCK              5
92 #define PXPCS_BLOCK             6
93 #define EMAC0_BLOCK             7
94 #define EMAC1_BLOCK             8
95 #define DBU_BLOCK               9
96 #define MISC_BLOCK              10
97 #define DBG_BLOCK               11
98 #define NIG_BLOCK               12
99 #define MCP_BLOCK               13
100 #define UPB_BLOCK               14
101 #define CSDM_BLOCK              15
102 #define USDM_BLOCK              16
103 #define CCM_BLOCK               17
104 #define UCM_BLOCK               18
105 #define USEM_BLOCK              19
106 #define CSEM_BLOCK              20
107 #define XPB_BLOCK               21
108 #define DQ_BLOCK                22
109 #define TIMERS_BLOCK            23
110 #define XSDM_BLOCK              24
111 #define QM_BLOCK                25
112 #define PBF_BLOCK               26
113 #define XCM_BLOCK               27
114 #define XSEM_BLOCK              28
115 #define CDU_BLOCK               29
116 #define DMAE_BLOCK              30
117 #define PXP_BLOCK               31
118 #define CFC_BLOCK               32
119 #define HC_BLOCK                33
120 #define PXP2_BLOCK              34
121 #define MISC_AEU_BLOCK          35
122 #define PGLUE_B_BLOCK           36
123 #define IGU_BLOCK               37
124
125 /* Returns the index of start or end of a specific block stage in ops array. */
126 #define BLOCK_OPS_IDX(block, stage, end)        \
127         (2 * (((block) * STAGE_IDX_MAX) + (stage)) + (end))
128
129 struct raw_op {
130         uint32_t        op:8;
131         uint32_t        offset:24;
132         uint32_t        raw_data;
133 };
134
135 struct op_read {
136         uint32_t        op:8;
137         uint32_t        offset:24;
138         uint32_t        pad;
139 };
140
141 struct op_write {
142         uint32_t        op:8;
143         uint32_t        offset:24;
144         uint32_t        val;
145 };
146
147 struct op_string_write {
148         uint32_t        op:8;
149         uint32_t        offset:24;
150 #ifdef __LITTLE_ENDIAN
151         uint16_t        data_off;
152         uint16_t        data_len;
153 #else /* __BIG_ENDIAN */
154         uint16_t        data_len;
155         uint16_t        data_off;
156 #endif
157 };
158
159 struct op_zero {
160         uint32_t        op:8;
161         uint32_t        offset:24;
162         uint32_t        len;
163 };
164
165 union init_op {
166         struct op_read          read;
167         struct op_write         write;
168         struct op_string_write  str_wr;
169         struct op_zero          zero;
170         struct raw_op           raw;
171 };
172
173 #include "bxe_init_values_e1.h"
174 #include "bxe_init_values_e1h.h"
175
176 #endif /* BXE_INIT_H */
177