Staging: hv: typedef removal for ChannelMessages.h
[deliverable/linux.git] / drivers / staging / hv / include / ChannelMessages.h
1 /*
2 *
3 * Copyright (c) 2009, Microsoft Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 *
22 */
23
24 #ifndef __CHANNELMESSAGES_H
25 #define __CHANNELMESSAGES_H
26
27 #include "VmbusPacketFormat.h"
28
29 /* Version 1 messages */
30 enum vmbus_channel_message_type {
31 ChannelMessageInvalid = 0,
32 ChannelMessageOfferChannel = 1,
33 ChannelMessageRescindChannelOffer = 2,
34 ChannelMessageRequestOffers = 3,
35 ChannelMessageAllOffersDelivered = 4,
36 ChannelMessageOpenChannel = 5,
37 ChannelMessageOpenChannelResult = 6,
38 ChannelMessageCloseChannel = 7,
39 ChannelMessageGpadlHeader = 8,
40 ChannelMessageGpadlBody = 9,
41 ChannelMessageGpadlCreated = 10,
42 ChannelMessageGpadlTeardown = 11,
43 ChannelMessageGpadlTorndown = 12,
44 ChannelMessageRelIdReleased = 13,
45 ChannelMessageInitiateContact = 14,
46 ChannelMessageVersionResponse = 15,
47 ChannelMessageUnload = 16,
48 #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
49 ChannelMessageViewRangeAdd = 17,
50 ChannelMessageViewRangeRemove = 18,
51 #endif
52 ChannelMessageCount
53 } __attribute__((packed));
54
55 struct vmbus_channel_message_header {
56 enum vmbus_channel_message_type MessageType;
57 u32 Padding;
58 } __attribute__((packed));
59
60 /* Query VMBus Version parameters */
61 struct vmbus_channel_query_vmbus_version {
62 struct vmbus_channel_message_header Header;
63 u32 Version;
64 } __attribute__((packed));
65
66 /* VMBus Version Supported parameters */
67 struct vmbus_channel_version_supported {
68 struct vmbus_channel_message_header Header;
69 bool VersionSupported;
70 } __attribute__((packed));
71
72 /* Offer Channel parameters */
73 struct vmbus_channel_offer_channel {
74 struct vmbus_channel_message_header Header;
75 struct vmbus_channel_offer Offer;
76 u32 ChildRelId;
77 u8 MonitorId;
78 bool MonitorAllocated;
79 } __attribute__((packed));
80
81 /* Rescind Offer parameters */
82 struct vmbus_channel_rescind_offer {
83 struct vmbus_channel_message_header Header;
84 u32 ChildRelId;
85 } __attribute__((packed));
86
87 /*
88 * Request Offer -- no parameters, SynIC message contains the partition ID
89 * Set Snoop -- no parameters, SynIC message contains the partition ID
90 * Clear Snoop -- no parameters, SynIC message contains the partition ID
91 * All Offers Delivered -- no parameters, SynIC message contains the partition
92 * ID
93 * Flush Client -- no parameters, SynIC message contains the partition ID
94 */
95
96 /* Open Channel parameters */
97 struct vmbus_channel_open_channel {
98 struct vmbus_channel_message_header Header;
99
100 /* Identifies the specific VMBus channel that is being opened. */
101 u32 ChildRelId;
102
103 /* ID making a particular open request at a channel offer unique. */
104 u32 OpenId;
105
106 /* GPADL for the channel's ring buffer. */
107 u32 RingBufferGpadlHandle;
108
109 /* GPADL for the channel's server context save area. */
110 u32 ServerContextAreaGpadlHandle;
111
112 /*
113 * The upstream ring buffer begins at offset zero in the memory
114 * described by RingBufferGpadlHandle. The downstream ring buffer
115 * follows it at this offset (in pages).
116 */
117 u32 DownstreamRingBufferPageOffset;
118
119 /* User-specific data to be passed along to the server endpoint. */
120 unsigned char UserData[MAX_USER_DEFINED_BYTES];
121 } __attribute__((packed));
122
123 /* Open Channel Result parameters */
124 struct vmbus_channel_open_result {
125 struct vmbus_channel_message_header Header;
126 u32 ChildRelId;
127 u32 OpenId;
128 u32 Status;
129 } __attribute__((packed));
130
131 /* Close channel parameters; */
132 struct vmbus_channel_close_channel {
133 struct vmbus_channel_message_header Header;
134 u32 ChildRelId;
135 } __attribute__((packed));
136
137 /* Channel Message GPADL */
138 #define GPADL_TYPE_RING_BUFFER 1
139 #define GPADL_TYPE_SERVER_SAVE_AREA 2
140 #define GPADL_TYPE_TRANSACTION 8
141
142 /*
143 * The number of PFNs in a GPADL message is defined by the number of
144 * pages that would be spanned by ByteCount and ByteOffset. If the
145 * implied number of PFNs won't fit in this packet, there will be a
146 * follow-up packet that contains more.
147 */
148 struct vmbus_channel_gpadl_header {
149 struct vmbus_channel_message_header Header;
150 u32 ChildRelId;
151 u32 Gpadl;
152 u16 RangeBufLen;
153 u16 RangeCount;
154 GPA_RANGE Range[0];
155 } __attribute__((packed));
156
157 /* This is the followup packet that contains more PFNs. */
158 struct vmbus_channel_gpadl_body {
159 struct vmbus_channel_message_header Header;
160 u32 MessageNumber;
161 u32 Gpadl;
162 u64 Pfn[0];
163 } __attribute__((packed));
164
165 struct vmbus_channel_gpadl_created {
166 struct vmbus_channel_message_header Header;
167 u32 ChildRelId;
168 u32 Gpadl;
169 u32 CreationStatus;
170 } __attribute__((packed));
171
172 struct vmbus_channel_gpadl_teardown {
173 struct vmbus_channel_message_header Header;
174 u32 ChildRelId;
175 u32 Gpadl;
176 } __attribute__((packed));
177
178 struct vmbus_channel_gpadl_torndown {
179 struct vmbus_channel_message_header Header;
180 u32 Gpadl;
181 } __attribute__((packed));
182
183 #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
184 struct vmbus_channel_view_range_add {
185 struct vmbus_channel_message_header Header;
186 PHYSICAL_ADDRESS ViewRangeBase;
187 u64 ViewRangeLength;
188 u32 ChildRelId;
189 } __attribute__((packed));
190
191 struct vmbus_channel_view_range_remove {
192 struct vmbus_channel_message_header Header;
193 PHYSICAL_ADDRESS ViewRangeBase;
194 u32 ChildRelId;
195 } __attribute__((packed));
196 #endif
197
198 struct vmbus_channel_relid_released {
199 struct vmbus_channel_message_header Header;
200 u32 ChildRelId;
201 } __attribute__((packed));
202
203 struct vmbus_channel_initiate_contact {
204 struct vmbus_channel_message_header Header;
205 u32 VMBusVersionRequested;
206 u32 Padding2;
207 u64 InterruptPage;
208 u64 MonitorPage1;
209 u64 MonitorPage2;
210 } __attribute__((packed));
211
212 struct vmbus_channel_version_response {
213 struct vmbus_channel_message_header Header;
214 bool VersionSupported;
215 } __attribute__((packed));
216
217 #endif
This page took 0.034806 seconds and 5 git commands to generate.