summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-05-13 11:22:22 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-23 02:14:18 -0700
commit54a4479e64bb8caed335a38402af2bd46538777d (patch)
tree41e29397e2254e6bec4540b9b761c3be18f29b17 /include
parent290708976c622282fb41ea575b8bda309ae31349 (diff)
downloadchrome-ec-54a4479e64bb8caed335a38402af2bd46538777d.tar.gz
flash_log: add api for setting base timestamp
The Cr50 environment does not have a wall clock, which makes it impossible to associate flash log entries with real time. This patch provides an API which allows to set a base time value and then use it plus current Cr50 uptime to generate more sensible flash log timestamps. Care is taken to ensure that attempts to set timestamp base such that it would cause a log timestamps rollback do not succeed. A unit test is being added to verify this behavior. BRANCH=none BUG=b:132287488 TEST='make buildall -j' (which runs the new tests) succeeds. Change-Id: I7521df1bac5aef67e0cf634c183bf1618655f48d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1610719 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/flash_log.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/flash_log.h b/include/flash_log.h
index bbdd8bb0b3..ee56226be6 100644
--- a/include/flash_log.h
+++ b/include/flash_log.h
@@ -132,10 +132,21 @@ int flash_log_dequeue_event(uint32_t event_after, void *buffer,
void flash_log_register_flash_control_callback(
void (*flash_control)(int enable));
+/*
+ * Set log timestamp base. The argument is current epoch time in seconds.
+ * Return value of EC_ERROR_INVAL indicates attempt to set the timestamp base
+ * to a value below the latest log entry timestamp.
+ */
+enum ec_error_list flash_log_set_tstamp(uint32_t tstamp);
+
+/* Get current log timestamp value. */
+uint32_t flash_log_get_tstamp(void);
+
#if defined(TEST_BUILD)
void flash_log_init(void);
-extern uint8_t log_event_in_progress;
+extern uint32_t last_used_timestamp;
extern uint32_t lock_failures_count;
+extern uint8_t log_event_in_progress;
#endif
#endif /* __CROS_EC_EVENT_LOG_H */