summaryrefslogtreecommitdiff
path: root/board/cr50/tpm2/NVMem.c
diff options
context:
space:
mode:
authorLouis Collard <louiscollard@chromium.org>2018-06-26 19:57:13 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-14 16:05:22 -0700
commita1e04f74c47d003bddd1802ab50b3ac74c2ea875 (patch)
tree3d6d6b7f8c513ab6bb5dbfbebbcd1475b11a392f /board/cr50/tpm2/NVMem.c
parent5419afaaf8986380a1e293330589b7850a074939 (diff)
downloadchrome-ec-a1e04f74c47d003bddd1802ab50b3ac74c2ea875.tar.gz
cr50: Add support for virtual NV indexes.
This is to allow reading of board ID and serial number through NV indexes. CQ-DEPEND=CL:1114675 BRANCH=none BUG=b:110971075, chromium:846114 TEST=NV_Read of virtual indices using trunks_send --raw, b:110971075 #3 Change-Id: Iaf7256ea50e36021b61c92f8606d1a62af37df2d Signed-off-by: Louis Collard <louiscollard@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1114674 Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'board/cr50/tpm2/NVMem.c')
-rw-r--r--board/cr50/tpm2/NVMem.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/board/cr50/tpm2/NVMem.c b/board/cr50/tpm2/NVMem.c
index 33ce13a336..1a2515236e 100644
--- a/board/cr50/tpm2/NVMem.c
+++ b/board/cr50/tpm2/NVMem.c
@@ -12,6 +12,7 @@
#include <string.h>
+#include "Platform.h"
#include "PlatformData.h"
#include "TpmError.h"
#include "assert.h"
@@ -114,6 +115,11 @@ void _plat__NvMemoryRead(unsigned int startOffset,
unsigned int size,
void *data)
{
+ if (_plat__NvOffsetIsVirtual(startOffset)) {
+ _plat__NvVirtualMemoryRead(startOffset, size, data);
+ return;
+ }
+
assert(startOffset + size <= NV_MEMORY_SIZE);
/* Copy the data from the NV image */
#ifdef CONFIG_FLASH_NVMEM