mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-02 17:13:28 +08:00
CONFIG_SYS_[ID]CACHE_OFF: unify the 'any' case
According to De Morgan's Law[1]: !(A && B) = !A || !B !(A || B) = !A && !B There are 5 places in the code where we find: #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) and 4 places in the code where we find: #if (!defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF)) In words, the construct: !defined(CONFIG_SYS_[DI]CACHE_OFF) means: "is the [DI]CACHE on?" and the construct: defined(CONFIG_SYS_[DI]CACHE_OFF) means: "is the [DI]CACHE off?" Therefore !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) means: "the opposite of 'are they both off?'" in other words: "are either or both on?" and: (!defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF) means: "are either or both on?" As a result, I've converted the 4 instances of '(!A || !B)' to '!(A && B)' for consistency. [1] https://en.wikipedia.org/wiki/De_Morgan%27s_laws Signed-off-by: Trevor Woerner <trevor@toganlabs.com>
This commit is contained in:
parent
98b3156b0d
commit
b7b4af0e35
@ -97,7 +97,7 @@ void flush_dcache_all(void)
|
||||
}
|
||||
#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
|
||||
|
||||
#if !defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF)
|
||||
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
|
||||
void enable_caches(void)
|
||||
{
|
||||
#ifndef CONFIG_SYS_ICACHE_OFF
|
||||
|
@ -129,7 +129,7 @@ set_ivb:
|
||||
mfsr $r1, $mr8
|
||||
and $r1, $r1, $r0
|
||||
mtsr $r1, $mr8
|
||||
#if (!defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF))
|
||||
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
|
||||
/*
|
||||
* MMU_CTL NTC0 Cacheable/Write-Back
|
||||
*/
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#if (!defined(CONFIG_SYS_ICACHE_OFF) || !defined(CONFIG_SYS_DCACHE_OFF))
|
||||
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
|
||||
static inline unsigned long CACHE_SET(unsigned char cache)
|
||||
{
|
||||
if (cache == ICACHE)
|
||||
|
@ -164,8 +164,7 @@ _start:
|
||||
* enable data/instruction cache for relocated image.
|
||||
*/
|
||||
#if XCHAL_HAVE_SPANNING_WAY && \
|
||||
(!defined(CONFIG_SYS_DCACHE_OFF) || \
|
||||
!defined(CONFIG_SYS_ICACHE_OFF))
|
||||
!(defined(CONFIG_SYS_DCACHE_OFF) && defined(CONFIG_SYS_ICACHE_OFF))
|
||||
srli a7, a4, 29
|
||||
slli a7, a7, 29
|
||||
addi a7, a7, XCHAL_SPANNING_WAY
|
||||
|
Loading…
Reference in New Issue
Block a user