diff options
author | Yu-Ping Wu <yupingso@chromium.org> | 2024-10-01 06:41:32 +0800 |
---|---|---|
committer | Yu-Ping Wu <yupingso@google.com> | 2024-10-02 02:30:12 +0000 |
commit | e5cce0055239b3c73ea5220c122e183694091ab6 (patch) | |
tree | 9af25f6442f41ae0465d86eb03b8a4ced4d40071 /payloads/libpayload/include | |
parent | caefaaa093eaff7cba9cdd4d4b6bfd987890ea15 (diff) |
libpayload: Remove default empty implementations in mock cache.h
The mock/arch/cache.h file exists for libpayload unit tests. However,
the default implementations (as empty macros) in it make these functions
difficult to mock in unit tests.
Therefore, we follow what's done for mock/arch/io.h, by only including
function declarations in the header. Each test is expected to implement
mocks for these cache functions when required.
Change-Id: Ie4383bf95435fd7d74d624b19b79b5a117cf6d00
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84608
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r-- | payloads/libpayload/include/mock/arch/cache.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/payloads/libpayload/include/mock/arch/cache.h b/payloads/libpayload/include/mock/arch/cache.h index 1e71d5e0e2..0e4bc033d0 100644 --- a/payloads/libpayload/include/mock/arch/cache.h +++ b/payloads/libpayload/include/mock/arch/cache.h @@ -3,16 +3,19 @@ #ifndef __ARCH_CACHE_H__ #define __ARCH_CACHE_H__ -/* No support for cache in the mock architecture */ +#include <stddef.h> -#define dmb() -#define dsb() -#define dcache_clean_all() -#define dcache_clean_by_mva(addr, len) -#define dcache_invalidate_all() -#define dcache_invalidate_by_mva(addr, len) -#define dcache_clean_invalidate_all() -#define dcache_clean_invalidate_by_mva(addr, len) -#define cache_sync_instructions() +/* Functions in this file are unimplemented by default. Tests are expected to implement + mocks for these functions, if tests will call functions using functions listed below. */ + +void dmb(void); +void dsb(void); +void dcache_clean_all(void); +void dcache_clean_by_mva(void const *addr, size_t len); +void dcache_invalidate_all(void); +void dcache_invalidate_by_mva(void const *addr, size_t len); +void dcache_clean_invalidate_all(void); +void dcache_clean_invalidate_by_mva(void const *addr, size_t len); +void cache_sync_instructions(void); #endif /* __ARCH_CACHE_H__ */ |