18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*  *********************************************************************
38c2ecf20Sopenharmony_ci    *  SB1250 Board Support Package
48c2ecf20Sopenharmony_ci    *
58c2ecf20Sopenharmony_ci    *  L2 Cache constants and macros		File: sb1250_l2c.h
68c2ecf20Sopenharmony_ci    *
78c2ecf20Sopenharmony_ci    *  This module contains constants useful for manipulating the
88c2ecf20Sopenharmony_ci    *  level 2 cache.
98c2ecf20Sopenharmony_ci    *
108c2ecf20Sopenharmony_ci    *  SB1250 specification level:  User's manual 1/02/02
118c2ecf20Sopenharmony_ci    *
128c2ecf20Sopenharmony_ci    *********************************************************************
138c2ecf20Sopenharmony_ci    *
148c2ecf20Sopenharmony_ci    *  Copyright 2000,2001,2002,2003
158c2ecf20Sopenharmony_ci    *  Broadcom Corporation. All rights reserved.
168c2ecf20Sopenharmony_ci    *
178c2ecf20Sopenharmony_ci    ********************************************************************* */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#ifndef _SB1250_L2C_H
218c2ecf20Sopenharmony_ci#define _SB1250_L2C_H
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#include <asm/sibyte/sb1250_defs.h>
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * Level 2 Cache Tag register (Table 5-3)
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define S_L2C_TAG_MBZ		    0
308c2ecf20Sopenharmony_ci#define M_L2C_TAG_MBZ		    _SB_MAKEMASK(5, S_L2C_TAG_MBZ)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define S_L2C_TAG_INDEX		    5
338c2ecf20Sopenharmony_ci#define M_L2C_TAG_INDEX		    _SB_MAKEMASK(12, S_L2C_TAG_INDEX)
348c2ecf20Sopenharmony_ci#define V_L2C_TAG_INDEX(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_INDEX)
358c2ecf20Sopenharmony_ci#define G_L2C_TAG_INDEX(x)	    _SB_GETVALUE(x, S_L2C_TAG_INDEX, M_L2C_TAG_INDEX)
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define S_L2C_TAG_TAG		    17
388c2ecf20Sopenharmony_ci#define M_L2C_TAG_TAG		    _SB_MAKEMASK(23, S_L2C_TAG_TAG)
398c2ecf20Sopenharmony_ci#define V_L2C_TAG_TAG(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_TAG)
408c2ecf20Sopenharmony_ci#define G_L2C_TAG_TAG(x)	    _SB_GETVALUE(x, S_L2C_TAG_TAG, M_L2C_TAG_TAG)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define S_L2C_TAG_ECC		    40
438c2ecf20Sopenharmony_ci#define M_L2C_TAG_ECC		    _SB_MAKEMASK(6, S_L2C_TAG_ECC)
448c2ecf20Sopenharmony_ci#define V_L2C_TAG_ECC(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_ECC)
458c2ecf20Sopenharmony_ci#define G_L2C_TAG_ECC(x)	    _SB_GETVALUE(x, S_L2C_TAG_ECC, M_L2C_TAG_ECC)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define S_L2C_TAG_WAY		    46
488c2ecf20Sopenharmony_ci#define M_L2C_TAG_WAY		    _SB_MAKEMASK(2, S_L2C_TAG_WAY)
498c2ecf20Sopenharmony_ci#define V_L2C_TAG_WAY(x)	    _SB_MAKEVALUE(x, S_L2C_TAG_WAY)
508c2ecf20Sopenharmony_ci#define G_L2C_TAG_WAY(x)	    _SB_GETVALUE(x, S_L2C_TAG_WAY, M_L2C_TAG_WAY)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define M_L2C_TAG_DIRTY		    _SB_MAKEMASK1(48)
538c2ecf20Sopenharmony_ci#define M_L2C_TAG_VALID		    _SB_MAKEMASK1(49)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci * Format of level 2 cache management address (table 5-2)
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define S_L2C_MGMT_INDEX	    5
608c2ecf20Sopenharmony_ci#define M_L2C_MGMT_INDEX	    _SB_MAKEMASK(12, S_L2C_MGMT_INDEX)
618c2ecf20Sopenharmony_ci#define V_L2C_MGMT_INDEX(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_INDEX)
628c2ecf20Sopenharmony_ci#define G_L2C_MGMT_INDEX(x)	    _SB_GETVALUE(x, S_L2C_MGMT_INDEX, M_L2C_MGMT_INDEX)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define S_L2C_MGMT_QUADRANT	    15
658c2ecf20Sopenharmony_ci#define M_L2C_MGMT_QUADRANT	    _SB_MAKEMASK(2, S_L2C_MGMT_QUADRANT)
668c2ecf20Sopenharmony_ci#define V_L2C_MGMT_QUADRANT(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_QUADRANT)
678c2ecf20Sopenharmony_ci#define G_L2C_MGMT_QUADRANT(x)	    _SB_GETVALUE(x, S_L2C_MGMT_QUADRANT, M_L2C_MGMT_QUADRANT)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define S_L2C_MGMT_HALF		    16
708c2ecf20Sopenharmony_ci#define M_L2C_MGMT_HALF		    _SB_MAKEMASK(1, S_L2C_MGMT_HALF)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define S_L2C_MGMT_WAY		    17
738c2ecf20Sopenharmony_ci#define M_L2C_MGMT_WAY		    _SB_MAKEMASK(2, S_L2C_MGMT_WAY)
748c2ecf20Sopenharmony_ci#define V_L2C_MGMT_WAY(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_WAY)
758c2ecf20Sopenharmony_ci#define G_L2C_MGMT_WAY(x)	    _SB_GETVALUE(x, S_L2C_MGMT_WAY, M_L2C_MGMT_WAY)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define S_L2C_MGMT_ECC_DIAG	    21
788c2ecf20Sopenharmony_ci#define M_L2C_MGMT_ECC_DIAG	    _SB_MAKEMASK(2, S_L2C_MGMT_ECC_DIAG)
798c2ecf20Sopenharmony_ci#define V_L2C_MGMT_ECC_DIAG(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_ECC_DIAG)
808c2ecf20Sopenharmony_ci#define G_L2C_MGMT_ECC_DIAG(x)	    _SB_GETVALUE(x, S_L2C_MGMT_ECC_DIAG, M_L2C_MGMT_ECC_DIAG)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define S_L2C_MGMT_TAG		    23
838c2ecf20Sopenharmony_ci#define M_L2C_MGMT_TAG		    _SB_MAKEMASK(4, S_L2C_MGMT_TAG)
848c2ecf20Sopenharmony_ci#define V_L2C_MGMT_TAG(x)	    _SB_MAKEVALUE(x, S_L2C_MGMT_TAG)
858c2ecf20Sopenharmony_ci#define G_L2C_MGMT_TAG(x)	    _SB_GETVALUE(x, S_L2C_MGMT_TAG, M_L2C_MGMT_TAG)
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define M_L2C_MGMT_DIRTY	    _SB_MAKEMASK1(19)
888c2ecf20Sopenharmony_ci#define M_L2C_MGMT_VALID	    _SB_MAKEMASK1(20)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define A_L2C_MGMT_TAG_BASE	    0x00D0000000
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define L2C_ENTRIES_PER_WAY	  4096
938c2ecf20Sopenharmony_ci#define L2C_NUM_WAYS		  4
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
978c2ecf20Sopenharmony_ci/*
988c2ecf20Sopenharmony_ci * L2 Read Misc. register (A_L2_READ_MISC)
998c2ecf20Sopenharmony_ci */
1008c2ecf20Sopenharmony_ci#define S_L2C_MISC_NO_WAY		10
1018c2ecf20Sopenharmony_ci#define M_L2C_MISC_NO_WAY		_SB_MAKEMASK(4, S_L2C_MISC_NO_WAY)
1028c2ecf20Sopenharmony_ci#define V_L2C_MISC_NO_WAY(x)		_SB_MAKEVALUE(x, S_L2C_MISC_NO_WAY)
1038c2ecf20Sopenharmony_ci#define G_L2C_MISC_NO_WAY(x)		_SB_GETVALUE(x, S_L2C_MISC_NO_WAY, M_L2C_MISC_NO_WAY)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define M_L2C_MISC_ECC_CLEANUP_DIS	_SB_MAKEMASK1(9)
1068c2ecf20Sopenharmony_ci#define M_L2C_MISC_MC_PRIO_LOW		_SB_MAKEMASK1(8)
1078c2ecf20Sopenharmony_ci#define M_L2C_MISC_SOFT_DISABLE_T	_SB_MAKEMASK1(7)
1088c2ecf20Sopenharmony_ci#define M_L2C_MISC_SOFT_DISABLE_B	_SB_MAKEMASK1(6)
1098c2ecf20Sopenharmony_ci#define M_L2C_MISC_SOFT_DISABLE_R	_SB_MAKEMASK1(5)
1108c2ecf20Sopenharmony_ci#define M_L2C_MISC_SOFT_DISABLE_L	_SB_MAKEMASK1(4)
1118c2ecf20Sopenharmony_ci#define M_L2C_MISC_SCACHE_DISABLE_T	_SB_MAKEMASK1(3)
1128c2ecf20Sopenharmony_ci#define M_L2C_MISC_SCACHE_DISABLE_B	_SB_MAKEMASK1(2)
1138c2ecf20Sopenharmony_ci#define M_L2C_MISC_SCACHE_DISABLE_R	_SB_MAKEMASK1(1)
1148c2ecf20Sopenharmony_ci#define M_L2C_MISC_SCACHE_DISABLE_L	_SB_MAKEMASK1(0)
1158c2ecf20Sopenharmony_ci#endif /* 1250 PASS3 || 112x PASS1 */
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#endif
119