summaryrefslogtreecommitdiff
path: root/common/shared_mem.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-01-05 14:23:53 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-06 16:37:52 +0000
commitb63c2bbf5c9773956874e6220bd54317b39d39d2 (patch)
treefd719b6dcf03a6212b8f80b8f682396e8bd91853 /common/shared_mem.c
parent3ab745a4517ec5b1ee7f0c9bea544ea6f33a5c53 (diff)
downloadchrome-ec-b63c2bbf5c9773956874e6220bd54317b39d39d2.tar.gz
zephyr: add a fake shared memory implementation for posix-ec
CL:2575207 was not tested against posix-ec and caused build issues. posix-ec does not have the _image_ram_end symbol available. This adds a new configuration for a fake 1MB shared memory option, and enables it for posix architecture by default. Note that if this CL (or an alternative fix) cannot be landed in a timely fashion, CL:2575207 and any CLs which depend on it should be reverted so we can enable the CQ again and stop stepping on our own toes. BUG=b:176828988 BRANCH=none TEST=run zephyr-chrome firmware_builder.py Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1d828f480c6a5da0b162a124c8a5a62ae8afb444 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611985 Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'common/shared_mem.c')
-rw-r--r--common/shared_mem.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/common/shared_mem.c b/common/shared_mem.c
index be420f60a6..e435408d3b 100644
--- a/common/shared_mem.c
+++ b/common/shared_mem.c
@@ -15,8 +15,14 @@
static int buf_in_use;
static int max_used;
+/* 1 MB buffer for fake shared memory implementation */
+STATIC_IF(CONFIG_FAKE_SHMEM) char fake_shmem_buf[BIT(20)];
+
int shared_mem_size(void)
{
+ if (IS_ENABLED(CONFIG_FAKE_SHMEM))
+ return sizeof(fake_shmem_buf);
+
/*
* Use all the RAM we can. The shared memory buffer is the last thing
* allocated from the start of RAM, so we can use everything up to the
@@ -39,7 +45,10 @@ int shared_mem_acquire(int size, char **dest_ptr)
*/
buf_in_use = size;
- *dest_ptr = __shared_mem_buf;
+ if (IS_ENABLED(CONFIG_FAKE_SHMEM))
+ *dest_ptr = fake_shmem_buf;
+ else
+ *dest_ptr = __shared_mem_buf;
if (max_used < size)
max_used = size;