1 //
2 // cache.c -- cache management routines
3 //
4 // $Id: //depot/rel/Foxhill/dot.8/Xtensa/OS/hal/cache.c#1 $
5 
6 // Copyright (c) 2002 Tensilica Inc.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining
9 // a copy of this software and associated documentation files (the
10 // "Software"), to deal in the Software without restriction, including
11 // without limitation the rights to use, copy, modify, merge, publish,
12 // distribute, sublicense, and/or sell copies of the Software, and to
13 // permit persons to whom the Software is furnished to do so, subject to
14 // the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included
17 // in all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 
27 #include <xtensa/config/core.h>
28 
29 // size of the cache lines in log2(bytes)
30 const unsigned char Xthal_icache_linewidth = XCHAL_ICACHE_LINEWIDTH;
31 const unsigned char Xthal_dcache_linewidth = XCHAL_DCACHE_LINEWIDTH;
32 
33 // size of the cache lines in bytes
34 const unsigned short Xthal_icache_linesize = XCHAL_ICACHE_LINESIZE;
35 const unsigned short Xthal_dcache_linesize = XCHAL_DCACHE_LINESIZE;
36 
37 // number of cache sets in log2(lines per way)
38 const unsigned char Xthal_icache_setwidth = XCHAL_ICACHE_SETWIDTH;
39 const unsigned char Xthal_dcache_setwidth = XCHAL_DCACHE_SETWIDTH;
40 
41 // cache set associativity (number of ways)
42 const unsigned int Xthal_icache_ways = XCHAL_ICACHE_WAYS;
43 const unsigned int Xthal_dcache_ways = XCHAL_DCACHE_WAYS;
44 
45 // size of the caches in bytes (ways * 2^(linewidth + setwidth))
46 const unsigned int Xthal_icache_size = XCHAL_ICACHE_SIZE;
47 const unsigned int Xthal_dcache_size = XCHAL_DCACHE_SIZE;
48 
49 // cache features
50 const unsigned char Xthal_dcache_is_writeback  = XCHAL_DCACHE_IS_WRITEBACK;
51 const unsigned char Xthal_icache_line_lockable = XCHAL_ICACHE_LINE_LOCKABLE;
52 const unsigned char Xthal_dcache_line_lockable = XCHAL_DCACHE_LINE_LOCKABLE;
53 
54