Platform: Add new NV counter for supported targets
Add new NV counter to the NV counter flash area to be used
by the bootloader as a security counter.
Change-Id: I40b62b35f62d2c2c92724549ebfc58814263652e
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/platform/ext/target/mps2/an519/partition/flash_layout.h b/platform/ext/target/mps2/an519/partition/flash_layout.h
index 174dadd..13fd8c8 100644
--- a/platform/ext/target/mps2/an519/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an519/partition/flash_layout.h
@@ -28,8 +28,8 @@
* 0x0020_0000 Non-secure image secondary
* 0x0028_0000 Scratch area(1 MB)
* 0x0038_0000 Secure Storage Area(0.02 MB)
- * 0x0038_5000 NV counters area(16 Bytes)
- * 0x0038_5010 Unused(0.491 MB)
+ * 0x0038_5000 NV counters area(20 Bytes)
+ * 0x0038_5014 Unused(0.480 MB)
*
* Flash layout on MPS2 AN519, if BL2 not defined:
* 0x0000_0000 Secure image
@@ -85,7 +85,7 @@
#define FLASH_SST_AREA_SIZE (0x5000) /* 20 KB */
#define FLASH_NV_COUNTERS_AREA_OFFSET (0x385000)
-#define FLASH_NV_COUNTERS_AREA_SIZE (0x10) /* 16 Bytes */
+#define FLASH_NV_COUNTERS_AREA_SIZE (0x14) /* 20 Bytes */
/* Offset and size definition in flash area, used by assemble.py */
#define SECURE_IMAGE_OFFSET 0x0
diff --git a/platform/ext/target/mps2/an521/partition/flash_layout.h b/platform/ext/target/mps2/an521/partition/flash_layout.h
index 2175396..2aff59b 100644
--- a/platform/ext/target/mps2/an521/partition/flash_layout.h
+++ b/platform/ext/target/mps2/an521/partition/flash_layout.h
@@ -28,8 +28,8 @@
* 0x0020_0000 Non-secure image secondary
* 0x0028_0000 Scratch area(1 MB)
* 0x0038_0000 Secure Storage Area(0.02 MB)
- * 0x0038_5000 NV counters area(16 Bytes)
- * 0x0038_5010 Unused(0.491 MB)
+ * 0x0038_5000 NV counters area(20 Bytes)
+ * 0x0038_5014 Unused(0.480 MB)
*
* Flash layout on MPS2 AN521, if BL2 not defined:
* 0x0000_0000 Secure image
@@ -85,7 +85,7 @@
#define FLASH_SST_AREA_SIZE (0x5000) /* 20 KB */
#define FLASH_NV_COUNTERS_AREA_OFFSET (0x385000)
-#define FLASH_NV_COUNTERS_AREA_SIZE (0x10) /* 16 Bytes */
+#define FLASH_NV_COUNTERS_AREA_SIZE (0x14) /* 20 Bytes */
/* Offset and size definition in flash area, used by assemble.py */
#define SECURE_IMAGE_OFFSET 0x0
diff --git a/platform/ext/target/musca_a/partition/flash_layout.h b/platform/ext/target/musca_a/partition/flash_layout.h
index 5b35eed..1bda7fe 100644
--- a/platform/ext/target/musca_a/partition/flash_layout.h
+++ b/platform/ext/target/musca_a/partition/flash_layout.h
@@ -26,8 +26,8 @@
* 0x0032_0000 Secure image secondary
* 0x003A_0000 Non-secure image secondary
* 0x0042_0000 Secure Storage Area(0.02 MB)
- * 0x0042_5000 NV counters area(16 Bytes)
- * 0x0042_5010 Unused
+ * 0x0042_5000 NV counters area(20 Bytes)
+ * 0x0042_5014 Unused
*/
/* Code SRAM layout on Musca (with BL2, which is mandatory) after the newest
@@ -94,7 +94,7 @@
#define FLASH_NV_COUNTERS_AREA_OFFSET (FLASH_SST_AREA_OFFSET + \
FLASH_SST_AREA_SIZE)
-#define FLASH_NV_COUNTERS_AREA_SIZE (0x10) /* 16 Bytes */
+#define FLASH_NV_COUNTERS_AREA_SIZE (0x14) /* 20 Bytes */
/* Offset and size definition in flash area, used by assemble.py */
#define SECURE_IMAGE_OFFSET 0x0
diff --git a/platform/ext/target/musca_b1/partition/flash_layout.h b/platform/ext/target/musca_b1/partition/flash_layout.h
index 87275d2..c03ade0 100644
--- a/platform/ext/target/musca_b1/partition/flash_layout.h
+++ b/platform/ext/target/musca_b1/partition/flash_layout.h
@@ -27,8 +27,8 @@
* 0x0A12_0000 Non-secure image secondary (512 KB)
* 0x0A1A_0000 Scratch area (256 KB)
* 0x0A1E_0000 Secure Storage Area(0.02 MB)
- * 0x0A1E_5000 NV counters area(16 Bytes)
- * 0x0A1E_5010 Unused
+ * 0x0A1E_5000 NV counters area(20 Bytes)
+ * 0x0A1E_5014 Unused
*/
/* Flash layout on Musca-B1 without BL2:
@@ -96,7 +96,7 @@
#define FLASH_NV_COUNTERS_AREA_OFFSET (FLASH_SST_AREA_OFFSET + \
FLASH_SST_AREA_SIZE)
-#define FLASH_NV_COUNTERS_AREA_SIZE (0x10) /* 16 Bytes */
+#define FLASH_NV_COUNTERS_AREA_SIZE (0x14) /* 20 Bytes */
/* Offset and size definition in flash area, used by assemble.py */
#define SECURE_IMAGE_OFFSET 0x0
diff --git a/platform/include/tfm_plat_nv_counters.h b/platform/include/tfm_plat_nv_counters.h
index 26e213b..d79c235 100644
--- a/platform/include/tfm_plat_nv_counters.h
+++ b/platform/include/tfm_plat_nv_counters.h
@@ -22,6 +22,8 @@
PLAT_NV_COUNTER_0 = 0, /* Used by SST service */
PLAT_NV_COUNTER_1, /* Used by SST service */
PLAT_NV_COUNTER_2, /* Used by SST service */
+ PLAT_NV_COUNTER_3, /* Used by bootloader */
+ PLAT_NV_COUNTER_MAX
};
#ifdef __cplusplus