diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-02-28 20:05:27 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-05 09:21:44 -0700 |
commit | 1d6c7bb9773f76aa70ce65822fa001ff72892cd2 (patch) | |
tree | 3631462d9540df08d13cffa9a7f8e7e9bb3e7899 /test/test_config.h | |
parent | 63bf8f8ba87b23378391b147f1b3e9fdcf3d8dc5 (diff) | |
download | chrome-ec-1d6c7bb9773f76aa70ce65822fa001ff72892cd2.tar.gz |
nvmem: test modifications to support the new scheme
This patch includes changes to support testing of the new nvmem
implementation.
Making fizz compatible required duplicating a lot of functionality
available in the test/ directory (fuzz/nvmem_tpm2_mock.c is very
similar to test/nvmem_tpm2_mock.c), but I could not find an easy way
to avoid it.
BRANCH=cr50, cr50-mp
BUG=b:69907320, b:129710256
CQ-DEPEND=CL:1496607
TEST=with the rest of the patches applied 'make buildall -j' succeeds,
which confirms both test and fuzz success.
Change-Id: Ife999b04d22f8ddbe9ea5d35f4c3e21f57592754
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1450278
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'test/test_config.h')
-rw-r--r-- | test/test_config.h | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/test/test_config.h b/test/test_config.h index 22f497bcc0..17e7d6f44d 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -257,53 +257,37 @@ int ncp15wb_calculate_temp(uint16_t adc); #define CONFIG_USB_PD_PORT_COUNT 2 #endif -#ifdef TEST_NVMEM +#if defined(TEST_NVMEM) || defined(TEST_NVMEM_VARS) +#define CONFIG_CRC8 +#define CONFIG_FLASH_ERASED_VALUE32 (-1U) +#define CONFIG_FLASH_LOG +#define CONFIG_FLASH_LOG_BASE CONFIG_PROGRAM_MEMORY_BASE +#define CONFIG_FLASH_LOG_SPACE 0x800 #define CONFIG_FLASH_NVMEM -#define CONFIG_FLASH_NVMEM_OFFSET_A 0x1000 -#define CONFIG_FLASH_NVMEM_OFFSET_B 0x4000 -#define CONFIG_FLASH_NVMEM_BASE_A (CONFIG_PROGRAM_MEMORY_BASE + \ - CONFIG_FLASH_NVMEM_OFFSET_A) -#define CONFIG_FLASH_NVMEM_BASE_B (CONFIG_PROGRAM_MEMORY_BASE + \ - CONFIG_FLASH_NVMEM_OFFSET_B) -#define CONFIG_FLASH_NVMEM_SIZE 0x4000 +#define CONFIG_FLASH_NVMEM_OFFSET_A 0x3d000 +#define CONFIG_FLASH_NVMEM_OFFSET_B 0x7d000 +#define CONFIG_FLASH_NVMEM_BASE_A \ + (CONFIG_PROGRAM_MEMORY_BASE + CONFIG_FLASH_NVMEM_OFFSET_A) +#define CONFIG_FLASH_NVMEM_BASE_B \ + (CONFIG_PROGRAM_MEMORY_BASE + CONFIG_FLASH_NVMEM_OFFSET_B) +#define CONFIG_FLASH_NEW_NVMEM_BASE_A (CONFIG_FLASH_NVMEM_BASE_A + 0x800) +#define CONFIG_FLASH_NEW_NVMEM_BASE_B (CONFIG_FLASH_NVMEM_BASE_B + 0x800) +#define CONFIG_MALLOC +/* This is legacy NVMEM partition size. */ +#define NVMEM_PARTITION_SIZE 0x3000 +#define NEW_FLASH_HALF_NVMEM_SIZE \ + (NVMEM_PARTITION_SIZE - CONFIG_FLASH_BANK_SIZE) +#define NEW_NVMEM_PARTITION_SIZE (NVMEM_PARTITION_SIZE - CONFIG_FLASH_BANK_SIZE) +#define NEW_NVMEM_TOTAL_PAGES \ + (2 * NEW_NVMEM_PARTITION_SIZE / CONFIG_FLASH_BANK_SIZE) #define CONFIG_SW_CRC - -#define NVMEM_PARTITION_SIZE \ - (CONFIG_FLASH_NVMEM_SIZE / NVMEM_NUM_PARTITIONS) -/* User buffer definitions for test purposes */ -#define NVMEM_USER_2_SIZE 0x201 -#define NVMEM_USER_1_SIZE 0x402 -#define NVMEM_USER_0_SIZE (NVMEM_PARTITION_SIZE - \ - NVMEM_USER_2_SIZE - NVMEM_USER_1_SIZE - \ - sizeof(struct nvmem_tag)) +#define CONFIG_FLASH_NVMEM_VARS #ifndef __ASSEMBLER__ -enum nvmem_users { - NVMEM_USER_0, - NVMEM_USER_1, - NVMEM_USER_2, - NVMEM_NUM_USERS -}; +enum nvmem_users { NVMEM_TPM = 0, NVMEM_CR50, NVMEM_NUM_USERS }; #endif #endif -#ifdef TEST_NVMEM_VARS -#define NVMEM_PARTITION_SIZE 0x3000 -#define CONFIG_FLASH_NVMEM_VARS -#ifndef __ASSEMBLER__ -/* Define the user region numbers */ -enum nvmem_users { - CONFIG_FLASH_NVMEM_VARS_USER_NUM, - NVMEM_NUM_USERS -}; -/* Define a test var. */ -enum nvmem_vars { - NVMEM_VAR_TEST_VAR, -}; -#endif -#define CONFIG_FLASH_NVMEM_VARS_USER_SIZE 600 -#endif /* TEST_NVMEM_VARS */ - #ifdef TEST_PINWEAVER #define CONFIG_DCRYPTO_MOCK #define CONFIG_PINWEAVER |