diff options
author | Tristan Honscheid <honscheid@google.com> | 2021-10-29 11:03:51 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-02 21:06:04 +0000 |
commit | 644fdfdcc5f4bd133af431abdaaf6ea6741bd4d8 (patch) | |
tree | 9298b3e89b70d2b4247822c9afc5622779e0094a /include/init_rom.h | |
parent | e88d582ee2f34f2423525a96d650c0da58506b4a (diff) | |
download | chrome-ec-644fdfdcc5f4bd133af431abdaaf6ea6741bd4d8.tar.gz |
zephyr: Add Kconfig for init_rom region
Add support for setting CONFIG_CHIP_INIT_ROM_REGION in unit tests.
Add FFF mocks for init_rom functions.
BRANCH=None
BUG=b:184856157
TEST=zmake configure --test zephyr/test/drivers
Signed-off-by: Tristan Honscheid <honscheid@google.com>
Change-Id: Ife649a4341381dbe2f5e10b87fa767ed14b6bc5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3252365
Reviewed-by: Yuval Peress <peress@google.com>
Diffstat (limited to 'include/init_rom.h')
-rw-r--r-- | include/init_rom.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/init_rom.h b/include/init_rom.h index 2c1ab33cd5..84fe53d4ff 100644 --- a/include/init_rom.h +++ b/include/init_rom.h @@ -14,7 +14,6 @@ #include "stdbool.h" -#ifdef CONFIG_CHIP_INIT_ROM_REGION /** * Get the memory mapped address of an .init_rom data object. * @@ -27,7 +26,14 @@ * @return Pointer to data object in memory. Return NULL if the object * is not memory mapped. */ +#ifdef CONFIG_CHIP_INIT_ROM_REGION const void *init_rom_map(const void *addr, int size); +#else +static inline const void *init_rom_map(const void *addr, int size) +{ + return addr; +} +#endif /** * Unmaps an .init_rom data object. Must be called when init_rom_map() is @@ -36,7 +42,13 @@ const void *init_rom_map(const void *addr, int size); * @param offset Address of the data object assigned by the linker. * @param size Size of the data object. */ +#ifdef CONFIG_CHIP_INIT_ROM_REGION void init_rom_unmap(const void *addr, int size); +#else +static inline void init_rom_unmap(const void *addr, int size) +{ +} +#endif /** * Copy an .init_rom data object into a RAM location. This routine must be used @@ -49,17 +61,9 @@ void init_rom_unmap(const void *addr, int size); * * @return 0 on success. */ +#ifdef CONFIG_CHIP_INIT_ROM_REGION int init_rom_copy(int offset, int size, char *data); #else -static inline const void *init_rom_map(const void *addr, int size) -{ - return addr; -} - -static inline void init_rom_unmap(const void *addr, int size) -{ -} - static inline int init_rom_copy(int offset, int size, char *data) { return 0; |