Staging: hv: remove UINT8 and INT8 typedefs
[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
25 #pragma once
26
27 #include "VmbusPacketFormat.h"
28
29 #define C_ASSERT(x)
30 typedef UINT32 NTSTATUS;
31
32 #pragma pack(push,1)
33
34 //
35 // Version 1 messages
36 //
37
38 typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE
39 {
40 ChannelMessageInvalid = 0,
41 ChannelMessageOfferChannel = 1,
42 ChannelMessageRescindChannelOffer = 2,
43 ChannelMessageRequestOffers = 3,
44 ChannelMessageAllOffersDelivered = 4,
45 ChannelMessageOpenChannel = 5,
46 ChannelMessageOpenChannelResult = 6,
47 ChannelMessageCloseChannel = 7,
48 ChannelMessageGpadlHeader = 8,
49 ChannelMessageGpadlBody = 9,
50 ChannelMessageGpadlCreated = 10,
51 ChannelMessageGpadlTeardown = 11,
52 ChannelMessageGpadlTorndown = 12,
53 ChannelMessageRelIdReleased = 13,
54 ChannelMessageInitiateContact = 14,
55 ChannelMessageVersionResponse = 15,
56 ChannelMessageUnload = 16,
57 #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
58 ChannelMessageViewRangeAdd = 17,
59 ChannelMessageViewRangeRemove = 18,
60 #endif
61 ChannelMessageCount
62 } VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE;
63
64 // begin_wpp config
65 // CUSTOM_TYPE(ChannelMessageType, ItemEnum(_VMBUS_CHANNEL_MESSAGE_TYPE));
66 // end_wpp
67
68 typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER
69 {
70 VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
71 UINT32 Padding;
72 } VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
73
74 // Query VMBus Version parameters
75 typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION
76 {
77 VMBUS_CHANNEL_MESSAGE_HEADER Header;
78 UINT32 Version;
79 } VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
80
81 // VMBus Version Supported parameters
82 typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED
83 {
84 VMBUS_CHANNEL_MESSAGE_HEADER Header;
85 BOOLEAN VersionSupported;
86 } VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
87
88 // Offer Channel parameters
89 typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL
90 {
91 VMBUS_CHANNEL_MESSAGE_HEADER Header;
92 VMBUS_CHANNEL_OFFER Offer;
93 UINT32 ChildRelId;
94 u8 MonitorId;
95 BOOLEAN MonitorAllocated;
96 } VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
97
98 //
99 // Make sure VMBUS_CHANNEL_OFFER_CHANNEL fits into Synic message.
100 //
101 C_ASSERT(sizeof(VMBUS_CHANNEL_OFFER_CHANNEL) <= MAXIMUM_SYNIC_MESSAGE_BYTES);
102
103 // Rescind Offer parameters
104 typedef struct _VMBUS_CHANNEL_RESCIND_OFFER
105 {
106 VMBUS_CHANNEL_MESSAGE_HEADER Header;
107 UINT32 ChildRelId;
108 } VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
109
110 // Request Offer -- no parameters, SynIC message contains the partition ID
111 // Set Snoop -- no parameters, SynIC message contains the partition ID
112 // Clear Snoop -- no parameters, SynIC message contains the partition ID
113 // All Offers Delivered -- no parameters, SynIC message contains the partition ID
114 // Flush Client -- no parameters, SynIC message contains the partition ID
115
116 // Open Channel parameters
117 typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL
118 {
119 VMBUS_CHANNEL_MESSAGE_HEADER Header;
120
121 //
122 // Identifies the specific VMBus channel that is being opened.
123 //
124 UINT32 ChildRelId;
125
126 //
127 // ID making a particular open request at a channel offer unique.
128 //
129 UINT32 OpenId;
130
131 //
132 // GPADL for the channel's ring buffer.
133 //
134 GPADL_HANDLE RingBufferGpadlHandle;
135
136 //
137 // GPADL for the channel's server context save area.
138 //
139 GPADL_HANDLE ServerContextAreaGpadlHandle;
140
141 //
142 // The upstream ring buffer begins at offset zero in the memory described
143 // by RingBufferGpadlHandle. The downstream ring buffer follows it at this
144 // offset (in pages).
145 //
146 UINT32 DownstreamRingBufferPageOffset;
147
148 //
149 // User-specific data to be passed along to the server endpoint.
150 //
151 UCHAR UserData[MAX_USER_DEFINED_BYTES];
152
153 } VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL;
154
155 // Reopen Channel parameters;
156 typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL;
157
158 // Open Channel Result parameters
159 typedef struct _VMBUS_CHANNEL_OPEN_RESULT
160 {
161 VMBUS_CHANNEL_MESSAGE_HEADER Header;
162 UINT32 ChildRelId;
163 UINT32 OpenId;
164 NTSTATUS Status;
165 } VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
166
167 // Close channel parameters;
168 typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL
169 {
170 VMBUS_CHANNEL_MESSAGE_HEADER Header;
171 UINT32 ChildRelId;
172 } VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
173
174 // Channel Message GPADL
175 #define GPADL_TYPE_RING_BUFFER 1
176 #define GPADL_TYPE_SERVER_SAVE_AREA 2
177 #define GPADL_TYPE_TRANSACTION 8
178
179 //
180 // The number of PFNs in a GPADL message is defined by the number of pages
181 // that would be spanned by ByteCount and ByteOffset. If the implied number
182 // of PFNs won't fit in this packet, there will be a follow-up packet that
183 // contains more.
184 //
185
186 typedef struct _VMBUS_CHANNEL_GPADL_HEADER
187 {
188 VMBUS_CHANNEL_MESSAGE_HEADER Header;
189 UINT32 ChildRelId;
190 UINT32 Gpadl;
191 UINT16 RangeBufLen;
192 UINT16 RangeCount;
193 GPA_RANGE Range[0];
194 } VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
195
196
197 //
198 // This is the followup packet that contains more PFNs.
199 //
200
201 typedef struct _VMBUS_CHANNEL_GPADL_BODY
202 {
203 VMBUS_CHANNEL_MESSAGE_HEADER Header;
204 UINT32 MessageNumber;
205 UINT32 Gpadl;
206 UINT64 Pfn[0];
207 } VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY;
208
209
210 typedef struct _VMBUS_CHANNEL_GPADL_CREATED
211 {
212 VMBUS_CHANNEL_MESSAGE_HEADER Header;
213 UINT32 ChildRelId;
214 UINT32 Gpadl;
215 UINT32 CreationStatus;
216 } VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED;
217
218 typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN
219 {
220 VMBUS_CHANNEL_MESSAGE_HEADER Header;
221 UINT32 ChildRelId;
222 UINT32 Gpadl;
223 } VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
224
225 typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN
226 {
227 VMBUS_CHANNEL_MESSAGE_HEADER Header;
228 UINT32 Gpadl;
229 } VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
230
231 #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
232 typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD
233 {
234 VMBUS_CHANNEL_MESSAGE_HEADER Header;
235 PHYSICAL_ADDRESS ViewRangeBase;
236 UINT64 ViewRangeLength;
237 UINT32 ChildRelId;
238 } VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
239
240 typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE
241 {
242 VMBUS_CHANNEL_MESSAGE_HEADER Header;
243 PHYSICAL_ADDRESS ViewRangeBase;
244 UINT32 ChildRelId;
245 } VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
246 #endif
247
248 typedef struct _VMBUS_CHANNEL_RELID_RELEASED
249 {
250 VMBUS_CHANNEL_MESSAGE_HEADER Header;
251 UINT32 ChildRelId;
252 } VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
253
254 typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT
255 {
256 VMBUS_CHANNEL_MESSAGE_HEADER Header;
257 UINT32 VMBusVersionRequested;
258 UINT32 Padding2;
259 UINT64 InterruptPage;
260 UINT64 MonitorPage1;
261 UINT64 MonitorPage2;
262 } VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT;
263
264 typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE
265 {
266 VMBUS_CHANNEL_MESSAGE_HEADER Header;
267 BOOLEAN VersionSupported;
268 } VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
269
270 typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD;
271
272 //
273 // Kind of a table to use the preprocessor to get us the right type for a
274 // specified message ID. Used with ChAllocateSendMessage()
275 //
276 #define ChannelMessageQueryVmbusVersion_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
277 #define ChannelMessageVmbusVersionSupported_TYPE VMBUS_CHANNEL_VERSION_SUPPORTED
278 #define ChannelMessageOfferChannel_TYPE VMBUS_CHANNEL_OFFER_CHANNEL
279 #define ChannelMessageRescindChannelOffer_TYPE VMBUS_CHANNEL_RESCIND_OFFER
280 #define ChannelMessageRequestOffers_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
281 #define ChannelMessageAllOffersDelivered_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
282 #define ChannelMessageOpenChannel_TYPE VMBUS_CHANNEL_OPEN_CHANNEL
283 #define ChannelMessageOpenChannelResult_TYPE VMBUS_CHANNEL_OPEN_RESULT
284 #define ChannelMessageCloseChannel_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
285 #define ChannelMessageAllGpadlsUnmapped_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
286 #define ChannelMessageGpadlHeader_TYPE VMBUS_CHANNEL_GPADL_HEADER
287 #define ChannelMessageGpadlBody_TYPE VMBUS_CHANNEL_GPADL_BODY
288 #define ChannelMessageGpadlCreated_TYPE VMBUS_CHANNEL_GPADL_CREATED
289 #define ChannelMessageGpadlTeardown_TYPE VMBUS_CHANNEL_GPADL_TEARDOWN
290 #define ChannelMessageGpadlTorndown_TYPE VMBUS_CHANNEL_GPADL_TORNDOWN
291 #define ChannelMessageViewRangeAdd_TYPE VMBUS_CHANNEL_VIEW_RANGE_ADD
292 #define ChannelMessageViewRangeRemove_TYPE VMBUS_CHANNEL_VIEW_RANGE_REMOVE
293 #define ChannelMessageRelIdReleased_TYPE VMBUS_CHANNEL_RELID_RELEASED
294 #define ChannelMessageInitiateContact_TYPE VMBUS_CHANNEL_INITIATE_CONTACT
295 #define ChannelMessageVersionResponse_TYPE VMBUS_CHANNEL_VERSION_RESPONSE
296 #define ChannelMessageUnload_TYPE VMBUS_CHANNEL_UNLOAD
297
298 //
299 // Preprocessor wrapper to ChAllocateSendMessageSize() converting the return
300 // value to the correct pointer and calculate the needed size.
301 //
302 // Argument:
303 //
304 // Id - the numberic ID (type VMBUS_CHANNEL_MESSAGE_TYPE) of the message to
305 // send.
306 //
307 #define ChAllocateSendMessage(Id, Fn, Context) \
308 (Id##_TYPE*)ChAllocateSendMessageSized(sizeof(Id##_TYPE), Id, Fn, Context)
309
310
311 #pragma pack(pop)
312
This page took 0.036952 seconds and 5 git commands to generate.