Merge tag 'for-linus-20190706' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / staging / greybus / arpc.h
blob3dab6375909c30f750a398a6194d4d8a911d2014
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.
6 * GPL LICENSE SUMMARY
8 * Copyright(c) 2016 Google Inc. All rights reserved.
9 * Copyright(c) 2016 Linaro Ltd. All rights reserved.
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.
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.
20 * BSD LICENSE
22 * Copyright(c) 2016 Google Inc. All rights reserved.
23 * Copyright(c) 2016 Linaro Ltd. All rights reserved.
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
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.
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.
53 #ifndef __ARPC_H
54 #define __ARPC_H
56 /* APBridgeA RPC (ARPC) */
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,
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;
73 struct arpc_response_message {
74 __le16 id; /* RPC unique id */
75 __u8 result; /* Result of RPC */
76 } __packed;
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
85 struct arpc_cport_connected_req {
86 __le16 cport_id;
87 } __packed;
89 struct arpc_cport_quiesce_req {
90 __le16 cport_id;
91 __le16 peer_space;
92 __le16 timeout;
93 } __packed;
95 struct arpc_cport_clear_req {
96 __le16 cport_id;
97 } __packed;
99 struct arpc_cport_flush_req {
100 __le16 cport_id;
101 } __packed;
103 struct arpc_cport_shutdown_req {
104 __le16 cport_id;
105 __le16 timeout;
106 __u8 phase;
107 } __packed;
109 #endif /* __ARPC_H */