xref: /rk3399_ARM-atf/include/common/param_header.h (revision c3cf06f1a3a9b9ee8ac7a0ae505f95c45f7dca84)
1 /*
2  * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef PARAM_HEADER_H
8 #define PARAM_HEADER_H
9 
10 #include <stdbool.h>
11 #include <utils_def.h>
12 
13 /* Param header types */
14 #define PARAM_EP			U(0x01)
15 #define PARAM_IMAGE_BINARY		U(0x02)
16 #define PARAM_BL31			U(0x03)
17 #define PARAM_BL_LOAD_INFO		U(0x04)
18 #define PARAM_BL_PARAMS			U(0x05)
19 #define PARAM_PSCI_LIB_ARGS		U(0x06)
20 #define PARAM_SP_IMAGE_BOOT_INFO	U(0x07)
21 
22 /* Param header version */
23 #define VERSION_1	U(0x01)
24 #define VERSION_2	U(0x02)
25 
26 #define SET_PARAM_HEAD(_p, _type, _ver, _attr) do { \
27 	(_p)->h.type = (uint8_t)(_type); \
28 	(_p)->h.version = (uint8_t)(_ver); \
29 	(_p)->h.size = (uint16_t)sizeof(*(_p)); \
30 	(_p)->h.attr = (uint32_t)(_attr) ; \
31 	} while (false)
32 
33 /* Following is used for populating structure members statically. */
34 #define SET_STATIC_PARAM_HEAD(_p, _type, _ver, _p_type, _attr)	\
35 	._p.h.type = (uint8_t)(_type), \
36 	._p.h.version = (uint8_t)(_ver), \
37 	._p.h.size = (uint16_t)sizeof(_p_type), \
38 	._p.h.attr = (uint32_t)(_attr)
39 
40 #ifndef __ASSEMBLY__
41 
42 #include <stdint.h>
43 
44 /***************************************************************************
45  * This structure provides version information and the size of the
46  * structure, attributes for the structure it represents
47  ***************************************************************************/
48 typedef struct param_header {
49 	uint8_t type;		/* type of the structure */
50 	uint8_t version;    /* version of this structure */
51 	uint16_t size;      /* size of this structure in bytes */
52 	uint32_t attr;      /* attributes: unused bits SBZ */
53 } param_header_t;
54 
55 #endif /*__ASSEMBLY__*/
56 
57 #endif /* PARAM_HEADER_H */
58