Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cvmx-l2c.h
Go to the documentation of this file.
1 /***********************license start***************
2  * Author: Cavium Networks
3  *
4  * Contact: [email protected]
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 
28 /*
29  * Interface to the Level 2 Cache (L2C) control, measurement, and debugging
30  * facilities.
31  */
32 
33 #ifndef __CVMX_L2C_H__
34 #define __CVMX_L2C_H__
35 
36 #define CVMX_L2_ASSOC cvmx_l2c_get_num_assoc() /* Deprecated macro, use function */
37 #define CVMX_L2_SET_BITS cvmx_l2c_get_set_bits() /* Deprecated macro, use function */
38 #define CVMX_L2_SETS cvmx_l2c_get_num_sets() /* Deprecated macro, use function */
39 
40 
41 #define CVMX_L2C_IDX_ADDR_SHIFT 7 /* based on 128 byte cache line size */
42 #define CVMX_L2C_IDX_MASK (cvmx_l2c_get_num_sets() - 1)
43 
44 /* Defines for index aliasing computations */
45 #define CVMX_L2C_TAG_ADDR_ALIAS_SHIFT (CVMX_L2C_IDX_ADDR_SHIFT + cvmx_l2c_get_set_bits())
46 #define CVMX_L2C_ALIAS_MASK (CVMX_L2C_IDX_MASK << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT)
47 #define CVMX_L2C_MEMBANK_SELECT_SIZE 4096
48 
49 /* Defines for Virtualizations, valid only from Octeon II onwards. */
50 #define CVMX_L2C_VRT_MAX_VIRTID_ALLOWED ((OCTEON_IS_MODEL(OCTEON_CN63XX)) ? 64 : 0)
51 #define CVMX_L2C_VRT_MAX_MEMSZ_ALLOWED ((OCTEON_IS_MODEL(OCTEON_CN63XX)) ? 32 : 0)
52 
53 union cvmx_l2c_tag {
55  struct {
57  uint64_t V:1; /* Line valid */
58  uint64_t D:1; /* Line dirty */
59  uint64_t L:1; /* Line locked */
60  uint64_t U:1; /* Use, LRU eviction */
61  uint64_t addr:32; /* Phys mem (not all bits valid) */
62  } s;
63 };
64 
65 /* Number of L2C Tag-and-data sections (TADs) that are connected to LMC. */
66 #define CVMX_L2C_TADS 1
67 
68  /* L2C Performance Counter events. */
125 };
126 
127 /* L2C Performance Counter events for Octeon2. */
156 };
157 
170 
180 
191 
209 
218 
235 
236 
246 
264 
278 
288 
299 
300 /* Wrapper providing a deprecated old function name */
301 static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, uint32_t index) __attribute__((deprecated));
302 static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, uint32_t index)
303 {
304  return cvmx_l2c_get_tag(association, index);
305 }
306 
307 
316 
322 void cvmx_l2c_flush(void);
323 
330 
336 int cvmx_l2c_get_num_sets(void);
337 
342 int cvmx_l2c_get_set_bits(void);
348 int cvmx_l2c_get_num_assoc(void);
349 
359 
360 #endif /* __CVMX_L2C_H__ */