]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/contrib/octeon-sdk/octeon-model.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / contrib / octeon-sdk / octeon-model.h
1 /***********************license start***************
2  * Copyright (c) 2003-2010  Cavium Inc. (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 Inc. 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 INC. 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
43
44
45 /**
46  * @file
47  *
48  * File defining different Octeon model IDs and macros to
49  * compare them.
50  *
51  * <hr>$Revision: 70338 $<hr>
52  */
53
54 #ifndef __OCTEON_MODEL_H__
55 #define __OCTEON_MODEL_H__
56
57 #ifdef  __cplusplus
58 extern "C" {
59 #endif
60
61
62 /* NOTE: These must match what is checked in common-config.mk */
63 /* Defines to represent the different versions of Octeon.  */
64
65
66 /* IMPORTANT: When the default pass is updated for an Octeon Model,
67 ** the corresponding change must also be made in the oct-sim script. */
68
69
70 /* The defines below should be used with the OCTEON_IS_MODEL() macro to
71 ** determine what model of chip the software is running on.  Models ending
72 ** in 'XX' match multiple models (families), while specific models match only
73 ** that model.  If a pass (revision) is specified, then only that revision
74 ** will be matched.  Care should be taken when checking for both specific
75 ** models and families that the specific models are checked for first.
76 ** While these defines are similar to the processor ID, they are not intended
77 ** to be used by anything other that the OCTEON_IS_MODEL framework, and
78 ** the values are subject to change at anytime without notice.
79 **
80 ** NOTE: only the OCTEON_IS_MODEL() macro/function and the OCTEON_CN* macros
81 ** should be used outside of this file.  All other macros are for internal
82 ** use only, and may change without notice.
83 */
84
85 #define OCTEON_FAMILY_MASK      0x00ffff00
86
87 /* Flag bits in top byte */
88 #define OM_IGNORE_REVISION        0x01000000      /* Ignores revision in model checks */
89 #define OM_CHECK_SUBMODEL         0x02000000      /* Check submodels */
90 #define OM_MATCH_PREVIOUS_MODELS  0x04000000      /* Match all models previous than the one specified */
91 #define OM_IGNORE_MINOR_REVISION  0x08000000      /* Ignores the minor revison on newer parts */
92 #define OM_FLAG_MASK              0xff000000
93
94 #define OM_MATCH_5XXX_FAMILY_MODELS     0x20000000 /* Match all cn5XXX Octeon models. */
95 #define OM_MATCH_6XXX_FAMILY_MODELS     0x40000000 /* Match all cn6XXX Octeon models. */
96 #define OM_MATCH_F7XXX_FAMILY_MODELS    0x80000000 /* Match all cnf7XXX Octeon models. */
97
98 /*
99  * CNF7XXX models with new revision encoding
100  */
101 #define OCTEON_CNF71XX_PASS1_0  0x000d9400
102
103 #define OCTEON_CNF71XX          (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_REVISION)
104 #define OCTEON_CNF71XX_PASS1_X  (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
105
106 /*
107  * CN6XXX models with new revision encoding
108  */
109 #define OCTEON_CN68XX_PASS1_0   0x000d9100
110 #define OCTEON_CN68XX_PASS1_1   0x000d9101
111 #define OCTEON_CN68XX_PASS1_2   0x000d9102
112 #define OCTEON_CN68XX_PASS2_0   0x000d9108
113
114 #define OCTEON_CN68XX           (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_REVISION)
115 #define OCTEON_CN68XX_PASS1_X   (OCTEON_CN68XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
116 #define OCTEON_CN68XX_PASS2_X   (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
117
118 #define OCTEON_CN68XX_PASS1     OCTEON_CN68XX_PASS1_X
119 #define OCTEON_CN68XX_PASS2     OCTEON_CN68XX_PASS2_X
120
121 #define OCTEON_CN66XX_PASS1_0   0x000d9200
122 #define OCTEON_CN66XX_PASS1_2   0x000d9202
123
124 #define OCTEON_CN66XX           (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_REVISION)
125 #define OCTEON_CN66XX_PASS1_X   (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
126
127 #define OCTEON_CN63XX_PASS1_0   0x000d9000
128 #define OCTEON_CN63XX_PASS1_1   0x000d9001
129 #define OCTEON_CN63XX_PASS1_2   0x000d9002
130 #define OCTEON_CN63XX_PASS2_0   0x000d9008
131 #define OCTEON_CN63XX_PASS2_1   0x000d9009
132 #define OCTEON_CN63XX_PASS2_2   0x000d900a
133
134 #define OCTEON_CN63XX           (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION)
135 #define OCTEON_CN63XX_PASS1_X   (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
136 #define OCTEON_CN63XX_PASS2_X   (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
137
138 #define OCTEON_CN61XX_PASS1_0   0x000d9300
139
140 #define OCTEON_CN61XX           (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_REVISION)
141 #define OCTEON_CN61XX_PASS1_X   (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
142
143 /*
144  * CN5XXX models with new revision encoding
145  */
146 #define OCTEON_CN58XX_PASS1_0   0x000d0300
147 #define OCTEON_CN58XX_PASS1_1   0x000d0301
148 #define OCTEON_CN58XX_PASS1_2   0x000d0303
149 #define OCTEON_CN58XX_PASS2_0   0x000d0308
150 #define OCTEON_CN58XX_PASS2_1   0x000d0309
151 #define OCTEON_CN58XX_PASS2_2   0x000d030a
152 #define OCTEON_CN58XX_PASS2_3   0x000d030b
153
154 #define OCTEON_CN58XX           (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_REVISION)
155 #define OCTEON_CN58XX_PASS1_X   (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
156 #define OCTEON_CN58XX_PASS2_X   (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
157 #define OCTEON_CN58XX_PASS1     OCTEON_CN58XX_PASS1_X
158 #define OCTEON_CN58XX_PASS2     OCTEON_CN58XX_PASS2_X
159
160 #define OCTEON_CN56XX_PASS1_0   0x000d0400
161 #define OCTEON_CN56XX_PASS1_1   0x000d0401
162 #define OCTEON_CN56XX_PASS2_0   0x000d0408
163 #define OCTEON_CN56XX_PASS2_1   0x000d0409
164
165 #define OCTEON_CN56XX           (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_REVISION)
166 #define OCTEON_CN56XX_PASS1_X   (OCTEON_CN56XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
167 #define OCTEON_CN56XX_PASS2_X   (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
168 #define OCTEON_CN56XX_PASS1     OCTEON_CN56XX_PASS1_X
169 #define OCTEON_CN56XX_PASS2     OCTEON_CN56XX_PASS2_X
170
171 #define OCTEON_CN57XX           OCTEON_CN56XX
172 #define OCTEON_CN57XX_PASS1     OCTEON_CN56XX_PASS1
173 #define OCTEON_CN57XX_PASS2     OCTEON_CN56XX_PASS2
174
175 #define OCTEON_CN55XX           OCTEON_CN56XX
176 #define OCTEON_CN55XX_PASS1     OCTEON_CN56XX_PASS1
177 #define OCTEON_CN55XX_PASS2     OCTEON_CN56XX_PASS2
178
179 #define OCTEON_CN54XX           OCTEON_CN56XX
180 #define OCTEON_CN54XX_PASS1     OCTEON_CN56XX_PASS1
181 #define OCTEON_CN54XX_PASS2     OCTEON_CN56XX_PASS2
182
183 #define OCTEON_CN50XX_PASS1_0   0x000d0600
184
185 #define OCTEON_CN50XX           (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_REVISION)
186 #define OCTEON_CN50XX_PASS1_X   (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
187 #define OCTEON_CN50XX_PASS1     OCTEON_CN50XX_PASS1_X
188
189 /* NOTE: Octeon CN5000F model is not identifiable using the OCTEON_IS_MODEL()
190     functions, but are treated as CN50XX */
191
192 #define OCTEON_CN52XX_PASS1_0   0x000d0700
193 #define OCTEON_CN52XX_PASS2_0   0x000d0708
194
195 #define OCTEON_CN52XX           (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_REVISION)
196 #define OCTEON_CN52XX_PASS1_X   (OCTEON_CN52XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
197 #define OCTEON_CN52XX_PASS2_X   (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
198 #define OCTEON_CN52XX_PASS1     OCTEON_CN52XX_PASS1_X
199 #define OCTEON_CN52XX_PASS2     OCTEON_CN52XX_PASS2_X
200
201 /*
202  * CN3XXX models with old revision enconding
203  */
204 //#define OCTEON_CN38XX_PASS1     0x000d0000    // is not supported
205 #define OCTEON_CN38XX_PASS2     0x000d0001
206 #define OCTEON_CN38XX_PASS3     0x000d0003
207 #define OCTEON_CN38XX           (OCTEON_CN38XX_PASS3 | OM_IGNORE_REVISION)
208
209 #define OCTEON_CN36XX           OCTEON_CN38XX
210 #define OCTEON_CN36XX_PASS2     OCTEON_CN38XX_PASS2
211 #define OCTEON_CN36XX_PASS3     OCTEON_CN38XX_PASS3
212
213 /* The OCTEON_CN31XX matches CN31XX models and the CN3020 */
214 #define OCTEON_CN31XX_PASS1     0x000d0100
215 #define OCTEON_CN31XX_PASS1_1   0x000d0102
216 #define OCTEON_CN31XX           (OCTEON_CN31XX_PASS1 | OM_IGNORE_REVISION)
217
218 /* This model is only used for internal checks, it
219 ** is not a valid model for the OCTEON_MODEL environment variable.
220 ** This matches the CN3010 and CN3005 but NOT the CN3020*/
221 #define OCTEON_CN30XX_PASS1     0x000d0200
222 #define OCTEON_CN30XX_PASS1_1   0x000d0202
223 #define OCTEON_CN30XX           (OCTEON_CN30XX_PASS1 | OM_IGNORE_REVISION)
224
225 #define OCTEON_CN3005_PASS1     (0x000d0210 | OM_CHECK_SUBMODEL)
226 #define OCTEON_CN3005_PASS1_0   (0x000d0210 | OM_CHECK_SUBMODEL)
227 #define OCTEON_CN3005_PASS1_1   (0x000d0212 | OM_CHECK_SUBMODEL)
228 #define OCTEON_CN3005           (OCTEON_CN3005_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
229
230 #define OCTEON_CN3010_PASS1     (0x000d0200 | OM_CHECK_SUBMODEL)
231 #define OCTEON_CN3010_PASS1_0   (0x000d0200 | OM_CHECK_SUBMODEL)
232 #define OCTEON_CN3010_PASS1_1   (0x000d0202 | OM_CHECK_SUBMODEL)
233 #define OCTEON_CN3010           (OCTEON_CN3010_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
234
235 #define OCTEON_CN3020_PASS1     (0x000d0110 | OM_CHECK_SUBMODEL)
236 #define OCTEON_CN3020_PASS1_0   (0x000d0110 | OM_CHECK_SUBMODEL)
237 #define OCTEON_CN3020_PASS1_1   (0x000d0112 | OM_CHECK_SUBMODEL)
238 #define OCTEON_CN3020           (OCTEON_CN3020_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
239
240
241
242 /* This matches the complete family of CN3xxx CPUs, and not subsequent models */
243 #define OCTEON_CN3XXX           (OCTEON_CN58XX_PASS1_0 | OM_MATCH_PREVIOUS_MODELS | OM_IGNORE_REVISION)
244 #define OCTEON_CN5XXX           (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS)
245 #define OCTEON_CN6XXX           (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS)
246 #define OCTEON_CNF7XXX          (OCTEON_CNF71XX_PASS1_0 | OM_MATCH_F7XXX_FAMILY_MODELS)
247
248 /* The revision byte (low byte) has two different encodings.
249 ** CN3XXX:
250 **
251 **     bits
252 **     <7:5>: reserved (0)
253 **     <4>:   alternate package
254 **     <3:0>: revision
255 **
256 ** CN5XXX:
257 **
258 **     bits
259 **     <7>:   reserved (0)
260 **     <6>:   alternate package
261 **     <5:3>: major revision
262 **     <2:0>: minor revision
263 **
264 */
265
266 /* Masks used for the various types of model/family/revision matching */
267 #define OCTEON_38XX_FAMILY_MASK      0x00ffff00
268 #define OCTEON_38XX_FAMILY_REV_MASK  0x00ffff0f
269 #define OCTEON_38XX_MODEL_MASK       0x00ffff10
270 #define OCTEON_38XX_MODEL_REV_MASK   (OCTEON_38XX_FAMILY_REV_MASK | OCTEON_38XX_MODEL_MASK)
271
272 /* CN5XXX and later use different layout of bits in the revision ID field */
273 #define OCTEON_58XX_FAMILY_MASK      OCTEON_38XX_FAMILY_MASK
274 #define OCTEON_58XX_FAMILY_REV_MASK  0x00ffff3f
275 #define OCTEON_58XX_MODEL_MASK       0x00ffffc0
276 #define OCTEON_58XX_MODEL_REV_MASK   (OCTEON_58XX_FAMILY_REV_MASK | OCTEON_58XX_MODEL_MASK)
277 #define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK & 0x00fffff8)
278 #define OCTEON_5XXX_MODEL_MASK       0x00ff0fc0
279
280
281 #define __OCTEON_MATCH_MASK__(x,y,z) (((x) & (z)) == ((y) & (z)))
282
283
284 /* NOTE: This for internal use only!!!!! */
285 #define __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) \
286     ((((arg_model & OCTEON_38XX_FAMILY_MASK) < OCTEON_CN58XX_PASS1_0)  && (\
287      ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \
288        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_MASK)) || \
289      ((((arg_model) & (OM_FLAG_MASK)) == 0) \
290        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_REV_MASK)) || \
291      ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \
292        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_MASK)) || \
293      ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \
294        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_REV_MASK)) || \
295      ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \
296        && (((chip_model) & OCTEON_38XX_MODEL_MASK) < ((arg_model) & OCTEON_38XX_MODEL_MASK))) \
297     )) || \
298     (((arg_model & OCTEON_38XX_FAMILY_MASK) >= OCTEON_CN58XX_PASS1_0)  && (\
299      ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \
300        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \
301      ((((arg_model) & (OM_FLAG_MASK)) == 0) \
302        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_REV_MASK)) || \
303      ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_MINOR_REVISION) \
304        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MINOR_REV_MASK)) || \
305      ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \
306        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_MASK)) || \
307      ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \
308        && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_REV_MASK)) || \
309      ((((arg_model) & (OM_MATCH_5XXX_FAMILY_MODELS)) == OM_MATCH_5XXX_FAMILY_MODELS) \
310        && ((chip_model) >= OCTEON_CN58XX_PASS1_0) && ((chip_model) < OCTEON_CN63XX_PASS1_0)) || \
311      ((((arg_model) & (OM_MATCH_6XXX_FAMILY_MODELS)) == OM_MATCH_6XXX_FAMILY_MODELS) \
312        && ((chip_model) >= OCTEON_CN63XX_PASS1_0) && ((chip_model) < OCTEON_CNF71XX_PASS1_0)) || \
313      ((((arg_model) & (OM_MATCH_F7XXX_FAMILY_MODELS)) == OM_MATCH_F7XXX_FAMILY_MODELS) \
314        && ((chip_model) >= OCTEON_CNF71XX_PASS1_0)) || \
315      ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \
316        && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \
317     )))
318
319 #ifndef OCTEON_IS_MODEL
320 #if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__FreeBSD__) && defined(_KERNEL) && !defined(OCTEON_MODEL))
321
322 /* NOTE: This for internal use only!!!!! */
323 static inline int __octeon_is_model_runtime__(uint32_t model)
324 {
325     uint32_t cpuid = cvmx_get_proc_id();
326
327     /* Check for special case of mismarked 3005 samples. We only need to check
328         if the sub model isn't being ignored */
329     if ((model & OM_CHECK_SUBMODEL) == OM_CHECK_SUBMODEL)
330     {
331         if (cpuid == OCTEON_CN3010_PASS1 && (cvmx_read_csr(0x80011800800007B8ull) & (1ull << 34)))
332             cpuid |= 0x10;
333     }
334     return(__OCTEON_IS_MODEL_COMPILE__(model, cpuid));
335 }
336
337 /* The OCTEON_IS_MODEL macro should be used for all Octeon model checking done
338 ** in a program.
339 ** This should be kept runtime if at all possible  and must be conditionalized
340 ** with OCTEON_IS_COMMON_BINARY() if runtime checking support is required.
341 **
342 ** Use of the macro in preprocessor directives ( #if OCTEON_IS_MODEL(...) )
343 ** is NOT SUPPORTED, and should be replaced with CVMX_COMPILED_FOR()
344 ** I.e.:
345 **  #if OCTEON_IS_MODEL(OCTEON_CN56XX)  ->  #if CVMX_COMPILED_FOR(OCTEON_CN56XX)
346 */
347 #define OCTEON_IS_MODEL(x) __octeon_is_model_runtime__(x)
348 #define OCTEON_IS_COMMON_BINARY() 1
349 #undef OCTEON_MODEL
350 #else
351 #define CVMX_COMPILED_FOR(x) __OCTEON_IS_MODEL_COMPILE__(x, OCTEON_MODEL)
352
353 #define OCTEON_IS_MODEL(x) \
354     (((x & (OM_IGNORE_REVISION | OM_IGNORE_MINOR_REVISION)) != 0) \
355     ? __OCTEON_IS_MODEL_COMPILE__(x, OCTEON_MODEL) \
356     : __OCTEON_IS_MODEL_COMPILE__(x, cvmx_get_proc_id()))
357
358 #define OCTEON_IS_COMMON_BINARY() 0
359 #endif
360 #endif
361
362 int octeon_model_version_check(uint32_t chip_id);
363 const char *octeon_model_get_string(uint32_t chip_id);
364 const char *octeon_model_get_string_buffer(uint32_t chip_id, char * buffer);
365
366 /**                                                                          
367  * Return the octeon family, i.e., ProcessorID of the PrID register.
368  *
369  * @return the octeon family on success, ((unint32_t)-1) on error.
370  */
371 static inline uint32_t cvmx_get_octeon_family(void)
372 {
373 #if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || defined(CVMX_BUILD_FOR_TOOLCHAIN) || (defined(__FreeBSD__) && defined(_KERNEL))
374     return (cvmx_get_proc_id() & OCTEON_FAMILY_MASK);
375 #else
376     return (OCTEON_MODEL & OCTEON_FAMILY_MASK);
377 #endif
378 }
379
380 #ifdef  __cplusplus
381 }
382 #endif
383
384 #endif    /* __OCTEON_MODEL_H__ */