xref: /rk3399_ARM-atf/include/common/param_header.h (revision 331f8a063f797c1e28d9c9d33dd757ded2edfeff)
1 /*
2  * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * Neither the name of ARM nor the names of its contributors may be used
15  * to endorse or promote products derived from this software without specific
16  * prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef __PARAM_HEADER_H__
32 #define __PARAM_HEADER_H__
33 
34 /* Param header types */
35 #define PARAM_EP		0x01
36 #define PARAM_IMAGE_BINARY	0x02
37 #define PARAM_BL31		0x03
38 #define PARAM_BL_LOAD_INFO	0x04
39 #define PARAM_BL_PARAMS		0x05
40 #define PARAM_PSCI_LIB_ARGS	0x06
41 
42 /* Param header version */
43 #define VERSION_1	0x01
44 #define VERSION_2	0x02
45 
46 #define SET_PARAM_HEAD(_p, _type, _ver, _attr) do { \
47 	(_p)->h.type = (uint8_t)(_type); \
48 	(_p)->h.version = (uint8_t)(_ver); \
49 	(_p)->h.size = (uint16_t)sizeof(*_p); \
50 	(_p)->h.attr = (uint32_t)(_attr) ; \
51 	} while (0)
52 
53 /* Following is used for populating structure members statically. */
54 #define SET_STATIC_PARAM_HEAD(_p, _type, _ver, _p_type, _attr)	\
55 	._p.h.type = (uint8_t)(_type), \
56 	._p.h.version = (uint8_t)(_ver), \
57 	._p.h.size = (uint16_t)sizeof(_p_type), \
58 	._p.h.attr = (uint32_t)(_attr)
59 
60 #ifndef __ASSEMBLY__
61 
62 #include <types.h>
63 
64 /***************************************************************************
65  * This structure provides version information and the size of the
66  * structure, attributes for the structure it represents
67  ***************************************************************************/
68 typedef struct param_header {
69 	uint8_t type;		/* type of the structure */
70 	uint8_t version;    /* version of this structure */
71 	uint16_t size;      /* size of this structure in bytes */
72 	uint32_t attr;      /* attributes: unused bits SBZ */
73 } param_header_t;
74 
75 #endif /*__ASSEMBLY__*/
76 
77 #endif /* __PARAM_HEADER_H__ */
78 
79