1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef RMM_CORE_MANIFEST_H
8 #define RMM_CORE_MANIFEST_H
9 
10 #include <assert.h>
11 #include <stddef.h>
12 #include <stdint.h>
13 
14 #include <lib/cassert.h>
15 
16 #define RMMD_MANIFEST_VERSION_MAJOR		U(0)
17 #define RMMD_MANIFEST_VERSION_MINOR		U(1)
18 
19 /*
20  * Manifest version encoding:
21  *	- Bit[31] RES0
22  *	- Bits [30:16] Major version
23  *	- Bits [15:0] Minor version
24  */
25 #define _RMMD_MANIFEST_VERSION(_major, _minor)				\
26 	((((_major) & 0x7FFF) << 16) | ((_minor) & 0xFFFF))
27 
28 #define RMMD_MANIFEST_VERSION _RMMD_MANIFEST_VERSION(			\
29 				RMMD_MANIFEST_VERSION_MAJOR,		\
30 				RMMD_MANIFEST_VERSION_MINOR)
31 
32 #define RMMD_GET_MANIFEST_VERSION_MAJOR(_version)			\
33 	((_version >> 16) & 0x7FFF)
34 
35 #define RMMD_GET_MANIFEST_VERSION_MINOR(_version)			\
36 	(_version & 0xFFFF)
37 
38 /* Boot manifest core structure as per v0.1 */
39 typedef struct rmm_manifest {
40 	uint32_t version;	/* Manifest version */
41 	uintptr_t plat_data;	/* Manifest platform data */
42 } rmm_manifest_t;
43 
44 CASSERT(offsetof(rmm_manifest_t, version) == 0,
45 				rmm_manifest_t_version_unaligned);
46 CASSERT(offsetof(rmm_manifest_t, plat_data) == 8,
47 				rmm_manifest_t_plat_data_unaligned);
48 
49 #endif /* RMM_CORE_MANIFEST_H */
50