1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef REF_PARTITION_CONFIGURATOR_H
9 #define REF_PARTITION_CONFIGURATOR_H
10 
11 #include <stdbool.h>
12 #include <service/block_storage/block_store/partitioned/partitioned_block_store.h>
13 #include <media/disk/guid.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /**
20  * To support test, a reference storage partition configuration is used with
21  * a set of different sized partitions. The total backend block store size
22  * is kept as small as possible to allow the reference configuration to be
23  * used with a ram backed store in environments where available memory is
24  * constrained.
25  */
26 
27 #define REF_PARTITION_BACK_STORE_SIZE   (200)
28 #define REF_PARTITION_BLOCK_SIZE        (256)
29 
30 /* About the right size for PSA storage */
31 #define REF_PARTITION_1_GUID            DISK_GUID_UNIQUE_PARTITION_PSA_ITS
32 #define REF_PARTITION_1_STARTING_LBA    (0)
33 #define REF_PARTITION_1_ENDING_LBA      (95)
34 
35 /* Also about the right size for PSA storage */
36 #define REF_PARTITION_2_GUID            DISK_GUID_UNIQUE_PARTITION_PSA_PS
37 #define REF_PARTITION_2_STARTING_LBA    (96)
38 #define REF_PARTITION_2_ENDING_LBA      (191)
39 
40 #define REF_PARTITION_3_GUID            DISK_GUID_UNIQUE_PARTITION_PRIMARY_FWU_METADATA
41 #define REF_PARTITION_3_STARTING_LBA    (192)
42 #define REF_PARTITION_3_ENDING_LBA      (195)
43 
44 #define REF_PARTITION_4_GUID            DISK_GUID_UNIQUE_PARTITION_BACKUP_FWU_METADATA
45 #define REF_PARTITION_4_STARTING_LBA    (196)
46 #define REF_PARTITION_4_ENDING_LBA      (199)
47 
48 /**
49  * \brief Configures a partitioned_block_store with the reference configuration
50  *
51  * \param[in]  subject  The subject partitioned_block_store
52  */
53 bool ref_partition_configure(struct partitioned_block_store *subject);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif /* REF_PARTITION_CONFIGURATOR_H */
60