Skip to content

Commit 1e9cae2

Browse files
committed
cache: change in cache functions definition
Makes cache functions available based on XCHAL_DCACHE_SIZE and XCHAL_ICACHE_SIZE rather than specific platform. Also fixes those definitions for BYT and CHT. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
1 parent 156d946 commit 1e9cae2

3 files changed

Lines changed: 21 additions & 22 deletions

File tree

src/arch/xtensa/include/arch/cache.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,36 @@
3333

3434
#include <stdint.h>
3535
#include <stddef.h>
36+
#include <xtensa/config/core.h>
3637
#include <xtensa/hal.h>
3738

38-
#if defined CONFIG_BAYTRAIL || defined CONFIG_CHERRYTRAIL ||\
39-
defined CONFIG_HASWELL || defined CONFIG_BROADWELL
40-
41-
static inline void dcache_writeback_region(void *addr, size_t size) {}
42-
static inline void dcache_invalidate_region(void *addr, size_t size) {}
43-
static inline void icache_invalidate_region(void *addr, size_t size) {}
44-
static inline void dcache_writeback_invalidate_region(void *addr, size_t size) {}
45-
#else
46-
4739
static inline void dcache_writeback_region(void *addr, size_t size)
4840
{
41+
#if XCHAL_DCACHE_SIZE > 0
4942
xthal_dcache_region_writeback(addr, size);
43+
#endif
5044
}
5145

5246
static inline void dcache_invalidate_region(void *addr, size_t size)
5347
{
48+
#if XCHAL_DCACHE_SIZE > 0
5449
xthal_dcache_region_invalidate(addr, size);
50+
#endif
5551
}
5652

5753
static inline void icache_invalidate_region(void *addr, size_t size)
5854
{
55+
#if XCHAL_ICACHE_SIZE > 0
5956
xthal_icache_region_invalidate(addr, size);
57+
#endif
6058
}
6159

6260
static inline void dcache_writeback_invalidate_region(void *addr, size_t size)
6361
{
62+
#if XCHAL_DCACHE_SIZE > 0
6463
xthal_dcache_region_writeback_inv(addr, size);
64+
#endif
6565
}
6666

6767
#endif
68-
#endif
6968

src/platform/baytrail/include/arch/xtensa/config/core-isa-byt.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@
213213
#define XCHAL_ICACHE_LINEWIDTH 7 /* log2(I line size in bytes) */
214214
#define XCHAL_DCACHE_LINEWIDTH 7 /* log2(D line size in bytes) */
215215

216-
#define XCHAL_ICACHE_SIZE 49152 /* I-cache size in bytes or 0 */
217-
#define XCHAL_DCACHE_SIZE 98304 /* D-cache size in bytes or 0 */
216+
#define XCHAL_ICACHE_SIZE 0 /* I-cache size in bytes or 0 */
217+
#define XCHAL_DCACHE_SIZE 0 /* D-cache size in bytes or 0 */
218218

219-
#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */
219+
#define XCHAL_DCACHE_IS_WRITEBACK 0 /* writeback feature */
220220
#define XCHAL_DCACHE_IS_COHERENT 0 /* MP coherence feature */
221221

222-
#define XCHAL_HAVE_PREFETCH 1 /* PREFCTL register */
222+
#define XCHAL_HAVE_PREFETCH 0 /* PREFCTL register */
223223
#define XCHAL_HAVE_PREFETCH_L1 0 /* prefetch to L1 dcache */
224-
#define XCHAL_PREFETCH_CASTOUT_LINES 1 /* dcache pref. castout bufsz */
225-
#define XCHAL_PREFETCH_ENTRIES 8 /* cache prefetch entries */
224+
#define XCHAL_PREFETCH_CASTOUT_LINES 0 /* dcache pref. castout bufsz */
225+
#define XCHAL_PREFETCH_ENTRIES 0 /* cache prefetch entries */
226226
#define XCHAL_PREFETCH_BLOCK_ENTRIES 0 /* prefetch block streams */
227227
#define XCHAL_HAVE_CACHE_BLOCKOPS 0 /* block prefetch for caches */
228228
#define XCHAL_HAVE_ICACHE_TEST 0 /* Icache test instructions */

src/platform/baytrail/include/arch/xtensa/config/core-isa-cht.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@
213213
#define XCHAL_ICACHE_LINEWIDTH 7 /* log2(I line size in bytes) */
214214
#define XCHAL_DCACHE_LINEWIDTH 7 /* log2(D line size in bytes) */
215215

216-
#define XCHAL_ICACHE_SIZE 49152 /* I-cache size in bytes or 0 */
217-
#define XCHAL_DCACHE_SIZE 98304 /* D-cache size in bytes or 0 */
216+
#define XCHAL_ICACHE_SIZE 0 /* I-cache size in bytes or 0 */
217+
#define XCHAL_DCACHE_SIZE 0 /* D-cache size in bytes or 0 */
218218

219-
#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */
219+
#define XCHAL_DCACHE_IS_WRITEBACK 0 /* writeback feature */
220220
#define XCHAL_DCACHE_IS_COHERENT 0 /* MP coherence feature */
221221

222-
#define XCHAL_HAVE_PREFETCH 1 /* PREFCTL register */
222+
#define XCHAL_HAVE_PREFETCH 0 /* PREFCTL register */
223223
#define XCHAL_HAVE_PREFETCH_L1 0 /* prefetch to L1 dcache */
224-
#define XCHAL_PREFETCH_CASTOUT_LINES 1 /* dcache pref. castout bufsz */
225-
#define XCHAL_PREFETCH_ENTRIES 8 /* cache prefetch entries */
224+
#define XCHAL_PREFETCH_CASTOUT_LINES 0 /* dcache pref. castout bufsz */
225+
#define XCHAL_PREFETCH_ENTRIES 0 /* cache prefetch entries */
226226
#define XCHAL_PREFETCH_BLOCK_ENTRIES 0 /* prefetch block streams */
227227
#define XCHAL_HAVE_CACHE_BLOCKOPS 0 /* block prefetch for caches */
228228
#define XCHAL_HAVE_ICACHE_TEST 0 /* Icache test instructions */

0 commit comments

Comments
 (0)