summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-02-27 16:00:22 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-04 12:42:26 -0800
commita11c3a1fd60ec8e12cde5e910b95d8ca6d6bf378 (patch)
treefa949bc24a0f473a7db8188bead97de8056d6bf1 /board/cr50
parent10254c179058bf3f55dc6ff6fd84efff49a73029 (diff)
downloadchrome-ec-a11c3a1fd60ec8e12cde5e910b95d8ca6d6bf378.tar.gz
cr50: drop SRAM based NVMEM support
This is a purely clean up patch, there is no need to keep alternative code around, flash storage is essential for TPM. BRANCH=cr50, cr50-mp BUG=none TEST=generated symbol maps before and after this patch are the same for the Cr50 board. Change-Id: I0ac37bdbf7a636a7ea0f412c6ad608e2262f75d7 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1450274 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board/cr50')
-rw-r--r--board/cr50/tpm2/NVMem.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/board/cr50/tpm2/NVMem.c b/board/cr50/tpm2/NVMem.c
index 1a2515236e..e1a14b4536 100644
--- a/board/cr50/tpm2/NVMem.c
+++ b/board/cr50/tpm2/NVMem.c
@@ -20,9 +20,6 @@
/* Local state */
static struct {
-#ifndef CONFIG_FLASH_NVMEM
- uint8_t s_NV[NV_MEMORY_SIZE];
-#endif
BOOL s_NvIsAvailable;
BOOL s_NV_unrecoverable;
BOOL s_NV_recoverable;
@@ -57,7 +54,6 @@ int _plat__NVEnable(void *platParameter)
local_state.s_NV_unrecoverable = FALSE;
local_state.s_NV_recoverable = FALSE;
-#ifdef CONFIG_FLASH_NVMEM
/* TODO: Need to define what is recoverable and unrecoverable
* conditions with regards to NvMem module. For now, the only
* requirement is that at Cr50 board initialization time, the
@@ -67,7 +63,7 @@ int _plat__NVEnable(void *platParameter)
*/
local_state.s_NV_recoverable = nvmem_get_error_state() != 0;
local_state.s_NV_unrecoverable = local_state.s_NV_recoverable;
-#endif
+
if (local_state.s_NV_unrecoverable)
return -1;
return local_state.s_NV_recoverable;
@@ -90,8 +86,8 @@ void _plat__NVDisable(void)
int _plat__IsNvAvailable(void)
{
-#ifdef CONFIG_FLASH_NVMEM
int rv;
+
/*
* sNv_IsAvailable is a state variable that can be accesed by the
* simmulator to control access to NvMemory. This variable and
@@ -100,12 +96,6 @@ int _plat__IsNvAvailable(void)
*/
rv = !local_state.s_NvIsAvailable || nvmem_get_error_state();
return rv;
-#else
- if (!local_state.s_NvIsAvailable)
- return 1;
-
- return 0;
-#endif
}
/*
@@ -122,11 +112,7 @@ void _plat__NvMemoryRead(unsigned int startOffset,
assert(startOffset + size <= NV_MEMORY_SIZE);
/* Copy the data from the NV image */
-#ifdef CONFIG_FLASH_NVMEM
nvmem_read(startOffset, size, data, NVMEM_TPM);
-#else
- memcpy(data, &local_state.s_NV[startOffset], size);
-#endif
return;
}
@@ -139,11 +125,7 @@ _plat__NvIsDifferent(unsigned int startOffset,
unsigned int size,
void *data)
{
-#ifdef CONFIG_FLASH_NVMEM
return (nvmem_is_different(startOffset, size, data, NVMEM_TPM) != 0);
-#else
- return !DCRYPTO_equals(&local_state.s_NV[startOffset], data, size);
-#endif
}
/*
@@ -157,11 +139,7 @@ void _plat__NvMemoryWrite(unsigned int startOffset,
{
assert(startOffset + size <= NV_MEMORY_SIZE);
/* Copy the data to the NV image */
-#ifdef CONFIG_FLASH_NVMEM
nvmem_write(startOffset, size, data, NVMEM_TPM);
-#else
- memcpy(&local_state.s_NV[startOffset], data, size);
-#endif
}
/*
@@ -174,13 +152,7 @@ void _plat__NvMemoryMove(unsigned int sourceOffset,
{
assert(sourceOffset + size <= NV_MEMORY_SIZE);
assert(destOffset + size <= NV_MEMORY_SIZE);
-#ifdef CONFIG_FLASH_NVMEM
nvmem_move(sourceOffset, destOffset, size, NVMEM_TPM);
-#else
- /* Move data in RAM */
- memmove(&local_state.s_NV[destOffset],
- &local_state.s_NV[sourceOffset], size);
-#endif
return;
}
@@ -194,11 +166,7 @@ void _plat__NvMemoryMove(unsigned int sourceOffset,
*/
int _plat__NvCommit(void)
{
-#ifdef CONFIG_FLASH_NVMEM
return nvmem_commit();
-#else
- return 0;
-#endif
}
/*