summaryrefslogtreecommitdiff
path: root/common/host_command.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-04-09 11:18:15 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-05-07 20:45:54 -0700
commit6e8cbe40eea777aeaeffe0fa0781a0a5d1763a4d (patch)
treed229d77bb060be8ba34d4bf94d257ac035c89c26 /common/host_command.c
parentc24d480d90699bf6aaf534d66dc48513d867bdd0 (diff)
downloadchrome-ec-6e8cbe40eea777aeaeffe0fa0781a0a5d1763a4d.tar.gz
shared_mem: Assert that shared memory size is large enough
We add a configuration option to set the minimum shared memory size (CONFIG_SHAREDMEM_MINIMUM_SIZE), so that the link will fail if there is not enough IRAM left. Also, we add 2 macros around shared_mem_acquire, that check, at build time, that the shared memory size is sufficient for the allocation: - SHARED_MEM_ACQUIRE_CHECK should be used instead of shared_mem_acquire, when size is known in advance. - SHARED_MEM_CHECK_SIZE should be used when only a maximum size is known. This does not account for "jump tags" that boards often add on jump from RO to RW. Luckily, RW usually does not do verification, and does not need as much shared memory. BRANCH=none BUG=chromium:739771 TEST=make buildall -j, no error Change-Id: Ic4c72938affe65fe8f8bc17ee5111c1798fc536f Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1002713 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/host_command.c')
-rw-r--r--common/host_command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/host_command.c b/common/host_command.c
index c8d01a3d6f..0900d9e1d4 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -838,7 +838,7 @@ static int command_host_command(int argc, char **argv)
int rv;
/* Use shared memory for command params space */
- if (shared_mem_acquire(EC_PROTO2_MAX_PARAM_SIZE, &cmd_params)) {
+ if (SHARED_MEM_ACQUIRE_CHECK(EC_PROTO2_MAX_PARAM_SIZE, &cmd_params)) {
ccputs("Can't acquire shared memory buffer.\n");
return EC_ERROR_UNKNOWN;
}