1 /* *********************************************************************
2 * SB1250 Board Support Package
4 * L1C initialization File: bcmcore_l1cache.S
6 * This module contains code to initialize the CPU's caches
8 * Note: all the routines in this module rely on registers only,
9 * since DRAM may not be active yet.
11 * Author: Mitch Lichtenberg (mpl@broadcom.com)
13 *********************************************************************
15 * XX Copyright 2000,2001
16 * Broadcom Corporation. All rights reserved.
18 * BROADCOM PROPRIETARY AND CONFIDENTIAL
20 * This software is furnished under license and may be used and
21 * copied only in accordance with the license.
22 ********************************************************************* */
25 #include "bsp_config.h"
32 /* *********************************************************************
33 * BCMCORE_L1CACHE_INIT()
35 * Initialize the L1 Cache
45 ********************************************************************* */
47 LEAF(bcmcore_l1cache_init)
56 * Sets Per Way = 64 << CFG_IS
66 * Associativity = 1 + CFG_IA
75 * Associativity * Sets Per Way
82 * Line Size = 2 << CFG_IL
92 * Instruction Cache Size =
93 * Associativity * Line Size * Sets Per Way
107 cache Index_Store_Tag_I,0(t1)
118 * Sets Per Way = 64 << CFG_DS
129 * Associativity = 1 + CFG_DA
138 * Associativity * Sets Per Way
145 * Line Size = 2 << CFG_DL
156 * Associativity * Line Size * Sets Per Way
168 beqz t1,r1 # t1 == 0 if mips32r1
170 mtc0 zero,C0_TAGLO,2 # For mips32r2 the D$ Tags are in select 2
175 r1: mtc0 zero,C0_TAGLO
180 cache Index_Store_Tag_D,0(t1)
184 # Now make K0 cacheable
186 mfc0 v0,C0_CONFIG # get current CONFIG register
187 srl v0,v0,3 # strip out K0 bits
188 sll v0,v0,3 # k0 bits now zero
189 or v0,v0,K_CFG_K0COH_CACHEABLE # K0 is cacheable.
195 END(bcmcore_l1cache_init)
197 /* *********************************************************************
198 * BCMCORE_L1CACHE_INVAL_I()
200 * Invalidate the entire ICache
210 ********************************************************************* */
212 LEAF(bcmcore_l1cache_inval_i)
221 * Sets Per Way = 64 << CFG_IS
231 * Associativity = 1 + CFG_IA
240 * Associativity * Sets Per Way
247 * Line Size = 2 << CFG_IL
257 * Instruction Cache Size =
258 * Associativity * Line Size * Sets Per Way
265 * Invalidate the icache
272 cache Index_Invalidate_I,0(t1)
278 END(bcmcore_l1cache_inval_i)
280 /* *********************************************************************
281 * BCMCORE_L1CACHE_FLUSH_D()
283 * Flush the entire DCache
293 ********************************************************************* */
295 LEAF(bcmcore_l1cache_flush_d)
304 * Sets Per Way = 64 << CFG_DS
315 * Associativity = 1 + CFG_DA
324 * Associativity * Sets Per Way
331 * Line Size = 2 << CFG_DL
342 * Associativity * Line Size * Sets Per Way
356 cache Index_Writeback_Inv_D,0(t1)
362 END(bcmcore_l1cache_flush_d)
367 /* *********************************************************************
369 ********************************************************************* */