summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2020-08-28 12:53:47 +0200
committerCommit Bot <commit-bot@chromium.org>2020-10-01 14:48:04 +0000
commit44f1d185697e6dd071046fbb71a66647979ac4c4 (patch)
tree82271f398f9d3dffc7d96d88c6502ef6229eda16
parent7230958db0d3dff50643cfb9960c6fecfc967e3b (diff)
downloadchrome-ec-44f1d185697e6dd071046fbb71a66647979ac4c4.tar.gz
npcx/system: Use newly provided functions to access panic data
This change removes usage of PANIC_DATA_PTR where possible. Now panic data is accessed through functions that performs more checks and in case of writing also moves other data when necessary. BUG=b:165773837, b:162254118 BRANCH=none TEST=make -j buildall Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I83dacf1bf680f15a8d5ce3dbb30b03fc3cc54f48 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2379848 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--chip/npcx/system.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index 645113baa7..91e7de8169 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -284,7 +284,7 @@ void chip_panic_data_backup(void)
static void chip_panic_data_restore(void)
{
- struct panic_data *d = PANIC_DATA_PTR;
+ struct panic_data *d;
/* Ensure BBRAM is valid. */
if (!bbram_valid(BKUP_CFSR, 4))
@@ -295,9 +295,11 @@ static void chip_panic_data_restore(void)
BKUP_PANIC_DATA_VALID))
return;
- memset(d, 0, sizeof(*d));
+ d = get_panic_data_write();
+
+ memset(d, 0, CONFIG_PANIC_DATA_SIZE);
d->magic = PANIC_DATA_MAGIC;
- d->struct_size = sizeof(*d);
+ d->struct_size = CONFIG_PANIC_DATA_SIZE;
d->struct_version = 2;
d->arch = PANIC_ARCH_CORTEX_M;