1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5 
6 #ifndef _TF_MSG_COMMON_H_
7 #define _TF_MSG_COMMON_H_
8 
9 /* Communication Mailboxes */
10 #define TF_CHIMP_MB 0
11 #define TF_KONG_MB  1
12 
13 /* Helper to fill in the parms structure */
14 #define MSG_PREP(parms, mb, type, subtype, req, resp) do {	\
15 		parms.mailbox = mb;				\
16 		parms.tf_type = type;				\
17 		parms.tf_subtype = subtype;			\
18 		parms.tf_resp_code = 0;				\
19 		parms.req_size = sizeof(req);			\
20 		parms.req_data = (uint32_t *)&(req);		\
21 		parms.resp_size = sizeof(resp);			\
22 		parms.resp_data = (uint32_t *)&(resp);		\
23 	} while (0)
24 
25 #define MSG_PREP_NO_REQ(parms, mb, type, subtype, resp) do {	\
26 		parms.mailbox = mb;				\
27 		parms.tf_type = type;				\
28 		parms.tf_subtype = subtype;			\
29 		parms.tf_resp_code = 0;				\
30 		parms.req_size  = 0;				\
31 		parms.req_data  = NULL;				\
32 		parms.resp_size = sizeof(resp);			\
33 		parms.resp_data = (uint32_t *)&(resp);		\
34 	} while (0)
35 
36 #define MSG_PREP_NO_RESP(parms, mb, type, subtype, req) do {	\
37 		parms.mailbox = mb;				\
38 		parms.tf_type = type;				\
39 		parms.tf_subtype = subtype;			\
40 		parms.tf_resp_code = 0;				\
41 		parms.req_size = sizeof(req);			\
42 		parms.req_data = (uint32_t *)&(req);		\
43 		parms.resp_size = 0;				\
44 		parms.resp_data = NULL;				\
45 	} while (0)
46 
47 #endif /* _TF_MSG_COMMON_H_ */
48