summaryrefslogtreecommitdiff
path: root/chip/mec1322/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'chip/mec1322/system.c')
-rw-r--r--chip/mec1322/system.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c
index 276803289b..62c08e028d 100644
--- a/chip/mec1322/system.c
+++ b/chip/mec1322/system.c
@@ -16,6 +16,11 @@
#include "timer.h"
#include "util.h"
+/* Indices for hibernate data registers (RAM backed by VBAT) */
+enum hibdata_index {
+ HIBDATA_INDEX_SCRATCHPAD = 0, /* General-purpose scratchpad */
+ HIBDATA_INDEX_SAVED_RESET_FLAGS /* Saved reset flags */
+};
@@ -78,6 +83,17 @@ int system_set_vbnvcontext(const uint8_t *block)
return EC_ERROR_UNIMPLEMENTED;
}
+int system_set_scratchpad(uint32_t value)
+{
+ MEC1322_VBAT_RAM(HIBDATA_INDEX_SCRATCHPAD) = value;
+ return EC_SUCCESS;
+}
+
+uint32_t system_get_scratchpad(void)
+{
+ return MEC1322_VBAT_RAM(HIBDATA_INDEX_SCRATCHPAD);
+}
+
void system_hibernate(uint32_t seconds, uint32_t microseconds)
{
/* TODO(crosbug.com/p/24107): Implement this */