1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*  *********************************************************************
3     *  SB1250 Board Support Package
4     *
5     *  L2 Cache constants and macros		File: sb1250_l2c.h
6     *
7     *  This module contains constants useful for manipulating the
8     *  level 2 cache.
9     *
10     *  SB1250 specification level:  User's manual 1/02/02
11     *
12     *********************************************************************
13     *
14     *  Copyright 2000,2001,2002,2003
15     *  Broadcom Corporation. All rights reserved.
16     *
17     ********************************************************************* */
18 
19 
20 #ifndef _SB1250_L2C_H
21 #define _SB1250_L2C_H
22 
23 #include <asm/sibyte/sb1250_defs.h>
24 
25 /*
26  * Level 2 Cache Tag register (Table 5-3)
27  */
28 
29 #define S_L2C_TAG_MBZ		    0
30 #define M_L2C_TAG_MBZ		    _SB_MAKEMASK(5, S_L2C_TAG_MBZ)
31 
32 #define S_L2C_TAG_INDEX		    5
33 #define M_L2C_TAG_INDEX		    _SB_MAKEMASK(12, S_L2C_TAG_INDEX)
34 #define V_L2C_TAG_INDEX(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_INDEX)
35 #define G_L2C_TAG_INDEX(x)	    _SB_GETVALUE(x, S_L2C_TAG_INDEX, M_L2C_TAG_INDEX)
36 
37 #define S_L2C_TAG_TAG		    17
38 #define M_L2C_TAG_TAG		    _SB_MAKEMASK(23, S_L2C_TAG_TAG)
39 #define V_L2C_TAG_TAG(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_TAG)
40 #define G_L2C_TAG_TAG(x)	    _SB_GETVALUE(x, S_L2C_TAG_TAG, M_L2C_TAG_TAG)
41 
42 #define S_L2C_TAG_ECC		    40
43 #define M_L2C_TAG_ECC		    _SB_MAKEMASK(6, S_L2C_TAG_ECC)
44 #define V_L2C_TAG_ECC(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_ECC)
45 #define G_L2C_TAG_ECC(x)	    _SB_GETVALUE(x, S_L2C_TAG_ECC, M_L2C_TAG_ECC)
46 
47 #define S_L2C_TAG_WAY		    46
48 #define M_L2C_TAG_WAY		    _SB_MAKEMASK(2, S_L2C_TAG_WAY)
49 #define V_L2C_TAG_WAY(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_WAY)
50 #define G_L2C_TAG_WAY(x)	    _SB_GETVALUE(x, S_L2C_TAG_WAY, M_L2C_TAG_WAY)
51 
52 #define M_L2C_TAG_DIRTY		    _SB_MAKEMASK1(48)
53 #define M_L2C_TAG_VALID		    _SB_MAKEMASK1(49)
54 
55 /*
56  * Format of level 2 cache management address (table 5-2)
57  */
58 
59 #define S_L2C_MGMT_INDEX	    5
60 #define M_L2C_MGMT_INDEX	    _SB_MAKEMASK(12, S_L2C_MGMT_INDEX)
61 #define V_L2C_MGMT_INDEX(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_INDEX)
62 #define G_L2C_MGMT_INDEX(x)	    _SB_GETVALUE(x, S_L2C_MGMT_INDEX, M_L2C_MGMT_INDEX)
63 
64 #define S_L2C_MGMT_QUADRANT	    15
65 #define M_L2C_MGMT_QUADRANT	    _SB_MAKEMASK(2, S_L2C_MGMT_QUADRANT)
66 #define V_L2C_MGMT_QUADRANT(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_QUADRANT)
67 #define G_L2C_MGMT_QUADRANT(x)	    _SB_GETVALUE(x, S_L2C_MGMT_QUADRANT, M_L2C_MGMT_QUADRANT)
68 
69 #define S_L2C_MGMT_HALF		    16
70 #define M_L2C_MGMT_HALF		    _SB_MAKEMASK(1, S_L2C_MGMT_HALF)
71 
72 #define S_L2C_MGMT_WAY		    17
73 #define M_L2C_MGMT_WAY		    _SB_MAKEMASK(2, S_L2C_MGMT_WAY)
74 #define V_L2C_MGMT_WAY(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_WAY)
75 #define G_L2C_MGMT_WAY(x)	    _SB_GETVALUE(x, S_L2C_MGMT_WAY, M_L2C_MGMT_WAY)
76 
77 #define S_L2C_MGMT_ECC_DIAG	    21
78 #define M_L2C_MGMT_ECC_DIAG	    _SB_MAKEMASK(2, S_L2C_MGMT_ECC_DIAG)
79 #define V_L2C_MGMT_ECC_DIAG(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_ECC_DIAG)
80 #define G_L2C_MGMT_ECC_DIAG(x)	    _SB_GETVALUE(x, S_L2C_MGMT_ECC_DIAG, M_L2C_MGMT_ECC_DIAG)
81 
82 #define S_L2C_MGMT_TAG		    23
83 #define M_L2C_MGMT_TAG		    _SB_MAKEMASK(4, S_L2C_MGMT_TAG)
84 #define V_L2C_MGMT_TAG(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_TAG)
85 #define G_L2C_MGMT_TAG(x)	    _SB_GETVALUE(x, S_L2C_MGMT_TAG, M_L2C_MGMT_TAG)
86 
87 #define M_L2C_MGMT_DIRTY	    _SB_MAKEMASK1(19)
88 #define M_L2C_MGMT_VALID	    _SB_MAKEMASK1(20)
89 
90 #define A_L2C_MGMT_TAG_BASE	    0x00D0000000
91 
92 #define L2C_ENTRIES_PER_WAY	  4096
93 #define L2C_NUM_WAYS		  4
94 
95 
96 #if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
97 /*
98  * L2 Read Misc. register (A_L2_READ_MISC)
99  */
100 #define S_L2C_MISC_NO_WAY		10
101 #define M_L2C_MISC_NO_WAY		_SB_MAKEMASK(4, S_L2C_MISC_NO_WAY)
102 #define V_L2C_MISC_NO_WAY(x)		_SB_MAKEVALUE(x, S_L2C_MISC_NO_WAY)
103 #define G_L2C_MISC_NO_WAY(x)		_SB_GETVALUE(x, S_L2C_MISC_NO_WAY, M_L2C_MISC_NO_WAY)
104 
105 #define M_L2C_MISC_ECC_CLEANUP_DIS	_SB_MAKEMASK1(9)
106 #define M_L2C_MISC_MC_PRIO_LOW		_SB_MAKEMASK1(8)
107 #define M_L2C_MISC_SOFT_DISABLE_T	_SB_MAKEMASK1(7)
108 #define M_L2C_MISC_SOFT_DISABLE_B	_SB_MAKEMASK1(6)
109 #define M_L2C_MISC_SOFT_DISABLE_R	_SB_MAKEMASK1(5)
110 #define M_L2C_MISC_SOFT_DISABLE_L	_SB_MAKEMASK1(4)
111 #define M_L2C_MISC_SCACHE_DISABLE_T	_SB_MAKEMASK1(3)
112 #define M_L2C_MISC_SCACHE_DISABLE_B	_SB_MAKEMASK1(2)
113 #define M_L2C_MISC_SCACHE_DISABLE_R	_SB_MAKEMASK1(1)
114 #define M_L2C_MISC_SCACHE_DISABLE_L	_SB_MAKEMASK1(0)
115 #endif /* 1250 PASS3 || 112x PASS1 */
116 
117 
118 #endif
119