1 /***********************license start*************** 2 * Author: Cavium Networks 3 * 4 * Contact: support@caviumnetworks.com 5 * This file is part of the OCTEON SDK 6 * 7 * Copyright (c) 2003-2010 Cavium Networks 8 * 9 * This file is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License, Version 2, as 11 * published by the Free Software Foundation. 12 * 13 * This file is distributed in the hope that it will be useful, but 14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 16 * NONINFRINGEMENT. See the GNU General Public License for more 17 * details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this file; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 * or visit http://www.gnu.org/licenses/. 23 * 24 * This file may also be available under a different license from Cavium. 25 * Contact Cavium Networks for more information 26 ***********************license end**************************************/ 27 #ifndef __OCTEON_MODEL_H__ 28 #define __OCTEON_MODEL_H__ 29 30 /* 31 * The defines below should be used with the OCTEON_IS_MODEL() macro 32 * to determine what model of chip the software is running on. Models 33 * ending in 'XX' match multiple models (families), while specific 34 * models match only that model. If a pass (revision) is specified, 35 * then only that revision will be matched. Care should be taken when 36 * checking for both specific models and families that the specific 37 * models are checked for first. While these defines are similar to 38 * the processor ID, they are not intended to be used by anything 39 * other that the OCTEON_IS_MODEL framework, and the values are 40 * subject to change at anytime without notice. 41 * 42 * NOTE: only the OCTEON_IS_MODEL() macro/function and the OCTEON_CN* 43 * macros should be used outside of this file. All other macros are 44 * for internal use only, and may change without notice. 45 */ 46 47 #define OCTEON_FAMILY_MASK 0x00ffff00 48 #define OCTEON_PRID_MASK 0x00ffffff 49 50 /* Flag bits in top byte */ 51 /* Ignores revision in model checks */ 52 #define OM_IGNORE_REVISION 0x01000000 53 /* Check submodels */ 54 #define OM_CHECK_SUBMODEL 0x02000000 55 /* Match all models previous than the one specified */ 56 #define OM_MATCH_PREVIOUS_MODELS 0x04000000 57 /* Ignores the minor revison on newer parts */ 58 #define OM_IGNORE_MINOR_REVISION 0x08000000 59 #define OM_FLAG_MASK 0xff000000 60 61 /* Match all cn5XXX Octeon models. */ 62 #define OM_MATCH_5XXX_FAMILY_MODELS 0x20000000 63 /* Match all cn6XXX Octeon models. */ 64 #define OM_MATCH_6XXX_FAMILY_MODELS 0x40000000 65 /* Match all cnf7XXX Octeon models. */ 66 #define OM_MATCH_F7XXX_FAMILY_MODELS 0x80000000 67 /* Match all cn7XXX Octeon models. */ 68 #define OM_MATCH_7XXX_FAMILY_MODELS 0x10000000 69 #define OM_MATCH_FAMILY_MODELS (OM_MATCH_5XXX_FAMILY_MODELS | \ 70 OM_MATCH_6XXX_FAMILY_MODELS | \ 71 OM_MATCH_F7XXX_FAMILY_MODELS | \ 72 OM_MATCH_7XXX_FAMILY_MODELS) 73 /* 74 * CN7XXX models with new revision encoding 75 */ 76 77 #define OCTEON_CN73XX_PASS1_0 0x000d9700 78 #define OCTEON_CN73XX (OCTEON_CN73XX_PASS1_0 | OM_IGNORE_REVISION) 79 #define OCTEON_CN73XX_PASS1_X (OCTEON_CN73XX_PASS1_0 | \ 80 OM_IGNORE_MINOR_REVISION) 81 82 #define OCTEON_CN70XX_PASS1_0 0x000d9600 83 #define OCTEON_CN70XX_PASS1_1 0x000d9601 84 #define OCTEON_CN70XX_PASS1_2 0x000d9602 85 86 #define OCTEON_CN70XX_PASS2_0 0x000d9608 87 88 #define OCTEON_CN70XX (OCTEON_CN70XX_PASS1_0 | OM_IGNORE_REVISION) 89 #define OCTEON_CN70XX_PASS1_X (OCTEON_CN70XX_PASS1_0 | \ 90 OM_IGNORE_MINOR_REVISION) 91 #define OCTEON_CN70XX_PASS2_X (OCTEON_CN70XX_PASS2_0 | \ 92 OM_IGNORE_MINOR_REVISION) 93 94 #define OCTEON_CN71XX OCTEON_CN70XX 95 96 #define OCTEON_CN78XX_PASS1_0 0x000d9500 97 #define OCTEON_CN78XX_PASS1_1 0x000d9501 98 #define OCTEON_CN78XX_PASS2_0 0x000d9508 99 100 #define OCTEON_CN78XX (OCTEON_CN78XX_PASS1_0 | OM_IGNORE_REVISION) 101 #define OCTEON_CN78XX_PASS1_X (OCTEON_CN78XX_PASS1_0 | \ 102 OM_IGNORE_MINOR_REVISION) 103 #define OCTEON_CN78XX_PASS2_X (OCTEON_CN78XX_PASS2_0 | \ 104 OM_IGNORE_MINOR_REVISION) 105 106 #define OCTEON_CN76XX (0x000d9540 | OM_CHECK_SUBMODEL) 107 108 /* 109 * CNF7XXX models with new revision encoding 110 */ 111 #define OCTEON_CNF71XX_PASS1_0 0x000d9400 112 #define OCTEON_CNF71XX_PASS1_1 0x000d9401 113 114 #define OCTEON_CNF71XX (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_REVISION) 115 #define OCTEON_CNF71XX_PASS1_X (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 116 117 /* 118 * CN6XXX models with new revision encoding 119 */ 120 #define OCTEON_CN68XX_PASS1_0 0x000d9100 121 #define OCTEON_CN68XX_PASS1_1 0x000d9101 122 #define OCTEON_CN68XX_PASS1_2 0x000d9102 123 #define OCTEON_CN68XX_PASS2_0 0x000d9108 124 #define OCTEON_CN68XX_PASS2_1 0x000d9109 125 #define OCTEON_CN68XX_PASS2_2 0x000d910a 126 127 #define OCTEON_CN68XX (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_REVISION) 128 #define OCTEON_CN68XX_PASS1_X (OCTEON_CN68XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 129 #define OCTEON_CN68XX_PASS2_X (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 130 131 #define OCTEON_CN68XX_PASS1 OCTEON_CN68XX_PASS1_X 132 #define OCTEON_CN68XX_PASS2 OCTEON_CN68XX_PASS2_X 133 134 #define OCTEON_CN66XX_PASS1_0 0x000d9200 135 #define OCTEON_CN66XX_PASS1_2 0x000d9202 136 137 #define OCTEON_CN66XX (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_REVISION) 138 #define OCTEON_CN66XX_PASS1_X (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 139 140 #define OCTEON_CN63XX_PASS1_0 0x000d9000 141 #define OCTEON_CN63XX_PASS1_1 0x000d9001 142 #define OCTEON_CN63XX_PASS1_2 0x000d9002 143 #define OCTEON_CN63XX_PASS2_0 0x000d9008 144 #define OCTEON_CN63XX_PASS2_1 0x000d9009 145 #define OCTEON_CN63XX_PASS2_2 0x000d900a 146 147 #define OCTEON_CN63XX (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION) 148 #define OCTEON_CN63XX_PASS1_X (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 149 #define OCTEON_CN63XX_PASS2_X (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 150 151 /* CN62XX is same as CN63XX with 1 MB cache */ 152 #define OCTEON_CN62XX OCTEON_CN63XX 153 154 #define OCTEON_CN61XX_PASS1_0 0x000d9300 155 #define OCTEON_CN61XX_PASS1_1 0x000d9301 156 157 #define OCTEON_CN61XX (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_REVISION) 158 #define OCTEON_CN61XX_PASS1_X (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 159 160 /* CN60XX is same as CN61XX with 512 KB cache */ 161 #define OCTEON_CN60XX OCTEON_CN61XX 162 163 /* 164 * CN5XXX models with new revision encoding 165 */ 166 #define OCTEON_CN58XX_PASS1_0 0x000d0300 167 #define OCTEON_CN58XX_PASS1_1 0x000d0301 168 #define OCTEON_CN58XX_PASS1_2 0x000d0303 169 #define OCTEON_CN58XX_PASS2_0 0x000d0308 170 #define OCTEON_CN58XX_PASS2_1 0x000d0309 171 #define OCTEON_CN58XX_PASS2_2 0x000d030a 172 #define OCTEON_CN58XX_PASS2_3 0x000d030b 173 174 #define OCTEON_CN58XX (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_REVISION) 175 #define OCTEON_CN58XX_PASS1_X (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 176 #define OCTEON_CN58XX_PASS2_X (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 177 #define OCTEON_CN58XX_PASS1 OCTEON_CN58XX_PASS1_X 178 #define OCTEON_CN58XX_PASS2 OCTEON_CN58XX_PASS2_X 179 180 #define OCTEON_CN56XX_PASS1_0 0x000d0400 181 #define OCTEON_CN56XX_PASS1_1 0x000d0401 182 #define OCTEON_CN56XX_PASS2_0 0x000d0408 183 #define OCTEON_CN56XX_PASS2_1 0x000d0409 184 185 #define OCTEON_CN56XX (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_REVISION) 186 #define OCTEON_CN56XX_PASS1_X (OCTEON_CN56XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 187 #define OCTEON_CN56XX_PASS2_X (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 188 #define OCTEON_CN56XX_PASS1 OCTEON_CN56XX_PASS1_X 189 #define OCTEON_CN56XX_PASS2 OCTEON_CN56XX_PASS2_X 190 191 #define OCTEON_CN57XX OCTEON_CN56XX 192 #define OCTEON_CN57XX_PASS1 OCTEON_CN56XX_PASS1 193 #define OCTEON_CN57XX_PASS2 OCTEON_CN56XX_PASS2 194 195 #define OCTEON_CN55XX OCTEON_CN56XX 196 #define OCTEON_CN55XX_PASS1 OCTEON_CN56XX_PASS1 197 #define OCTEON_CN55XX_PASS2 OCTEON_CN56XX_PASS2 198 199 #define OCTEON_CN54XX OCTEON_CN56XX 200 #define OCTEON_CN54XX_PASS1 OCTEON_CN56XX_PASS1 201 #define OCTEON_CN54XX_PASS2 OCTEON_CN56XX_PASS2 202 203 #define OCTEON_CN50XX_PASS1_0 0x000d0600 204 205 #define OCTEON_CN50XX (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_REVISION) 206 #define OCTEON_CN50XX_PASS1_X (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 207 #define OCTEON_CN50XX_PASS1 OCTEON_CN50XX_PASS1_X 208 209 /* 210 * NOTE: Octeon CN5000F model is not identifiable using the 211 * OCTEON_IS_MODEL() functions, but are treated as CN50XX. 212 */ 213 214 #define OCTEON_CN52XX_PASS1_0 0x000d0700 215 #define OCTEON_CN52XX_PASS2_0 0x000d0708 216 217 #define OCTEON_CN52XX (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_REVISION) 218 #define OCTEON_CN52XX_PASS1_X (OCTEON_CN52XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 219 #define OCTEON_CN52XX_PASS2_X (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 220 #define OCTEON_CN52XX_PASS1 OCTEON_CN52XX_PASS1_X 221 #define OCTEON_CN52XX_PASS2 OCTEON_CN52XX_PASS2_X 222 223 /* 224 * CN3XXX models with old revision enconding 225 */ 226 #define OCTEON_CN38XX_PASS1 0x000d0000 227 #define OCTEON_CN38XX_PASS2 0x000d0001 228 #define OCTEON_CN38XX_PASS3 0x000d0003 229 #define OCTEON_CN38XX (OCTEON_CN38XX_PASS3 | OM_IGNORE_REVISION) 230 231 #define OCTEON_CN36XX OCTEON_CN38XX 232 #define OCTEON_CN36XX_PASS2 OCTEON_CN38XX_PASS2 233 #define OCTEON_CN36XX_PASS3 OCTEON_CN38XX_PASS3 234 235 /* The OCTEON_CN31XX matches CN31XX models and the CN3020 */ 236 #define OCTEON_CN31XX_PASS1 0x000d0100 237 #define OCTEON_CN31XX_PASS1_1 0x000d0102 238 #define OCTEON_CN31XX (OCTEON_CN31XX_PASS1 | OM_IGNORE_REVISION) 239 240 /* 241 * This model is only used for internal checks, it is not a valid 242 * model for the OCTEON_MODEL environment variable. This matches the 243 * CN3010 and CN3005 but NOT the CN3020. 244 */ 245 #define OCTEON_CN30XX_PASS1 0x000d0200 246 #define OCTEON_CN30XX_PASS1_1 0x000d0202 247 #define OCTEON_CN30XX (OCTEON_CN30XX_PASS1 | OM_IGNORE_REVISION) 248 249 #define OCTEON_CN3005_PASS1 (0x000d0210 | OM_CHECK_SUBMODEL) 250 #define OCTEON_CN3005_PASS1_0 (0x000d0210 | OM_CHECK_SUBMODEL) 251 #define OCTEON_CN3005_PASS1_1 (0x000d0212 | OM_CHECK_SUBMODEL) 252 #define OCTEON_CN3005 (OCTEON_CN3005_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) 253 254 #define OCTEON_CN3010_PASS1 (0x000d0200 | OM_CHECK_SUBMODEL) 255 #define OCTEON_CN3010_PASS1_0 (0x000d0200 | OM_CHECK_SUBMODEL) 256 #define OCTEON_CN3010_PASS1_1 (0x000d0202 | OM_CHECK_SUBMODEL) 257 #define OCTEON_CN3010 (OCTEON_CN3010_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) 258 259 #define OCTEON_CN3020_PASS1 (0x000d0110 | OM_CHECK_SUBMODEL) 260 #define OCTEON_CN3020_PASS1_0 (0x000d0110 | OM_CHECK_SUBMODEL) 261 #define OCTEON_CN3020_PASS1_1 (0x000d0112 | OM_CHECK_SUBMODEL) 262 #define OCTEON_CN3020 (OCTEON_CN3020_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) 263 264 /* 265 * This matches the complete family of CN3xxx CPUs, and not subsequent 266 * models 267 */ 268 #define OCTEON_CN3XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_PREVIOUS_MODELS | OM_IGNORE_REVISION) 269 #define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS) 270 #define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS) 271 #define OCTEON_CNF7XXX (OCTEON_CNF71XX_PASS1_0 | \ 272 OM_MATCH_F7XXX_FAMILY_MODELS) 273 #define OCTEON_CN7XXX (OCTEON_CN78XX_PASS1_0 | \ 274 OM_MATCH_7XXX_FAMILY_MODELS) 275 276 /* The revision byte (low byte) has two different encodings. 277 * CN3XXX: 278 * 279 * bits 280 * <7:5>: reserved (0) 281 * <4>: alternate package 282 * <3:0>: revision 283 * 284 * CN5XXX and older models: 285 * 286 * bits 287 * <7>: reserved (0) 288 * <6>: alternate package 289 * <5:3>: major revision 290 * <2:0>: minor revision 291 * 292 */ 293 294 /* Masks used for the various types of model/family/revision matching */ 295 #define OCTEON_38XX_FAMILY_MASK 0x00ffff00 296 #define OCTEON_38XX_FAMILY_REV_MASK 0x00ffff0f 297 #define OCTEON_38XX_MODEL_MASK 0x00ffff10 298 #define OCTEON_38XX_MODEL_REV_MASK (OCTEON_38XX_FAMILY_REV_MASK | OCTEON_38XX_MODEL_MASK) 299 300 /* CN5XXX and later use different layout of bits in the revision ID field */ 301 #define OCTEON_58XX_FAMILY_MASK OCTEON_38XX_FAMILY_MASK 302 #define OCTEON_58XX_FAMILY_REV_MASK 0x00ffff3f 303 #define OCTEON_58XX_MODEL_MASK 0x00ffff40 304 #define OCTEON_58XX_MODEL_REV_MASK (OCTEON_58XX_FAMILY_REV_MASK | OCTEON_58XX_MODEL_MASK) 305 #define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK & 0x00ffff38) 306 #define OCTEON_5XXX_MODEL_MASK 0x00ff0fc0 307 308 static inline uint32_t cvmx_get_proc_id(void) __attribute__ ((pure)); 309 static inline uint64_t cvmx_read_csr(uint64_t csr_addr); 310 311 #define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z))) 312 313 /* 314 * __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) 315 * returns true if chip_model is identical or belong to the OCTEON 316 * model group specified in arg_model. 317 */ 318 /* NOTE: This for internal use only! */ 319 #define __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) \ 320 ((((arg_model & OCTEON_38XX_FAMILY_MASK) < OCTEON_CN58XX_PASS1_0) && ( \ 321 ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \ 322 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_MASK)) || \ 323 ((((arg_model) & (OM_FLAG_MASK)) == 0) \ 324 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_REV_MASK)) || \ 325 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \ 326 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_MASK)) || \ 327 ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \ 328 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_REV_MASK)) || \ 329 ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \ 330 && (((chip_model) & OCTEON_38XX_MODEL_MASK) < ((arg_model) & OCTEON_38XX_MODEL_MASK))) \ 331 )) || \ 332 (((arg_model & OCTEON_38XX_FAMILY_MASK) >= OCTEON_CN58XX_PASS1_0) && ( \ 333 ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \ 334 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \ 335 ((((arg_model) & (OM_FLAG_MASK)) == 0) \ 336 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_REV_MASK)) || \ 337 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_MINOR_REVISION) \ 338 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MINOR_REV_MASK)) || \ 339 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \ 340 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_MASK)) || \ 341 ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \ 342 && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \ 343 ((((arg_model) & (OM_MATCH_5XXX_FAMILY_MODELS)) == OM_MATCH_5XXX_FAMILY_MODELS) \ 344 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN58XX_PASS1_0) \ 345 && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN63XX_PASS1_0)) || \ 346 ((((arg_model) & (OM_MATCH_6XXX_FAMILY_MODELS)) == OM_MATCH_6XXX_FAMILY_MODELS) \ 347 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN63XX_PASS1_0) \ 348 && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CNF71XX_PASS1_0)) || \ 349 ((((arg_model) & (OM_MATCH_F7XXX_FAMILY_MODELS)) == OM_MATCH_F7XXX_FAMILY_MODELS) \ 350 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CNF71XX_PASS1_0) \ 351 && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN78XX_PASS1_0)) || \ 352 ((((arg_model) & (OM_MATCH_7XXX_FAMILY_MODELS)) == OM_MATCH_7XXX_FAMILY_MODELS) \ 353 && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN78XX_PASS1_0)) || \ 354 ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \ 355 && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \ 356 ))) 357 358 /* NOTE: This for internal use only!!!!! */ 359 static inline int __octeon_is_model_runtime__(uint32_t model) 360 { 361 uint32_t cpuid = cvmx_get_proc_id(); 362 363 return __OCTEON_IS_MODEL_COMPILE__(model, cpuid); 364 } 365 366 /* 367 * The OCTEON_IS_MODEL macro should be used for all Octeon model checking done 368 * in a program. 369 * This should be kept runtime if at all possible and must be conditionalized 370 * with OCTEON_IS_COMMON_BINARY() if runtime checking support is required. 371 * 372 * Use of the macro in preprocessor directives ( #if OCTEON_IS_MODEL(...) ) 373 * is NOT SUPPORTED, and should be replaced with CVMX_COMPILED_FOR() 374 * I.e.: 375 * #if OCTEON_IS_MODEL(OCTEON_CN56XX) -> #if CVMX_COMPILED_FOR(OCTEON_CN56XX) 376 */ 377 #define OCTEON_IS_MODEL(x) __octeon_is_model_runtime__(x) 378 #define OCTEON_IS_COMMON_BINARY() 1 379 #undef OCTEON_MODEL 380 381 #define OCTEON_IS_OCTEON1() OCTEON_IS_MODEL(OCTEON_CN3XXX) 382 #define OCTEON_IS_OCTEONPLUS() OCTEON_IS_MODEL(OCTEON_CN5XXX) 383 #define OCTEON_IS_OCTEON2() \ 384 (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF71XX)) 385 386 #define OCTEON_IS_OCTEON3() OCTEON_IS_MODEL(OCTEON_CN7XXX) 387 388 #define OCTEON_IS_OCTEON1PLUS() (OCTEON_IS_OCTEON1() || OCTEON_IS_OCTEONPLUS()) 389 390 const char *__init octeon_model_get_string(uint32_t chip_id); 391 392 /* 393 * Return the octeon family, i.e., ProcessorID of the PrID register. 394 * 395 * @return the octeon family on success, ((unint32_t)-1) on error. 396 */ 397 static inline uint32_t cvmx_get_octeon_family(void) 398 { 399 return cvmx_get_proc_id() & OCTEON_FAMILY_MASK; 400 } 401 402 #include <asm/octeon/octeon-feature.h> 403 404 #endif /* __OCTEON_MODEL_H__ */ 405