summaryrefslogtreecommitdiff
path: root/libcpu/mips/common/mips_cache.h
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-05-28 16:20:08 +0800
committerGitHub <[email protected]>2021-05-28 16:20:08 +0800
commit92beddf3bccf6346e26aa097f82464456fb8e6bd (patch)
tree197e4a108118dda016ea02274172f0c40e7ee8ed /libcpu/mips/common/mips_cache.h
parentb18a99b44240ec3152011e159cc24a5af8dff0ce (diff)
parent03f4d40e30f3c94e1db0b3a65b3610dee695694a (diff)
Merge pull request #4737 from mysterywolf/3,1,xformatv3.1.5
[lts 3.1.x] format codes
Diffstat (limited to 'libcpu/mips/common/mips_cache.h')
-rw-r--r--libcpu/mips/common/mips_cache.h96
1 files changed, 48 insertions, 48 deletions
diff --git a/libcpu/mips/common/mips_cache.h b/libcpu/mips/common/mips_cache.h
index 17a728df7e..c260ed3047 100644
--- a/libcpu/mips/common/mips_cache.h
+++ b/libcpu/mips/common/mips_cache.h
@@ -106,7 +106,7 @@ enum dma_data_direction
#define INDEX_STORE_DATA_D 0x1d
#define INDEX_STORE_DATA_S 0x1f
-#define cache_op(op, addr) \
+#define cache_op(op, addr) \
__asm__ __volatile__( \
".set push\n" \
".set noreorder\n" \
@@ -116,95 +116,95 @@ enum dma_data_direction
: \
: "i" (op), "R" (*(unsigned char *)(addr)))
-#define cache16_unroll32(base, op) \
- __asm__ __volatile__( \
- " .set noreorder \n" \
- " .set mips3 \n" \
- " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \
- " cache %1, 0x020(%0); cache %1, 0x030(%0) \n" \
- " cache %1, 0x040(%0); cache %1, 0x050(%0) \n" \
- " cache %1, 0x060(%0); cache %1, 0x070(%0) \n" \
- " cache %1, 0x080(%0); cache %1, 0x090(%0) \n" \
- " cache %1, 0x0a0(%0); cache %1, 0x0b0(%0) \n" \
- " cache %1, 0x0c0(%0); cache %1, 0x0d0(%0) \n" \
- " cache %1, 0x0e0(%0); cache %1, 0x0f0(%0) \n" \
- " cache %1, 0x100(%0); cache %1, 0x110(%0) \n" \
- " cache %1, 0x120(%0); cache %1, 0x130(%0) \n" \
- " cache %1, 0x140(%0); cache %1, 0x150(%0) \n" \
- " cache %1, 0x160(%0); cache %1, 0x170(%0) \n" \
- " cache %1, 0x180(%0); cache %1, 0x190(%0) \n" \
- " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \
- " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \
- " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \
- " .set mips0 \n" \
- " .set reorder \n" \
- : \
- : "r" (base), \
- "i" (op));
+#define cache16_unroll32(base, op) \
+ __asm__ __volatile__( \
+ " .set noreorder \n" \
+ " .set mips3 \n" \
+ " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \
+ " cache %1, 0x020(%0); cache %1, 0x030(%0) \n" \
+ " cache %1, 0x040(%0); cache %1, 0x050(%0) \n" \
+ " cache %1, 0x060(%0); cache %1, 0x070(%0) \n" \
+ " cache %1, 0x080(%0); cache %1, 0x090(%0) \n" \
+ " cache %1, 0x0a0(%0); cache %1, 0x0b0(%0) \n" \
+ " cache %1, 0x0c0(%0); cache %1, 0x0d0(%0) \n" \
+ " cache %1, 0x0e0(%0); cache %1, 0x0f0(%0) \n" \
+ " cache %1, 0x100(%0); cache %1, 0x110(%0) \n" \
+ " cache %1, 0x120(%0); cache %1, 0x130(%0) \n" \
+ " cache %1, 0x140(%0); cache %1, 0x150(%0) \n" \
+ " cache %1, 0x160(%0); cache %1, 0x170(%0) \n" \
+ " cache %1, 0x180(%0); cache %1, 0x190(%0) \n" \
+ " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \
+ " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \
+ " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \
+ " .set mips0 \n" \
+ " .set reorder \n" \
+ : \
+ : "r" (base), \
+ "i" (op));
static inline void flush_icache_line_indexed(rt_ubase_t addr)
{
- cache_op(INDEX_INVALIDATE_I, addr);
+ cache_op(INDEX_INVALIDATE_I, addr);
}
static inline void flush_dcache_line_indexed(rt_ubase_t addr)
{
- cache_op(INDEX_WRITEBACK_INV_D, addr);
+ cache_op(INDEX_WRITEBACK_INV_D, addr);
}
static inline void flush_icache_line(rt_ubase_t addr)
{
- cache_op(HIT_INVALIDATE_I, addr);
+ cache_op(HIT_INVALIDATE_I, addr);
}
static inline void lock_icache_line(rt_ubase_t addr)
{
- cache_op(FETCH_AND_LOCK_I, addr);
+ cache_op(FETCH_AND_LOCK_I, addr);
}
static inline void lock_dcache_line(rt_ubase_t addr)
{
- cache_op(FETCH_AND_LOCK_D, addr);
+ cache_op(FETCH_AND_LOCK_D, addr);
}
static inline void flush_dcache_line(rt_ubase_t addr)
{
- cache_op(HIT_WRITEBACK_INV_D, addr);
+ cache_op(HIT_WRITEBACK_INV_D, addr);
}
static inline void invalidate_dcache_line(rt_ubase_t addr)
{
- cache_op(HIT_INVALIDATE_D, addr);
+ cache_op(HIT_INVALIDATE_D, addr);
}
static inline void blast_dcache16(void)
{
- rt_ubase_t start = KSEG0BASE;
- rt_ubase_t end = start + g_mips_core.dcache_size;
- rt_ubase_t addr;
+ rt_ubase_t start = KSEG0BASE;
+ rt_ubase_t end = start + g_mips_core.dcache_size;
+ rt_ubase_t addr;
- for (addr = start; addr < end; addr += g_mips_core.dcache_line_size)
- cache16_unroll32(addr, INDEX_WRITEBACK_INV_D);
+ for (addr = start; addr < end; addr += g_mips_core.dcache_line_size)
+ cache16_unroll32(addr, INDEX_WRITEBACK_INV_D);
}
static inline void inv_dcache16(void)
{
- rt_ubase_t start = KSEG0BASE;
- rt_ubase_t end = start + g_mips_core.dcache_size;
- rt_ubase_t addr;
+ rt_ubase_t start = KSEG0BASE;
+ rt_ubase_t end = start + g_mips_core.dcache_size;
+ rt_ubase_t addr;
- for (addr = start; addr < end; addr += g_mips_core.dcache_line_size)
- cache16_unroll32(addr, HIT_INVALIDATE_D);
+ for (addr = start; addr < end; addr += g_mips_core.dcache_line_size)
+ cache16_unroll32(addr, HIT_INVALIDATE_D);
}
static inline void blast_icache16(void)
{
- rt_ubase_t start = KSEG0BASE;
- rt_ubase_t end = start + g_mips_core.icache_size;
- rt_ubase_t addr;
+ rt_ubase_t start = KSEG0BASE;
+ rt_ubase_t end = start + g_mips_core.icache_size;
+ rt_ubase_t addr;
- for (addr = start; addr < end; addr += g_mips_core.icache_line_size)
- cache16_unroll32(addr, INDEX_INVALIDATE_I);
+ for (addr = start; addr < end; addr += g_mips_core.icache_line_size)
+ cache16_unroll32(addr, INDEX_INVALIDATE_I);
}
void r4k_cache_init(void);