summaryrefslogtreecommitdiff
path: root/zephyr/linker
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2022-03-17 13:58:04 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-23 02:05:47 +0000
commite31212c4a2d061ce535b36a8e471237aa4a13972 (patch)
treea22e951a601b66f0b59c5682cde73948611febf3 /zephyr/linker
parentd343176e9dfd57de2569cb39540c6939c0c1576e (diff)
downloadchrome-ec-e31212c4a2d061ce535b36a8e471237aa4a13972.tar.gz
zephyr/hooks: don't store hooks in RAM
This saves 8 bytes times the number of hook handlers in RAM, which amounts to nearly 1KB in most configurations. It trades that RAM for higher cost in calling handlers since the hook list must be traversed multiple times for each notification, but that matches the ECOS behavior which implies the performance cost is acceptable. BUG=b:223044986 TEST=zmake testall; 944 bytes of RAM are saved on Nereid BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I823f2a974faf69fa5195f11c645b569fb57854a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3529602 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'zephyr/linker')
-rw-r--r--zephyr/linker/iterables-ram.ld3
-rw-r--r--zephyr/linker/iterables-rom.ld8
2 files changed, 8 insertions, 3 deletions
diff --git a/zephyr/linker/iterables-ram.ld b/zephyr/linker/iterables-ram.ld
index 58318a0e78..e69de29bb2 100644
--- a/zephyr/linker/iterables-ram.ld
+++ b/zephyr/linker/iterables-ram.ld
@@ -1,3 +0,0 @@
-#ifdef CONFIG_PLATFORM_EC_HOOKS
-ITERABLE_SECTION_RAM(zephyr_shim_hook_list, 4)
-#endif
diff --git a/zephyr/linker/iterables-rom.ld b/zephyr/linker/iterables-rom.ld
index b8e451a085..25a9a4c7b7 100644
--- a/zephyr/linker/iterables-rom.ld
+++ b/zephyr/linker/iterables-rom.ld
@@ -5,3 +5,11 @@ ITERABLE_SECTION_ROM(host_command, 4)
#ifdef CONFIG_PLATFORM_EC_MKBP_EVENT
ITERABLE_SECTION_ROM(mkbp_event_source, 4)
#endif
+
+#ifdef CONFIG_PLATFORM_EC_HOOKS
+#include "../shim/include/hook_types.h"
+#define HOOK_TYPE_SECTION(type) \
+ ITERABLE_SECTION_ROM(zephyr_shim_hook_##type, 4)
+FOR_EACH(HOOK_TYPE_SECTION, (
+), HOOK_TYPES_LIST)
+#endif \ No newline at end of file