18c2ecf20Sopenharmony_ci/***********************license start*************** 28c2ecf20Sopenharmony_ci * Author: Cavium Networks 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Contact: support@caviumnetworks.com 58c2ecf20Sopenharmony_ci * This file is part of the OCTEON SDK 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2010 Cavium Networks 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as 118c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but 148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 168c2ecf20Sopenharmony_ci * NONINFRINGEMENT. See the GNU General Public License for more 178c2ecf20Sopenharmony_ci * details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 208c2ecf20Sopenharmony_ci * along with this file; if not, write to the Free Software 218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 228c2ecf20Sopenharmony_ci * or visit http://www.gnu.org/licenses/. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * This file may also be available under a different license from Cavium. 258c2ecf20Sopenharmony_ci * Contact Cavium Networks for more information 268c2ecf20Sopenharmony_ci ***********************license end**************************************/ 278c2ecf20Sopenharmony_ci#ifndef __OCTEON_MODEL_H__ 288c2ecf20Sopenharmony_ci#define __OCTEON_MODEL_H__ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* 318c2ecf20Sopenharmony_ci * The defines below should be used with the OCTEON_IS_MODEL() macro 328c2ecf20Sopenharmony_ci * to determine what model of chip the software is running on. Models 338c2ecf20Sopenharmony_ci * ending in 'XX' match multiple models (families), while specific 348c2ecf20Sopenharmony_ci * models match only that model. If a pass (revision) is specified, 358c2ecf20Sopenharmony_ci * then only that revision will be matched. Care should be taken when 368c2ecf20Sopenharmony_ci * checking for both specific models and families that the specific 378c2ecf20Sopenharmony_ci * models are checked for first. While these defines are similar to 388c2ecf20Sopenharmony_ci * the processor ID, they are not intended to be used by anything 398c2ecf20Sopenharmony_ci * other that the OCTEON_IS_MODEL framework, and the values are 408c2ecf20Sopenharmony_ci * subject to change at anytime without notice. 418c2ecf20Sopenharmony_ci * 428c2ecf20Sopenharmony_ci * NOTE: only the OCTEON_IS_MODEL() macro/function and the OCTEON_CN* 438c2ecf20Sopenharmony_ci * macros should be used outside of this file. All other macros are 448c2ecf20Sopenharmony_ci * for internal use only, and may change without notice. 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#define OCTEON_FAMILY_MASK 0x00ffff00 488c2ecf20Sopenharmony_ci#define OCTEON_PRID_MASK 0x00ffffff 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/* Flag bits in top byte */ 518c2ecf20Sopenharmony_ci/* Ignores revision in model checks */ 528c2ecf20Sopenharmony_ci#define OM_IGNORE_REVISION 0x01000000 538c2ecf20Sopenharmony_ci/* Check submodels */ 548c2ecf20Sopenharmony_ci#define OM_CHECK_SUBMODEL 0x02000000 558c2ecf20Sopenharmony_ci/* Match all models previous than the one specified */ 568c2ecf20Sopenharmony_ci#define OM_MATCH_PREVIOUS_MODELS 0x04000000 578c2ecf20Sopenharmony_ci/* Ignores the minor revison on newer parts */ 588c2ecf20Sopenharmony_ci#define OM_IGNORE_MINOR_REVISION 0x08000000 598c2ecf20Sopenharmony_ci#define OM_FLAG_MASK 0xff000000 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* Match all cn5XXX Octeon models. */ 628c2ecf20Sopenharmony_ci#define OM_MATCH_5XXX_FAMILY_MODELS 0x20000000 638c2ecf20Sopenharmony_ci/* Match all cn6XXX Octeon models. */ 648c2ecf20Sopenharmony_ci#define OM_MATCH_6XXX_FAMILY_MODELS 0x40000000 658c2ecf20Sopenharmony_ci/* Match all cnf7XXX Octeon models. */ 668c2ecf20Sopenharmony_ci#define OM_MATCH_F7XXX_FAMILY_MODELS 0x80000000 678c2ecf20Sopenharmony_ci/* Match all cn7XXX Octeon models. */ 688c2ecf20Sopenharmony_ci#define OM_MATCH_7XXX_FAMILY_MODELS 0x10000000 698c2ecf20Sopenharmony_ci#define OM_MATCH_FAMILY_MODELS (OM_MATCH_5XXX_FAMILY_MODELS | \ 708c2ecf20Sopenharmony_ci OM_MATCH_6XXX_FAMILY_MODELS | \ 718c2ecf20Sopenharmony_ci OM_MATCH_F7XXX_FAMILY_MODELS | \ 728c2ecf20Sopenharmony_ci OM_MATCH_7XXX_FAMILY_MODELS) 738c2ecf20Sopenharmony_ci/* 748c2ecf20Sopenharmony_ci * CN7XXX models with new revision encoding 758c2ecf20Sopenharmony_ci */ 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define OCTEON_CNF75XX_PASS1_0 0x000d9800 788c2ecf20Sopenharmony_ci#define OCTEON_CNF75XX (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_REVISION) 798c2ecf20Sopenharmony_ci#define OCTEON_CNF75XX_PASS1_X (OCTEON_CNF75XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define OCTEON_CN73XX_PASS1_0 0x000d9700 828c2ecf20Sopenharmony_ci#define OCTEON_CN73XX_PASS1_1 0x000d9701 838c2ecf20Sopenharmony_ci#define OCTEON_CN73XX (OCTEON_CN73XX_PASS1_0 | OM_IGNORE_REVISION) 848c2ecf20Sopenharmony_ci#define OCTEON_CN73XX_PASS1_X (OCTEON_CN73XX_PASS1_0 | \ 858c2ecf20Sopenharmony_ci OM_IGNORE_MINOR_REVISION) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define OCTEON_CN70XX_PASS1_0 0x000d9600 888c2ecf20Sopenharmony_ci#define OCTEON_CN70XX_PASS1_1 0x000d9601 898c2ecf20Sopenharmony_ci#define OCTEON_CN70XX_PASS1_2 0x000d9602 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define OCTEON_CN70XX_PASS2_0 0x000d9608 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define OCTEON_CN70XX (OCTEON_CN70XX_PASS1_0 | OM_IGNORE_REVISION) 948c2ecf20Sopenharmony_ci#define OCTEON_CN70XX_PASS1_X (OCTEON_CN70XX_PASS1_0 | \ 958c2ecf20Sopenharmony_ci OM_IGNORE_MINOR_REVISION) 968c2ecf20Sopenharmony_ci#define OCTEON_CN70XX_PASS2_X (OCTEON_CN70XX_PASS2_0 | \ 978c2ecf20Sopenharmony_ci OM_IGNORE_MINOR_REVISION) 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define OCTEON_CN71XX OCTEON_CN70XX 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define OCTEON_CN78XX_PASS1_0 0x000d9500 1028c2ecf20Sopenharmony_ci#define OCTEON_CN78XX_PASS1_1 0x000d9501 1038c2ecf20Sopenharmony_ci#define OCTEON_CN78XX_PASS2_0 0x000d9508 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define OCTEON_CN78XX (OCTEON_CN78XX_PASS1_0 | OM_IGNORE_REVISION) 1068c2ecf20Sopenharmony_ci#define OCTEON_CN78XX_PASS1_X (OCTEON_CN78XX_PASS1_0 | \ 1078c2ecf20Sopenharmony_ci OM_IGNORE_MINOR_REVISION) 1088c2ecf20Sopenharmony_ci#define OCTEON_CN78XX_PASS2_X (OCTEON_CN78XX_PASS2_0 | \ 1098c2ecf20Sopenharmony_ci OM_IGNORE_MINOR_REVISION) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define OCTEON_CN76XX (0x000d9540 | OM_CHECK_SUBMODEL) 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci/* 1148c2ecf20Sopenharmony_ci * CNF7XXX models with new revision encoding 1158c2ecf20Sopenharmony_ci */ 1168c2ecf20Sopenharmony_ci#define OCTEON_CNF71XX_PASS1_0 0x000d9400 1178c2ecf20Sopenharmony_ci#define OCTEON_CNF71XX_PASS1_1 0x000d9401 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define OCTEON_CNF71XX (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_REVISION) 1208c2ecf20Sopenharmony_ci#define OCTEON_CNF71XX_PASS1_X (OCTEON_CNF71XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* 1238c2ecf20Sopenharmony_ci * CN6XXX models with new revision encoding 1248c2ecf20Sopenharmony_ci */ 1258c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS1_0 0x000d9100 1268c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS1_1 0x000d9101 1278c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS1_2 0x000d9102 1288c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS2_0 0x000d9108 1298c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS2_1 0x000d9109 1308c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS2_2 0x000d910a 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define OCTEON_CN68XX (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_REVISION) 1338c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS1_X (OCTEON_CN68XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1348c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS2_X (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS1 OCTEON_CN68XX_PASS1_X 1378c2ecf20Sopenharmony_ci#define OCTEON_CN68XX_PASS2 OCTEON_CN68XX_PASS2_X 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define OCTEON_CN66XX_PASS1_0 0x000d9200 1408c2ecf20Sopenharmony_ci#define OCTEON_CN66XX_PASS1_2 0x000d9202 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define OCTEON_CN66XX (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_REVISION) 1438c2ecf20Sopenharmony_ci#define OCTEON_CN66XX_PASS1_X (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS1_0 0x000d9000 1468c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS1_1 0x000d9001 1478c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS1_2 0x000d9002 1488c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS2_0 0x000d9008 1498c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS2_1 0x000d9009 1508c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS2_2 0x000d900a 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci#define OCTEON_CN63XX (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION) 1538c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS1_X (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1548c2ecf20Sopenharmony_ci#define OCTEON_CN63XX_PASS2_X (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci/* CN62XX is same as CN63XX with 1 MB cache */ 1578c2ecf20Sopenharmony_ci#define OCTEON_CN62XX OCTEON_CN63XX 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define OCTEON_CN61XX_PASS1_0 0x000d9300 1608c2ecf20Sopenharmony_ci#define OCTEON_CN61XX_PASS1_1 0x000d9301 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci#define OCTEON_CN61XX (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_REVISION) 1638c2ecf20Sopenharmony_ci#define OCTEON_CN61XX_PASS1_X (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci/* CN60XX is same as CN61XX with 512 KB cache */ 1668c2ecf20Sopenharmony_ci#define OCTEON_CN60XX OCTEON_CN61XX 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci/* 1698c2ecf20Sopenharmony_ci * CN5XXX models with new revision encoding 1708c2ecf20Sopenharmony_ci */ 1718c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS1_0 0x000d0300 1728c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS1_1 0x000d0301 1738c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS1_2 0x000d0303 1748c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS2_0 0x000d0308 1758c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS2_1 0x000d0309 1768c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS2_2 0x000d030a 1778c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS2_3 0x000d030b 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci#define OCTEON_CN58XX (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_REVISION) 1808c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS1_X (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1818c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS2_X (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 1828c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS1 OCTEON_CN58XX_PASS1_X 1838c2ecf20Sopenharmony_ci#define OCTEON_CN58XX_PASS2 OCTEON_CN58XX_PASS2_X 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS1_0 0x000d0400 1868c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS1_1 0x000d0401 1878c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS2_0 0x000d0408 1888c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS2_1 0x000d0409 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#define OCTEON_CN56XX (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_REVISION) 1918c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS1_X (OCTEON_CN56XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 1928c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS2_X (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 1938c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS1 OCTEON_CN56XX_PASS1_X 1948c2ecf20Sopenharmony_ci#define OCTEON_CN56XX_PASS2 OCTEON_CN56XX_PASS2_X 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci#define OCTEON_CN57XX OCTEON_CN56XX 1978c2ecf20Sopenharmony_ci#define OCTEON_CN57XX_PASS1 OCTEON_CN56XX_PASS1 1988c2ecf20Sopenharmony_ci#define OCTEON_CN57XX_PASS2 OCTEON_CN56XX_PASS2 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci#define OCTEON_CN55XX OCTEON_CN56XX 2018c2ecf20Sopenharmony_ci#define OCTEON_CN55XX_PASS1 OCTEON_CN56XX_PASS1 2028c2ecf20Sopenharmony_ci#define OCTEON_CN55XX_PASS2 OCTEON_CN56XX_PASS2 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci#define OCTEON_CN54XX OCTEON_CN56XX 2058c2ecf20Sopenharmony_ci#define OCTEON_CN54XX_PASS1 OCTEON_CN56XX_PASS1 2068c2ecf20Sopenharmony_ci#define OCTEON_CN54XX_PASS2 OCTEON_CN56XX_PASS2 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define OCTEON_CN50XX_PASS1_0 0x000d0600 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci#define OCTEON_CN50XX (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_REVISION) 2118c2ecf20Sopenharmony_ci#define OCTEON_CN50XX_PASS1_X (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 2128c2ecf20Sopenharmony_ci#define OCTEON_CN50XX_PASS1 OCTEON_CN50XX_PASS1_X 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* 2158c2ecf20Sopenharmony_ci * NOTE: Octeon CN5000F model is not identifiable using the 2168c2ecf20Sopenharmony_ci * OCTEON_IS_MODEL() functions, but are treated as CN50XX. 2178c2ecf20Sopenharmony_ci */ 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define OCTEON_CN52XX_PASS1_0 0x000d0700 2208c2ecf20Sopenharmony_ci#define OCTEON_CN52XX_PASS2_0 0x000d0708 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci#define OCTEON_CN52XX (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_REVISION) 2238c2ecf20Sopenharmony_ci#define OCTEON_CN52XX_PASS1_X (OCTEON_CN52XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) 2248c2ecf20Sopenharmony_ci#define OCTEON_CN52XX_PASS2_X (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) 2258c2ecf20Sopenharmony_ci#define OCTEON_CN52XX_PASS1 OCTEON_CN52XX_PASS1_X 2268c2ecf20Sopenharmony_ci#define OCTEON_CN52XX_PASS2 OCTEON_CN52XX_PASS2_X 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci/* 2298c2ecf20Sopenharmony_ci * CN3XXX models with old revision enconding 2308c2ecf20Sopenharmony_ci */ 2318c2ecf20Sopenharmony_ci#define OCTEON_CN38XX_PASS1 0x000d0000 2328c2ecf20Sopenharmony_ci#define OCTEON_CN38XX_PASS2 0x000d0001 2338c2ecf20Sopenharmony_ci#define OCTEON_CN38XX_PASS3 0x000d0003 2348c2ecf20Sopenharmony_ci#define OCTEON_CN38XX (OCTEON_CN38XX_PASS3 | OM_IGNORE_REVISION) 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci#define OCTEON_CN36XX OCTEON_CN38XX 2378c2ecf20Sopenharmony_ci#define OCTEON_CN36XX_PASS2 OCTEON_CN38XX_PASS2 2388c2ecf20Sopenharmony_ci#define OCTEON_CN36XX_PASS3 OCTEON_CN38XX_PASS3 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci/* The OCTEON_CN31XX matches CN31XX models and the CN3020 */ 2418c2ecf20Sopenharmony_ci#define OCTEON_CN31XX_PASS1 0x000d0100 2428c2ecf20Sopenharmony_ci#define OCTEON_CN31XX_PASS1_1 0x000d0102 2438c2ecf20Sopenharmony_ci#define OCTEON_CN31XX (OCTEON_CN31XX_PASS1 | OM_IGNORE_REVISION) 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci/* 2468c2ecf20Sopenharmony_ci * This model is only used for internal checks, it is not a valid 2478c2ecf20Sopenharmony_ci * model for the OCTEON_MODEL environment variable. This matches the 2488c2ecf20Sopenharmony_ci * CN3010 and CN3005 but NOT the CN3020. 2498c2ecf20Sopenharmony_ci */ 2508c2ecf20Sopenharmony_ci#define OCTEON_CN30XX_PASS1 0x000d0200 2518c2ecf20Sopenharmony_ci#define OCTEON_CN30XX_PASS1_1 0x000d0202 2528c2ecf20Sopenharmony_ci#define OCTEON_CN30XX (OCTEON_CN30XX_PASS1 | OM_IGNORE_REVISION) 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci#define OCTEON_CN3005_PASS1 (0x000d0210 | OM_CHECK_SUBMODEL) 2558c2ecf20Sopenharmony_ci#define OCTEON_CN3005_PASS1_0 (0x000d0210 | OM_CHECK_SUBMODEL) 2568c2ecf20Sopenharmony_ci#define OCTEON_CN3005_PASS1_1 (0x000d0212 | OM_CHECK_SUBMODEL) 2578c2ecf20Sopenharmony_ci#define OCTEON_CN3005 (OCTEON_CN3005_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci#define OCTEON_CN3010_PASS1 (0x000d0200 | OM_CHECK_SUBMODEL) 2608c2ecf20Sopenharmony_ci#define OCTEON_CN3010_PASS1_0 (0x000d0200 | OM_CHECK_SUBMODEL) 2618c2ecf20Sopenharmony_ci#define OCTEON_CN3010_PASS1_1 (0x000d0202 | OM_CHECK_SUBMODEL) 2628c2ecf20Sopenharmony_ci#define OCTEON_CN3010 (OCTEON_CN3010_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci#define OCTEON_CN3020_PASS1 (0x000d0110 | OM_CHECK_SUBMODEL) 2658c2ecf20Sopenharmony_ci#define OCTEON_CN3020_PASS1_0 (0x000d0110 | OM_CHECK_SUBMODEL) 2668c2ecf20Sopenharmony_ci#define OCTEON_CN3020_PASS1_1 (0x000d0112 | OM_CHECK_SUBMODEL) 2678c2ecf20Sopenharmony_ci#define OCTEON_CN3020 (OCTEON_CN3020_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci/* 2708c2ecf20Sopenharmony_ci * This matches the complete family of CN3xxx CPUs, and not subsequent 2718c2ecf20Sopenharmony_ci * models 2728c2ecf20Sopenharmony_ci */ 2738c2ecf20Sopenharmony_ci#define OCTEON_CN3XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_PREVIOUS_MODELS | OM_IGNORE_REVISION) 2748c2ecf20Sopenharmony_ci#define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS) 2758c2ecf20Sopenharmony_ci#define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS) 2768c2ecf20Sopenharmony_ci#define OCTEON_CNF7XXX (OCTEON_CNF71XX_PASS1_0 | \ 2778c2ecf20Sopenharmony_ci OM_MATCH_F7XXX_FAMILY_MODELS) 2788c2ecf20Sopenharmony_ci#define OCTEON_CN7XXX (OCTEON_CN78XX_PASS1_0 | \ 2798c2ecf20Sopenharmony_ci OM_MATCH_7XXX_FAMILY_MODELS) 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci/* The revision byte (low byte) has two different encodings. 2828c2ecf20Sopenharmony_ci * CN3XXX: 2838c2ecf20Sopenharmony_ci * 2848c2ecf20Sopenharmony_ci * bits 2858c2ecf20Sopenharmony_ci * <7:5>: reserved (0) 2868c2ecf20Sopenharmony_ci * <4>: alternate package 2878c2ecf20Sopenharmony_ci * <3:0>: revision 2888c2ecf20Sopenharmony_ci * 2898c2ecf20Sopenharmony_ci * CN5XXX and older models: 2908c2ecf20Sopenharmony_ci * 2918c2ecf20Sopenharmony_ci * bits 2928c2ecf20Sopenharmony_ci * <7>: reserved (0) 2938c2ecf20Sopenharmony_ci * <6>: alternate package 2948c2ecf20Sopenharmony_ci * <5:3>: major revision 2958c2ecf20Sopenharmony_ci * <2:0>: minor revision 2968c2ecf20Sopenharmony_ci * 2978c2ecf20Sopenharmony_ci */ 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* Masks used for the various types of model/family/revision matching */ 3008c2ecf20Sopenharmony_ci#define OCTEON_38XX_FAMILY_MASK 0x00ffff00 3018c2ecf20Sopenharmony_ci#define OCTEON_38XX_FAMILY_REV_MASK 0x00ffff0f 3028c2ecf20Sopenharmony_ci#define OCTEON_38XX_MODEL_MASK 0x00ffff10 3038c2ecf20Sopenharmony_ci#define OCTEON_38XX_MODEL_REV_MASK (OCTEON_38XX_FAMILY_REV_MASK | OCTEON_38XX_MODEL_MASK) 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci/* CN5XXX and later use different layout of bits in the revision ID field */ 3068c2ecf20Sopenharmony_ci#define OCTEON_58XX_FAMILY_MASK OCTEON_38XX_FAMILY_MASK 3078c2ecf20Sopenharmony_ci#define OCTEON_58XX_FAMILY_REV_MASK 0x00ffff3f 3088c2ecf20Sopenharmony_ci#define OCTEON_58XX_MODEL_MASK 0x00ffff40 3098c2ecf20Sopenharmony_ci#define OCTEON_58XX_MODEL_REV_MASK (OCTEON_58XX_FAMILY_REV_MASK | OCTEON_58XX_MODEL_MASK) 3108c2ecf20Sopenharmony_ci#define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK & 0x00ffff38) 3118c2ecf20Sopenharmony_ci#define OCTEON_5XXX_MODEL_MASK 0x00ff0fc0 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_cistatic inline uint32_t cvmx_get_proc_id(void) __attribute__ ((pure)); 3148c2ecf20Sopenharmony_cistatic inline uint64_t cvmx_read_csr(uint64_t csr_addr); 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci#define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z))) 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci/* 3198c2ecf20Sopenharmony_ci * __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) 3208c2ecf20Sopenharmony_ci * returns true if chip_model is identical or belong to the OCTEON 3218c2ecf20Sopenharmony_ci * model group specified in arg_model. 3228c2ecf20Sopenharmony_ci */ 3238c2ecf20Sopenharmony_ci/* NOTE: This for internal use only! */ 3248c2ecf20Sopenharmony_ci#define __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) \ 3258c2ecf20Sopenharmony_ci((((arg_model & OCTEON_38XX_FAMILY_MASK) < OCTEON_CN58XX_PASS1_0) && ( \ 3268c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \ 3278c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_MASK)) || \ 3288c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == 0) \ 3298c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_REV_MASK)) || \ 3308c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \ 3318c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_MASK)) || \ 3328c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \ 3338c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_REV_MASK)) || \ 3348c2ecf20Sopenharmony_ci ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \ 3358c2ecf20Sopenharmony_ci && (((chip_model) & OCTEON_38XX_MODEL_MASK) < ((arg_model) & OCTEON_38XX_MODEL_MASK))) \ 3368c2ecf20Sopenharmony_ci )) || \ 3378c2ecf20Sopenharmony_ci (((arg_model & OCTEON_38XX_FAMILY_MASK) >= OCTEON_CN58XX_PASS1_0) && ( \ 3388c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \ 3398c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \ 3408c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == 0) \ 3418c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_REV_MASK)) || \ 3428c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_MINOR_REVISION) \ 3438c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MINOR_REV_MASK)) || \ 3448c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \ 3458c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_MASK)) || \ 3468c2ecf20Sopenharmony_ci ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \ 3478c2ecf20Sopenharmony_ci && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \ 3488c2ecf20Sopenharmony_ci ((((arg_model) & (OM_MATCH_5XXX_FAMILY_MODELS)) == OM_MATCH_5XXX_FAMILY_MODELS) \ 3498c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN58XX_PASS1_0) \ 3508c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN63XX_PASS1_0)) || \ 3518c2ecf20Sopenharmony_ci ((((arg_model) & (OM_MATCH_6XXX_FAMILY_MODELS)) == OM_MATCH_6XXX_FAMILY_MODELS) \ 3528c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN63XX_PASS1_0) \ 3538c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CNF71XX_PASS1_0)) || \ 3548c2ecf20Sopenharmony_ci ((((arg_model) & (OM_MATCH_F7XXX_FAMILY_MODELS)) == OM_MATCH_F7XXX_FAMILY_MODELS) \ 3558c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CNF71XX_PASS1_0) \ 3568c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) < OCTEON_CN78XX_PASS1_0)) || \ 3578c2ecf20Sopenharmony_ci ((((arg_model) & (OM_MATCH_7XXX_FAMILY_MODELS)) == OM_MATCH_7XXX_FAMILY_MODELS) \ 3588c2ecf20Sopenharmony_ci && ((chip_model & OCTEON_PRID_MASK) >= OCTEON_CN78XX_PASS1_0)) || \ 3598c2ecf20Sopenharmony_ci ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \ 3608c2ecf20Sopenharmony_ci && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \ 3618c2ecf20Sopenharmony_ci ))) 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci/* NOTE: This for internal use only!!!!! */ 3648c2ecf20Sopenharmony_cistatic inline int __octeon_is_model_runtime__(uint32_t model) 3658c2ecf20Sopenharmony_ci{ 3668c2ecf20Sopenharmony_ci uint32_t cpuid = cvmx_get_proc_id(); 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci return __OCTEON_IS_MODEL_COMPILE__(model, cpuid); 3698c2ecf20Sopenharmony_ci} 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci/* 3728c2ecf20Sopenharmony_ci * The OCTEON_IS_MODEL macro should be used for all Octeon model checking done 3738c2ecf20Sopenharmony_ci * in a program. 3748c2ecf20Sopenharmony_ci * This should be kept runtime if at all possible and must be conditionalized 3758c2ecf20Sopenharmony_ci * with OCTEON_IS_COMMON_BINARY() if runtime checking support is required. 3768c2ecf20Sopenharmony_ci * 3778c2ecf20Sopenharmony_ci * Use of the macro in preprocessor directives ( #if OCTEON_IS_MODEL(...) ) 3788c2ecf20Sopenharmony_ci * is NOT SUPPORTED, and should be replaced with CVMX_COMPILED_FOR() 3798c2ecf20Sopenharmony_ci * I.e.: 3808c2ecf20Sopenharmony_ci * #if OCTEON_IS_MODEL(OCTEON_CN56XX) -> #if CVMX_COMPILED_FOR(OCTEON_CN56XX) 3818c2ecf20Sopenharmony_ci */ 3828c2ecf20Sopenharmony_ci#define OCTEON_IS_MODEL(x) __octeon_is_model_runtime__(x) 3838c2ecf20Sopenharmony_ci#define OCTEON_IS_COMMON_BINARY() 1 3848c2ecf20Sopenharmony_ci#undef OCTEON_MODEL 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci#define OCTEON_IS_OCTEON1() OCTEON_IS_MODEL(OCTEON_CN3XXX) 3878c2ecf20Sopenharmony_ci#define OCTEON_IS_OCTEONPLUS() OCTEON_IS_MODEL(OCTEON_CN5XXX) 3888c2ecf20Sopenharmony_ci#define OCTEON_IS_OCTEON2() \ 3898c2ecf20Sopenharmony_ci (OCTEON_IS_MODEL(OCTEON_CN6XXX) || OCTEON_IS_MODEL(OCTEON_CNF71XX)) 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci#define OCTEON_IS_OCTEON3() OCTEON_IS_MODEL(OCTEON_CN7XXX) 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci#define OCTEON_IS_OCTEON1PLUS() (OCTEON_IS_OCTEON1() || OCTEON_IS_OCTEONPLUS()) 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ciconst char *__init octeon_model_get_string(uint32_t chip_id); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci/* 3988c2ecf20Sopenharmony_ci * Return the octeon family, i.e., ProcessorID of the PrID register. 3998c2ecf20Sopenharmony_ci * 4008c2ecf20Sopenharmony_ci * @return the octeon family on success, ((unint32_t)-1) on error. 4018c2ecf20Sopenharmony_ci */ 4028c2ecf20Sopenharmony_cistatic inline uint32_t cvmx_get_octeon_family(void) 4038c2ecf20Sopenharmony_ci{ 4048c2ecf20Sopenharmony_ci return cvmx_get_proc_id() & OCTEON_FAMILY_MASK; 4058c2ecf20Sopenharmony_ci} 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci#include <asm/octeon/octeon-feature.h> 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci#endif /* __OCTEON_MODEL_H__ */ 410