root/arch/mips/include/asm/octeon/octeon-model.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __octeon_is_model_runtime__
  2. cvmx_get_octeon_family

   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_CNF75XX_PASS1_0  0x000d9800
  78 #define OCTEON_CNF75XX          (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_REVISION)
  79 #define OCTEON_CNF75XX_PASS1_X  (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
  80 
  81 #define OCTEON_CN73XX_PASS1_0   0x000d9700
  82 #define OCTEON_CN73XX_PASS1_1   0x000d9701
  83 #define OCTEON_CN73XX           (OCTEON_CN73XX_PASS1_0 | OM_IGNORE_REVISION)
  84 #define OCTEON_CN73XX_PASS1_X   (OCTEON_CN73XX_PASS1_0 | \
  85                                  OM_IGNORE_MINOR_REVISION)
  86 
  87 #define OCTEON_CN70XX_PASS1_0   0x000d9600
  88 #define OCTEON_CN70XX_PASS1_1   0x000d9601
  89 #define OCTEON_CN70XX_PASS1_2   0x000d9602
  90 
  91 #define OCTEON_CN70XX_PASS2_0   0x000d9608
  92 
  93 #define OCTEON_CN70XX           (OCTEON_CN70XX_PASS1_0 | OM_IGNORE_REVISION)
  94 #define OCTEON_CN70XX_PASS1_X   (OCTEON_CN70XX_PASS1_0 | \
  95                                  OM_IGNORE_MINOR_REVISION)
  96 #define OCTEON_CN70XX_PASS2_X   (OCTEON_CN70XX_PASS2_0 | \
  97                                  OM_IGNORE_MINOR_REVISION)
  98 
  99 #define OCTEON_CN71XX           OCTEON_CN70XX
 100 
 101 #define OCTEON_CN78XX_PASS1_0   0x000d9500
 102 #define OCTEON_CN78XX_PASS1_1   0x000d9501
 103 #define OCTEON_CN78XX_PASS2_0   0x000d9508
 104 
 105 #define OCTEON_CN78XX           (OCTEON_CN78XX_PASS1_0 | OM_IGNORE_REVISION)
 106 #define OCTEON_CN78XX_PASS1_X   (OCTEON_CN78XX_PASS1_0 | \
 107                                  OM_IGNORE_MINOR_REVISION)
 108 #define OCTEON_CN78XX_PASS2_X   (OCTEON_CN78XX_PASS2_0 | \
 109                                  OM_IGNORE_MINOR_REVISION)
 110 
 111 #define OCTEON_CN76XX           (0x000d9540 | OM_CHECK_SUBMODEL)
 112 
 113 /*
 114  * CNF7XXX models with new revision encoding
 115  */
 116 #define OCTEON_CNF71XX_PASS1_0  0x000d9400
 117 #define OCTEON_CNF71XX_PASS1_1  0x000d9401
 118 
 119 #define OCTEON_CNF71XX          (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_REVISION)
 120 #define OCTEON_CNF71XX_PASS1_X  (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 121 
 122 /*
 123  * CN6XXX models with new revision encoding
 124  */
 125 #define OCTEON_CN68XX_PASS1_0   0x000d9100
 126 #define OCTEON_CN68XX_PASS1_1   0x000d9101
 127 #define OCTEON_CN68XX_PASS1_2   0x000d9102
 128 #define OCTEON_CN68XX_PASS2_0   0x000d9108
 129 #define OCTEON_CN68XX_PASS2_1   0x000d9109
 130 #define OCTEON_CN68XX_PASS2_2   0x000d910a
 131 
 132 #define OCTEON_CN68XX           (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_REVISION)
 133 #define OCTEON_CN68XX_PASS1_X   (OCTEON_CN68XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 134 #define OCTEON_CN68XX_PASS2_X   (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
 135 
 136 #define OCTEON_CN68XX_PASS1     OCTEON_CN68XX_PASS1_X
 137 #define OCTEON_CN68XX_PASS2     OCTEON_CN68XX_PASS2_X
 138 
 139 #define OCTEON_CN66XX_PASS1_0   0x000d9200
 140 #define OCTEON_CN66XX_PASS1_2   0x000d9202
 141 
 142 #define OCTEON_CN66XX           (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_REVISION)
 143 #define OCTEON_CN66XX_PASS1_X   (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 144 
 145 #define OCTEON_CN63XX_PASS1_0   0x000d9000
 146 #define OCTEON_CN63XX_PASS1_1   0x000d9001
 147 #define OCTEON_CN63XX_PASS1_2   0x000d9002
 148 #define OCTEON_CN63XX_PASS2_0   0x000d9008
 149 #define OCTEON_CN63XX_PASS2_1   0x000d9009
 150 #define OCTEON_CN63XX_PASS2_2   0x000d900a
 151 
 152 #define OCTEON_CN63XX           (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION)
 153 #define OCTEON_CN63XX_PASS1_X   (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 154 #define OCTEON_CN63XX_PASS2_X   (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
 155 
 156 /* CN62XX is same as CN63XX with 1 MB cache */
 157 #define OCTEON_CN62XX           OCTEON_CN63XX
 158 
 159 #define OCTEON_CN61XX_PASS1_0   0x000d9300
 160 #define OCTEON_CN61XX_PASS1_1   0x000d9301
 161 
 162 #define OCTEON_CN61XX           (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_REVISION)
 163 #define OCTEON_CN61XX_PASS1_X   (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 164 
 165 /* CN60XX is same as CN61XX with 512 KB cache */
 166 #define OCTEON_CN60XX           OCTEON_CN61XX
 167 
 168 /*
 169  * CN5XXX models with new revision encoding
 170  */
 171 #define OCTEON_CN58XX_PASS1_0   0x000d0300
 172 #define OCTEON_CN58XX_PASS1_1   0x000d0301
 173 #define OCTEON_CN58XX_PASS1_2   0x000d0303
 174 #define OCTEON_CN58XX_PASS2_0   0x000d0308
 175 #define OCTEON_CN58XX_PASS2_1   0x000d0309
 176 #define OCTEON_CN58XX_PASS2_2   0x000d030a
 177 #define OCTEON_CN58XX_PASS2_3   0x000d030b
 178 
 179 #define OCTEON_CN58XX           (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_REVISION)
 180 #define OCTEON_CN58XX_PASS1_X   (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 181 #define OCTEON_CN58XX_PASS2_X   (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
 182 #define OCTEON_CN58XX_PASS1     OCTEON_CN58XX_PASS1_X
 183 #define OCTEON_CN58XX_PASS2     OCTEON_CN58XX_PASS2_X
 184 
 185 #define OCTEON_CN56XX_PASS1_0   0x000d0400
 186 #define OCTEON_CN56XX_PASS1_1   0x000d0401
 187 #define OCTEON_CN56XX_PASS2_0   0x000d0408
 188 #define OCTEON_CN56XX_PASS2_1   0x000d0409
 189 
 190 #define OCTEON_CN56XX           (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_REVISION)
 191 #define OCTEON_CN56XX_PASS1_X   (OCTEON_CN56XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 192 #define OCTEON_CN56XX_PASS2_X   (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
 193 #define OCTEON_CN56XX_PASS1     OCTEON_CN56XX_PASS1_X
 194 #define OCTEON_CN56XX_PASS2     OCTEON_CN56XX_PASS2_X
 195 
 196 #define OCTEON_CN57XX           OCTEON_CN56XX
 197 #define OCTEON_CN57XX_PASS1     OCTEON_CN56XX_PASS1
 198 #define OCTEON_CN57XX_PASS2     OCTEON_CN56XX_PASS2
 199 
 200 #define OCTEON_CN55XX           OCTEON_CN56XX
 201 #define OCTEON_CN55XX_PASS1     OCTEON_CN56XX_PASS1
 202 #define OCTEON_CN55XX_PASS2     OCTEON_CN56XX_PASS2
 203 
 204 #define OCTEON_CN54XX           OCTEON_CN56XX
 205 #define OCTEON_CN54XX_PASS1     OCTEON_CN56XX_PASS1
 206 #define OCTEON_CN54XX_PASS2     OCTEON_CN56XX_PASS2
 207 
 208 #define OCTEON_CN50XX_PASS1_0   0x000d0600
 209 
 210 #define OCTEON_CN50XX           (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_REVISION)
 211 #define OCTEON_CN50XX_PASS1_X   (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 212 #define OCTEON_CN50XX_PASS1     OCTEON_CN50XX_PASS1_X
 213 
 214 /*
 215  * NOTE: Octeon CN5000F model is not identifiable using the
 216  * OCTEON_IS_MODEL() functions, but are treated as CN50XX.
 217  */
 218 
 219 #define OCTEON_CN52XX_PASS1_0   0x000d0700
 220 #define OCTEON_CN52XX_PASS2_0   0x000d0708
 221 
 222 #define OCTEON_CN52XX           (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_REVISION)
 223 #define OCTEON_CN52XX_PASS1_X   (OCTEON_CN52XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
 224 #define OCTEON_CN52XX_PASS2_X   (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
 225 #define OCTEON_CN52XX_PASS1     OCTEON_CN52XX_PASS1_X
 226 #define OCTEON_CN52XX_PASS2     OCTEON_CN52XX_PASS2_X
 227 
 228 /*
 229  * CN3XXX models with old revision enconding
 230  */
 231 #define OCTEON_CN38XX_PASS1     0x000d0000
 232 #define OCTEON_CN38XX_PASS2     0x000d0001
 233 #define OCTEON_CN38XX_PASS3     0x000d0003
 234 #define OCTEON_CN38XX           (OCTEON_CN38XX_PASS3 | OM_IGNORE_REVISION)
 235 
 236 #define OCTEON_CN36XX           OCTEON_CN38XX
 237 #define OCTEON_CN36XX_PASS2     OCTEON_CN38XX_PASS2
 238 #define OCTEON_CN36XX_PASS3     OCTEON_CN38XX_PASS3
 239 
 240 /* The OCTEON_CN31XX matches CN31XX models and the CN3020 */
 241 #define OCTEON_CN31XX_PASS1     0x000d0100
 242 #define OCTEON_CN31XX_PASS1_1   0x000d0102
 243 #define OCTEON_CN31XX           (OCTEON_CN31XX_PASS1 | OM_IGNORE_REVISION)
 244 
 245 /*
 246  * This model is only used for internal checks, it is not a valid
 247  * model for the OCTEON_MODEL environment variable.  This matches the
 248  * CN3010 and CN3005 but NOT the CN3020.
 249  */
 250 #define OCTEON_CN30XX_PASS1     0x000d0200
 251 #define OCTEON_CN30XX_PASS1_1   0x000d0202
 252 #define OCTEON_CN30XX           (OCTEON_CN30XX_PASS1 | OM_IGNORE_REVISION)
 253 
 254 #define OCTEON_CN3005_PASS1     (0x000d0210 | OM_CHECK_SUBMODEL)
 255 #define OCTEON_CN3005_PASS1_0   (0x000d0210 | OM_CHECK_SUBMODEL)
 256 #define OCTEON_CN3005_PASS1_1   (0x000d0212 | OM_CHECK_SUBMODEL)
 257 #define OCTEON_CN3005           (OCTEON_CN3005_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
 258 
 259 #define OCTEON_CN3010_PASS1     (0x000d0200 | OM_CHECK_SUBMODEL)
 260 #define OCTEON_CN3010_PASS1_0   (0x000d0200 | OM_CHECK_SUBMODEL)
 261 #define OCTEON_CN3010_PASS1_1   (0x000d0202 | OM_CHECK_SUBMODEL)
 262 #define OCTEON_CN3010           (OCTEON_CN3010_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
 263 
 264 #define OCTEON_CN3020_PASS1     (0x000d0110 | OM_CHECK_SUBMODEL)
 265 #define OCTEON_CN3020_PASS1_0   (0x000d0110 | OM_CHECK_SUBMODEL)
 266 #define OCTEON_CN3020_PASS1_1   (0x000d0112 | OM_CHECK_SUBMODEL)
 267 #define OCTEON_CN3020           (OCTEON_CN3020_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)
 268 
 269 /*
 270  * This matches the complete family of CN3xxx CPUs, and not subsequent
 271  * models
 272  */
 273 #define OCTEON_CN3XXX           (OCTEON_CN58XX_PASS1_0 | OM_MATCH_PREVIOUS_MODELS | OM_IGNORE_REVISION)
 274 #define OCTEON_CN5XXX           (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS)
 275 #define OCTEON_CN6XXX           (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS)
 276 #define OCTEON_CNF7XXX          (OCTEON_CNF71XX_PASS1_0 | \
 277                                  OM_MATCH_F7XXX_FAMILY_MODELS)
 278 #define OCTEON_CN7XXX           (OCTEON_CN78XX_PASS1_0 | \
 279                                  OM_MATCH_7XXX_FAMILY_MODELS)
 280 
 281 /* The revision byte (low byte) has two different encodings.
 282  * CN3XXX:
 283  *
 284  *     bits
 285  *     <7:5>: reserved (0)
 286  *     <4>:   alternate package
 287  *     <3:0>: revision
 288  *
 289  * CN5XXX and older models:
 290  *
 291  *     bits
 292  *     <7>:   reserved (0)
 293  *     <6>:   alternate package
 294  *     <5:3>: major revision
 295  *     <2:0>: minor revision
 296  *
 297  */
 298 
 299 /* Masks used for the various types of model/family/revision matching */
 300 #define OCTEON_38XX_FAMILY_MASK      0x00ffff00
 301 #define OCTEON_38XX_FAMILY_REV_MASK  0x00ffff0f
 302 #define OCTEON_38XX_MODEL_MASK       0x00ffff10
 303 #define OCTEON_38XX_MODEL_REV_MASK   (OCTEON_38XX_FAMILY_REV_MASK | OCTEON_38XX_MODEL_MASK)
 304 
 305 /* CN5XXX and later use different layout of bits in the revision ID field */
 306 #define OCTEON_58XX_FAMILY_MASK      OCTEON_38XX_FAMILY_MASK
 307 #define OCTEON_58XX_FAMILY_REV_MASK  0x00ffff3f
 308 #define OCTEON_58XX_MODEL_MASK       0x00ffff40
 309 #define OCTEON_58XX_MODEL_REV_MASK   (OCTEON_58XX_FAMILY_REV_MASK | OCTEON_58XX_MODEL_MASK)
 310 #define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK & 0x00ffff38)
 311 #define OCTEON_5XXX_MODEL_MASK       0x00ff0fc0
 312 
 313 static inline uint32_t cvmx_get_proc_id(void) __attribute__ ((pure));
 314 static inline uint64_t cvmx_read_csr(uint64_t csr_addr);
 315 
 316 #define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z)))
 317 
 318 /*
 319  * __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model)
 320  * returns true if chip_model is identical or belong to the OCTEON
 321  * model group specified in arg_model.
 322  */
 323 /* NOTE: This for internal use only! */
 324 #define __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model)              \
 325 ((((arg_model & OCTEON_38XX_FAMILY_MASK) < OCTEON_CN58XX_PASS1_0)  && ( \
 326                 ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \
 327                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_MASK)) || \
 328                 ((((arg_model) & (OM_FLAG_MASK)) == 0)                  \
 329                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_REV_MASK)) || \
 330                 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \
 331                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_MASK)) || \
 332                 ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL)  \
 333                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_REV_MASK)) || \
 334                 ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \
 335                         && (((chip_model) & OCTEON_38XX_MODEL_MASK) < ((arg_model) & OCTEON_38XX_MODEL_MASK))) \
 336                 )) ||                                                   \
 337         (((arg_model & OCTEON_38XX_FAMILY_MASK) >= OCTEON_CN58XX_PASS1_0)  && ( \
 338                 ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \
 339                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \
 340                 ((((arg_model) & (OM_FLAG_MASK)) == 0)                  \
 341                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_REV_MASK)) || \
 342                 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_MINOR_REVISION) \
 343                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MINOR_REV_MASK)) || \
 344                 ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \
 345                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_MASK)) || \
 346                 ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL)  \
 347                         && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \
 348                 ((((arg_model) & (OM_MATCH_5XXX_FAMILY_MODELS)) == OM_MATCH_5XXX_FAMILY_MODELS) \
 349                         && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN58XX_PASS1_0) \
 350                         && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN63XX_PASS1_0)) || \
 351                 ((((arg_model) & (OM_MATCH_6XXX_FAMILY_MODELS)) == OM_MATCH_6XXX_FAMILY_MODELS) \
 352                         && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN63XX_PASS1_0) \
 353                         && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CNF71XX_PASS1_0)) || \
 354                 ((((arg_model) & (OM_MATCH_F7XXX_FAMILY_MODELS)) == OM_MATCH_F7XXX_FAMILY_MODELS) \
 355                         && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CNF71XX_PASS1_0) \
 356                         && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN78XX_PASS1_0)) || \
 357                 ((((arg_model) & (OM_MATCH_7XXX_FAMILY_MODELS)) == OM_MATCH_7XXX_FAMILY_MODELS) \
 358                         && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN78XX_PASS1_0)) || \
 359                 ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \
 360                         && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \
 361                 )))
 362 
 363 /* NOTE: This for internal use only!!!!! */
 364 static inline int __octeon_is_model_runtime__(uint32_t model)
 365 {
 366         uint32_t cpuid = cvmx_get_proc_id();
 367 
 368         return __OCTEON_IS_MODEL_COMPILE__(model, cpuid);
 369 }
 370 
 371 /*
 372  * The OCTEON_IS_MODEL macro should be used for all Octeon model checking done
 373  * in a program.
 374  * This should be kept runtime if at all possible  and must be conditionalized
 375  * with OCTEON_IS_COMMON_BINARY() if runtime checking support is required.
 376  *
 377  * Use of the macro in preprocessor directives ( #if OCTEON_IS_MODEL(...) )
 378  * is NOT SUPPORTED, and should be replaced with CVMX_COMPILED_FOR()
 379  * I.e.:
 380  *  #if OCTEON_IS_MODEL(OCTEON_CN56XX)  ->  #if CVMX_COMPILED_FOR(OCTEON_CN56XX)
 381  */
 382 #define OCTEON_IS_MODEL(x) __octeon_is_model_runtime__(x)
 383 #define OCTEON_IS_COMMON_BINARY() 1
 384 #undef OCTEON_MODEL
 385 
 386 #define OCTEON_IS_OCTEON1()     OCTEON_IS_MODEL(OCTEON_CN3XXX)
 387 #define OCTEON_IS_OCTEONPLUS()  OCTEON_IS_MODEL(OCTEON_CN5XXX)
 388 #define OCTEON_IS_OCTEON2()                                             \
 389         (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF71XX))
 390 
 391 #define OCTEON_IS_OCTEON3()     OCTEON_IS_MODEL(OCTEON_CN7XXX)
 392 
 393 #define OCTEON_IS_OCTEON1PLUS() (OCTEON_IS_OCTEON1() || OCTEON_IS_OCTEONPLUS())
 394 
 395 const char *__init octeon_model_get_string(uint32_t chip_id);
 396 
 397 /*
 398  * Return the octeon family, i.e., ProcessorID of the PrID register.
 399  *
 400  * @return the octeon family on success, ((unint32_t)-1) on error.
 401  */
 402 static inline uint32_t cvmx_get_octeon_family(void)
 403 {
 404         return cvmx_get_proc_id() & OCTEON_FAMILY_MASK;
 405 }
 406 
 407 #include <asm/octeon/octeon-feature.h>
 408 
 409 #endif /* __OCTEON_MODEL_H__ */

/* [<][>][^][v][top][bottom][index][help] */