summaryrefslogtreecommitdiff
path: root/common/system.c
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2021-07-09 12:34:18 -0700
committerCommit Bot <commit-bot@chromium.org>2021-07-12 17:56:01 +0000
commitb86dfea40060ba8e5037ba5cb3ea971b28ec541c (patch)
treec3d7d2ebf5ea21f64f870da3ab09bbde5fa7d3ec /common/system.c
parent4cb260ea26a3d6e18320bea2421624fa29b1b53d (diff)
downloadchrome-ec-b86dfea40060ba8e5037ba5cb3ea971b28ec541c.tar.gz
system: Generalize system_get_board_version()
Extend system_get_board_version() to support not only AP-sourced SKU ID but also EC-sourced SKU ID, whose getter function can be customized per board. BRANCH=None BUG=b:186264627 TEST=make buildall -j TEST=zmake testall Change-Id: I764868d6472fb66480a43d028e5a79933b10117d Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3017602 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'common/system.c')
-rw-r--r--common/system.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/common/system.c b/common/system.c
index d01253fdaf..54d5378095 100644
--- a/common/system.c
+++ b/common/system.c
@@ -77,13 +77,10 @@ uint32_t sleep_mask;
uint32_t idle_disabled;
#endif
-#ifdef CONFIG_HOSTCMD_AP_SET_SKUID
+/* SKU ID sourced from AP */
static uint32_t ap_sku_id;
-uint32_t system_get_sku_id(void)
-{
- return ap_sku_id;
-}
+#ifdef CONFIG_HOSTCMD_AP_SET_SKUID
#define AP_SKUID_SYSJUMP_TAG 0x4153 /* AS */
#define AP_SKUID_HOOK_VERSION 1
@@ -118,6 +115,19 @@ static void ap_sku_id_restore_state(void)
DECLARE_HOOK(HOOK_INIT, ap_sku_id_restore_state, HOOK_PRIO_DEFAULT);
#endif
+__overridable uint32_t board_get_sku_id(void)
+{
+ return 0;
+}
+
+uint32_t system_get_sku_id(void)
+{
+ if (IS_ENABLED(CONFIG_HOSTCMD_AP_SET_SKUID))
+ return ap_sku_id;
+
+ return board_get_sku_id();
+}
+
/**
* Return the program memory address where the image `copy` begins or should
* begin. In the case of external storage, the image may or may not currently