18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright(c) 2016 Google Inc. All rights reserved.
48c2ecf20Sopenharmony_ci * Copyright(c) 2016 Linaro Ltd. All rights reserved.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __ARPC_H
88c2ecf20Sopenharmony_ci#define __ARPC_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* APBridgeA RPC (ARPC) */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cienum arpc_result {
138c2ecf20Sopenharmony_ci	ARPC_SUCCESS		= 0x00,
148c2ecf20Sopenharmony_ci	ARPC_NO_MEMORY		= 0x01,
158c2ecf20Sopenharmony_ci	ARPC_INVALID		= 0x02,
168c2ecf20Sopenharmony_ci	ARPC_TIMEOUT		= 0x03,
178c2ecf20Sopenharmony_ci	ARPC_UNKNOWN_ERROR	= 0xff,
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct arpc_request_message {
218c2ecf20Sopenharmony_ci	__le16	id;		/* RPC unique id */
228c2ecf20Sopenharmony_ci	__le16	size;		/* Size in bytes of header + payload */
238c2ecf20Sopenharmony_ci	__u8	type;		/* RPC type */
248c2ecf20Sopenharmony_ci	__u8	data[];	/* ARPC data */
258c2ecf20Sopenharmony_ci} __packed;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistruct arpc_response_message {
288c2ecf20Sopenharmony_ci	__le16	id;		/* RPC unique id */
298c2ecf20Sopenharmony_ci	__u8	result;		/* Result of RPC */
308c2ecf20Sopenharmony_ci} __packed;
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* ARPC requests */
338c2ecf20Sopenharmony_ci#define ARPC_TYPE_CPORT_CONNECTED		0x01
348c2ecf20Sopenharmony_ci#define ARPC_TYPE_CPORT_QUIESCE			0x02
358c2ecf20Sopenharmony_ci#define ARPC_TYPE_CPORT_CLEAR			0x03
368c2ecf20Sopenharmony_ci#define ARPC_TYPE_CPORT_FLUSH			0x04
378c2ecf20Sopenharmony_ci#define ARPC_TYPE_CPORT_SHUTDOWN		0x05
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct arpc_cport_connected_req {
408c2ecf20Sopenharmony_ci	__le16 cport_id;
418c2ecf20Sopenharmony_ci} __packed;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct arpc_cport_quiesce_req {
448c2ecf20Sopenharmony_ci	__le16 cport_id;
458c2ecf20Sopenharmony_ci	__le16 peer_space;
468c2ecf20Sopenharmony_ci	__le16 timeout;
478c2ecf20Sopenharmony_ci} __packed;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistruct arpc_cport_clear_req {
508c2ecf20Sopenharmony_ci	__le16 cport_id;
518c2ecf20Sopenharmony_ci} __packed;
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistruct arpc_cport_flush_req {
548c2ecf20Sopenharmony_ci	__le16 cport_id;
558c2ecf20Sopenharmony_ci} __packed;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistruct arpc_cport_shutdown_req {
588c2ecf20Sopenharmony_ci	__le16 cport_id;
598c2ecf20Sopenharmony_ci	__le16 timeout;
608c2ecf20Sopenharmony_ci	__u8 phase;
618c2ecf20Sopenharmony_ci} __packed;
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#endif	/* __ARPC_H */
64