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-2017 Cavium, Inc. 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 288c2ecf20Sopenharmony_ci/* 298c2ecf20Sopenharmony_ci * Interface to the Level 2 Cache (L2C) control, measurement, and debugging 308c2ecf20Sopenharmony_ci * facilities. 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#ifndef __CVMX_L2C_H__ 348c2ecf20Sopenharmony_ci#define __CVMX_L2C_H__ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#include <uapi/asm/bitfield.h> 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define CVMX_L2_ASSOC cvmx_l2c_get_num_assoc() /* Deprecated macro */ 398c2ecf20Sopenharmony_ci#define CVMX_L2_SET_BITS cvmx_l2c_get_set_bits() /* Deprecated macro */ 408c2ecf20Sopenharmony_ci#define CVMX_L2_SETS cvmx_l2c_get_num_sets() /* Deprecated macro */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* Based on 128 byte cache line size */ 438c2ecf20Sopenharmony_ci#define CVMX_L2C_IDX_ADDR_SHIFT 7 448c2ecf20Sopenharmony_ci#define CVMX_L2C_IDX_MASK (cvmx_l2c_get_num_sets() - 1) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* Defines for index aliasing computations */ 478c2ecf20Sopenharmony_ci#define CVMX_L2C_TAG_ADDR_ALIAS_SHIFT (CVMX_L2C_IDX_ADDR_SHIFT + \ 488c2ecf20Sopenharmony_ci cvmx_l2c_get_set_bits()) 498c2ecf20Sopenharmony_ci#define CVMX_L2C_ALIAS_MASK (CVMX_L2C_IDX_MASK << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) 508c2ecf20Sopenharmony_ci#define CVMX_L2C_MEMBANK_SELECT_SIZE 4096 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* Number of L2C Tag-and-data sections (TADs) that are connected to LMC. */ 538c2ecf20Sopenharmony_ci#define CVMX_L2C_TADS 1 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciunion cvmx_l2c_tag { 568c2ecf20Sopenharmony_ci uint64_t u64; 578c2ecf20Sopenharmony_ci struct { 588c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t reserved:28, 598c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t V:1, 608c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t D:1, 618c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t L:1, 628c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t U:1, 638c2ecf20Sopenharmony_ci __BITFIELD_FIELD(uint64_t addr:32, 648c2ecf20Sopenharmony_ci ;)))))) 658c2ecf20Sopenharmony_ci } s; 668c2ecf20Sopenharmony_ci}; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* L2C Performance Counter events. */ 698c2ecf20Sopenharmony_cienum cvmx_l2c_event { 708c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_CYCLES = 0, 718c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_INSTRUCTION_MISS = 1, 728c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_INSTRUCTION_HIT = 2, 738c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DATA_MISS = 3, 748c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DATA_HIT = 4, 758c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_MISS = 5, 768c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_HIT = 6, 778c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_VICTIM_HIT = 7, 788c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_INDEX_CONFLICT = 8, 798c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_TAG_PROBE = 9, 808c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_TAG_UPDATE = 10, 818c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_TAG_COMPLETE = 11, 828c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_TAG_DIRTY = 12, 838c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DATA_STORE_NOP = 13, 848c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DATA_STORE_READ = 14, 858c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DATA_STORE_WRITE = 15, 868c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_FILL_DATA_VALID = 16, 878c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_WRITE_REQUEST = 17, 888c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_READ_REQUEST = 18, 898c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_WRITE_DATA_VALID = 19, 908c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_NOP = 20, 918c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_LDT = 21, 928c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_LDI = 22, 938c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_LDD = 23, 948c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_STF = 24, 958c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_STT = 25, 968c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_STP = 26, 978c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_STC = 27, 988c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_DWB = 28, 998c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_PL2 = 29, 1008c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_PSL1 = 30, 1018c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_IOBLD = 31, 1028c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_IOBST = 32, 1038c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_IOBDMA = 33, 1048c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_IOBRSP = 34, 1058c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_BUS_VALID = 35, 1068c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_MEM_DATA = 36, 1078c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_REFL_DATA = 37, 1088c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_XMC_IOBRSP_DATA = 38, 1098c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_NOP = 39, 1108c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_STDN = 40, 1118c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_FILL = 41, 1128c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_REFL = 42, 1138c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_STIN = 43, 1148c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_SCIN = 44, 1158c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_SCFL = 45, 1168c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_SCDN = 46, 1178c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_DATA_VALID = 47, 1188c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_VALID_FILL = 48, 1198c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_VALID_STRSP = 49, 1208c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_RSC_VALID_REFL = 50, 1218c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_LRF_REQ = 51, 1228c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DT_RD_ALLOC = 52, 1238c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_DT_WR_INVAL = 53, 1248c2ecf20Sopenharmony_ci CVMX_L2C_EVENT_MAX 1258c2ecf20Sopenharmony_ci}; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* L2C Performance Counter events for Octeon2. */ 1288c2ecf20Sopenharmony_cienum cvmx_l2c_tad_event { 1298c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_NONE = 0, 1308c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_TAG_HIT = 1, 1318c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_TAG_MISS = 2, 1328c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_TAG_NOALLOC = 3, 1338c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_TAG_VICTIM = 4, 1348c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_SC_FAIL = 5, 1358c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_SC_PASS = 6, 1368c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_LFB_VALID = 7, 1378c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_LFB_WAIT_LFB = 8, 1388c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_LFB_WAIT_VAB = 9, 1398c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD0_INDEX = 128, 1408c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD0_READ = 129, 1418c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD0_BANK = 130, 1428c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD0_WDAT = 131, 1438c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD1_INDEX = 144, 1448c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD1_READ = 145, 1458c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD1_BANK = 146, 1468c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD1_WDAT = 147, 1478c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD2_INDEX = 160, 1488c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD2_READ = 161, 1498c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD2_BANK = 162, 1508c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD2_WDAT = 163, 1518c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD3_INDEX = 176, 1528c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD3_READ = 177, 1538c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD3_BANK = 178, 1548c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_QUAD3_WDAT = 179, 1558c2ecf20Sopenharmony_ci CVMX_L2C_TAD_EVENT_MAX 1568c2ecf20Sopenharmony_ci}; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci/** 1598c2ecf20Sopenharmony_ci * Configure one of the four L2 Cache performance counters to capture event 1608c2ecf20Sopenharmony_ci * occurrences. 1618c2ecf20Sopenharmony_ci * 1628c2ecf20Sopenharmony_ci * @counter: The counter to configure. Range 0..3. 1638c2ecf20Sopenharmony_ci * @event: The type of L2 Cache event occurrence to count. 1648c2ecf20Sopenharmony_ci * @clear_on_read: When asserted, any read of the performance counter 1658c2ecf20Sopenharmony_ci * clears the counter. 1668c2ecf20Sopenharmony_ci * 1678c2ecf20Sopenharmony_ci * @note The routine does not clear the counter. 1688c2ecf20Sopenharmony_ci */ 1698c2ecf20Sopenharmony_civoid cvmx_l2c_config_perf(uint32_t counter, enum cvmx_l2c_event event, 1708c2ecf20Sopenharmony_ci uint32_t clear_on_read); 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/** 1738c2ecf20Sopenharmony_ci * Read the given L2 Cache performance counter. The counter must be configured 1748c2ecf20Sopenharmony_ci * before reading, but this routine does not enforce this requirement. 1758c2ecf20Sopenharmony_ci * 1768c2ecf20Sopenharmony_ci * @counter: The counter to configure. Range 0..3. 1778c2ecf20Sopenharmony_ci * 1788c2ecf20Sopenharmony_ci * Returns The current counter value. 1798c2ecf20Sopenharmony_ci */ 1808c2ecf20Sopenharmony_ciuint64_t cvmx_l2c_read_perf(uint32_t counter); 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci/** 1838c2ecf20Sopenharmony_ci * Return the L2 Cache way partitioning for a given core. 1848c2ecf20Sopenharmony_ci * 1858c2ecf20Sopenharmony_ci * @core: The core processor of interest. 1868c2ecf20Sopenharmony_ci * 1878c2ecf20Sopenharmony_ci * Returns The mask specifying the partitioning. 0 bits in mask indicates 1888c2ecf20Sopenharmony_ci * the cache 'ways' that a core can evict from. 1898c2ecf20Sopenharmony_ci * -1 on error 1908c2ecf20Sopenharmony_ci */ 1918c2ecf20Sopenharmony_ciint cvmx_l2c_get_core_way_partition(uint32_t core); 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci/** 1948c2ecf20Sopenharmony_ci * Partitions the L2 cache for a core 1958c2ecf20Sopenharmony_ci * 1968c2ecf20Sopenharmony_ci * @core: The core that the partitioning applies to. 1978c2ecf20Sopenharmony_ci * @mask: The partitioning of the ways expressed as a binary 1988c2ecf20Sopenharmony_ci * mask. A 0 bit allows the core to evict cache lines from 1998c2ecf20Sopenharmony_ci * a way, while a 1 bit blocks the core from evicting any 2008c2ecf20Sopenharmony_ci * lines from that way. There must be at least one allowed 2018c2ecf20Sopenharmony_ci * way (0 bit) in the mask. 2028c2ecf20Sopenharmony_ci * 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci * @note If any ways are blocked for all cores and the HW blocks, then 2058c2ecf20Sopenharmony_ci * those ways will never have any cache lines evicted from them. 2068c2ecf20Sopenharmony_ci * All cores and the hardware blocks are free to read from all 2078c2ecf20Sopenharmony_ci * ways regardless of the partitioning. 2088c2ecf20Sopenharmony_ci */ 2098c2ecf20Sopenharmony_ciint cvmx_l2c_set_core_way_partition(uint32_t core, uint32_t mask); 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci/** 2128c2ecf20Sopenharmony_ci * Return the L2 Cache way partitioning for the hw blocks. 2138c2ecf20Sopenharmony_ci * 2148c2ecf20Sopenharmony_ci * Returns The mask specifying the reserved way. 0 bits in mask indicates 2158c2ecf20Sopenharmony_ci * the cache 'ways' that a core can evict from. 2168c2ecf20Sopenharmony_ci * -1 on error 2178c2ecf20Sopenharmony_ci */ 2188c2ecf20Sopenharmony_ciint cvmx_l2c_get_hw_way_partition(void); 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci/** 2218c2ecf20Sopenharmony_ci * Partitions the L2 cache for the hardware blocks. 2228c2ecf20Sopenharmony_ci * 2238c2ecf20Sopenharmony_ci * @mask: The partitioning of the ways expressed as a binary 2248c2ecf20Sopenharmony_ci * mask. A 0 bit allows the core to evict cache lines from 2258c2ecf20Sopenharmony_ci * a way, while a 1 bit blocks the core from evicting any 2268c2ecf20Sopenharmony_ci * lines from that way. There must be at least one allowed 2278c2ecf20Sopenharmony_ci * way (0 bit) in the mask. 2288c2ecf20Sopenharmony_ci * 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci * @note If any ways are blocked for all cores and the HW blocks, then 2318c2ecf20Sopenharmony_ci * those ways will never have any cache lines evicted from them. 2328c2ecf20Sopenharmony_ci * All cores and the hardware blocks are free to read from all 2338c2ecf20Sopenharmony_ci * ways regardless of the partitioning. 2348c2ecf20Sopenharmony_ci */ 2358c2ecf20Sopenharmony_ciint cvmx_l2c_set_hw_way_partition(uint32_t mask); 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci/** 2398c2ecf20Sopenharmony_ci * Locks a line in the L2 cache at the specified physical address 2408c2ecf20Sopenharmony_ci * 2418c2ecf20Sopenharmony_ci * @addr: physical address of line to lock 2428c2ecf20Sopenharmony_ci * 2438c2ecf20Sopenharmony_ci * Returns 0 on success, 2448c2ecf20Sopenharmony_ci * 1 if line not locked. 2458c2ecf20Sopenharmony_ci */ 2468c2ecf20Sopenharmony_ciint cvmx_l2c_lock_line(uint64_t addr); 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci/** 2498c2ecf20Sopenharmony_ci * Locks a specified memory region in the L2 cache. 2508c2ecf20Sopenharmony_ci * 2518c2ecf20Sopenharmony_ci * Note that if not all lines can be locked, that means that all 2528c2ecf20Sopenharmony_ci * but one of the ways (associations) available to the locking 2538c2ecf20Sopenharmony_ci * core are locked. Having only 1 association available for 2548c2ecf20Sopenharmony_ci * normal caching may have a significant adverse affect on performance. 2558c2ecf20Sopenharmony_ci * Care should be taken to ensure that enough of the L2 cache is left 2568c2ecf20Sopenharmony_ci * unlocked to allow for normal caching of DRAM. 2578c2ecf20Sopenharmony_ci * 2588c2ecf20Sopenharmony_ci * @start: Physical address of the start of the region to lock 2598c2ecf20Sopenharmony_ci * @len: Length (in bytes) of region to lock 2608c2ecf20Sopenharmony_ci * 2618c2ecf20Sopenharmony_ci * Returns Number of requested lines that where not locked. 2628c2ecf20Sopenharmony_ci * 0 on success (all locked) 2638c2ecf20Sopenharmony_ci */ 2648c2ecf20Sopenharmony_ciint cvmx_l2c_lock_mem_region(uint64_t start, uint64_t len); 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci/** 2678c2ecf20Sopenharmony_ci * Unlock and flush a cache line from the L2 cache. 2688c2ecf20Sopenharmony_ci * IMPORTANT: Must only be run by one core at a time due to use 2698c2ecf20Sopenharmony_ci * of L2C debug features. 2708c2ecf20Sopenharmony_ci * Note that this function will flush a matching but unlocked cache line. 2718c2ecf20Sopenharmony_ci * (If address is not in L2, no lines are flushed.) 2728c2ecf20Sopenharmony_ci * 2738c2ecf20Sopenharmony_ci * @address: Physical address to unlock 2748c2ecf20Sopenharmony_ci * 2758c2ecf20Sopenharmony_ci * Returns 0: line not unlocked 2768c2ecf20Sopenharmony_ci * 1: line unlocked 2778c2ecf20Sopenharmony_ci */ 2788c2ecf20Sopenharmony_ciint cvmx_l2c_unlock_line(uint64_t address); 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci/** 2818c2ecf20Sopenharmony_ci * Unlocks a region of memory that is locked in the L2 cache 2828c2ecf20Sopenharmony_ci * 2838c2ecf20Sopenharmony_ci * @start: start physical address 2848c2ecf20Sopenharmony_ci * @len: length (in bytes) to unlock 2858c2ecf20Sopenharmony_ci * 2868c2ecf20Sopenharmony_ci * Returns Number of locked lines that the call unlocked 2878c2ecf20Sopenharmony_ci */ 2888c2ecf20Sopenharmony_ciint cvmx_l2c_unlock_mem_region(uint64_t start, uint64_t len); 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci/** 2918c2ecf20Sopenharmony_ci * Read the L2 controller tag for a given location in L2 2928c2ecf20Sopenharmony_ci * 2938c2ecf20Sopenharmony_ci * @association: 2948c2ecf20Sopenharmony_ci * Which association to read line from 2958c2ecf20Sopenharmony_ci * @index: Which way to read from. 2968c2ecf20Sopenharmony_ci * 2978c2ecf20Sopenharmony_ci * Returns l2c tag structure for line requested. 2988c2ecf20Sopenharmony_ci */ 2998c2ecf20Sopenharmony_ciunion cvmx_l2c_tag cvmx_l2c_get_tag(uint32_t association, uint32_t index); 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci/* Wrapper providing a deprecated old function name */ 3028c2ecf20Sopenharmony_cistatic inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, 3038c2ecf20Sopenharmony_ci uint32_t index) 3048c2ecf20Sopenharmony_ci __attribute__((deprecated)); 3058c2ecf20Sopenharmony_cistatic inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, 3068c2ecf20Sopenharmony_ci uint32_t index) 3078c2ecf20Sopenharmony_ci{ 3088c2ecf20Sopenharmony_ci return cvmx_l2c_get_tag(association, index); 3098c2ecf20Sopenharmony_ci} 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/** 3138c2ecf20Sopenharmony_ci * Returns the cache index for a given physical address 3148c2ecf20Sopenharmony_ci * 3158c2ecf20Sopenharmony_ci * @addr: physical address 3168c2ecf20Sopenharmony_ci * 3178c2ecf20Sopenharmony_ci * Returns L2 cache index 3188c2ecf20Sopenharmony_ci */ 3198c2ecf20Sopenharmony_ciuint32_t cvmx_l2c_address_to_index(uint64_t addr); 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci/** 3228c2ecf20Sopenharmony_ci * Flushes (and unlocks) the entire L2 cache. 3238c2ecf20Sopenharmony_ci * IMPORTANT: Must only be run by one core at a time due to use 3248c2ecf20Sopenharmony_ci * of L2C debug features. 3258c2ecf20Sopenharmony_ci */ 3268c2ecf20Sopenharmony_civoid cvmx_l2c_flush(void); 3278c2ecf20Sopenharmony_ci 3288c2ecf20Sopenharmony_ci/** 3298c2ecf20Sopenharmony_ci * 3308c2ecf20Sopenharmony_ci * Returns the size of the L2 cache in bytes, 3318c2ecf20Sopenharmony_ci * -1 on error (unrecognized model) 3328c2ecf20Sopenharmony_ci */ 3338c2ecf20Sopenharmony_ciint cvmx_l2c_get_cache_size_bytes(void); 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci/** 3368c2ecf20Sopenharmony_ci * Return the number of sets in the L2 Cache 3378c2ecf20Sopenharmony_ci * 3388c2ecf20Sopenharmony_ci * Returns 3398c2ecf20Sopenharmony_ci */ 3408c2ecf20Sopenharmony_ciint cvmx_l2c_get_num_sets(void); 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci/** 3438c2ecf20Sopenharmony_ci * Return log base 2 of the number of sets in the L2 cache 3448c2ecf20Sopenharmony_ci * Returns 3458c2ecf20Sopenharmony_ci */ 3468c2ecf20Sopenharmony_ciint cvmx_l2c_get_set_bits(void); 3478c2ecf20Sopenharmony_ci/** 3488c2ecf20Sopenharmony_ci * Return the number of associations in the L2 Cache 3498c2ecf20Sopenharmony_ci * 3508c2ecf20Sopenharmony_ci * Returns 3518c2ecf20Sopenharmony_ci */ 3528c2ecf20Sopenharmony_ciint cvmx_l2c_get_num_assoc(void); 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/** 3558c2ecf20Sopenharmony_ci * Flush a line from the L2 cache 3568c2ecf20Sopenharmony_ci * This should only be called from one core at a time, as this routine 3578c2ecf20Sopenharmony_ci * sets the core to the 'debug' core in order to flush the line. 3588c2ecf20Sopenharmony_ci * 3598c2ecf20Sopenharmony_ci * @assoc: Association (or way) to flush 3608c2ecf20Sopenharmony_ci * @index: Index to flush 3618c2ecf20Sopenharmony_ci */ 3628c2ecf20Sopenharmony_civoid cvmx_l2c_flush_line(uint32_t assoc, uint32_t index); 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci#endif /* __CVMX_L2C_H__ */ 365