This source file includes following definitions.
- octeon_has_crypto
- octeon_has_feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 #ifndef __OCTEON_FEATURE_H__
33 #define __OCTEON_FEATURE_H__
34 #include <asm/octeon/cvmx-mio-defs.h>
35 #include <asm/octeon/cvmx-rnm-defs.h>
36
37 enum octeon_feature {
38
39 OCTEON_FEATURE_PKND,
40
41 OCTEON_FEATURE_CN68XX_WQE,
42
43
44
45
46 OCTEON_FEATURE_SAAD,
47
48 OCTEON_FEATURE_ZIP,
49 OCTEON_FEATURE_DORM_CRYPTO,
50
51 OCTEON_FEATURE_PCIE,
52
53 OCTEON_FEATURE_SRIO,
54
55 OCTEON_FEATURE_ILK,
56
57
58 OCTEON_FEATURE_KEY_MEMORY,
59
60 OCTEON_FEATURE_LED_CONTROLLER,
61
62 OCTEON_FEATURE_TRA,
63
64 OCTEON_FEATURE_MGMT_PORT,
65
66 OCTEON_FEATURE_RAID,
67
68 OCTEON_FEATURE_USB,
69
70 OCTEON_FEATURE_NO_WPTR,
71
72 OCTEON_FEATURE_DFA,
73
74
75 OCTEON_FEATURE_MDIO_CLAUSE_45,
76
77
78
79
80 OCTEON_FEATURE_NPEI,
81 OCTEON_FEATURE_HFA,
82 OCTEON_FEATURE_DFM,
83 OCTEON_FEATURE_CIU2,
84 OCTEON_FEATURE_CIU3,
85
86 OCTEON_FEATURE_FPA3,
87 OCTEON_FEATURE_FAU,
88 OCTEON_MAX_FEATURE
89 };
90
91 enum octeon_feature_bits {
92 OCTEON_HAS_CRYPTO = 0x0001,
93 };
94 extern enum octeon_feature_bits __octeon_feature_bits;
95
96
97
98
99
100
101 static inline int octeon_has_crypto(void)
102 {
103 return __octeon_feature_bits & OCTEON_HAS_CRYPTO;
104 }
105
106
107
108
109
110
111
112
113
114
115
116
117 static inline bool octeon_has_feature(enum octeon_feature feature)
118 {
119 switch (feature) {
120 case OCTEON_FEATURE_SAAD:
121 return !OCTEON_IS_MODEL(OCTEON_CN3XXX);
122
123 case OCTEON_FEATURE_DORM_CRYPTO:
124 if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
125 union cvmx_mio_fus_dat2 fus_2;
126 fus_2.u64 = cvmx_read_csr(CVMX_MIO_FUS_DAT2);
127 return !fus_2.s.nocrypto && !fus_2.s.nomul && fus_2.s.dorm_crypto;
128 } else {
129 return false;
130 }
131
132 case OCTEON_FEATURE_PCIE:
133 return OCTEON_IS_MODEL(OCTEON_CN56XX)
134 || OCTEON_IS_MODEL(OCTEON_CN52XX)
135 || OCTEON_IS_MODEL(OCTEON_CN6XXX)
136 || OCTEON_IS_MODEL(OCTEON_CN7XXX);
137
138 case OCTEON_FEATURE_SRIO:
139 return OCTEON_IS_MODEL(OCTEON_CN63XX)
140 || OCTEON_IS_MODEL(OCTEON_CN66XX);
141
142 case OCTEON_FEATURE_ILK:
143 return (OCTEON_IS_MODEL(OCTEON_CN68XX));
144
145 case OCTEON_FEATURE_KEY_MEMORY:
146 return OCTEON_IS_MODEL(OCTEON_CN38XX)
147 || OCTEON_IS_MODEL(OCTEON_CN58XX)
148 || OCTEON_IS_MODEL(OCTEON_CN56XX)
149 || OCTEON_IS_MODEL(OCTEON_CN6XXX);
150
151 case OCTEON_FEATURE_LED_CONTROLLER:
152 return OCTEON_IS_MODEL(OCTEON_CN38XX)
153 || OCTEON_IS_MODEL(OCTEON_CN58XX)
154 || OCTEON_IS_MODEL(OCTEON_CN56XX);
155
156 case OCTEON_FEATURE_TRA:
157 return !(OCTEON_IS_MODEL(OCTEON_CN30XX)
158 || OCTEON_IS_MODEL(OCTEON_CN50XX));
159 case OCTEON_FEATURE_MGMT_PORT:
160 return OCTEON_IS_MODEL(OCTEON_CN56XX)
161 || OCTEON_IS_MODEL(OCTEON_CN52XX)
162 || OCTEON_IS_MODEL(OCTEON_CN6XXX);
163
164 case OCTEON_FEATURE_RAID:
165 return OCTEON_IS_MODEL(OCTEON_CN56XX)
166 || OCTEON_IS_MODEL(OCTEON_CN52XX)
167 || OCTEON_IS_MODEL(OCTEON_CN6XXX);
168
169 case OCTEON_FEATURE_USB:
170 return !(OCTEON_IS_MODEL(OCTEON_CN38XX)
171 || OCTEON_IS_MODEL(OCTEON_CN58XX));
172
173 case OCTEON_FEATURE_NO_WPTR:
174 return (OCTEON_IS_MODEL(OCTEON_CN56XX)
175 || OCTEON_IS_MODEL(OCTEON_CN52XX)
176 || OCTEON_IS_MODEL(OCTEON_CN6XXX))
177 && !OCTEON_IS_MODEL(OCTEON_CN56XX_PASS1_X)
178 && !OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_X);
179
180 case OCTEON_FEATURE_MDIO_CLAUSE_45:
181 return !(OCTEON_IS_MODEL(OCTEON_CN3XXX)
182 || OCTEON_IS_MODEL(OCTEON_CN58XX)
183 || OCTEON_IS_MODEL(OCTEON_CN50XX));
184
185 case OCTEON_FEATURE_NPEI:
186 return OCTEON_IS_MODEL(OCTEON_CN56XX)
187 || OCTEON_IS_MODEL(OCTEON_CN52XX);
188
189 case OCTEON_FEATURE_PKND:
190 return OCTEON_IS_MODEL(OCTEON_CN68XX);
191
192 case OCTEON_FEATURE_CN68XX_WQE:
193 return OCTEON_IS_MODEL(OCTEON_CN68XX);
194
195 case OCTEON_FEATURE_CIU2:
196 return OCTEON_IS_MODEL(OCTEON_CN68XX);
197 case OCTEON_FEATURE_CIU3:
198 case OCTEON_FEATURE_FPA3:
199 return OCTEON_IS_MODEL(OCTEON_CN78XX)
200 || OCTEON_IS_MODEL(OCTEON_CNF75XX)
201 || OCTEON_IS_MODEL(OCTEON_CN73XX);
202 case OCTEON_FEATURE_FAU:
203 return !(OCTEON_IS_MODEL(OCTEON_CN78XX)
204 || OCTEON_IS_MODEL(OCTEON_CNF75XX)
205 || OCTEON_IS_MODEL(OCTEON_CN73XX));
206
207 default:
208 break;
209 }
210 return false;
211 }
212
213 #endif