summaryrefslogtreecommitdiff
path: root/chip/g/board_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/g/board_id.c')
-rw-r--r--chip/g/board_id.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/chip/g/board_id.c b/chip/g/board_id.c
index 588676c41e..0eb6efc0b5 100644
--- a/chip/g/board_id.c
+++ b/chip/g/board_id.c
@@ -40,6 +40,25 @@ int board_id_is_blank(const struct board_id *id)
return board_id_type_is_blank(id) && board_id_flags_are_blank(id);
}
+int board_id_is_erased(void)
+{
+ struct board_id id;
+ /*
+ * If we can't read the board id for some reason, return 0 just to be
+ * safe
+ */
+ if (read_board_id(&id) != EC_SUCCESS) {
+ CPRINTS("%s: BID read error", __func__);
+ return 0;
+ }
+
+ if (board_id_is_blank(&id)) {
+ CPRINTS("BID erased");
+ return 1;
+ }
+ return 0;
+}
+
uint32_t check_board_id_vs_header(const struct board_id *id,
const struct SignedHeader *h)
{