diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2019-05-29 15:51:48 -0600 |
---|---|---|
committer | Jack Rosenthal <jrosenth@chromium.org> | 2019-06-06 19:55:40 +0000 |
commit | c723e723392aabc35747a6678b4b7931d7aeddb7 (patch) | |
tree | 2ebdd22275c369d0580641ddb23b8e782ff0b91a /chip/ish/ish_persistent_data.h | |
parent | e12b71b1fe82af7bc804004147f33da5e29cced1 (diff) | |
download | chrome-ec-c723e723392aabc35747a6678b4b7931d7aeddb7.tar.gz |
ish: use magic number to verify persistent data
Move persistent data definitions to a structure and have linker script
define the address of the symbol into the AON ROM (persistent data
storage). Use the magic number "ISHd" to verify persistent data
storage and copy to static memory when valid. Commit changes from the
local copy during reset.
BUG=b:133779707,b:133647823,b:132059981
BRANCH=none
TEST=power-on is only reset flag under cold reset, panic data
persists, watchdog reset produces correct reset flags, UART always
printing system info on boot
Change-Id: I65a458cc2656f8fe26361ef2117ceb5439edff6c
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1636293
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Diffstat (limited to 'chip/ish/ish_persistent_data.h')
-rw-r--r-- | chip/ish/ish_persistent_data.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chip/ish/ish_persistent_data.h b/chip/ish/ish_persistent_data.h new file mode 100644 index 0000000000..65a85203fb --- /dev/null +++ b/chip/ish/ish_persistent_data.h @@ -0,0 +1,41 @@ +/* Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_ISH_PERSISTENT_DATA_H +#define __CROS_EC_ISH_PERSISTENT_DATA_H + +#include "panic.h" + +/* + * If you make backwards-incompatible changes to this struct, (that + * is, reading a previous version of the data would be incorrect), + * simply change the magic number in ish_persistent_data.c. This will + * cause the struct to be re-initialized when the firmware loads. + */ +struct ish_persistent_data { + uint32_t magic; + uint32_t reset_flags; + uint32_t watchdog_counter; + struct panic_data panic_data; +}; + +/* + * Local copy of persistent data, which is copied from AON memory only + * if the data in AON memory is valid. + */ +extern struct ish_persistent_data ish_persistent_data; + +/* + * Copy the AON persistent data into the local copy and initialize + * system reset flags, only if magic number is correct. + */ +void ish_persistent_data_init(void); + +/* + * Commit the local copy to the AON memory (to be called at reset). + */ +void ish_persistent_data_commit(void); + +#endif /* __CROS_EC_ISH_PERSISTENT_DATA_H */ |