diff options
author | David Hendricks <dhendrix@chromium.org> | 2016-08-02 19:28:40 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-03 17:47:17 -0700 |
commit | 961f6d2d16c7b1bc5d033364e3c7fc3b30ceaba4 (patch) | |
tree | 3cc6d05882a79b5fa8f9d34556505f768b306b44 | |
parent | ff3721e6859b777ae7d9015a45c721ffe65c5eee (diff) | |
download | chrome-ec-961f6d2d16c7b1bc5d033364e3c7fc3b30ceaba4.tar.gz |
reef: Complain (loudly) if FW is built for wrong board
This adds a hook that will run every second and complain if the EC
firmware was built for the wrong board.
BUG=chrome-os-partner:54947
BRANCH=none
TEST=tested on proto and EVT units
Change-Id: I9799249f74f3cea9a3f6b66b2441af8f16be7e01
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/365505
Reviewed-by: Martin Roth <martinroth@chromium.org>
-rw-r--r-- | board/reef/board.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/board/reef/board.c b/board/reef/board.c index d121add9cf..19a3ccfcf2 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -881,3 +881,25 @@ int board_get_version(void) CPRINTS("Board version: %d\n", version); return version; } + +/* FIXME: Remove this once proto boards are obsolete */ +static void check_ec_fw_mismatch(void) +{ + int board_version = board_get_version(); + + if (board_version == BOARD_VERSION_UNKNOWN) + return; + +#if IS_PROTO == 1 + if (board_version != BOARD_VERSION_1) { + CPRINTS("ERROR: Detected proto firmware on non-proto unit."); + CPRINTS("Set IS_PROTO correctly in board/reef/board.h"); + } +#else + if (board_version == BOARD_VERSION_1) { + CPRINTS("ERROR: Detected >=EVT firmware on proto unit."); + CPRINTS("Set IS_PROTO correctly in board/reef/board.h"); + } +#endif +} +DECLARE_HOOK(HOOK_SECOND, check_ec_fw_mismatch, HOOK_PRIO_DEFAULT); |