1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) 2 /* 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2016 Google Inc. All rights reserved. 9 * Copyright(c) 2016 Linaro Ltd. All rights reserved. 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of version 2 of the GNU General Public License as 13 * published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * General Public License version 2 for more details. 19 * 20 * BSD LICENSE 21 * 22 * Copyright(c) 2016 Google Inc. All rights reserved. 23 * Copyright(c) 2016 Linaro Ltd. All rights reserved. 24 * 25 * Redistribution and use in source and binary forms, with or without 26 * modification, are permitted provided that the following conditions 27 * are met: 28 * 29 * * Redistributions of source code must retain the above copyright 30 * notice, this list of conditions and the following disclaimer. 31 * * Redistributions in binary form must reproduce the above copyright 32 * notice, this list of conditions and the following disclaimer in 33 * the documentation and/or other materials provided with the 34 * distribution. 35 * * Neither the name of Google Inc. or Linaro Ltd. nor the names of 36 * its contributors may be used to endorse or promote products 37 * derived from this software without specific prior written 38 * permission. 39 * 40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR 44 * LINARO LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 45 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 46 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 47 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 48 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 */ 52 53 #ifndef __ARPC_H 54 #define __ARPC_H 55 56 /* APBridgeA RPC (ARPC) */ 57 58 enum arpc_result { 59 ARPC_SUCCESS = 0x00, 60 ARPC_NO_MEMORY = 0x01, 61 ARPC_INVALID = 0x02, 62 ARPC_TIMEOUT = 0x03, 63 ARPC_UNKNOWN_ERROR = 0xff, 64 }; 65 66 struct arpc_request_message { 67 __le16 id; /* RPC unique id */ 68 __le16 size; /* Size in bytes of header + payload */ 69 __u8 type; /* RPC type */ 70 __u8 data[0]; /* ARPC data */ 71 } __packed; 72 73 struct arpc_response_message { 74 __le16 id; /* RPC unique id */ 75 __u8 result; /* Result of RPC */ 76 } __packed; 77 78 /* ARPC requests */ 79 #define ARPC_TYPE_CPORT_CONNECTED 0x01 80 #define ARPC_TYPE_CPORT_QUIESCE 0x02 81 #define ARPC_TYPE_CPORT_CLEAR 0x03 82 #define ARPC_TYPE_CPORT_FLUSH 0x04 83 #define ARPC_TYPE_CPORT_SHUTDOWN 0x05 84 85 struct arpc_cport_connected_req { 86 __le16 cport_id; 87 } __packed; 88 89 struct arpc_cport_quiesce_req { 90 __le16 cport_id; 91 __le16 peer_space; 92 __le16 timeout; 93 } __packed; 94 95 struct arpc_cport_clear_req { 96 __le16 cport_id; 97 } __packed; 98 99 struct arpc_cport_flush_req { 100 __le16 cport_id; 101 } __packed; 102 103 struct arpc_cport_shutdown_req { 104 __le16 cport_id; 105 __le16 timeout; 106 __u8 phase; 107 } __packed; 108 109 #endif /* __ARPC_H */ 110