xref: /dpdk/drivers/net/bnxt/tf_core/tf_msg_common.h (revision e6e8f03e5459f25153f1e4cd3e9ac30d3e473a61)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2023 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.req_size = sizeof(req);			\
19 		parms.req_data = (uint32_t *)&(req);		\
20 		parms.resp_size = sizeof(resp);			\
21 		parms.resp_data = (uint32_t *)&(resp);		\
22 	} while (0)
23 
24 #define MSG_PREP_NO_REQ(parms, mb, type, subtype, resp) do {	\
25 		parms.mailbox = mb;				\
26 		parms.tf_type = type;				\
27 		parms.tf_subtype = subtype;			\
28 		parms.req_size  = 0;				\
29 		parms.req_data  = NULL;				\
30 		parms.resp_size = sizeof(resp);			\
31 		parms.resp_data = (uint32_t *)&(resp);		\
32 	} while (0)
33 
34 #define MSG_PREP_NO_RESP(parms, mb, type, subtype, req) do {	\
35 		parms.mailbox = mb;				\
36 		parms.tf_type = type;				\
37 		parms.tf_subtype = subtype;			\
38 		parms.req_size = sizeof(req);			\
39 		parms.req_data = (uint32_t *)&(req);		\
40 		parms.resp_size = 0;				\
41 		parms.resp_data = NULL;				\
42 	} while (0)
43 #endif /* _TF_MSG_COMMON_H_ */
44