summaryrefslogtreecommitdiff
path: root/board/cr50/tpm2/nvmem_ops.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-12-04 13:37:06 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-06 22:06:26 -0800
commit4dd1ecfe74fb4ec81652a9376fc2c5603400ec29 (patch)
tree0899b34ea8da3e1361cf10c36b3150d1adfe4dba /board/cr50/tpm2/nvmem_ops.c
parenta45e42da1a5c16a94d4d02531802f87061b8891c (diff)
downloadchrome-ec-4dd1ecfe74fb4ec81652a9376fc2c5603400ec29.tar.gz
cr50: clear TPM NVMEM cache when entering Alt OS
Each time TPM is disabled for booting Alt OS, NVMEM cache needs to be wiped out, only a few NV indices need to be preserved. We also are making sure that wipeout is possible only if key ladder is disabled. CQ-DEPEND=CL:1362161 BRANCH=cr50, cr50-mp BUG=b:119221935 TEST=on a dual boot machine observed that when booting ALT OS on reboots, key ladder is disabled, but RW AP firmware rollback indices at address 0x1007 are still read properly. Alt OS resume happens pretty quickly. Change-Id: I5326937d0a36b67ac848629faeee42aadcb9e64d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1362203 Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'board/cr50/tpm2/nvmem_ops.c')
-rw-r--r--board/cr50/tpm2/nvmem_ops.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/cr50/tpm2/nvmem_ops.c b/board/cr50/tpm2/nvmem_ops.c
new file mode 100644
index 0000000000..0f2e977967
--- /dev/null
+++ b/board/cr50/tpm2/nvmem_ops.c
@@ -0,0 +1,18 @@
+/* Copyright 2018 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.
+ */
+
+#include "Global.h"
+#include "NV_fp.h"
+
+void nvmem_wipe_cache(void)
+{
+ /*
+ * Inclusive list of NV indices not to be wiped out when invalidating
+ * the cache.
+ */
+ const uint16_t whitelist_range[] = { 0x1007, 0x100b };
+
+ NvSelectivelyInvalidateCache(whitelist_range);
+}