xref: /openbmc/linux/drivers/greybus/arpc.h (revision 234489ac)
1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
2 /*
3  * Copyright(c) 2016 Google Inc. All rights reserved.
4  * Copyright(c) 2016 Linaro Ltd. All rights reserved.
5  */
6 
7 #ifndef __ARPC_H
8 #define __ARPC_H
9 
10 /* APBridgeA RPC (ARPC) */
11 
12 enum arpc_result {
13 	ARPC_SUCCESS		= 0x00,
14 	ARPC_NO_MEMORY		= 0x01,
15 	ARPC_INVALID		= 0x02,
16 	ARPC_TIMEOUT		= 0x03,
17 	ARPC_UNKNOWN_ERROR	= 0xff,
18 };
19 
20 struct arpc_request_message {
21 	__le16	id;		/* RPC unique id */
22 	__le16	size;		/* Size in bytes of header + payload */
23 	__u8	type;		/* RPC type */
24 	__u8	data[];	/* ARPC data */
25 } __packed;
26 
27 struct arpc_response_message {
28 	__le16	id;		/* RPC unique id */
29 	__u8	result;		/* Result of RPC */
30 } __packed;
31 
32 /* ARPC requests */
33 #define ARPC_TYPE_CPORT_CONNECTED		0x01
34 #define ARPC_TYPE_CPORT_QUIESCE			0x02
35 #define ARPC_TYPE_CPORT_CLEAR			0x03
36 #define ARPC_TYPE_CPORT_FLUSH			0x04
37 #define ARPC_TYPE_CPORT_SHUTDOWN		0x05
38 
39 struct arpc_cport_connected_req {
40 	__le16 cport_id;
41 } __packed;
42 
43 struct arpc_cport_quiesce_req {
44 	__le16 cport_id;
45 	__le16 peer_space;
46 	__le16 timeout;
47 } __packed;
48 
49 struct arpc_cport_clear_req {
50 	__le16 cport_id;
51 } __packed;
52 
53 struct arpc_cport_flush_req {
54 	__le16 cport_id;
55 } __packed;
56 
57 struct arpc_cport_shutdown_req {
58 	__le16 cport_id;
59 	__le16 timeout;
60 	__u8 phase;
61 } __packed;
62 
63 #endif	/* __ARPC_H */
64