diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c index 354dbc6..f147674 100644 --- a/arch/arc/lib/cache.c +++ b/arch/arc/lib/cache.c @@ -141,6 +141,9 @@ static void __slc_entire_op(const int op) { unsigned int ctrl; + if (!slc_exists) + return; + ctrl = read_aux_reg(ARC_AUX_SLC_CTRL); if (!(op & OP_FLUSH)) /* i.e. OP_INV */ @@ -179,6 +182,9 @@ static void __slc_rgn_op(unsigned long paddr, unsigned long sz, const int op) unsigned int ctrl; unsigned long end; + if (!slc_exists) + return; + /* * The Region Flush operation is specified by CTRL.RGN_OP[11..9] * - b'000 (default) is Flush, @@ -366,7 +372,7 @@ void invalidate_icache_all(void) { __ic_entire_invalidate(); - if (is_isa_arcv2() && slc_exists) + if (is_isa_arcv2()) __slc_entire_op(OP_INV); } @@ -487,7 +493,7 @@ void invalidate_dcache_range(unsigned long start, unsigned long end) if (!is_isa_arcv2() || !ioc_exists) __dc_line_op(start, end - start, OP_INV); - if (is_isa_arcv2() && slc_exists && !ioc_exists) + if (is_isa_arcv2() && !ioc_exists) __slc_rgn_op(start, end - start, OP_INV); } @@ -504,7 +510,7 @@ void flush_dcache_range(unsigned long start, unsigned long end) if (!is_isa_arcv2() || !ioc_exists) __dc_line_op(start, end - start, OP_FLUSH); - if (is_isa_arcv2() && slc_exists && !ioc_exists) + if (is_isa_arcv2() && !ioc_exists) __slc_rgn_op(start, end - start, OP_FLUSH); } @@ -523,7 +529,7 @@ void flush_n_invalidate_dcache_all(void) { __dc_entire_op(OP_FLUSH_N_INV); - if (is_isa_arcv2() && slc_exists) + if (is_isa_arcv2()) __slc_entire_op(OP_FLUSH_N_INV); } @@ -531,6 +537,6 @@ void flush_dcache_all(void) { __dc_entire_op(OP_FLUSH); - if (is_isa_arcv2() && slc_exists) + if (is_isa_arcv2()) __slc_entire_op(OP_FLUSH); }