ITS/PS: Make file system configuration dynamic

Support not providing the following macros:
- ITS_FLASH_AREA_ADDR
- ITS_FLASH_AREA_SIZE
- PS_FLASH_AREA_ADDR
- PS_FLASH_AREA_SIZE
instead getting them from the platform HAL at runtime.

The intent here is that it will eventually be possible to use a single
TFM image on multiple boards, with the flash layout specified in
provisioning information.

Add platform HAL API functions to get the file system configuration.
Provide default implementations that just use the macros.

Add support for new macros, ITS_RAM_FS_SIZE and PS_RAM_FS_SIZE, for
use with ITS_RAM_FS and PS_RAM_FS.

Also add a validation function and perform the validation of fs
configuration that was previously done at compile-time at runtime.

There's a TODO in the new code - to move the flash_dev from struct
its_flash_info_t to struct flash_fs_info_t. Because the sector_size
and erase_val are both hard-coded in macros rather than being read
from the device driver using flash_dev->ARM_Flash_GetInfo(), this
would be a fairly major change in itself at this time.

Change-Id: I6ccb126999b0227e85dd8f6de2ea044e2a36c2e8
Signed-off-by: Chris Brand <chris.brand@cypress.com>
diff --git a/platform/include/tfm_hal_its.h b/platform/include/tfm_hal_its.h
new file mode 100644
index 0000000..843eb71
--- /dev/null
+++ b/platform/include/tfm_hal_its.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_HAL_ITS_H__
+#define __TFM_HAL_ITS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Retrieve the filesystem config for ITS.
+ *
+ * Note that this function should ensure that the values returned do
+ * not result in a security compromise.
+ *
+ * \param [out] flash_area_addr  Location of the block of flash to use for ITS
+ * \param [out] flash_area_size  Number of bytes of flash to use for ITS
+ *
+ * \return void
+ * If an error is detected within this function, is should leave the
+ * content of the parameters unchanged.
+ */
+void tfm_hal_its_fs_info(uint32_t *flash_area_addr, uint32_t *flash_area_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_HAL_ITS_H__ */
diff --git a/platform/include/tfm_hal_ps.h b/platform/include/tfm_hal_ps.h
new file mode 100644
index 0000000..e372883
--- /dev/null
+++ b/platform/include/tfm_hal_ps.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_HAL_PS_H__
+#define __TFM_HAL_PS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Retrieve the filesystem config for PS.
+ *
+ * Note that this function should ensure that the values returned do
+ * not result in a security compromise.
+ *
+ * \param [out] flash_area_addr  Location of the block of flash to use for PS
+ * \param [out] flash_area_size  Number of bytes of flash to use for PS
+ *
+ * \return void
+ * If an error is detected within this function, is should leave the
+ * content of the parameters unchanged.
+ */
+void tfm_hal_ps_fs_info(uint32_t *flash_area_addr, uint32_t *flash_area_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_HAL_PS_H__ */