Platform: RSS: Enable NS NV counters
Change-Id: I2e377129148279657780396654558c3249426520
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/platform/ext/target/arm/rss/config.cmake b/platform/ext/target/arm/rss/config.cmake
index e944a57..35d287f 100644
--- a/platform/ext/target/arm/rss/config.cmake
+++ b/platform/ext/target/arm/rss/config.cmake
@@ -41,6 +41,8 @@
set(ATTEST_TOKEN_PROFILE "ARM_CCA" CACHE STRING "Set the initial attestation token profile")
+set(TFM_NS_NV_COUNTER_AMOUNT 3 CACHE STRING "How many NS NV counters are enabled")
+
set(CONFIG_TFM_USE_TRUSTZONE OFF CACHE BOOL "Enable use of TrustZone to transition between NSPE and SPE")
set(TFM_MULTI_CORE_TOPOLOGY ON CACHE BOOL "Whether to build for a dual-cpu architecture")
set(TFM_PLAT_SPECIFIC_MULTI_CORE_COMM ON CACHE BOOL "Whether to use a platform specific inter-core communication instead of mailbox in dual-cpu topology")
diff --git a/platform/ext/target/arm/rss/otp_cc312.c b/platform/ext/target/arm/rss/otp_cc312.c
index 971f448..223d200 100644
--- a/platform/ext/target/arm/rss/otp_cc312.c
+++ b/platform/ext/target/arm/rss/otp_cc312.c
@@ -240,6 +240,16 @@
#endif /* PLATFORM_DEFAULT_BL1 */
#endif /* BL1 */
+#if (PLATFORM_NS_NV_COUNTERS > 0)
+ uint8_t ns_nv_counter_0[32];
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 1)
+ uint8_t ns_nv_counter_1[32];
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 2)
+ uint8_t ns_nv_counter_2[32];
+#endif
+
uint8_t secure_debug_pk[32];
};
};
@@ -723,6 +733,22 @@
#endif /* PLATFORM_DEFAULT_BL1 */
#endif /* BL1 */
+#if (PLATFORM_NS_NV_COUNTERS > 0)
+ case PLAT_OTP_ID_NV_COUNTER_NS_0:
+ return otp_read(otp->ns_nv_counter_0,
+ sizeof(otp->ns_nv_counter_0), out_len, out);
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 1)
+ case PLAT_OTP_ID_NV_COUNTER_NS_1:
+ return otp_read(otp->ns_nv_counter_1,
+ sizeof(otp->ns_nv_counter_1), out_len, out);
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 2)
+ case PLAT_OTP_ID_NV_COUNTER_NS_2:
+ return otp_read(otp->ns_nv_counter_2,
+ sizeof(otp->ns_nv_counter_2), out_len, out);
+#endif
+
case PLAT_OTP_ID_ENTROPY_SEED:
return TFM_PLAT_ERR_UNSUPPORTED;
@@ -847,6 +873,22 @@
#endif /* PLATFORM_DEFAULT_BL1 */
#endif /* BL1 */
+#if (PLATFORM_NS_NV_COUNTERS > 0)
+ case PLAT_OTP_ID_NV_COUNTER_NS_0:
+ return otp_write(otp->ns_nv_counter_0,
+ sizeof(otp->ns_nv_counter_0), in_len, in, NULL);
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 1)
+ case PLAT_OTP_ID_NV_COUNTER_NS_1:
+ return otp_write(otp->ns_nv_counter_1,
+ sizeof(otp->ns_nv_counter_1), in_len, in, NULL);
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 2)
+ case PLAT_OTP_ID_NV_COUNTER_NS_2:
+ return otp_write(otp->ns_nv_counter_2,
+ sizeof(otp->ns_nv_counter_2), in_len, in, NULL);
+#endif
+
case PLAT_OTP_ID_ENTROPY_SEED:
return TFM_PLAT_ERR_UNSUPPORTED;
@@ -955,6 +997,22 @@
#endif /* PLATFORM_DEFAULT_BL1 */
#endif
+#if (PLATFORM_NS_NV_COUNTERS > 0)
+ case PLAT_OTP_ID_NV_COUNTER_NS_0:
+ *size = sizeof(otp->ns_nv_counter_0);
+ break;
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 1)
+ case PLAT_OTP_ID_NV_COUNTER_NS_1:
+ *size = sizeof(otp->ns_nv_counter_1);
+ break;
+#endif
+#if (PLATFORM_NS_NV_COUNTERS > 2)
+ case PLAT_OTP_ID_NV_COUNTER_NS_2:
+ *size = sizeof(otp->ns_nv_counter_2);
+ break;
+#endif
+
case PLAT_OTP_ID_ENTROPY_SEED:
return TFM_PLAT_ERR_UNSUPPORTED;
diff --git a/platform/ext/target/arm/rss/partition/region_defs.h b/platform/ext/target/arm/rss/partition/region_defs.h
index cd622ad..5b60524 100644
--- a/platform/ext/target/arm/rss/partition/region_defs.h
+++ b/platform/ext/target/arm/rss/partition/region_defs.h
@@ -114,7 +114,7 @@
/* BL1_2 executes from VM1 */
#define BL1_2_CODE_START (NS_IMAGE_LOAD_ADDRESS + NON_SECURE_IMAGE_MAX_SIZE)
-#define BL1_2_CODE_SIZE (0x1C00) /* 7 KB */
+#define BL1_2_CODE_SIZE (0x1B00) /* 6.5 KB */
#define BL1_2_CODE_LIMIT (BL1_2_CODE_START + BL1_2_CODE_SIZE - 1)
/* BL2 executes from VM1, and is positioned directly after BL1_2 */