Introduce common disk GUID defintions
Adds the file media/disk/guid.h for common storage related GUIDs
for identifying things like partitions and partition types. Platform
integrators are free to define and manage their own GUIDs but may
use common ones in guid.h if appropriate.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I742108e53959508103e027686a0ffc6f46b3bf49
diff --git a/components/media/disk/guid.h b/components/media/disk/guid.h
new file mode 100644
index 0000000..10bf916
--- /dev/null
+++ b/components/media/disk/guid.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef MEDIA_DISK_GUID_H
+#define MEDIA_DISK_GUID_H
+
+/**
+ * Some common GUID definitions related to disk object identification used
+ * by TS components. This is not intended to be a comprehensive list. Platform
+ * integrators are free to define their own GUIDs and to manage them externally.
+ */
+
+/* Partition type GUIDs */
+#define DISK_GUID_PARTITION_TYPE_FWU_METADATA \
+ "8a7a84a0-8387-40f6-ab41-a8b9a5a60d23"
+
+#define DISK_GUID_PARTITION_TYPE_SFS_STORAGE \
+ "a495f487-892c-4d9d-b5dc-679a10985aed"
+
+/* Unique partition GUIDs */
+#define DISK_GUID_UNIQUE_PARTITION_PRIMARY_FWU_METADATA \
+ "c39ef8a6-ec97-4883-aa64-025f40f7d922"
+
+#define DISK_GUID_UNIQUE_PARTITION_BACKUP_FWU_METADATA \
+ "c3d82065-58f3-4fcb-a8fc-772434bfc91d"
+
+#define DISK_GUID_UNIQUE_PARTITION_PSA_ITS \
+ "92f7d53b-127e-432b-815c-9a95b80d69b7"
+
+#define DISK_GUID_UNIQUE_PARTITION_PSA_PS \
+ "701456da-9b50-49b2-9722-47510f851ccd"
+
+#endif /* MEDIA_DISK_GUID_H */
diff --git a/components/service/block_storage/config/ref/ref_partition_configurator.h b/components/service/block_storage/config/ref/ref_partition_configurator.h
index 81aa108..4e15d54 100644
--- a/components/service/block_storage/config/ref/ref_partition_configurator.h
+++ b/components/service/block_storage/config/ref/ref_partition_configurator.h
@@ -9,7 +9,8 @@
#define REF_PARTITION_CONFIGURATOR_H
#include <stdbool.h>
-#include "service/block_storage/block_store/partitioned/partitioned_block_store.h"
+#include <service/block_storage/block_store/partitioned/partitioned_block_store.h>
+#include <media/disk/guid.h>
#ifdef __cplusplus
extern "C" {
@@ -27,20 +28,20 @@
#define REF_PARTITION_BLOCK_SIZE (512)
/* About the right size for PSA storage */
-#define REF_PARTITION_1_GUID "92f7d53b-127e-432b-815c-9a95b80d69b7"
+#define REF_PARTITION_1_GUID DISK_GUID_UNIQUE_PARTITION_PSA_ITS
#define REF_PARTITION_1_STARTING_LBA (0)
#define REF_PARTITION_1_ENDING_LBA (95)
/* Also about the right size for PSA storage */
-#define REF_PARTITION_2_GUID "701456da-9b50-49b2-9722-47510f851ccd"
+#define REF_PARTITION_2_GUID DISK_GUID_UNIQUE_PARTITION_PSA_PS
#define REF_PARTITION_2_STARTING_LBA (96)
#define REF_PARTITION_2_ENDING_LBA (191)
-#define REF_PARTITION_3_GUID "c39ef8a6-ec97-4883-aa64-025f40f7d922"
+#define REF_PARTITION_3_GUID DISK_GUID_UNIQUE_PARTITION_PRIMARY_FWU_METADATA
#define REF_PARTITION_3_STARTING_LBA (192)
#define REF_PARTITION_3_ENDING_LBA (195)
-#define REF_PARTITION_4_GUID "c3d82065-58f3-4fcb-a8fc-772434bfc91d"
+#define REF_PARTITION_4_GUID DISK_GUID_UNIQUE_PARTITION_BACKUP_FWU_METADATA
#define REF_PARTITION_4_STARTING_LBA (196)
#define REF_PARTITION_4_ENDING_LBA (199)
diff --git a/components/service/locator/standalone/services/protected-storage/ps_service_context.cpp b/components/service/locator/standalone/services/protected-storage/ps_service_context.cpp
index 476f510..7e74a01 100644
--- a/components/service/locator/standalone/services/protected-storage/ps_service_context.cpp
+++ b/components/service/locator/standalone/services/protected-storage/ps_service_context.cpp
@@ -6,8 +6,8 @@
#include "ps_service_context.h"
#include "service/block_storage/factory/client/block_store_factory.h"
-#include "service/block_storage/config/ref/ref_partition_configurator.h"
#include "service/secure_storage/backend/secure_flash_store/secure_flash_store.h"
+#include "media/disk/guid.h"
ps_service_context::ps_service_context(const char *sn) :
standalone_service_context(sn),
@@ -28,7 +28,7 @@
struct uuid_octets guid;
const struct sfs_flash_info_t *flash_info = NULL;
- uuid_parse_to_octets(REF_PARTITION_2_GUID, guid.octets, sizeof(guid.octets));
+ uuid_parse_to_octets(DISK_GUID_UNIQUE_PARTITION_PSA_PS, guid.octets, sizeof(guid.octets));
m_block_store = client_block_store_factory_create(
"sn:trustedfirmware.org:block-storage:0");
diff --git a/components/service/secure_storage/factory/sp/sfs_shared_block_store/storage_factory.c b/components/service/secure_storage/factory/sp/sfs_shared_block_store/storage_factory.c
index 3e1bfc1..44bc38b 100644
--- a/components/service/secure_storage/factory/sp/sfs_shared_block_store/storage_factory.c
+++ b/components/service/secure_storage/factory/sp/sfs_shared_block_store/storage_factory.c
@@ -18,7 +18,7 @@
#include "service/secure_storage/factory/storage_factory.h"
#include "service/block_storage/block_store/block_store.h"
#include "service/block_storage/factory/client/block_store_factory.h"
-#include "service/block_storage/config/ref/ref_partition_configurator.h"
+#include "media/disk/guid.h"
/* Overridable SFS configuration */
@@ -66,9 +66,11 @@
const struct sfs_flash_info_t *flash_info = NULL;
if (security_class == storage_factory_security_class_INTERNAL_TRUSTED)
- uuid_parse_to_octets(REF_PARTITION_1_GUID, guid.octets, sizeof(guid.octets));
+ uuid_parse_to_octets(
+ DISK_GUID_UNIQUE_PARTITION_PSA_ITS, guid.octets, sizeof(guid.octets));
else
- uuid_parse_to_octets(REF_PARTITION_2_GUID, guid.octets, sizeof(guid.octets));
+ uuid_parse_to_octets(
+ DISK_GUID_UNIQUE_PARTITION_PSA_PS, guid.octets, sizeof(guid.octets));
psa_status_t status = sfs_flash_block_store_adapter_init(
&storage_instance.sfs_flash_adapter,