]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.drivers/staging-hv-add-the-hyper-v-api-header-files.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / staging-hv-add-the-hyper-v-api-header-files.patch
1 From 50626ba62379de1e1c92abe1e630138bfd096fd0 Mon Sep 17 00:00:00 2001
2 From: Hank Janssen <hjanssen@microsoft.com>
3 Date: Mon, 13 Jul 2009 15:15:47 -0700
4 Subject: Staging: hv: add the Hyper-V api header files
5
6 From: Hank Janssen <hjanssen@microsoft.com>
7
8 These are the header files for the API to talk to the Hyper-V
9 core.
10
11 Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
12 Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
13 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 ---
15 drivers/staging/hv/include/ChannelMessages.h | 312 +++++++
16 drivers/staging/hv/include/HvHalApi.h | 32
17 drivers/staging/hv/include/HvHcApi.h | 60 +
18 drivers/staging/hv/include/HvPtApi.h | 86 ++
19 drivers/staging/hv/include/HvStatus.h | 718 ++++++++++++++++++
20 drivers/staging/hv/include/HvSynicApi.h | 490 ++++++++++++
21 drivers/staging/hv/include/HvTypes.h | 31
22 drivers/staging/hv/include/HvVpApi.h | 51 +
23 drivers/staging/hv/include/List.h | 269 ++++++
24 drivers/staging/hv/include/VmbusChannelInterface.h | 131 +++
25 drivers/staging/hv/include/VmbusPacketFormat.h | 322 ++++++++
26 drivers/staging/hv/include/nvspprotocol.h | 306 +++++++
27 drivers/staging/hv/include/rndis.h | 836 +++++++++++++++++++++
28 drivers/staging/hv/include/vstorage.h | 309 +++++++
29 14 files changed, 3953 insertions(+)
30 create mode 100644 drivers/staging/hv/include/ChannelMessages.h
31 create mode 100644 drivers/staging/hv/include/HvHalApi.h
32 create mode 100644 drivers/staging/hv/include/HvHcApi.h
33 create mode 100644 drivers/staging/hv/include/HvPtApi.h
34 create mode 100644 drivers/staging/hv/include/HvStatus.h
35 create mode 100644 drivers/staging/hv/include/HvSynicApi.h
36 create mode 100644 drivers/staging/hv/include/HvTypes.h
37 create mode 100644 drivers/staging/hv/include/HvVpApi.h
38 create mode 100644 drivers/staging/hv/include/List.h
39 create mode 100644 drivers/staging/hv/include/VmbusChannelInterface.h
40 create mode 100644 drivers/staging/hv/include/VmbusPacketFormat.h
41 create mode 100644 drivers/staging/hv/include/nvspprotocol.h
42 create mode 100644 drivers/staging/hv/include/rndis.h
43 create mode 100644 drivers/staging/hv/include/vstorage.h
44
45 --- /dev/null
46 +++ b/drivers/staging/hv/include/ChannelMessages.h
47 @@ -0,0 +1,312 @@
48 +/*
49 + *
50 + * Copyright (c) 2009, Microsoft Corporation.
51 + *
52 + * This program is free software; you can redistribute it and/or modify it
53 + * under the terms and conditions of the GNU General Public License,
54 + * version 2, as published by the Free Software Foundation.
55 + *
56 + * This program is distributed in the hope it will be useful, but WITHOUT
57 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
58 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
59 + * more details.
60 + *
61 + * You should have received a copy of the GNU General Public License along with
62 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
63 + * Place - Suite 330, Boston, MA 02111-1307 USA.
64 + *
65 + * Authors:
66 + * Haiyang Zhang <haiyangz@microsoft.com>
67 + * Hank Janssen <hjanssen@microsoft.com>
68 + *
69 + */
70 +
71 +
72 +#pragma once
73 +
74 +#include <VmbusPacketFormat.h>
75 +
76 +#define C_ASSERT(x)
77 +typedef UINT32 NTSTATUS;
78 +
79 +#pragma pack(push,1)
80 +
81 +//
82 +// Version 1 messages
83 +//
84 +
85 +typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE
86 +{
87 + ChannelMessageInvalid = 0,
88 + ChannelMessageOfferChannel = 1,
89 + ChannelMessageRescindChannelOffer = 2,
90 + ChannelMessageRequestOffers = 3,
91 + ChannelMessageAllOffersDelivered = 4,
92 + ChannelMessageOpenChannel = 5,
93 + ChannelMessageOpenChannelResult = 6,
94 + ChannelMessageCloseChannel = 7,
95 + ChannelMessageGpadlHeader = 8,
96 + ChannelMessageGpadlBody = 9,
97 + ChannelMessageGpadlCreated = 10,
98 + ChannelMessageGpadlTeardown = 11,
99 + ChannelMessageGpadlTorndown = 12,
100 + ChannelMessageRelIdReleased = 13,
101 + ChannelMessageInitiateContact = 14,
102 + ChannelMessageVersionResponse = 15,
103 + ChannelMessageUnload = 16,
104 +#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
105 + ChannelMessageViewRangeAdd = 17,
106 + ChannelMessageViewRangeRemove = 18,
107 +#endif
108 + ChannelMessageCount
109 +} VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE;
110 +
111 +// begin_wpp config
112 +// CUSTOM_TYPE(ChannelMessageType, ItemEnum(_VMBUS_CHANNEL_MESSAGE_TYPE));
113 +// end_wpp
114 +
115 +typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER
116 +{
117 + VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
118 + UINT32 Padding;
119 +} VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
120 +
121 +// Query VMBus Version parameters
122 +typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION
123 +{
124 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
125 + UINT32 Version;
126 +} VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
127 +
128 +// VMBus Version Supported parameters
129 +typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED
130 +{
131 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
132 + BOOLEAN VersionSupported;
133 +} VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
134 +
135 +// Offer Channel parameters
136 +typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL
137 +{
138 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
139 + VMBUS_CHANNEL_OFFER Offer;
140 + UINT32 ChildRelId;
141 + UINT8 MonitorId;
142 + BOOLEAN MonitorAllocated;
143 +} VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
144 +
145 +//
146 +// Make sure VMBUS_CHANNEL_OFFER_CHANNEL fits into Synic message.
147 +//
148 +C_ASSERT(sizeof(VMBUS_CHANNEL_OFFER_CHANNEL) <= MAXIMUM_SYNIC_MESSAGE_BYTES);
149 +
150 +// Rescind Offer parameters
151 +typedef struct _VMBUS_CHANNEL_RESCIND_OFFER
152 +{
153 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
154 + UINT32 ChildRelId;
155 +} VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
156 +
157 +// Request Offer -- no parameters, SynIC message contains the partition ID
158 +// Set Snoop -- no parameters, SynIC message contains the partition ID
159 +// Clear Snoop -- no parameters, SynIC message contains the partition ID
160 +// All Offers Delivered -- no parameters, SynIC message contains the partition ID
161 +// Flush Client -- no parameters, SynIC message contains the partition ID
162 +
163 +// Open Channel parameters
164 +typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL
165 +{
166 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
167 +
168 + //
169 + // Identifies the specific VMBus channel that is being opened.
170 + //
171 + UINT32 ChildRelId;
172 +
173 + //
174 + // ID making a particular open request at a channel offer unique.
175 + //
176 + UINT32 OpenId;
177 +
178 + //
179 + // GPADL for the channel's ring buffer.
180 + //
181 + GPADL_HANDLE RingBufferGpadlHandle;
182 +
183 + //
184 + // GPADL for the channel's server context save area.
185 + //
186 + GPADL_HANDLE ServerContextAreaGpadlHandle;
187 +
188 + //
189 + // The upstream ring buffer begins at offset zero in the memory described
190 + // by RingBufferGpadlHandle. The downstream ring buffer follows it at this
191 + // offset (in pages).
192 + //
193 + UINT32 DownstreamRingBufferPageOffset;
194 +
195 + //
196 + // User-specific data to be passed along to the server endpoint.
197 + //
198 + UCHAR UserData[MAX_USER_DEFINED_BYTES];
199 +
200 +} VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL;
201 +
202 +// Reopen Channel parameters;
203 +typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL;
204 +
205 +// Open Channel Result parameters
206 +typedef struct _VMBUS_CHANNEL_OPEN_RESULT
207 +{
208 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
209 + UINT32 ChildRelId;
210 + UINT32 OpenId;
211 + NTSTATUS Status;
212 +} VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
213 +
214 +// Close channel parameters;
215 +typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL
216 +{
217 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
218 + UINT32 ChildRelId;
219 +} VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
220 +
221 +// Channel Message GPADL
222 +#define GPADL_TYPE_RING_BUFFER 1
223 +#define GPADL_TYPE_SERVER_SAVE_AREA 2
224 +#define GPADL_TYPE_TRANSACTION 8
225 +
226 +//
227 +// The number of PFNs in a GPADL message is defined by the number of pages
228 +// that would be spanned by ByteCount and ByteOffset. If the implied number
229 +// of PFNs won't fit in this packet, there will be a follow-up packet that
230 +// contains more.
231 +//
232 +
233 +typedef struct _VMBUS_CHANNEL_GPADL_HEADER
234 +{
235 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
236 + UINT32 ChildRelId;
237 + UINT32 Gpadl;
238 + UINT16 RangeBufLen;
239 + UINT16 RangeCount;
240 + GPA_RANGE Range[0];
241 +} VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
242 +
243 +
244 +//
245 +// This is the followup packet that contains more PFNs.
246 +//
247 +
248 +typedef struct _VMBUS_CHANNEL_GPADL_BODY
249 +{
250 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
251 + UINT32 MessageNumber;
252 + UINT32 Gpadl;
253 + UINT64 Pfn[0];
254 +} VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY;
255 +
256 +
257 +typedef struct _VMBUS_CHANNEL_GPADL_CREATED
258 +{
259 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
260 + UINT32 ChildRelId;
261 + UINT32 Gpadl;
262 + UINT32 CreationStatus;
263 +} VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED;
264 +
265 +typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN
266 +{
267 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
268 + UINT32 ChildRelId;
269 + UINT32 Gpadl;
270 +} VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
271 +
272 +typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN
273 +{
274 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
275 + UINT32 Gpadl;
276 +} VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
277 +
278 +#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
279 +typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD
280 +{
281 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
282 + PHYSICAL_ADDRESS ViewRangeBase;
283 + UINT64 ViewRangeLength;
284 + UINT32 ChildRelId;
285 +} VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
286 +
287 +typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE
288 +{
289 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
290 + PHYSICAL_ADDRESS ViewRangeBase;
291 + UINT32 ChildRelId;
292 +} VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
293 +#endif
294 +
295 +typedef struct _VMBUS_CHANNEL_RELID_RELEASED
296 +{
297 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
298 + UINT32 ChildRelId;
299 +} VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
300 +
301 +typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT
302 +{
303 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
304 + UINT32 VMBusVersionRequested;
305 + UINT32 Padding2;
306 + UINT64 InterruptPage;
307 + UINT64 MonitorPage1;
308 + UINT64 MonitorPage2;
309 +} VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT;
310 +
311 +typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE
312 +{
313 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
314 + BOOLEAN VersionSupported;
315 +} VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
316 +
317 +typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD;
318 +
319 +//
320 +// Kind of a table to use the preprocessor to get us the right type for a
321 +// specified message ID. Used with ChAllocateSendMessage()
322 +//
323 +#define ChannelMessageQueryVmbusVersion_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
324 +#define ChannelMessageVmbusVersionSupported_TYPE VMBUS_CHANNEL_VERSION_SUPPORTED
325 +#define ChannelMessageOfferChannel_TYPE VMBUS_CHANNEL_OFFER_CHANNEL
326 +#define ChannelMessageRescindChannelOffer_TYPE VMBUS_CHANNEL_RESCIND_OFFER
327 +#define ChannelMessageRequestOffers_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
328 +#define ChannelMessageAllOffersDelivered_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
329 +#define ChannelMessageOpenChannel_TYPE VMBUS_CHANNEL_OPEN_CHANNEL
330 +#define ChannelMessageOpenChannelResult_TYPE VMBUS_CHANNEL_OPEN_RESULT
331 +#define ChannelMessageCloseChannel_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
332 +#define ChannelMessageAllGpadlsUnmapped_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
333 +#define ChannelMessageGpadlHeader_TYPE VMBUS_CHANNEL_GPADL_HEADER
334 +#define ChannelMessageGpadlBody_TYPE VMBUS_CHANNEL_GPADL_BODY
335 +#define ChannelMessageGpadlCreated_TYPE VMBUS_CHANNEL_GPADL_CREATED
336 +#define ChannelMessageGpadlTeardown_TYPE VMBUS_CHANNEL_GPADL_TEARDOWN
337 +#define ChannelMessageGpadlTorndown_TYPE VMBUS_CHANNEL_GPADL_TORNDOWN
338 +#define ChannelMessageViewRangeAdd_TYPE VMBUS_CHANNEL_VIEW_RANGE_ADD
339 +#define ChannelMessageViewRangeRemove_TYPE VMBUS_CHANNEL_VIEW_RANGE_REMOVE
340 +#define ChannelMessageRelIdReleased_TYPE VMBUS_CHANNEL_RELID_RELEASED
341 +#define ChannelMessageInitiateContact_TYPE VMBUS_CHANNEL_INITIATE_CONTACT
342 +#define ChannelMessageVersionResponse_TYPE VMBUS_CHANNEL_VERSION_RESPONSE
343 +#define ChannelMessageUnload_TYPE VMBUS_CHANNEL_UNLOAD
344 +
345 +//
346 +// Preprocessor wrapper to ChAllocateSendMessageSize() converting the return
347 +// value to the correct pointer and calculate the needed size.
348 +//
349 +// Argument:
350 +//
351 +// Id - the numberic ID (type VMBUS_CHANNEL_MESSAGE_TYPE) of the message to
352 +// send.
353 +//
354 +#define ChAllocateSendMessage(Id, Fn, Context) \
355 + (Id##_TYPE*)ChAllocateSendMessageSized(sizeof(Id##_TYPE), Id, Fn, Context)
356 +
357 +
358 +#pragma pack(pop)
359 +
360 --- /dev/null
361 +++ b/drivers/staging/hv/include/HvHalApi.h
362 @@ -0,0 +1,32 @@
363 +/*
364 + *
365 + * Copyright (c) 2009, Microsoft Corporation.
366 + *
367 + * This program is free software; you can redistribute it and/or modify it
368 + * under the terms and conditions of the GNU General Public License,
369 + * version 2, as published by the Free Software Foundation.
370 + *
371 + * This program is distributed in the hope it will be useful, but WITHOUT
372 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
373 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
374 + * more details.
375 + *
376 + * You should have received a copy of the GNU General Public License along with
377 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
378 + * Place - Suite 330, Boston, MA 02111-1307 USA.
379 + *
380 + * Authors:
381 + * Haiyang Zhang <haiyangz@microsoft.com>
382 + * Hank Janssen <hjanssen@microsoft.com>
383 + *
384 + */
385 +
386 +
387 +#pragma once
388 +
389 +
390 +//
391 +// Time in the hypervisor is measured in 100 nanosecond units
392 +//
393 +typedef UINT64 HV_NANO100_TIME, *PHV_NANO100_TIME;
394 +typedef UINT64 HV_NANO100_DURATION, *PHV_NANO100_DURATION;
395 --- /dev/null
396 +++ b/drivers/staging/hv/include/HvHcApi.h
397 @@ -0,0 +1,60 @@
398 +/*
399 + *
400 + * Copyright (c) 2009, Microsoft Corporation.
401 + *
402 + * This program is free software; you can redistribute it and/or modify it
403 + * under the terms and conditions of the GNU General Public License,
404 + * version 2, as published by the Free Software Foundation.
405 + *
406 + * This program is distributed in the hope it will be useful, but WITHOUT
407 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
408 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
409 + * more details.
410 + *
411 + * You should have received a copy of the GNU General Public License along with
412 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
413 + * Place - Suite 330, Boston, MA 02111-1307 USA.
414 + *
415 + * Authors:
416 + * Haiyang Zhang <haiyangz@microsoft.com>
417 + * Hank Janssen <hjanssen@microsoft.com>
418 + *
419 + */
420 +
421 +
422 +#pragma once
423 +
424 +//
425 +// Declare the various hypercall operations.
426 +//
427 +typedef enum _HV_CALL_CODE
428 +{
429 +
430 + HvCallPostMessage = 0x005c,
431 + HvCallSignalEvent = 0x005d,
432 +
433 +} HV_CALL_CODE, *PHV_CALL_CODE;
434 +//
435 +// Definition of the HvPostMessage hypercall input structure.
436 +//
437 +
438 +typedef struct _HV_INPUT_POST_MESSAGE
439 +{
440 + HV_CONNECTION_ID ConnectionId;
441 + UINT32 Reserved;
442 + HV_MESSAGE_TYPE MessageType;
443 + UINT32 PayloadSize;
444 + UINT64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
445 +} HV_INPUT_POST_MESSAGE, *PHV_INPUT_POST_MESSAGE;
446 +
447 +
448 +//
449 +// Definition of the HvSignalEvent hypercall input structure.
450 +//
451 +
452 +typedef struct _HV_INPUT_SIGNAL_EVENT
453 +{
454 + HV_CONNECTION_ID ConnectionId;
455 + UINT16 FlagNumber;
456 + UINT16 RsvdZ;
457 +} HV_INPUT_SIGNAL_EVENT, *PHV_INPUT_SIGNAL_EVENT;
458 --- /dev/null
459 +++ b/drivers/staging/hv/include/HvPtApi.h
460 @@ -0,0 +1,86 @@
461 +/*
462 + *
463 + * Copyright (c) 2009, Microsoft Corporation.
464 + *
465 + * This program is free software; you can redistribute it and/or modify it
466 + * under the terms and conditions of the GNU General Public License,
467 + * version 2, as published by the Free Software Foundation.
468 + *
469 + * This program is distributed in the hope it will be useful, but WITHOUT
470 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
471 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
472 + * more details.
473 + *
474 + * You should have received a copy of the GNU General Public License along with
475 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
476 + * Place - Suite 330, Boston, MA 02111-1307 USA.
477 + *
478 + * Authors:
479 + * Haiyang Zhang <haiyangz@microsoft.com>
480 + * Hank Janssen <hjanssen@microsoft.com>
481 + *
482 + */
483 +
484 +
485 +#pragma once
486 +
487 +//
488 +// Versioning definitions used for guests reporting themselves to the
489 +// hypervisor, and visa versa.
490 +// ==================================================================
491 +//
492 +
493 +//
494 +// Version info reported by guest OS's
495 +//
496 +typedef enum _HV_GUEST_OS_VENDOR
497 +{
498 + HvGuestOsVendorMicrosoft = 0x0001
499 +
500 +} HV_GUEST_OS_VENDOR, *PHV_GUEST_OS_VENDOR;
501 +
502 +typedef enum _HV_GUEST_OS_MICROSOFT_IDS
503 +{
504 + HvGuestOsMicrosoftUndefined = 0x00,
505 + HvGuestOsMicrosoftMSDOS = 0x01,
506 + HvGuestOsMicrosoftWindows3x = 0x02,
507 + HvGuestOsMicrosoftWindows9x = 0x03,
508 + HvGuestOsMicrosoftWindowsNT = 0x04,
509 + HvGuestOsMicrosoftWindowsCE = 0x05
510 +
511 +} HV_GUEST_OS_MICROSOFT_IDS, *PHV_GUEST_OS_MICROSOFT_IDS;
512 +
513 +//
514 +// Declare the MSR used to identify the guest OS.
515 +//
516 +#define HV_X64_MSR_GUEST_OS_ID 0x40000000
517 +
518 +typedef union _HV_X64_MSR_GUEST_OS_ID_CONTENTS
519 +{
520 + UINT64 AsUINT64;
521 + struct
522 + {
523 + UINT64 BuildNumber : 16;
524 + UINT64 ServiceVersion : 8; // Service Pack, etc.
525 + UINT64 MinorVersion : 8;
526 + UINT64 MajorVersion : 8;
527 + UINT64 OsId : 8; // HV_GUEST_OS_MICROSOFT_IDS (If Vendor=MS)
528 + UINT64 VendorId : 16; // HV_GUEST_OS_VENDOR
529 + };
530 +} HV_X64_MSR_GUEST_OS_ID_CONTENTS, *PHV_X64_MSR_GUEST_OS_ID_CONTENTS;
531 +
532 +//
533 +// Declare the MSR used to setup pages used to communicate with the hypervisor.
534 +//
535 +#define HV_X64_MSR_HYPERCALL 0x40000001
536 +
537 +typedef union _HV_X64_MSR_HYPERCALL_CONTENTS
538 +{
539 + UINT64 AsUINT64;
540 + struct
541 + {
542 + UINT64 Enable : 1;
543 + UINT64 Reserved : 11;
544 + UINT64 GuestPhysicalAddress : 52;
545 + };
546 +} HV_X64_MSR_HYPERCALL_CONTENTS, *PHV_X64_MSR_HYPERCALL_CONTENTS;
547 --- /dev/null
548 +++ b/drivers/staging/hv/include/HvStatus.h
549 @@ -0,0 +1,718 @@
550 +/*
551 + *
552 + * Copyright (c) 2009, Microsoft Corporation.
553 + *
554 + * This program is free software; you can redistribute it and/or modify it
555 + * under the terms and conditions of the GNU General Public License,
556 + * version 2, as published by the Free Software Foundation.
557 + *
558 + * This program is distributed in the hope it will be useful, but WITHOUT
559 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
560 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
561 + * more details.
562 + *
563 + * You should have received a copy of the GNU General Public License along with
564 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
565 + * Place - Suite 330, Boston, MA 02111-1307 USA.
566 + *
567 + * Authors:
568 + * Haiyang Zhang <haiyangz@microsoft.com>
569 + * Hank Janssen <hjanssen@microsoft.com>
570 + *
571 + */
572 +
573 +
574 +// begin_hvgdk
575 +//
576 +// Status codes for hypervisor operations.
577 +//
578 +typedef UINT16 HV_STATUS, *PHV_STATUS;
579 +
580 +//
581 +// MessageId: HV_STATUS_SUCCESS
582 +//
583 +// MessageText:
584 +//
585 +// The specified hypercall succeeded
586 +//
587 +#define HV_STATUS_SUCCESS ((HV_STATUS)0x0000)
588 +
589 +//
590 +// MessageId: HV_STATUS_INVALID_HYPERCALL_CODE
591 +//
592 +// MessageText:
593 +//
594 +// The hypervisor does not support the operation because the specified hypercall code is not supported.
595 +//
596 +#define HV_STATUS_INVALID_HYPERCALL_CODE ((HV_STATUS)0x0002)
597 +
598 +//
599 +// MessageId: HV_STATUS_INVALID_HYPERCALL_INPUT
600 +//
601 +// MessageText:
602 +//
603 +// The hypervisor does not support the operation because the encoding for the hypercall input register is not supported.
604 +//
605 +#define HV_STATUS_INVALID_HYPERCALL_INPUT ((HV_STATUS)0x0003)
606 +
607 +//
608 +// MessageId: HV_STATUS_INVALID_ALIGNMENT
609 +//
610 +// MessageText:
611 +//
612 +// The hypervisor could not perform the operation beacuse a parameter has an invalid alignment.
613 +//
614 +#define HV_STATUS_INVALID_ALIGNMENT ((HV_STATUS)0x0004)
615 +
616 +//
617 +// MessageId: HV_STATUS_INVALID_PARAMETER
618 +//
619 +// MessageText:
620 +//
621 +// The hypervisor could not perform the operation beacuse an invalid parameter was specified.
622 +//
623 +#define HV_STATUS_INVALID_PARAMETER ((HV_STATUS)0x0005)
624 +
625 +//
626 +// MessageId: HV_STATUS_ACCESS_DENIED
627 +//
628 +// MessageText:
629 +//
630 +// Access to the specified object was denied.
631 +//
632 +#define HV_STATUS_ACCESS_DENIED ((HV_STATUS)0x0006)
633 +
634 +//
635 +// MessageId: HV_STATUS_INVALID_PARTITION_STATE
636 +//
637 +// MessageText:
638 +//
639 +// The hypervisor could not perform the operation because the partition is entering or in an invalid state.
640 +//
641 +#define HV_STATUS_INVALID_PARTITION_STATE ((HV_STATUS)0x0007)
642 +
643 +//
644 +// MessageId: HV_STATUS_OPERATION_DENIED
645 +//
646 +// MessageText:
647 +//
648 +// The operation is not allowed in the current state.
649 +//
650 +#define HV_STATUS_OPERATION_DENIED ((HV_STATUS)0x0008)
651 +
652 +//
653 +// MessageId: HV_STATUS_UNKNOWN_PROPERTY
654 +//
655 +// MessageText:
656 +//
657 +// The hypervisor does not recognize the specified partition property.
658 +//
659 +#define HV_STATUS_UNKNOWN_PROPERTY ((HV_STATUS)0x0009)
660 +
661 +//
662 +// MessageId: HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE
663 +//
664 +// MessageText:
665 +//
666 +// The specified value of a partition property is out of range or violates an invariant.
667 +//
668 +#define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE ((HV_STATUS)0x000A)
669 +
670 +//
671 +// MessageId: HV_STATUS_INSUFFICIENT_MEMORY
672 +//
673 +// MessageText:
674 +//
675 +// There is not enough memory in the hypervisor pool to complete the operation.
676 +//
677 +#define HV_STATUS_INSUFFICIENT_MEMORY ((HV_STATUS)0x000B)
678 +
679 +//
680 +// MessageId: HV_STATUS_PARTITION_TOO_DEEP
681 +//
682 +// MessageText:
683 +//
684 +// The maximum partition depth has been exceeded for the partition hierarchy.
685 +//
686 +#define HV_STATUS_PARTITION_TOO_DEEP ((HV_STATUS)0x000C)
687 +
688 +//
689 +// MessageId: HV_STATUS_INVALID_PARTITION_ID
690 +//
691 +// MessageText:
692 +//
693 +// A partition with the specified partition Id does not exist.
694 +//
695 +#define HV_STATUS_INVALID_PARTITION_ID ((HV_STATUS)0x000D)
696 +
697 +//
698 +// MessageId: HV_STATUS_INVALID_VP_INDEX
699 +//
700 +// MessageText:
701 +//
702 +// The hypervisor could not perform the operation because the specified VP index is invalid.
703 +//
704 +#define HV_STATUS_INVALID_VP_INDEX ((HV_STATUS)0x000E)
705 +
706 +//
707 +// MessageId: HV_STATUS_NOT_FOUND
708 +//
709 +// MessageText:
710 +//
711 +// The iteration is complete; no addition items in the iteration could be found.
712 +//
713 +#define HV_STATUS_NOT_FOUND ((HV_STATUS)0x0010)
714 +
715 +//
716 +// MessageId: HV_STATUS_INVALID_PORT_ID
717 +//
718 +// MessageText:
719 +//
720 +// The hypervisor could not perform the operation because the specified port identifier is invalid.
721 +//
722 +#define HV_STATUS_INVALID_PORT_ID ((HV_STATUS)0x0011)
723 +
724 +//
725 +// MessageId: HV_STATUS_INVALID_CONNECTION_ID
726 +//
727 +// MessageText:
728 +//
729 +// The hypervisor could not perform the operation because the specified connection identifier is invalid.
730 +//
731 +#define HV_STATUS_INVALID_CONNECTION_ID ((HV_STATUS)0x0012)
732 +
733 +//
734 +// MessageId: HV_STATUS_INSUFFICIENT_BUFFERS
735 +//
736 +// MessageText:
737 +//
738 +// You did not supply enough message buffers to send a message.
739 +//
740 +#define HV_STATUS_INSUFFICIENT_BUFFERS ((HV_STATUS)0x0013)
741 +
742 +//
743 +// MessageId: HV_STATUS_NOT_ACKNOWLEDGED
744 +//
745 +// MessageText:
746 +//
747 +// The previous virtual interrupt has not been acknowledged.
748 +//
749 +#define HV_STATUS_NOT_ACKNOWLEDGED ((HV_STATUS)0x0014)
750 +
751 +//
752 +// MessageId: HV_STATUS_INVALID_VP_STATE
753 +//
754 +// MessageText:
755 +//
756 +// A virtual processor is not in the correct state for the performance of the indicated operation.
757 +//
758 +#define HV_STATUS_INVALID_VP_STATE ((HV_STATUS)0x0015)
759 +
760 +//
761 +// MessageId: HV_STATUS_ACKNOWLEDGED
762 +//
763 +// MessageText:
764 +//
765 +// The previous virtual interrupt has already been acknowledged.
766 +//
767 +#define HV_STATUS_ACKNOWLEDGED ((HV_STATUS)0x0016)
768 +
769 +//
770 +// MessageId: HV_STATUS_INVALID_SAVE_RESTORE_STATE
771 +//
772 +// MessageText:
773 +//
774 +// The indicated partition is not in a valid state for saving or restoring.
775 +//
776 +#define HV_STATUS_INVALID_SAVE_RESTORE_STATE ((HV_STATUS)0x0017)
777 +
778 +//
779 +// MessageId: HV_STATUS_INVALID_SYNIC_STATE
780 +//
781 +// MessageText:
782 +//
783 +// The hypervisor could not complete the operation because a required feature of the synthetic interrupt controller (SynIC) was disabled.
784 +//
785 +#define HV_STATUS_INVALID_SYNIC_STATE ((HV_STATUS)0x0018)
786 +
787 +//
788 +// MessageId: HV_STATUS_OBJECT_IN_USE
789 +//
790 +// MessageText:
791 +//
792 +// The hypervisor could not perform the operation because the object or value was either already in use or being used for a purpose that would not permit completing the operation.
793 +//
794 +#define HV_STATUS_OBJECT_IN_USE ((HV_STATUS)0x0019)
795 +
796 +//
797 +// MessageId: HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO
798 +//
799 +// MessageText:
800 +//
801 +// The proximity domain information is invalid.
802 +//
803 +#define HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO ((HV_STATUS)0x001A)
804 +
805 +//
806 +// MessageId: HV_STATUS_NO_DATA
807 +//
808 +// MessageText:
809 +//
810 +// An attempt to retrieve debugging data failed because none was available.
811 +//
812 +#define HV_STATUS_NO_DATA ((HV_STATUS)0x001B)
813 +
814 +//
815 +// MessageId: HV_STATUS_INACTIVE
816 +//
817 +// MessageText:
818 +//
819 +// The physical connection being used for debuggging has not recorded any receive activity since the last operation.
820 +//
821 +#define HV_STATUS_INACTIVE ((HV_STATUS)0x001C)
822 +
823 +//
824 +// MessageId: HV_STATUS_NO_RESOURCES
825 +//
826 +// MessageText:
827 +//
828 +// There are not enough resources to complete the operation.
829 +//
830 +#define HV_STATUS_NO_RESOURCES ((HV_STATUS)0x001D)
831 +
832 +//
833 +// MessageId: HV_STATUS_FEATURE_UNAVAILABLE
834 +//
835 +// MessageText:
836 +//
837 +// A hypervisor feature is not available to the user.
838 +//
839 +#define HV_STATUS_FEATURE_UNAVAILABLE ((HV_STATUS)0x001E)
840 +
841 +// end_hvgdk
842 +
843 +//
844 +// MessageId: HV_STATUS_UNSUCCESSFUL
845 +//
846 +// MessageText:
847 +//
848 +// {Operation Failed}
849 +// The requested operation was unsuccessful.
850 +//
851 +#define HV_STATUS_UNSUCCESSFUL ((HV_STATUS)0x1001)
852 +
853 +//
854 +// MessageId: HV_STATUS_INSUFFICIENT_BUFFER
855 +//
856 +// MessageText:
857 +//
858 +// The specified buffer was too small to contain all of the requested data.
859 +//
860 +#define HV_STATUS_INSUFFICIENT_BUFFER ((HV_STATUS)0x1002)
861 +
862 +//
863 +// MessageId: HV_STATUS_GPA_NOT_PRESENT
864 +//
865 +// MessageText:
866 +//
867 +// The guest physical address is not currently associated with a system physical address.
868 +//
869 +#define HV_STATUS_GPA_NOT_PRESENT ((HV_STATUS)0x1003)
870 +
871 +//
872 +// MessageId: HV_STATUS_GUEST_PAGE_FAULT
873 +//
874 +// MessageText:
875 +//
876 +// The operation would have resulted in a page fault in the guest.
877 +//
878 +#define HV_STATUS_GUEST_PAGE_FAULT ((HV_STATUS)0x1004)
879 +
880 +//
881 +// MessageId: HV_STATUS_RUNDOWN_DISABLED
882 +//
883 +// MessageText:
884 +//
885 +// The operation cannot proceed as the rundown object was marked disabled.
886 +//
887 +#define HV_STATUS_RUNDOWN_DISABLED ((HV_STATUS)0x1005)
888 +
889 +//
890 +// MessageId: HV_STATUS_KEY_ALREADY_EXISTS
891 +//
892 +// MessageText:
893 +//
894 +// The entry cannot be added as another entry with the same key already exists.
895 +//
896 +#define HV_STATUS_KEY_ALREADY_EXISTS ((HV_STATUS)0x1006)
897 +
898 +//
899 +// MessageId: HV_STATUS_GPA_INTERCEPT
900 +//
901 +// MessageText:
902 +//
903 +// The operation resulted an intercept on a region of guest physical memory.
904 +//
905 +#define HV_STATUS_GPA_INTERCEPT ((HV_STATUS)0x1007)
906 +
907 +//
908 +// MessageId: HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT
909 +//
910 +// MessageText:
911 +//
912 +// The operation would have resulted in a general protection fault in the guest.
913 +//
914 +#define HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT ((HV_STATUS)0x1008)
915 +
916 +//
917 +// MessageId: HV_STATUS_GUEST_STACK_FAULT
918 +//
919 +// MessageText:
920 +//
921 +// The operation would have resulted in a stack fault in the guest.
922 +//
923 +#define HV_STATUS_GUEST_STACK_FAULT ((HV_STATUS)0x1009)
924 +
925 +//
926 +// MessageId: HV_STATUS_GUEST_INVALID_OPCODE_FAULT
927 +//
928 +// MessageText:
929 +//
930 +// The operation would have resulted in an invalid opcode fault in the guest.
931 +//
932 +#define HV_STATUS_GUEST_INVALID_OPCODE_FAULT ((HV_STATUS)0x100A)
933 +
934 +//
935 +// MessageId: HV_STATUS_FINALIZE_INCOMPLETE
936 +//
937 +// MessageText:
938 +//
939 +// The partition is not completely finalized.
940 +//
941 +#define HV_STATUS_FINALIZE_INCOMPLETE ((HV_STATUS)0x100B)
942 +
943 +//
944 +// MessageId: HV_STATUS_GUEST_MACHINE_CHECK_ABORT
945 +//
946 +// MessageText:
947 +//
948 +// The operation would have resulted in an machine check abort in the guest.
949 +//
950 +#define HV_STATUS_GUEST_MACHINE_CHECK_ABORT ((HV_STATUS)0x100C)
951 +
952 +//
953 +// MessageId: HV_STATUS_ILLEGAL_OVERLAY_ACCESS
954 +//
955 +// MessageText:
956 +//
957 +// An illegal access was attempted to an overlay page.
958 +//
959 +#define HV_STATUS_ILLEGAL_OVERLAY_ACCESS ((HV_STATUS)0x100D)
960 +
961 +//
962 +// MessageId: HV_STATUS_INSUFFICIENT_SYSTEM_VA
963 +//
964 +// MessageText:
965 +//
966 +// There is not enough system VA space available to satisfy the request,
967 +//
968 +#define HV_STATUS_INSUFFICIENT_SYSTEM_VA ((HV_STATUS)0x100E)
969 +
970 +//
971 +// MessageId: HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED
972 +//
973 +// MessageText:
974 +//
975 +// The passed virtual address was not mapped in the hypervisor address space.
976 +//
977 +#define HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED ((HV_STATUS)0x100F)
978 +
979 +//
980 +// MessageId: HV_STATUS_NOT_IMPLEMENTED
981 +//
982 +// MessageText:
983 +//
984 +// The requested operation is not implemented in this version of the hypervisor.
985 +//
986 +#define HV_STATUS_NOT_IMPLEMENTED ((HV_STATUS)0x1010)
987 +
988 +//
989 +// MessageId: HV_STATUS_VMX_INSTRUCTION_FAILED
990 +//
991 +// MessageText:
992 +//
993 +// The requested VMX instruction failed to complete succesfully.
994 +//
995 +#define HV_STATUS_VMX_INSTRUCTION_FAILED ((HV_STATUS)0x1011)
996 +
997 +//
998 +// MessageId: HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS
999 +//
1000 +// MessageText:
1001 +//
1002 +// The requested VMX instruction failed to complete succesfully indicating status.
1003 +//
1004 +#define HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS ((HV_STATUS)0x1012)
1005 +
1006 +//
1007 +// MessageId: HV_STATUS_MSR_ACCESS_FAILED
1008 +//
1009 +// MessageText:
1010 +//
1011 +// The requested access to the model specific register failed.
1012 +//
1013 +#define HV_STATUS_MSR_ACCESS_FAILED ((HV_STATUS)0x1013)
1014 +
1015 +//
1016 +// MessageId: HV_STATUS_CR_ACCESS_FAILED
1017 +//
1018 +// MessageText:
1019 +//
1020 +// The requested access to the control register failed.
1021 +//
1022 +#define HV_STATUS_CR_ACCESS_FAILED ((HV_STATUS)0x1014)
1023 +
1024 +//
1025 +// MessageId: HV_STATUS_TIMEOUT
1026 +//
1027 +// MessageText:
1028 +//
1029 +// The specified timeout expired before the operation completed.
1030 +//
1031 +#define HV_STATUS_TIMEOUT ((HV_STATUS)0x1016)
1032 +
1033 +//
1034 +// MessageId: HV_STATUS_MSR_INTERCEPT
1035 +//
1036 +// MessageText:
1037 +//
1038 +// The requested access to the model specific register generated an intercept.
1039 +//
1040 +#define HV_STATUS_MSR_INTERCEPT ((HV_STATUS)0x1017)
1041 +
1042 +//
1043 +// MessageId: HV_STATUS_CPUID_INTERCEPT
1044 +//
1045 +// MessageText:
1046 +//
1047 +// The CPUID instruction generated an intercept.
1048 +//
1049 +#define HV_STATUS_CPUID_INTERCEPT ((HV_STATUS)0x1018)
1050 +
1051 +//
1052 +// MessageId: HV_STATUS_REPEAT_INSTRUCTION
1053 +//
1054 +// MessageText:
1055 +//
1056 +// The current instruction should be repeated and the instruction pointer not advanced.
1057 +//
1058 +#define HV_STATUS_REPEAT_INSTRUCTION ((HV_STATUS)0x1019)
1059 +
1060 +//
1061 +// MessageId: HV_STATUS_PAGE_PROTECTION_VIOLATION
1062 +//
1063 +// MessageText:
1064 +//
1065 +// The current instruction should be repeated and the instruction pointer not advanced.
1066 +//
1067 +#define HV_STATUS_PAGE_PROTECTION_VIOLATION ((HV_STATUS)0x101A)
1068 +
1069 +//
1070 +// MessageId: HV_STATUS_PAGE_TABLE_INVALID
1071 +//
1072 +// MessageText:
1073 +//
1074 +// The current instruction should be repeated and the instruction pointer not advanced.
1075 +//
1076 +#define HV_STATUS_PAGE_TABLE_INVALID ((HV_STATUS)0x101B)
1077 +
1078 +//
1079 +// MessageId: HV_STATUS_PAGE_NOT_PRESENT
1080 +//
1081 +// MessageText:
1082 +//
1083 +// The current instruction should be repeated and the instruction pointer not advanced.
1084 +//
1085 +#define HV_STATUS_PAGE_NOT_PRESENT ((HV_STATUS)0x101C)
1086 +
1087 +//
1088 +// MessageId: HV_STATUS_IO_INTERCEPT
1089 +//
1090 +// MessageText:
1091 +//
1092 +// The requested access to the I/O port generated an intercept.
1093 +//
1094 +#define HV_STATUS_IO_INTERCEPT ((HV_STATUS)0x101D)
1095 +
1096 +//
1097 +// MessageId: HV_STATUS_NOTHING_TO_DO
1098 +//
1099 +// MessageText:
1100 +//
1101 +// There is nothing to do.
1102 +//
1103 +#define HV_STATUS_NOTHING_TO_DO ((HV_STATUS)0x101E)
1104 +
1105 +//
1106 +// MessageId: HV_STATUS_THREAD_TERMINATING
1107 +//
1108 +// MessageText:
1109 +//
1110 +// The requested thread is terminating.
1111 +//
1112 +#define HV_STATUS_THREAD_TERMINATING ((HV_STATUS)0x101F)
1113 +
1114 +//
1115 +// MessageId: HV_STATUS_SECTION_ALREADY_CONSTRUCTED
1116 +//
1117 +// MessageText:
1118 +//
1119 +// The specified section was already constructed.
1120 +//
1121 +#define HV_STATUS_SECTION_ALREADY_CONSTRUCTED ((HV_STATUS)0x1020)
1122 +
1123 +//
1124 +// MessageId: HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED
1125 +//
1126 +// MessageText:
1127 +//
1128 +// The specified section was not already constructed.
1129 +//
1130 +#define HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED ((HV_STATUS)0x1021)
1131 +
1132 +//
1133 +// MessageId: HV_STATUS_PAGE_ALREADY_COMMITTED
1134 +//
1135 +// MessageText:
1136 +//
1137 +// The specified virtual address was already backed by physical memory.
1138 +//
1139 +#define HV_STATUS_PAGE_ALREADY_COMMITTED ((HV_STATUS)0x1022)
1140 +
1141 +//
1142 +// MessageId: HV_STATUS_PAGE_NOT_ALREADY_COMMITTED
1143 +//
1144 +// MessageText:
1145 +//
1146 +// The specified virtual address was not already backed by physical memory.
1147 +//
1148 +#define HV_STATUS_PAGE_NOT_ALREADY_COMMITTED ((HV_STATUS)0x1023)
1149 +
1150 +//
1151 +// MessageId: HV_STATUS_COMMITTED_PAGES_REMAIN
1152 +//
1153 +// MessageText:
1154 +//
1155 +// Committed pages remain in the section.
1156 +//
1157 +#define HV_STATUS_COMMITTED_PAGES_REMAIN ((HV_STATUS)0x1024)
1158 +
1159 +//
1160 +// MessageId: HV_STATUS_NO_REMAINING_COMMITTED_PAGES
1161 +//
1162 +// MessageText:
1163 +//
1164 +// No additional committed pages beyond the specified page exist in the section.
1165 +//
1166 +#define HV_STATUS_NO_REMAINING_COMMITTED_PAGES ((HV_STATUS)0x1025)
1167 +
1168 +//
1169 +// MessageId: HV_STATUS_INSUFFICIENT_COMPARTMENT_VA
1170 +//
1171 +// MessageText:
1172 +//
1173 +// The VA space of the compartment is exhausted.
1174 +//
1175 +#define HV_STATUS_INSUFFICIENT_COMPARTMENT_VA ((HV_STATUS)0x1026)
1176 +
1177 +//
1178 +// MessageId: HV_STATUS_DEREF_SPA_LIST_FULL
1179 +//
1180 +// MessageText:
1181 +//
1182 +// The SPA dereference list is full, and there are additional entries
1183 +// to be added to it.
1184 +//
1185 +#define HV_STATUS_DEREF_SPA_LIST_FULL ((HV_STATUS)0x1027)
1186 +
1187 +//
1188 +// MessageId: HV_STATUS_GPA_OUT_OF_RANGE
1189 +//
1190 +// MessageText:
1191 +//
1192 +// The supplied GPA is out of range.
1193 +//
1194 +#define HV_STATUS_GPA_OUT_OF_RANGE ((HV_STATUS)0x1027)
1195 +
1196 +//
1197 +// MessageId: HV_STATUS_NONVOLATILE_XMM_STALE
1198 +//
1199 +// MessageText:
1200 +//
1201 +// The XMM register that was being accessed is stale.
1202 +//
1203 +#define HV_STATUS_NONVOLATILE_XMM_STALE ((HV_STATUS)0x1028)
1204 +
1205 +//
1206 +// MessageId: HV_STATUS_UNSUPPORTED_PROCESSOR
1207 +//
1208 +// MessageText:
1209 +//
1210 +// The hypervisor does not support the processors in this system.
1211 +//
1212 +#define HV_STATUS_UNSUPPORTED_PROCESSOR ((HV_STATUS)0x1029)
1213 +
1214 +//
1215 +// MessageId: HV_STATUS_INSUFFICIENT_CROM_SPACE
1216 +//
1217 +// MessageText:
1218 +//
1219 +// Insufficient space existed for copying over the CROM contents.
1220 +//
1221 +#define HV_STATUS_INSUFFICIENT_CROM_SPACE ((HV_STATUS)0x2000)
1222 +
1223 +//
1224 +// MessageId: HV_STATUS_BAD_CROM_FORMAT
1225 +//
1226 +// MessageText:
1227 +//
1228 +// The contents of the CROM failed validation attempts.
1229 +//
1230 +#define HV_STATUS_BAD_CROM_FORMAT ((HV_STATUS)0x2001)
1231 +
1232 +//
1233 +// MessageId: HV_STATUS_UNSUPPORTED_CROM_FORMAT
1234 +//
1235 +// MessageText:
1236 +//
1237 +// The contents of the CROM contain contents the parser doesn't support.
1238 +//
1239 +#define HV_STATUS_UNSUPPORTED_CROM_FORMAT ((HV_STATUS)0x2002)
1240 +
1241 +//
1242 +// MessageId: HV_STATUS_UNSUPPORTED_CONTROLLER
1243 +//
1244 +// MessageText:
1245 +//
1246 +// The register format of the OHCI controller specified for debugging is not supported.
1247 +//
1248 +#define HV_STATUS_UNSUPPORTED_CONTROLLER ((HV_STATUS)0x2003)
1249 +
1250 +//
1251 +// MessageId: HV_STATUS_CROM_TOO_LARGE
1252 +//
1253 +// MessageText:
1254 +//
1255 +// The CROM contents were to large to copy over.
1256 +//
1257 +#define HV_STATUS_CROM_TOO_LARGE ((HV_STATUS)0x2004)
1258 +
1259 +//
1260 +// MessageId: HV_STATUS_CONTROLLER_IN_USE
1261 +//
1262 +// MessageText:
1263 +//
1264 +// The OHCI controller specified for debugging cannot be used as it is already in use.
1265 +//
1266 +#define HV_STATUS_CONTROLLER_IN_USE ((HV_STATUS)0x2005)
1267 +
1268 --- /dev/null
1269 +++ b/drivers/staging/hv/include/HvSynicApi.h
1270 @@ -0,0 +1,490 @@
1271 +/*
1272 + *
1273 + * Copyright (c) 2009, Microsoft Corporation.
1274 + *
1275 + * This program is free software; you can redistribute it and/or modify it
1276 + * under the terms and conditions of the GNU General Public License,
1277 + * version 2, as published by the Free Software Foundation.
1278 + *
1279 + * This program is distributed in the hope it will be useful, but WITHOUT
1280 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1281 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1282 + * more details.
1283 + *
1284 + * You should have received a copy of the GNU General Public License along with
1285 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1286 + * Place - Suite 330, Boston, MA 02111-1307 USA.
1287 + *
1288 + * Authors:
1289 + * Haiyang Zhang <haiyangz@microsoft.com>
1290 + * Hank Janssen <hjanssen@microsoft.com>
1291 + *
1292 + */
1293 +
1294 +#pragma once
1295 +
1296 +//
1297 +// Define the virtual APIC registers
1298 +//
1299 +#define HV_X64_MSR_EOI (0x40000070)
1300 +#define HV_X64_MSR_ICR (0x40000071)
1301 +#define HV_X64_MSR_TPR (0x40000072)
1302 +#define HV_X64_MSR_APIC_ASSIST_PAGE (0x40000073)
1303 +
1304 +//
1305 +// Define version of the synthetic interrupt controller.
1306 +//
1307 +
1308 +#define HV_SYNIC_VERSION (1)
1309 +
1310 +
1311 +//
1312 +// Define synthetic interrupt controller model specific registers.
1313 +//
1314 +
1315 +#define HV_X64_MSR_SCONTROL (0x40000080)
1316 +#define HV_X64_MSR_SVERSION (0x40000081)
1317 +#define HV_X64_MSR_SIEFP (0x40000082)
1318 +#define HV_X64_MSR_SIMP (0x40000083)
1319 +#define HV_X64_MSR_EOM (0x40000084)
1320 +#define HV_X64_MSR_SINT0 (0x40000090)
1321 +#define HV_X64_MSR_SINT1 (0x40000091)
1322 +#define HV_X64_MSR_SINT2 (0x40000092)
1323 +#define HV_X64_MSR_SINT3 (0x40000093)
1324 +#define HV_X64_MSR_SINT4 (0x40000094)
1325 +#define HV_X64_MSR_SINT5 (0x40000095)
1326 +#define HV_X64_MSR_SINT6 (0x40000096)
1327 +#define HV_X64_MSR_SINT7 (0x40000097)
1328 +#define HV_X64_MSR_SINT8 (0x40000098)
1329 +#define HV_X64_MSR_SINT9 (0x40000099)
1330 +#define HV_X64_MSR_SINT10 (0x4000009A)
1331 +#define HV_X64_MSR_SINT11 (0x4000009B)
1332 +#define HV_X64_MSR_SINT12 (0x4000009C)
1333 +#define HV_X64_MSR_SINT13 (0x4000009D)
1334 +#define HV_X64_MSR_SINT14 (0x4000009E)
1335 +#define HV_X64_MSR_SINT15 (0x4000009F)
1336 +
1337 +//
1338 +// Define the expected SynIC version.
1339 +//
1340 +#define HV_SYNIC_VERSION_1 (0x1)
1341 +
1342 +//
1343 +// Define synthetic interrupt controller message constants.
1344 +//
1345 +
1346 +#define HV_MESSAGE_SIZE (256)
1347 +#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
1348 +#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
1349 +#define HV_ANY_VP (0xFFFFFFFF)
1350 +
1351 +//
1352 +// Define synthetic interrupt controller flag constants.
1353 +//
1354 +
1355 +#define HV_EVENT_FLAGS_COUNT (256 * 8)
1356 +#define HV_EVENT_FLAGS_BYTE_COUNT (256)
1357 +#define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(UINT32))
1358 +
1359 +//
1360 +// Define hypervisor message types.
1361 +//
1362 +typedef enum _HV_MESSAGE_TYPE
1363 +{
1364 + HvMessageTypeNone = 0x00000000,
1365 +
1366 + //
1367 + // Memory access messages.
1368 + //
1369 + HvMessageTypeUnmappedGpa = 0x80000000,
1370 + HvMessageTypeGpaIntercept = 0x80000001,
1371 +
1372 + //
1373 + // Timer notification messages.
1374 + //
1375 + HvMessageTimerExpired = 0x80000010,
1376 +
1377 + //
1378 + // Error messages.
1379 + //
1380 + HvMessageTypeInvalidVpRegisterValue = 0x80000020,
1381 + HvMessageTypeUnrecoverableException = 0x80000021,
1382 + HvMessageTypeUnsupportedFeature = 0x80000022,
1383 +
1384 + //
1385 + // Trace buffer complete messages.
1386 + //
1387 + HvMessageTypeEventLogBufferComplete = 0x80000040,
1388 +
1389 + //
1390 + // Platform-specific processor intercept messages.
1391 + //
1392 + HvMessageTypeX64IoPortIntercept = 0x80010000,
1393 + HvMessageTypeX64MsrIntercept = 0x80010001,
1394 + HvMessageTypeX64CpuidIntercept = 0x80010002,
1395 + HvMessageTypeX64ExceptionIntercept = 0x80010003,
1396 + HvMessageTypeX64ApicEoi = 0x80010004,
1397 + HvMessageTypeX64LegacyFpError = 0x80010005
1398 +
1399 +} HV_MESSAGE_TYPE, *PHV_MESSAGE_TYPE;
1400 +
1401 +//
1402 +// Define the number of synthetic interrupt sources.
1403 +//
1404 +
1405 +#define HV_SYNIC_SINT_COUNT (16)
1406 +#define HV_SYNIC_STIMER_COUNT (4)
1407 +
1408 +//
1409 +// Define the synthetic interrupt source index type.
1410 +//
1411 +
1412 +typedef UINT32 HV_SYNIC_SINT_INDEX, *PHV_SYNIC_SINT_INDEX;
1413 +
1414 +//
1415 +// Define partition identifier type.
1416 +//
1417 +
1418 +typedef UINT64 HV_PARTITION_ID, *PHV_PARTITION_ID;
1419 +
1420 +//
1421 +// Define invalid partition identifier.
1422 +//
1423 +#define HV_PARTITION_ID_INVALID ((HV_PARTITION_ID) 0x0)
1424 +
1425 +//
1426 +// Define connection identifier type.
1427 +//
1428 +
1429 +typedef union _HV_CONNECTION_ID
1430 +{
1431 + UINT32 AsUINT32;
1432 +
1433 + struct
1434 + {
1435 + UINT32 Id:24;
1436 + UINT32 Reserved:8;
1437 + } u;
1438 +
1439 +} HV_CONNECTION_ID, *PHV_CONNECTION_ID;
1440 +
1441 +//
1442 +// Define port identifier type.
1443 +//
1444 +
1445 +typedef union _HV_PORT_ID
1446 +{
1447 + UINT32 AsUINT32;
1448 +
1449 + struct
1450 + {
1451 + UINT32 Id:24;
1452 + UINT32 Reserved:8;
1453 + } u ;
1454 +
1455 +} HV_PORT_ID, *PHV_PORT_ID;
1456 +
1457 +//
1458 +// Define port type.
1459 +//
1460 +
1461 +typedef enum _HV_PORT_TYPE
1462 +{
1463 + HvPortTypeMessage = 1,
1464 + HvPortTypeEvent = 2,
1465 + HvPortTypeMonitor = 3
1466 +} HV_PORT_TYPE, *PHV_PORT_TYPE;
1467 +
1468 +//
1469 +// Define port information structure.
1470 +//
1471 +
1472 +typedef struct _HV_PORT_INFO
1473 +{
1474 + HV_PORT_TYPE PortType;
1475 + UINT32 Padding;
1476 +
1477 + union
1478 + {
1479 + struct
1480 + {
1481 + HV_SYNIC_SINT_INDEX TargetSint;
1482 + HV_VP_INDEX TargetVp;
1483 + UINT64 RsvdZ;
1484 + } MessagePortInfo;
1485 +
1486 + struct
1487 + {
1488 + HV_SYNIC_SINT_INDEX TargetSint;
1489 + HV_VP_INDEX TargetVp;
1490 + UINT16 BaseFlagNumber;
1491 + UINT16 FlagCount;
1492 + UINT32 RsvdZ;
1493 + } EventPortInfo;
1494 +
1495 + struct
1496 + {
1497 + HV_GPA MonitorAddress;
1498 + UINT64 RsvdZ;
1499 + } MonitorPortInfo;
1500 + };
1501 +} HV_PORT_INFO, *PHV_PORT_INFO;
1502 +
1503 +typedef const HV_PORT_INFO *PCHV_PORT_INFO;
1504 +
1505 +typedef struct _HV_CONNECTION_INFO
1506 +{
1507 + HV_PORT_TYPE PortType;
1508 + UINT32 Padding;
1509 +
1510 + union
1511 + {
1512 + struct
1513 + {
1514 + UINT64 RsvdZ;
1515 + } MessageConnectionInfo;
1516 +
1517 + struct
1518 + {
1519 + UINT64 RsvdZ;
1520 + } EventConnectionInfo;
1521 +
1522 + struct
1523 + {
1524 + HV_GPA MonitorAddress;
1525 + } MonitorConnectionInfo;
1526 + };
1527 +} HV_CONNECTION_INFO, *PHV_CONNECTION_INFO;
1528 +
1529 +typedef const HV_CONNECTION_INFO *PCHV_CONNECTION_INFO;
1530 +
1531 +//
1532 +// Define synthetic interrupt controller message flags.
1533 +//
1534 +
1535 +typedef union _HV_MESSAGE_FLAGS
1536 +{
1537 + UINT8 AsUINT8;
1538 + struct
1539 + {
1540 + UINT8 MessagePending:1;
1541 + UINT8 Reserved:7;
1542 + };
1543 +} HV_MESSAGE_FLAGS, *PHV_MESSAGE_FLAGS;
1544 +
1545 +
1546 +//
1547 +// Define synthetic interrupt controller message header.
1548 +//
1549 +
1550 +typedef struct _HV_MESSAGE_HEADER
1551 +{
1552 + HV_MESSAGE_TYPE MessageType;
1553 + UINT8 PayloadSize;
1554 + HV_MESSAGE_FLAGS MessageFlags;
1555 + UINT8 Reserved[2];
1556 + union
1557 + {
1558 + HV_PARTITION_ID Sender;
1559 + HV_PORT_ID Port;
1560 + };
1561 +
1562 +} HV_MESSAGE_HEADER, *PHV_MESSAGE_HEADER;
1563 +
1564 +//
1565 +// Define timer message payload structure.
1566 +//
1567 +typedef struct _HV_TIMER_MESSAGE_PAYLOAD
1568 +{
1569 + UINT32 TimerIndex;
1570 + UINT32 Reserved;
1571 + HV_NANO100_TIME ExpirationTime; // When the timer expired
1572 + HV_NANO100_TIME DeliveryTime; // When the message was delivered
1573 +} HV_TIMER_MESSAGE_PAYLOAD, *PHV_TIMER_MESSAGE_PAYLOAD;
1574 +
1575 +//
1576 +// Define synthetic interrupt controller message format.
1577 +//
1578 +
1579 +typedef struct _HV_MESSAGE
1580 +{
1581 + HV_MESSAGE_HEADER Header;
1582 + union
1583 + {
1584 + UINT64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
1585 + } u ;
1586 +} HV_MESSAGE, *PHV_MESSAGE;
1587 +
1588 +//
1589 +// Define the number of message buffers associated with each port.
1590 +//
1591 +
1592 +#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
1593 +
1594 +//
1595 +// Define the synthetic interrupt message page layout.
1596 +//
1597 +
1598 +typedef struct _HV_MESSAGE_PAGE
1599 +{
1600 + volatile HV_MESSAGE SintMessage[HV_SYNIC_SINT_COUNT];
1601 +} HV_MESSAGE_PAGE, *PHV_MESSAGE_PAGE;
1602 +
1603 +
1604 +//
1605 +// Define the synthetic interrupt controller event flags format.
1606 +//
1607 +
1608 +typedef union _HV_SYNIC_EVENT_FLAGS
1609 +{
1610 + UINT8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT];
1611 + UINT32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT];
1612 +} HV_SYNIC_EVENT_FLAGS, *PHV_SYNIC_EVENT_FLAGS;
1613 +
1614 +
1615 +//
1616 +// Define the synthetic interrupt flags page layout.
1617 +//
1618 +
1619 +typedef struct _HV_SYNIC_EVENT_FLAGS_PAGE
1620 +{
1621 + volatile HV_SYNIC_EVENT_FLAGS SintEventFlags[HV_SYNIC_SINT_COUNT];
1622 +} HV_SYNIC_EVENT_FLAGS_PAGE, *PHV_SYNIC_EVENT_FLAGS_PAGE;
1623 +
1624 +
1625 +//
1626 +// Define SynIC control register.
1627 +//
1628 +typedef union _HV_SYNIC_SCONTROL
1629 +{
1630 + UINT64 AsUINT64;
1631 + struct
1632 + {
1633 + UINT64 Enable:1;
1634 + UINT64 Reserved:63;
1635 + };
1636 +} HV_SYNIC_SCONTROL, *PHV_SYNIC_SCONTROL;
1637 +
1638 +//
1639 +// Define synthetic interrupt source.
1640 +//
1641 +
1642 +typedef union _HV_SYNIC_SINT
1643 +{
1644 + UINT64 AsUINT64;
1645 + struct
1646 + {
1647 + UINT64 Vector :8;
1648 + UINT64 Reserved1 :8;
1649 + UINT64 Masked :1;
1650 + UINT64 AutoEoi :1;
1651 + UINT64 Reserved2 :46;
1652 + };
1653 +} HV_SYNIC_SINT, *PHV_SYNIC_SINT;
1654 +
1655 +//
1656 +// Define the format of the SIMP register
1657 +//
1658 +
1659 +typedef union _HV_SYNIC_SIMP
1660 +{
1661 + UINT64 AsUINT64;
1662 + struct
1663 + {
1664 + UINT64 SimpEnabled : 1;
1665 + UINT64 Preserved : 11;
1666 + UINT64 BaseSimpGpa : 52;
1667 + };
1668 +} HV_SYNIC_SIMP, *PHV_SYNIC_SIMP;
1669 +
1670 +//
1671 +// Define the format of the SIEFP register
1672 +//
1673 +
1674 +typedef union _HV_SYNIC_SIEFP
1675 +{
1676 + UINT64 AsUINT64;
1677 + struct
1678 + {
1679 + UINT64 SiefpEnabled : 1;
1680 + UINT64 Preserved : 11;
1681 + UINT64 BaseSiefpGpa : 52;
1682 + };
1683 +} HV_SYNIC_SIEFP, *PHV_SYNIC_SIEFP;
1684 +
1685 +//
1686 +// Definitions for the monitored notification facility
1687 +//
1688 +
1689 +typedef union _HV_MONITOR_TRIGGER_GROUP
1690 +{
1691 + UINT64 AsUINT64;
1692 +
1693 + struct
1694 + {
1695 + UINT32 Pending;
1696 + UINT32 Armed;
1697 + };
1698 +
1699 +} HV_MONITOR_TRIGGER_GROUP, *PHV_MONITOR_TRIGGER_GROUP;
1700 +
1701 +typedef struct _HV_MONITOR_PARAMETER
1702 +{
1703 + HV_CONNECTION_ID ConnectionId;
1704 + UINT16 FlagNumber;
1705 + UINT16 RsvdZ;
1706 +} HV_MONITOR_PARAMETER, *PHV_MONITOR_PARAMETER;
1707 +
1708 +typedef union _HV_MONITOR_TRIGGER_STATE
1709 +{
1710 + UINT32 AsUINT32;
1711 +
1712 + struct
1713 + {
1714 + UINT32 GroupEnable : 4;
1715 + UINT32 RsvdZ : 28;
1716 + };
1717 +
1718 +} HV_MONITOR_TRIGGER_STATE, *PHV_MONITOR_TRIGGER_STATE;
1719 +
1720 +//
1721 +// HV_MONITOR_PAGE Layout
1722 +// ------------------------------------------------------
1723 +// | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) |
1724 +// | 8 | TriggerGroup[0] |
1725 +// | 10 | TriggerGroup[1] |
1726 +// | 18 | TriggerGroup[2] |
1727 +// | 20 | TriggerGroup[3] |
1728 +// | 28 | Rsvd2[0] |
1729 +// | 30 | Rsvd2[1] |
1730 +// | 38 | Rsvd2[2] |
1731 +// | 40 | NextCheckTime[0][0] | NextCheckTime[0][1] |
1732 +// | ... |
1733 +// | 240 | Latency[0][0..3] |
1734 +// | 340 | Rsvz3[0] |
1735 +// | 440 | Parameter[0][0] |
1736 +// | 448 | Parameter[0][1] |
1737 +// | ... |
1738 +// | 840 | Rsvd4[0] |
1739 +// ------------------------------------------------------
1740 +
1741 +typedef struct _HV_MONITOR_PAGE
1742 +{
1743 + HV_MONITOR_TRIGGER_STATE TriggerState;
1744 + UINT32 RsvdZ1;
1745 +
1746 + HV_MONITOR_TRIGGER_GROUP TriggerGroup[4];
1747 + UINT64 RsvdZ2[3];
1748 +
1749 + INT32 NextCheckTime[4][32];
1750 +
1751 + UINT16 Latency[4][32];
1752 + UINT64 RsvdZ3[32];
1753 +
1754 + HV_MONITOR_PARAMETER Parameter[4][32];
1755 +
1756 + UINT8 RsvdZ4[1984];
1757 +
1758 +} HV_MONITOR_PAGE, *PHV_MONITOR_PAGE;
1759 +
1760 +typedef volatile HV_MONITOR_PAGE* PVHV_MONITOR_PAGE;
1761 --- /dev/null
1762 +++ b/drivers/staging/hv/include/HvTypes.h
1763 @@ -0,0 +1,31 @@
1764 +/*
1765 + *
1766 + * Copyright (c) 2009, Microsoft Corporation.
1767 + *
1768 + * This program is free software; you can redistribute it and/or modify it
1769 + * under the terms and conditions of the GNU General Public License,
1770 + * version 2, as published by the Free Software Foundation.
1771 + *
1772 + * This program is distributed in the hope it will be useful, but WITHOUT
1773 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1774 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1775 + * more details.
1776 + *
1777 + * You should have received a copy of the GNU General Public License along with
1778 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1779 + * Place - Suite 330, Boston, MA 02111-1307 USA.
1780 + *
1781 + * Authors:
1782 + * Haiyang Zhang <haiyangz@microsoft.com>
1783 + * Hank Janssen <hjanssen@microsoft.com>
1784 + *
1785 + */
1786 +
1787 +
1788 +#pragma once
1789 +
1790 +typedef UINT64 HV_GPA, *PHV_GPA;
1791 +
1792 +#define HV_X64_PAGE_SIZE (4096)
1793 +#define HV_PAGE_SIZE HV_X64_PAGE_SIZE
1794 +
1795 --- /dev/null
1796 +++ b/drivers/staging/hv/include/HvVpApi.h
1797 @@ -0,0 +1,51 @@
1798 +/*
1799 + *
1800 + * Copyright (c) 2009, Microsoft Corporation.
1801 + *
1802 + * This program is free software; you can redistribute it and/or modify it
1803 + * under the terms and conditions of the GNU General Public License,
1804 + * version 2, as published by the Free Software Foundation.
1805 + *
1806 + * This program is distributed in the hope it will be useful, but WITHOUT
1807 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1808 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1809 + * more details.
1810 + *
1811 + * You should have received a copy of the GNU General Public License along with
1812 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1813 + * Place - Suite 330, Boston, MA 02111-1307 USA.
1814 + *
1815 + * Authors:
1816 + * Haiyang Zhang <haiyangz@microsoft.com>
1817 + * Hank Janssen <hjanssen@microsoft.com>
1818 + *
1819 + */
1820 +
1821 +
1822 +#pragma once
1823 +//
1824 +// Virtual Processor Indices
1825 +//
1826 +typedef UINT32 HV_VP_INDEX, *PHV_VP_INDEX;
1827 +
1828 +//
1829 +// The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
1830 +// is set by CPUID(HvCpuIdFunctionVersionAndFeatures).
1831 +// ==========================================================================
1832 +//
1833 +
1834 +typedef enum _HV_CPUID_FUNCTION
1835 +{
1836 + HvCpuIdFunctionVersionAndFeatures = 0x00000001,
1837 + HvCpuIdFunctionHvVendorAndMaxFunction = 0x40000000,
1838 + HvCpuIdFunctionHvInterface = 0x40000001,
1839 +
1840 + //
1841 + // The remaining functions depend on the value of HvCpuIdFunctionInterface
1842 + //
1843 + HvCpuIdFunctionMsHvVersion = 0x40000002,
1844 + HvCpuIdFunctionMsHvFeatures = 0x40000003,
1845 + HvCpuIdFunctionMsHvEnlightenmentInformation = 0x40000004,
1846 + HvCpuIdFunctionMsHvImplementationLimits = 0x40000005
1847 +
1848 +} HV_CPUID_FUNCTION, *PHV_CPUID_FUNCTION;
1849 --- /dev/null
1850 +++ b/drivers/staging/hv/include/List.h
1851 @@ -0,0 +1,269 @@
1852 +/*
1853 + *
1854 + * Copyright (c) 2009, Microsoft Corporation.
1855 + *
1856 + * This program is free software; you can redistribute it and/or modify it
1857 + * under the terms and conditions of the GNU General Public License,
1858 + * version 2, as published by the Free Software Foundation.
1859 + *
1860 + * This program is distributed in the hope it will be useful, but WITHOUT
1861 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1862 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1863 + * more details.
1864 + *
1865 + * You should have received a copy of the GNU General Public License along with
1866 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1867 + * Place - Suite 330, Boston, MA 02111-1307 USA.
1868 + *
1869 + * Authors:
1870 + * Haiyang Zhang <haiyangz@microsoft.com>
1871 + * Hank Janssen <hjanssen@microsoft.com>
1872 + *
1873 + */
1874 +
1875 +
1876 +#ifndef _LIST_H_
1877 +#define _LIST_H_
1878 +
1879 +#include "osd.h"
1880 +/*
1881 + *
1882 + * Doubly-linked list manipulation routines. Implemented as macros
1883 + * but logically these are procedures.
1884 + *
1885 + */
1886 +
1887 +typedef DLIST_ENTRY LIST_ENTRY;
1888 +typedef DLIST_ENTRY *PLIST_ENTRY;
1889 +
1890 +//typedef struct LIST_ENTRY {
1891 +// struct LIST_ENTRY * volatile Flink;
1892 +// struct LIST_ENTRY * volatile Blink;
1893 +//} LIST_ENTRY, *PLIST_ENTRY;
1894 +
1895 +
1896 +
1897 +/*
1898 + * VOID
1899 + * InitializeListHead(
1900 + * PLIST_ENTRY ListHead
1901 + * );
1902 + */
1903 +#define INITIALIZE_LIST_HEAD InitializeListHead
1904 +
1905 +#define InitializeListHead(ListHead) (\
1906 + (ListHead)->Flink = (ListHead)->Blink = (ListHead))
1907 +
1908 +
1909 +/*
1910 + * BOOLEAN
1911 + * IsListEmpty(
1912 + * PLIST_ENTRY ListHead
1913 + * );
1914 + */
1915 +#define IS_LIST_EMPTY IsListEmpty
1916 +
1917 +#define IsListEmpty(ListHead) \
1918 + ((ListHead)->Flink == (ListHead))
1919 +
1920 +
1921 +/*
1922 + * PLIST_ENTRY
1923 + * NextListEntry(
1924 + * PLIST_ENTRY Entry
1925 + * );
1926 + */
1927 +#define NEXT_LIST_ENTRY NextListEntry
1928 +
1929 +#define NextListEntry(Entry) \
1930 + (Entry)->Flink
1931 +
1932 +
1933 +/*
1934 + * PLIST_ENTRY
1935 + * PrevListEntry(
1936 + * PLIST_ENTRY Entry
1937 + * );
1938 + */
1939 +#define PREV_LIST_ENTRY PrevListEntry
1940 +
1941 +#define PrevListEntry(Entry) \
1942 + (Entry)->Blink
1943 +
1944 +
1945 +/*
1946 + * PLIST_ENTRY
1947 + * TopListEntry(
1948 + * PLIST_ENTRY ListHead
1949 + * );
1950 + */
1951 +#define TOP_LIST_ENTRY TopListEntry
1952 +
1953 +#define TopListEntry(ListHead) \
1954 + (ListHead)->Flink
1955 +
1956 +
1957 +
1958 +/*
1959 + * PLIST_ENTRY
1960 + * RemoveHeadList(
1961 + * PLIST_ENTRY ListHead
1962 + * );
1963 + */
1964 +
1965 +#define REMOVE_HEAD_LIST RemoveHeadList
1966 +
1967 +#define RemoveHeadList(ListHead) \
1968 + (ListHead)->Flink;\
1969 + {RemoveEntryList((ListHead)->Flink)}
1970 +
1971 +
1972 +/*
1973 + * PLIST_ENTRY
1974 + * RemoveTailList(
1975 + * PLIST_ENTRY ListHead
1976 + * );
1977 + */
1978 +#define REMOVE_TAIL_LIST RemoveTailList
1979 +
1980 +#define RemoveTailList(ListHead) \
1981 + (ListHead)->Blink;\
1982 + {RemoveEntryList((ListHead)->Blink)}
1983 +
1984 +
1985 +/*
1986 + * VOID
1987 + * RemoveEntryList(
1988 + * PLIST_ENTRY Entry
1989 + * );
1990 + */
1991 +#define REMOVE_ENTRY_LIST RemoveEntryList
1992 +
1993 +#define RemoveEntryList(Entry) {\
1994 + PLIST_ENTRY _EX_Flink = (Entry)->Flink;\
1995 + PLIST_ENTRY _EX_Blink = (Entry)->Blink;\
1996 + _EX_Blink->Flink = _EX_Flink;\
1997 + _EX_Flink->Blink = _EX_Blink;\
1998 + }
1999 +
2000 +
2001 +/*
2002 + * VOID
2003 + * AttachList(
2004 + * PLIST_ENTRY ListHead,
2005 + * PLIST_ENTRY ListEntry
2006 + * );
2007 + */
2008 +#define ATTACH_LIST AttachList
2009 +
2010 +#define AttachList(ListHead,ListEntry) {\
2011 + PLIST_ENTRY _EX_ListHead = (ListHead);\
2012 + PLIST_ENTRY _EX_Blink = (ListHead)->Blink;\
2013 + (ListEntry)->Blink->Flink = _EX_ListHead;\
2014 + _EX_Blink->Flink = (ListEntry);\
2015 + _EX_ListHead->Blink = (ListEntry)->Blink;\
2016 + (ListEntry)->Blink = _EX_Blink;\
2017 + }
2018 +
2019 +
2020 +
2021 +/*
2022 + * VOID
2023 + * InsertTailList(
2024 + * PLIST_ENTRY ListHead,
2025 + * PLIST_ENTRY Entry
2026 + * );
2027 + */
2028 +
2029 +#define INSERT_TAIL_LIST InsertTailList
2030 +
2031 +#define InsertTailList(ListHead,Entry) {\
2032 + PLIST_ENTRY _EX_ListHead = (ListHead);\
2033 + PLIST_ENTRY _EX_Blink = (ListHead)->Blink;\
2034 + (Entry)->Flink = _EX_ListHead;\
2035 + (Entry)->Blink = _EX_Blink;\
2036 + _EX_Blink->Flink = (Entry);\
2037 + _EX_ListHead->Blink = (Entry);\
2038 + }
2039 +
2040 +
2041 +/*
2042 + * VOID
2043 + * InsertHeadList(
2044 + * PLIST_ENTRY ListHead,
2045 + * PLIST_ENTRY Entry
2046 + * );
2047 + */
2048 +#define INSERT_HEAD_LIST InsertHeadList
2049 +
2050 +#define InsertHeadList(ListHead,Entry) {\
2051 + PLIST_ENTRY _EX_ListHead = (ListHead);\
2052 + PLIST_ENTRY _EX_Flink = (ListHead)->Flink;\
2053 + (Entry)->Flink = _EX_Flink;\
2054 + (Entry)->Blink = _EX_ListHead;\
2055 + _EX_Flink->Blink = (Entry);\
2056 + _EX_ListHead->Flink = (Entry);\
2057 + }
2058 +
2059 +
2060 +/*
2061 + * VOID
2062 + * IterateListEntries(
2063 + * PLIST_ENTRY anchor,
2064 + * PLIST_ENTRY index,
2065 + * PLIST_ENTRY listp
2066 + * );
2067 + */
2068 +
2069 +#define ITERATE_LIST_ENTRIES IterateListEntries
2070 +
2071 +#define IterateListEntries(anchor, index, listp) \
2072 + (anchor) = (LIST_ENTRY *)(listp); \
2073 + for((index) = (anchor)->Flink; (index) != (anchor); (index) = (index)->Flink)
2074 +
2075 +
2076 +
2077 +/*
2078 + * PSINGLE_LIST_ENTRY
2079 + * PopEntryList(
2080 + * PSINGLE_LIST_ENTRY ListHead
2081 + * );
2082 + */
2083 +
2084 +#define POP_ENTRY_LIST PopEntryList
2085 +
2086 +#define PopEntryList(ListHead) \
2087 + (ListHead)->Next;\
2088 + {\
2089 + PSINGLE_LIST_ENTRY FirstEntry;\
2090 + FirstEntry = (ListHead)->Next;\
2091 + if (FirstEntry != NULL) { \
2092 + (ListHead)->Next = FirstEntry->Next;\
2093 + } \
2094 + }
2095 +
2096 +
2097 +
2098 +/*
2099 + * VOID
2100 + * PushEntryList(
2101 + * PSINGLE_LIST_ENTRY ListHead,
2102 + * PSINGLE_LIST_ENTRY Entry
2103 + * );
2104 + */
2105 +
2106 +#define PUSH_ENTRY_LIST PushEntryList
2107 +
2108 +#define PushEntryList(ListHead,Entry) \
2109 + (Entry)->Next = (ListHead)->Next; \
2110 + (ListHead)->Next = (Entry)
2111 +
2112 +#ifndef CONTAINING_RECORD
2113 +#define CONTAINING_RECORD(address, type, field) ((type *)( \
2114 + (PCHAR)(address) - \
2115 + (PCHAR)(&((type *)0)->field)))
2116 +#endif /* CONTAINING_RECORD */
2117 +
2118 +#endif /* _LIST_H_ */
2119 +
2120 +/* EOF */
2121 --- /dev/null
2122 +++ b/drivers/staging/hv/include/nvspprotocol.h
2123 @@ -0,0 +1,306 @@
2124 +/*
2125 + *
2126 + * Copyright (c) 2009, Microsoft Corporation.
2127 + *
2128 + * This program is free software; you can redistribute it and/or modify it
2129 + * under the terms and conditions of the GNU General Public License,
2130 + * version 2, as published by the Free Software Foundation.
2131 + *
2132 + * This program is distributed in the hope it will be useful, but WITHOUT
2133 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2134 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
2135 + * more details.
2136 + *
2137 + * You should have received a copy of the GNU General Public License along with
2138 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
2139 + * Place - Suite 330, Boston, MA 02111-1307 USA.
2140 + *
2141 + * Authors:
2142 + * Haiyang Zhang <haiyangz@microsoft.com>
2143 + * Hank Janssen <hjanssen@microsoft.com>
2144 + *
2145 + */
2146 +
2147 +
2148 +#pragma once
2149 +
2150 +#include <VmbusChannelInterface.h>
2151 +
2152 +#define NVSP_INVALID_PROTOCOL_VERSION ((UINT32)0xFFFFFFFF)
2153 +
2154 +#define NVSP_PROTOCOL_VERSION_1 2
2155 +#define NVSP_MIN_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
2156 +#define NVSP_MAX_PROTOCOL_VERSION NVSP_PROTOCOL_VERSION_1
2157 +
2158 +typedef enum _NVSP_MESSAGE_TYPE
2159 +{
2160 + NvspMessageTypeNone = 0,
2161 +
2162 + //
2163 + // Init Messages
2164 + //
2165 + NvspMessageTypeInit = 1,
2166 + NvspMessageTypeInitComplete = 2,
2167 +
2168 + NvspVersionMessageStart = 100,
2169 +
2170 + //
2171 + // Version 1 Messages
2172 + //
2173 + NvspMessage1TypeSendNdisVersion = NvspVersionMessageStart,
2174 +
2175 + NvspMessage1TypeSendReceiveBuffer,
2176 + NvspMessage1TypeSendReceiveBufferComplete,
2177 + NvspMessage1TypeRevokeReceiveBuffer,
2178 +
2179 + NvspMessage1TypeSendSendBuffer,
2180 + NvspMessage1TypeSendSendBufferComplete,
2181 + NvspMessage1TypeRevokeSendBuffer,
2182 +
2183 + NvspMessage1TypeSendRNDISPacket,
2184 + NvspMessage1TypeSendRNDISPacketComplete,
2185 +
2186 + //
2187 + // This should be set to the number of messages for the version
2188 + // with the maximum number of messages.
2189 + //
2190 + NvspNumMessagePerVersion = 9,
2191 +
2192 +} NVSP_MESSAGE_TYPE, *PNVSP_MESSAGE_TYPE;
2193 +
2194 +typedef enum _NVSP_STATUS
2195 +{
2196 + NvspStatusNone = 0,
2197 + NvspStatusSuccess,
2198 + NvspStatusFailure,
2199 + NvspStatusProtocolVersionRangeTooNew,
2200 + NvspStatusProtocolVersionRangeTooOld,
2201 + NvspStatusInvalidRndisPacket,
2202 + NvspStatusBusy,
2203 + NvspStatusMax,
2204 +} NVSP_STATUS, *PNVSP_STATUS;
2205 +
2206 +#pragma pack(push, 1)
2207 +
2208 +typedef struct _NVSP_MESSAGE_HEADER
2209 +{
2210 + UINT32 MessageType;
2211 +} NVSP_MESSAGE_HEADER, *PNVSP_MESSAGE_HEADER;
2212 +
2213 +//
2214 +// Init Messages
2215 +//
2216 +
2217 +//
2218 +// This message is used by the VSC to initialize the channel
2219 +// after the channels has been opened. This message should
2220 +// never include anything other then versioning (i.e. this
2221 +// message will be the same for ever).
2222 +//
2223 +typedef struct _NVSP_MESSAGE_INIT
2224 +{
2225 + UINT32 MinProtocolVersion;
2226 + UINT32 MaxProtocolVersion;
2227 +} NVSP_MESSAGE_INIT, *PNVSP_MESSAGE_INIT;
2228 +
2229 +//
2230 +// This message is used by the VSP to complete the initialization
2231 +// of the channel. This message should never include anything other
2232 +// then versioning (i.e. this message will be the same for ever).
2233 +//
2234 +typedef struct _NVSP_MESSAGE_INIT_COMPLETE
2235 +{
2236 + UINT32 NegotiatedProtocolVersion;
2237 + UINT32 MaximumMdlChainLength;
2238 + UINT32 Status;
2239 +} NVSP_MESSAGE_INIT_COMPLETE, *PNVSP_MESSAGE_INIT_COMPLETE;
2240 +
2241 +typedef union _NVSP_MESSAGE_INIT_UBER
2242 +{
2243 + NVSP_MESSAGE_INIT Init;
2244 + NVSP_MESSAGE_INIT_COMPLETE InitComplete;
2245 +} NVSP_MESSAGE_INIT_UBER;
2246 +
2247 +//
2248 +// Version 1 Messages
2249 +//
2250 +
2251 +//
2252 +// This message is used by the VSC to send the NDIS version
2253 +// to the VSP. The VSP can use this information when handling
2254 +// OIDs sent by the VSC.
2255 +//
2256 +typedef struct _NVSP_1_MESSAGE_SEND_NDIS_VERSION
2257 +{
2258 + UINT32 NdisMajorVersion;
2259 + UINT32 NdisMinorVersion;
2260 +} NVSP_1_MESSAGE_SEND_NDIS_VERSION, *PNVSP_1_MESSAGE_SEND_NDIS_VERSION;
2261 +
2262 +//
2263 +// This message is used by the VSC to send a receive buffer
2264 +// to the VSP. The VSP can then use the receive buffer to
2265 +// send data to the VSC.
2266 +//
2267 +typedef struct _NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER
2268 +{
2269 + GPADL_HANDLE GpadlHandle;
2270 + UINT16 Id;
2271 +} NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER, *PNVSP_1_MESSAGE_SEND_RECEIVE_BUFFER;
2272 +
2273 +typedef struct _NVSP_1_RECEIVE_BUFFER_SECTION
2274 +{
2275 + UINT32 Offset;
2276 + UINT32 SubAllocationSize;
2277 + UINT32 NumSubAllocations;
2278 + UINT32 EndOffset;
2279 +} NVSP_1_RECEIVE_BUFFER_SECTION, *PNVSP_1_RECEIVE_BUFFER_SECTION;
2280 +
2281 +//
2282 +// This message is used by the VSP to acknowledge a receive
2283 +// buffer send by the VSC. This message must be sent by the
2284 +// VSP before the VSP uses the receive buffer.
2285 +//
2286 +typedef struct _NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE
2287 +{
2288 + UINT32 Status;
2289 + UINT32 NumSections;
2290 +
2291 + //
2292 + // The receive buffer is split into two parts, a large
2293 + // suballocation section and a small suballocation
2294 + // section. These sections are then suballocated by a
2295 + // certain size.
2296 + //
2297 + // For example, the following break up of the receive
2298 + // buffer has 6 large suballocations and 10 small
2299 + // suballocations.
2300 + //
2301 + // | Large Section | | Small Section |
2302 + // ------------------------------------------------------------
2303 + // | | | | | | | | | | | | | | | | | |
2304 + // | |
2305 + // LargeOffset SmallOffset
2306 + //
2307 + NVSP_1_RECEIVE_BUFFER_SECTION Sections[1];
2308 +
2309 +} NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE, *PNVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE;
2310 +
2311 +//
2312 +// This message is sent by the VSC to revoke the receive buffer.
2313 +// After the VSP completes this transaction, the vsp should never
2314 +// use the receive buffer again.
2315 +//
2316 +typedef struct _NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER
2317 +{
2318 + UINT16 Id;
2319 +} NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER, *PNVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER;
2320 +
2321 +//
2322 +// This message is used by the VSC to send a send buffer
2323 +// to the VSP. The VSC can then use the send buffer to
2324 +// send data to the VSP.
2325 +//
2326 +typedef struct _NVSP_1_MESSAGE_SEND_SEND_BUFFER
2327 +{
2328 + GPADL_HANDLE GpadlHandle;
2329 + UINT16 Id;
2330 +} NVSP_1_MESSAGE_SEND_SEND_BUFFER, *PNVSP_1_MESSAGE_SEND_SEND_BUFFER;
2331 +
2332 +//
2333 +// This message is used by the VSP to acknowledge a send
2334 +// buffer sent by the VSC. This message must be sent by the
2335 +// VSP before the VSP uses the sent buffer.
2336 +//
2337 +typedef struct _NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE
2338 +{
2339 + UINT32 Status;
2340 +
2341 + //
2342 + // The VSC gets to choose the size of the send buffer and
2343 + // the VSP gets to choose the sections size of the buffer.
2344 + // This was done to enable dynamic reconfigurations when
2345 + // the cost of GPA-direct buffers decreases.
2346 + //
2347 + UINT32 SectionSize;
2348 +} NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE, *PNVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE;
2349 +
2350 +//
2351 +// This message is sent by the VSC to revoke the send buffer.
2352 +// After the VSP completes this transaction, the vsp should never
2353 +// use the send buffer again.
2354 +//
2355 +typedef struct _NVSP_1_MESSAGE_REVOKE_SEND_BUFFER
2356 +{
2357 + UINT16 Id;
2358 +} NVSP_1_MESSAGE_REVOKE_SEND_BUFFER, *PNVSP_1_MESSAGE_REVOKE_SEND_BUFFER;
2359 +
2360 +//
2361 +// This message is used by both the VSP and the VSC to send
2362 +// a RNDIS message to the opposite channel endpoint.
2363 +//
2364 +typedef struct _NVSP_1_MESSAGE_SEND_RNDIS_PACKET
2365 +{
2366 + //
2367 + // This field is specified by RNIDS. They assume there's
2368 + // two different channels of communication. However,
2369 + // the Network VSP only has one. Therefore, the channel
2370 + // travels with the RNDIS packet.
2371 + //
2372 + UINT32 ChannelType;
2373 +
2374 + //
2375 + // This field is used to send part or all of the data
2376 + // through a send buffer. This values specifies an
2377 + // index into the send buffer. If the index is
2378 + // 0xFFFFFFFF, then the send buffer is not being used
2379 + // and all of the data was sent through other VMBus
2380 + // mechanisms.
2381 + //
2382 + UINT32 SendBufferSectionIndex;
2383 + UINT32 SendBufferSectionSize;
2384 +} NVSP_1_MESSAGE_SEND_RNDIS_PACKET, *PNVSP_1_MESSAGE_SEND_RNDIS_PACKET;
2385 +
2386 +//
2387 +// This message is used by both the VSP and the VSC to complete
2388 +// a RNDIS message to the opposite channel endpoint. At this
2389 +// point, the initiator of this message cannot use any resources
2390 +// associated with the original RNDIS packet.
2391 +//
2392 +typedef struct _NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE
2393 +{
2394 + UINT32 Status;
2395 +} NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE, *PNVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE;
2396 +
2397 +typedef union _NVSP_MESSAGE_1_UBER
2398 +{
2399 + NVSP_1_MESSAGE_SEND_NDIS_VERSION SendNdisVersion;
2400 +
2401 + NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER SendReceiveBuffer;
2402 + NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE SendReceiveBufferComplete;
2403 + NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER RevokeReceiveBuffer;
2404 +
2405 + NVSP_1_MESSAGE_SEND_SEND_BUFFER SendSendBuffer;
2406 + NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE SendSendBufferComplete;
2407 + NVSP_1_MESSAGE_REVOKE_SEND_BUFFER RevokeSendBuffer;
2408 +
2409 + NVSP_1_MESSAGE_SEND_RNDIS_PACKET SendRNDISPacket;
2410 + NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE SendRNDISPacketComplete;
2411 +} NVSP_1_MESSAGE_UBER;
2412 +
2413 +typedef union _NVSP_ALL_MESSAGES
2414 +{
2415 + NVSP_MESSAGE_INIT_UBER InitMessages;
2416 + NVSP_1_MESSAGE_UBER Version1Messages;
2417 +
2418 +} NVSP_ALL_MESSAGES;
2419 +
2420 +//
2421 +// ALL Messages
2422 +//
2423 +typedef struct _NVSP_MESSAGE
2424 +{
2425 + NVSP_MESSAGE_HEADER Header;
2426 + NVSP_ALL_MESSAGES Messages;
2427 +} NVSP_MESSAGE, *PNVSP_MESSAGE;
2428 +
2429 +#pragma pack(pop)
2430 --- /dev/null
2431 +++ b/drivers/staging/hv/include/rndis.h
2432 @@ -0,0 +1,836 @@
2433 +/*
2434 + *
2435 + * Copyright (c) 2009, Microsoft Corporation.
2436 + *
2437 + * This program is free software; you can redistribute it and/or modify it
2438 + * under the terms and conditions of the GNU General Public License,
2439 + * version 2, as published by the Free Software Foundation.
2440 + *
2441 + * This program is distributed in the hope it will be useful, but WITHOUT
2442 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2443 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
2444 + * more details.
2445 + *
2446 + * You should have received a copy of the GNU General Public License along with
2447 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
2448 + * Place - Suite 330, Boston, MA 02111-1307 USA.
2449 + *
2450 + * Authors:
2451 + * Haiyang Zhang <haiyangz@microsoft.com>
2452 + * Hank Janssen <hjanssen@microsoft.com>
2453 + *
2454 + */
2455 +
2456 +
2457 +#ifndef _RNDIS_H_
2458 +#define _RNDIS_H_
2459 +
2460 +//
2461 +// Basic types
2462 +//
2463 +typedef UINT32 RNDIS_REQUEST_ID;
2464 +typedef UINT32 RNDIS_HANDLE;
2465 +typedef UINT32 RNDIS_STATUS;
2466 +typedef UINT32 RNDIS_REQUEST_TYPE;
2467 +typedef UINT32 RNDIS_OID;
2468 +typedef UINT32 RNDIS_CLASS_ID;
2469 +typedef UINT32 RNDIS_MEDIUM;
2470 +typedef UINT32 *PRNDIS_REQUEST_ID;
2471 +typedef UINT32 *PRNDIS_HANDLE;
2472 +typedef UINT32 *PRNDIS_STATUS;
2473 +typedef UINT32 *PRNDIS_REQUEST_TYPE;
2474 +typedef UINT32 *PRNDIS_OID;
2475 +typedef UINT32 *PRNDIS_CLASS_ID;
2476 +typedef UINT32 *PRNDIS_MEDIUM;
2477 +typedef UINT32 RNDIS_AF;
2478 +
2479 +//
2480 +// Status codes
2481 +//
2482 +
2483 +#ifndef STATUS_SUCCESS
2484 +#define STATUS_SUCCESS (0x00000000L)
2485 +#endif
2486 +
2487 +#ifndef STATUS_UNSUCCESSFUL
2488 +#define STATUS_UNSUCCESSFUL (0xC0000001L)
2489 +#endif
2490 +
2491 +#ifndef STATUS_PENDING
2492 +#define STATUS_PENDING (0x00000103L)
2493 +#endif
2494 +
2495 +#ifndef STATUS_INSUFFICIENT_RESOURCES
2496 +#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
2497 +#endif
2498 +
2499 +#ifndef STATUS_BUFFER_OVERFLOW
2500 +#define STATUS_BUFFER_OVERFLOW (0x80000005L)
2501 +#endif
2502 +
2503 +#ifndef STATUS_NOT_SUPPORTED
2504 +#define STATUS_NOT_SUPPORTED (0xC00000BBL)
2505 +#endif
2506 +
2507 +#define RNDIS_STATUS_SUCCESS ((RNDIS_STATUS)STATUS_SUCCESS)
2508 +#define RNDIS_STATUS_PENDING ((RNDIS_STATUS)STATUS_PENDING)
2509 +#define RNDIS_STATUS_NOT_RECOGNIZED ((RNDIS_STATUS)0x00010001L)
2510 +#define RNDIS_STATUS_NOT_COPIED ((RNDIS_STATUS)0x00010002L)
2511 +#define RNDIS_STATUS_NOT_ACCEPTED ((RNDIS_STATUS)0x00010003L)
2512 +#define RNDIS_STATUS_CALL_ACTIVE ((RNDIS_STATUS)0x00010007L)
2513 +
2514 +#define RNDIS_STATUS_ONLINE ((RNDIS_STATUS)0x40010003L)
2515 +#define RNDIS_STATUS_RESET_START ((RNDIS_STATUS)0x40010004L)
2516 +#define RNDIS_STATUS_RESET_END ((RNDIS_STATUS)0x40010005L)
2517 +#define RNDIS_STATUS_RING_STATUS ((RNDIS_STATUS)0x40010006L)
2518 +#define RNDIS_STATUS_CLOSED ((RNDIS_STATUS)0x40010007L)
2519 +#define RNDIS_STATUS_WAN_LINE_UP ((RNDIS_STATUS)0x40010008L)
2520 +#define RNDIS_STATUS_WAN_LINE_DOWN ((RNDIS_STATUS)0x40010009L)
2521 +#define RNDIS_STATUS_WAN_FRAGMENT ((RNDIS_STATUS)0x4001000AL)
2522 +#define RNDIS_STATUS_MEDIA_CONNECT ((RNDIS_STATUS)0x4001000BL)
2523 +#define RNDIS_STATUS_MEDIA_DISCONNECT ((RNDIS_STATUS)0x4001000CL)
2524 +#define RNDIS_STATUS_HARDWARE_LINE_UP ((RNDIS_STATUS)0x4001000DL)
2525 +#define RNDIS_STATUS_HARDWARE_LINE_DOWN ((RNDIS_STATUS)0x4001000EL)
2526 +#define RNDIS_STATUS_INTERFACE_UP ((RNDIS_STATUS)0x4001000FL)
2527 +#define RNDIS_STATUS_INTERFACE_DOWN ((RNDIS_STATUS)0x40010010L)
2528 +#define RNDIS_STATUS_MEDIA_BUSY ((RNDIS_STATUS)0x40010011L)
2529 +#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((RNDIS_STATUS)0x40010012L)
2530 +#define RNDIS_STATUS_WW_INDICATION RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION
2531 +#define RNDIS_STATUS_LINK_SPEED_CHANGE ((RNDIS_STATUS)0x40010013L)
2532 +
2533 +#define RNDIS_STATUS_NOT_RESETTABLE ((RNDIS_STATUS)0x80010001L)
2534 +#define RNDIS_STATUS_SOFT_ERRORS ((RNDIS_STATUS)0x80010003L)
2535 +#define RNDIS_STATUS_HARD_ERRORS ((RNDIS_STATUS)0x80010004L)
2536 +#define RNDIS_STATUS_BUFFER_OVERFLOW ((RNDIS_STATUS)STATUS_BUFFER_OVERFLOW)
2537 +
2538 +#define RNDIS_STATUS_FAILURE ((RNDIS_STATUS)STATUS_UNSUCCESSFUL)
2539 +#define RNDIS_STATUS_RESOURCES ((RNDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
2540 +#define RNDIS_STATUS_CLOSING ((RNDIS_STATUS)0xC0010002L)
2541 +#define RNDIS_STATUS_BAD_VERSION ((RNDIS_STATUS)0xC0010004L)
2542 +#define RNDIS_STATUS_BAD_CHARACTERISTICS ((RNDIS_STATUS)0xC0010005L)
2543 +#define RNDIS_STATUS_ADAPTER_NOT_FOUND ((RNDIS_STATUS)0xC0010006L)
2544 +#define RNDIS_STATUS_OPEN_FAILED ((RNDIS_STATUS)0xC0010007L)
2545 +#define RNDIS_STATUS_DEVICE_FAILED ((RNDIS_STATUS)0xC0010008L)
2546 +#define RNDIS_STATUS_MULTICAST_FULL ((RNDIS_STATUS)0xC0010009L)
2547 +#define RNDIS_STATUS_MULTICAST_EXISTS ((RNDIS_STATUS)0xC001000AL)
2548 +#define RNDIS_STATUS_MULTICAST_NOT_FOUND ((RNDIS_STATUS)0xC001000BL)
2549 +#define RNDIS_STATUS_REQUEST_ABORTED ((RNDIS_STATUS)0xC001000CL)
2550 +#define RNDIS_STATUS_RESET_IN_PROGRESS ((RNDIS_STATUS)0xC001000DL)
2551 +#define RNDIS_STATUS_CLOSING_INDICATING ((RNDIS_STATUS)0xC001000EL)
2552 +#define RNDIS_STATUS_NOT_SUPPORTED ((RNDIS_STATUS)STATUS_NOT_SUPPORTED)
2553 +#define RNDIS_STATUS_INVALID_PACKET ((RNDIS_STATUS)0xC001000FL)
2554 +#define RNDIS_STATUS_OPEN_LIST_FULL ((RNDIS_STATUS)0xC0010010L)
2555 +#define RNDIS_STATUS_ADAPTER_NOT_READY ((RNDIS_STATUS)0xC0010011L)
2556 +#define RNDIS_STATUS_ADAPTER_NOT_OPEN ((RNDIS_STATUS)0xC0010012L)
2557 +#define RNDIS_STATUS_NOT_INDICATING ((RNDIS_STATUS)0xC0010013L)
2558 +#define RNDIS_STATUS_INVALID_LENGTH ((RNDIS_STATUS)0xC0010014L)
2559 +#define RNDIS_STATUS_INVALID_DATA ((RNDIS_STATUS)0xC0010015L)
2560 +#define RNDIS_STATUS_BUFFER_TOO_SHORT ((RNDIS_STATUS)0xC0010016L)
2561 +#define RNDIS_STATUS_INVALID_OID ((RNDIS_STATUS)0xC0010017L)
2562 +#define RNDIS_STATUS_ADAPTER_REMOVED ((RNDIS_STATUS)0xC0010018L)
2563 +#define RNDIS_STATUS_UNSUPPORTED_MEDIA ((RNDIS_STATUS)0xC0010019L)
2564 +#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE ((RNDIS_STATUS)0xC001001AL)
2565 +#define RNDIS_STATUS_FILE_NOT_FOUND ((RNDIS_STATUS)0xC001001BL)
2566 +#define RNDIS_STATUS_ERROR_READING_FILE ((RNDIS_STATUS)0xC001001CL)
2567 +#define RNDIS_STATUS_ALREADY_MAPPED ((RNDIS_STATUS)0xC001001DL)
2568 +#define RNDIS_STATUS_RESOURCE_CONFLICT ((RNDIS_STATUS)0xC001001EL)
2569 +#define RNDIS_STATUS_NO_CABLE ((RNDIS_STATUS)0xC001001FL)
2570 +
2571 +#define RNDIS_STATUS_INVALID_SAP ((RNDIS_STATUS)0xC0010020L)
2572 +#define RNDIS_STATUS_SAP_IN_USE ((RNDIS_STATUS)0xC0010021L)
2573 +#define RNDIS_STATUS_INVALID_ADDRESS ((RNDIS_STATUS)0xC0010022L)
2574 +#define RNDIS_STATUS_VC_NOT_ACTIVATED ((RNDIS_STATUS)0xC0010023L)
2575 +#define RNDIS_STATUS_DEST_OUT_OF_ORDER ((RNDIS_STATUS)0xC0010024L)
2576 +#define RNDIS_STATUS_VC_NOT_AVAILABLE ((RNDIS_STATUS)0xC0010025L)
2577 +#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE ((RNDIS_STATUS)0xC0010026L)
2578 +#define RNDIS_STATUS_INCOMPATABLE_QOS ((RNDIS_STATUS)0xC0010027L)
2579 +#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((RNDIS_STATUS)0xC0010028L)
2580 +#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION ((RNDIS_STATUS)0xC0010029L)
2581 +
2582 +#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR ((RNDIS_STATUS)0xC0011000L)
2583 +
2584 +
2585 +//
2586 +// Object Identifiers used by NdisRequest Query/Set Information
2587 +//
2588 +
2589 +//
2590 +// General Objects
2591 +//
2592 +
2593 +#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
2594 +#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
2595 +#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
2596 +#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
2597 +#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
2598 +#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
2599 +#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
2600 +#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
2601 +#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
2602 +#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
2603 +#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
2604 +#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
2605 +#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
2606 +#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
2607 +#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
2608 +#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
2609 +#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
2610 +#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
2611 +#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
2612 +#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
2613 +#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
2614 +#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
2615 +#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
2616 +#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
2617 +#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
2618 +#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
2619 +
2620 +#define RNDIS_OID_GEN_XMIT_OK 0x00020101
2621 +#define RNDIS_OID_GEN_RCV_OK 0x00020102
2622 +#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
2623 +#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
2624 +#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
2625 +
2626 +#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
2627 +#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
2628 +#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
2629 +#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
2630 +#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
2631 +#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
2632 +#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
2633 +#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
2634 +#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
2635 +#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
2636 +#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
2637 +#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
2638 +
2639 +#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
2640 +#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
2641 +
2642 +#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
2643 +#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
2644 +
2645 +//
2646 +// These are connection-oriented general OIDs.
2647 +// These replace the above OIDs for connection-oriented media.
2648 +//
2649 +#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
2650 +#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
2651 +#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
2652 +#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
2653 +#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
2654 +#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
2655 +#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
2656 +#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
2657 +#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
2658 +#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
2659 +#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
2660 +#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
2661 +#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
2662 +
2663 +#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
2664 +#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
2665 +
2666 +//
2667 +// These are connection-oriented statistics OIDs.
2668 +//
2669 +#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
2670 +#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
2671 +#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
2672 +#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
2673 +#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
2674 +
2675 +
2676 +#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
2677 +#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
2678 +#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
2679 +#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
2680 +#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
2681 +#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
2682 +
2683 +//
2684 +// These are objects for Connection-oriented media call-managers.
2685 +//
2686 +#define RNDIS_OID_CO_ADD_PVC 0xFF000001
2687 +#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
2688 +#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
2689 +#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
2690 +#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
2691 +#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
2692 +#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
2693 +#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
2694 +#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
2695 +
2696 +
2697 +//
2698 +// 802.3 Objects (Ethernet)
2699 +//
2700 +
2701 +#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
2702 +#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
2703 +#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
2704 +#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
2705 +#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
2706 +
2707 +//
2708 +//
2709 +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
2710 +
2711 +#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
2712 +#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
2713 +#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
2714 +
2715 +#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
2716 +#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
2717 +#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
2718 +#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
2719 +#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
2720 +#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
2721 +#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
2722 +
2723 +
2724 +//
2725 +// Remote NDIS message types
2726 +//
2727 +#define REMOTE_NDIS_PACKET_MSG 0x00000001
2728 +#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002
2729 +#define REMOTE_NDIS_HALT_MSG 0x00000003
2730 +#define REMOTE_NDIS_QUERY_MSG 0x00000004
2731 +#define REMOTE_NDIS_SET_MSG 0x00000005
2732 +#define REMOTE_NDIS_RESET_MSG 0x00000006
2733 +#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007
2734 +#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008
2735 +
2736 +#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
2737 +#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
2738 +#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
2739 +#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
2740 +#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
2741 +
2742 +
2743 +// Remote NDIS message completion types
2744 +#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002
2745 +#define REMOTE_NDIS_QUERY_CMPLT 0x80000004
2746 +#define REMOTE_NDIS_SET_CMPLT 0x80000005
2747 +#define REMOTE_NDIS_RESET_CMPLT 0x80000006
2748 +#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008
2749 +
2750 +#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
2751 +#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
2752 +#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
2753 +#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
2754 +
2755 +//
2756 +// Reserved message type for private communication between lower-layer
2757 +// host driver and remote device, if necessary.
2758 +//
2759 +#define REMOTE_NDIS_BUS_MSG 0xff000001
2760 +
2761 +
2762 +
2763 +//
2764 +// Defines for DeviceFlags in RNDIS_INITIALIZE_COMPLETE
2765 +//
2766 +#define RNDIS_DF_CONNECTIONLESS 0x00000001
2767 +#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
2768 +#define RNDIS_DF_RAW_DATA 0x00000004
2769 +
2770 +//
2771 +// Remote NDIS medium types.
2772 +//
2773 +#define RNdisMedium802_3 0x00000000
2774 +#define RNdisMedium802_5 0x00000001
2775 +#define RNdisMediumFddi 0x00000002
2776 +#define RNdisMediumWan 0x00000003
2777 +#define RNdisMediumLocalTalk 0x00000004
2778 +#define RNdisMediumArcnetRaw 0x00000006
2779 +#define RNdisMediumArcnet878_2 0x00000007
2780 +#define RNdisMediumAtm 0x00000008
2781 +#define RNdisMediumWirelessWan 0x00000009
2782 +#define RNdisMediumIrda 0x0000000a
2783 +#define RNdisMediumCoWan 0x0000000b
2784 +#define RNdisMediumMax 0x0000000d // Not a real medium, defined as an upper-bound
2785 +
2786 +//
2787 +// Remote NDIS medium connection states.
2788 +//
2789 +#define RNdisMediaStateConnected 0x00000000
2790 +#define RNdisMediaStateDisconnected 0x00000001
2791 +
2792 +//
2793 +// Remote NDIS version numbers
2794 +//
2795 +#define RNDIS_MAJOR_VERSION 0x00000001
2796 +#define RNDIS_MINOR_VERSION 0x00000000
2797 +
2798 +//
2799 +// NdisInitialize message
2800 +//
2801 +typedef struct _RNDIS_INITIALIZE_REQUEST
2802 +{
2803 + RNDIS_REQUEST_ID RequestId;
2804 + UINT32 MajorVersion;
2805 + UINT32 MinorVersion;
2806 + UINT32 MaxTransferSize;
2807 +} RNDIS_INITIALIZE_REQUEST, *PRNDIS_INITIALIZE_REQUEST;
2808 +
2809 +
2810 +//
2811 +// Response to NdisInitialize
2812 +//
2813 +typedef struct _RNDIS_INITIALIZE_COMPLETE
2814 +{
2815 + RNDIS_REQUEST_ID RequestId;
2816 + RNDIS_STATUS Status;
2817 + UINT32 MajorVersion;
2818 + UINT32 MinorVersion;
2819 + UINT32 DeviceFlags;
2820 + RNDIS_MEDIUM Medium;
2821 + UINT32 MaxPacketsPerMessage;
2822 + UINT32 MaxTransferSize;
2823 + UINT32 PacketAlignmentFactor;
2824 + UINT32 AFListOffset;
2825 + UINT32 AFListSize;
2826 +} RNDIS_INITIALIZE_COMPLETE, *PRNDIS_INITIALIZE_COMPLETE;
2827 +
2828 +
2829 +//
2830 +// Call manager devices only: Information about an address family
2831 +// supported by the device is appended to the response to NdisInitialize.
2832 +//
2833 +typedef struct _RNDIS_CO_ADDRESS_FAMILY
2834 +{
2835 + RNDIS_AF AddressFamily;
2836 + UINT32 MajorVersion;
2837 + UINT32 MinorVersion;
2838 +} RNDIS_CO_ADDRESS_FAMILY, *PRNDIS_CO_ADDRESS_FAMILY;
2839 +
2840 +
2841 +//
2842 +// NdisHalt message
2843 +//
2844 +typedef struct _RNDIS_HALT_REQUEST
2845 +{
2846 + RNDIS_REQUEST_ID RequestId;
2847 +} RNDIS_HALT_REQUEST, *PRNDIS_HALT_REQUEST;
2848 +
2849 +
2850 +//
2851 +// NdisQueryRequest message
2852 +//
2853 +typedef struct _RNDIS_QUERY_REQUEST
2854 +{
2855 + RNDIS_REQUEST_ID RequestId;
2856 + RNDIS_OID Oid;
2857 + UINT32 InformationBufferLength;
2858 + UINT32 InformationBufferOffset;
2859 + RNDIS_HANDLE DeviceVcHandle;
2860 +} RNDIS_QUERY_REQUEST, *PRNDIS_QUERY_REQUEST;
2861 +
2862 +
2863 +//
2864 +// Response to NdisQueryRequest
2865 +//
2866 +typedef struct _RNDIS_QUERY_COMPLETE
2867 +{
2868 + RNDIS_REQUEST_ID RequestId;
2869 + RNDIS_STATUS Status;
2870 + UINT32 InformationBufferLength;
2871 + UINT32 InformationBufferOffset;
2872 +} RNDIS_QUERY_COMPLETE, *PRNDIS_QUERY_COMPLETE;
2873 +
2874 +
2875 +//
2876 +// NdisSetRequest message
2877 +//
2878 +typedef struct _RNDIS_SET_REQUEST
2879 +{
2880 + RNDIS_REQUEST_ID RequestId;
2881 + RNDIS_OID Oid;
2882 + UINT32 InformationBufferLength;
2883 + UINT32 InformationBufferOffset;
2884 + RNDIS_HANDLE DeviceVcHandle;
2885 +} RNDIS_SET_REQUEST, *PRNDIS_SET_REQUEST;
2886 +
2887 +
2888 +//
2889 +// Response to NdisSetRequest
2890 +//
2891 +typedef struct _RNDIS_SET_COMPLETE
2892 +{
2893 + RNDIS_REQUEST_ID RequestId;
2894 + RNDIS_STATUS Status;
2895 +} RNDIS_SET_COMPLETE, *PRNDIS_SET_COMPLETE;
2896 +
2897 +
2898 +//
2899 +// NdisReset message
2900 +//
2901 +typedef struct _RNDIS_RESET_REQUEST
2902 +{
2903 + UINT32 Reserved;
2904 +} RNDIS_RESET_REQUEST, *PRNDIS_RESET_REQUEST;
2905 +
2906 +//
2907 +// Response to NdisReset
2908 +//
2909 +typedef struct _RNDIS_RESET_COMPLETE
2910 +{
2911 + RNDIS_STATUS Status;
2912 + UINT32 AddressingReset;
2913 +} RNDIS_RESET_COMPLETE, *PRNDIS_RESET_COMPLETE;
2914 +
2915 +
2916 +//
2917 +// NdisMIndicateStatus message
2918 +//
2919 +typedef struct _RNDIS_INDICATE_STATUS
2920 +{
2921 + RNDIS_STATUS Status;
2922 + UINT32 StatusBufferLength;
2923 + UINT32 StatusBufferOffset;
2924 +} RNDIS_INDICATE_STATUS, *PRNDIS_INDICATE_STATUS;
2925 +
2926 +
2927 +//
2928 +// Diagnostic information passed as the status buffer in
2929 +// RNDIS_INDICATE_STATUS messages signifying error conditions.
2930 +//
2931 +typedef struct _RNDIS_DIAGNOSTIC_INFO
2932 +{
2933 + RNDIS_STATUS DiagStatus;
2934 + UINT32 ErrorOffset;
2935 +} RNDIS_DIAGNOSTIC_INFO, *PRNDIS_DIAGNOSTIC_INFO;
2936 +
2937 +
2938 +
2939 +//
2940 +// NdisKeepAlive message
2941 +//
2942 +typedef struct _RNDIS_KEEPALIVE_REQUEST
2943 +{
2944 + RNDIS_REQUEST_ID RequestId;
2945 +} RNDIS_KEEPALIVE_REQUEST, *PRNDIS_KEEPALIVE_REQUEST;
2946 +
2947 +
2948 +//
2949 +// Response to NdisKeepAlive
2950 +//
2951 +typedef struct _RNDIS_KEEPALIVE_COMPLETE
2952 +{
2953 + RNDIS_REQUEST_ID RequestId;
2954 + RNDIS_STATUS Status;
2955 +} RNDIS_KEEPALIVE_COMPLETE, *PRNDIS_KEEPALIVE_COMPLETE;
2956 +
2957 +
2958 +//
2959 +// Data message. All Offset fields contain byte offsets from the beginning
2960 +// of the RNDIS_PACKET structure. All Length fields are in bytes.
2961 +// VcHandle is set to 0 for connectionless data, otherwise it
2962 +// contains the VC handle.
2963 +//
2964 +typedef struct _RNDIS_PACKET
2965 +{
2966 + UINT32 DataOffset;
2967 + UINT32 DataLength;
2968 + UINT32 OOBDataOffset;
2969 + UINT32 OOBDataLength;
2970 + UINT32 NumOOBDataElements;
2971 + UINT32 PerPacketInfoOffset;
2972 + UINT32 PerPacketInfoLength;
2973 + RNDIS_HANDLE VcHandle;
2974 + UINT32 Reserved;
2975 +} RNDIS_PACKET, *PRNDIS_PACKET;
2976 +
2977 +//
2978 +// Optional Out of Band data associated with a Data message.
2979 +//
2980 +typedef struct _RNDIS_OOBD
2981 +{
2982 + UINT32 Size;
2983 + RNDIS_CLASS_ID Type;
2984 + UINT32 ClassInformationOffset;
2985 +} RNDIS_OOBD, *PRNDIS_OOBD;
2986 +
2987 +//
2988 +// Packet extension field contents associated with a Data message.
2989 +//
2990 +typedef struct _RNDIS_PER_PACKET_INFO
2991 +{
2992 + UINT32 Size;
2993 + UINT32 Type;
2994 + UINT32 PerPacketInformationOffset;
2995 +} RNDIS_PER_PACKET_INFO, *PRNDIS_PER_PACKET_INFO;
2996 +
2997 +
2998 +//
2999 +// Format of Information buffer passed in a SetRequest for the OID
3000 +// OID_GEN_RNDIS_CONFIG_PARAMETER.
3001 +//
3002 +typedef struct _RNDIS_CONFIG_PARAMETER_INFO
3003 +{
3004 + UINT32 ParameterNameOffset;
3005 + UINT32 ParameterNameLength;
3006 + UINT32 ParameterType;
3007 + UINT32 ParameterValueOffset;
3008 + UINT32 ParameterValueLength;
3009 +} RNDIS_CONFIG_PARAMETER_INFO, *PRNDIS_CONFIG_PARAMETER_INFO;
3010 +
3011 +//
3012 +// Values for ParameterType in RNDIS_CONFIG_PARAMETER_INFO
3013 +//
3014 +#define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
3015 +#define RNDIS_CONFIG_PARAM_TYPE_STRING 2
3016 +
3017 +
3018 +//
3019 +// CONDIS Miniport messages for connection oriented devices
3020 +// that do not implement a call manager.
3021 +//
3022 +
3023 +//
3024 +// CoNdisMiniportCreateVc message
3025 +//
3026 +typedef struct _RCONDIS_MP_CREATE_VC
3027 +{
3028 + RNDIS_REQUEST_ID RequestId;
3029 + RNDIS_HANDLE NdisVcHandle;
3030 +} RCONDIS_MP_CREATE_VC, *PRCONDIS_MP_CREATE_VC;
3031 +
3032 +//
3033 +// Response to CoNdisMiniportCreateVc
3034 +//
3035 +typedef struct _RCONDIS_MP_CREATE_VC_COMPLETE
3036 +{
3037 + RNDIS_REQUEST_ID RequestId;
3038 + RNDIS_HANDLE DeviceVcHandle;
3039 + RNDIS_STATUS Status;
3040 +} RCONDIS_MP_CREATE_VC_COMPLETE, *PRCONDIS_MP_CREATE_VC_COMPLETE;
3041 +
3042 +
3043 +//
3044 +// CoNdisMiniportDeleteVc message
3045 +//
3046 +typedef struct _RCONDIS_MP_DELETE_VC
3047 +{
3048 + RNDIS_REQUEST_ID RequestId;
3049 + RNDIS_HANDLE DeviceVcHandle;
3050 +} RCONDIS_MP_DELETE_VC, *PRCONDIS_MP_DELETE_VC;
3051 +
3052 +//
3053 +// Response to CoNdisMiniportDeleteVc
3054 +//
3055 +typedef struct _RCONDIS_MP_DELETE_VC_COMPLETE
3056 +{
3057 + RNDIS_REQUEST_ID RequestId;
3058 + RNDIS_STATUS Status;
3059 +} RCONDIS_MP_DELETE_VC_COMPLETE, *PRCONDIS_MP_DELETE_VC_COMPLETE;
3060 +
3061 +
3062 +//
3063 +// CoNdisMiniportQueryRequest message
3064 +//
3065 +typedef struct _RCONDIS_MP_QUERY_REQUEST
3066 +{
3067 + RNDIS_REQUEST_ID RequestId;
3068 + RNDIS_REQUEST_TYPE RequestType;
3069 + RNDIS_OID Oid;
3070 + RNDIS_HANDLE DeviceVcHandle;
3071 + UINT32 InformationBufferLength;
3072 + UINT32 InformationBufferOffset;
3073 +} RCONDIS_MP_QUERY_REQUEST, *PRCONDIS_MP_QUERY_REQUEST;
3074 +
3075 +
3076 +//
3077 +// CoNdisMiniportSetRequest message
3078 +//
3079 +typedef struct _RCONDIS_MP_SET_REQUEST
3080 +{
3081 + RNDIS_REQUEST_ID RequestId;
3082 + RNDIS_REQUEST_TYPE RequestType;
3083 + RNDIS_OID Oid;
3084 + RNDIS_HANDLE DeviceVcHandle;
3085 + UINT32 InformationBufferLength;
3086 + UINT32 InformationBufferOffset;
3087 +} RCONDIS_MP_SET_REQUEST, *PRCONDIS_MP_SET_REQUEST;
3088 +
3089 +
3090 +//
3091 +// CoNdisIndicateStatus message
3092 +//
3093 +typedef struct _RCONDIS_INDICATE_STATUS
3094 +{
3095 + RNDIS_HANDLE NdisVcHandle;
3096 + RNDIS_STATUS Status;
3097 + UINT32 StatusBufferLength;
3098 + UINT32 StatusBufferOffset;
3099 +} RCONDIS_INDICATE_STATUS, *PRCONDIS_INDICATE_STATUS;
3100 +
3101 +
3102 +//
3103 +// CONDIS Call/VC parameters
3104 +//
3105 +
3106 +typedef struct _RCONDIS_SPECIFIC_PARAMETERS
3107 +{
3108 + UINT32 ParameterType;
3109 + UINT32 ParameterLength;
3110 + UINT32 ParameterOffset;
3111 +} RCONDIS_SPECIFIC_PARAMETERS, *PRCONDIS_SPECIFIC_PARAMETERS;
3112 +
3113 +typedef struct _RCONDIS_MEDIA_PARAMETERS
3114 +{
3115 + UINT32 Flags;
3116 + UINT32 Reserved1;
3117 + UINT32 Reserved2;
3118 + RCONDIS_SPECIFIC_PARAMETERS MediaSpecific;
3119 +} RCONDIS_MEDIA_PARAMETERS, *PRCONDIS_MEDIA_PARAMETERS;
3120 +
3121 +
3122 +typedef struct _RNDIS_FLOWSPEC
3123 +{
3124 + UINT32 TokenRate;
3125 + UINT32 TokenBucketSize;
3126 + UINT32 PeakBandwidth;
3127 + UINT32 Latency;
3128 + UINT32 DelayVariation;
3129 + UINT32 ServiceType;
3130 + UINT32 MaxSduSize;
3131 + UINT32 MinimumPolicedSize;
3132 +} RNDIS_FLOWSPEC, *PRNDIS_FLOWSPEC;
3133 +
3134 +typedef struct _RCONDIS_CALL_MANAGER_PARAMETERS
3135 +{
3136 + RNDIS_FLOWSPEC Transmit;
3137 + RNDIS_FLOWSPEC Receive;
3138 + RCONDIS_SPECIFIC_PARAMETERS CallMgrSpecific;
3139 +} RCONDIS_CALL_MANAGER_PARAMETERS, *PRCONDIS_CALL_MANAGER_PARAMETERS;
3140 +
3141 +//
3142 +// CoNdisMiniportActivateVc message
3143 +//
3144 +typedef struct _RCONDIS_MP_ACTIVATE_VC_REQUEST
3145 +{
3146 + RNDIS_REQUEST_ID RequestId;
3147 + UINT32 Flags;
3148 + RNDIS_HANDLE DeviceVcHandle;
3149 + UINT32 MediaParamsOffset;
3150 + UINT32 MediaParamsLength;
3151 + UINT32 CallMgrParamsOffset;
3152 + UINT32 CallMgrParamsLength;
3153 +} RCONDIS_MP_ACTIVATE_VC_REQUEST, *PRCONDIS_MP_ACTIVATE_VC_REQUEST;
3154 +
3155 +//
3156 +// Response to CoNdisMiniportActivateVc
3157 +//
3158 +typedef struct _RCONDIS_MP_ACTIVATE_VC_COMPLETE
3159 +{
3160 + RNDIS_REQUEST_ID RequestId;
3161 + RNDIS_STATUS Status;
3162 +} RCONDIS_MP_ACTIVATE_VC_COMPLETE, *PRCONDIS_MP_ACTIVATE_VC_COMPLETE;
3163 +
3164 +
3165 +//
3166 +// CoNdisMiniportDeactivateVc message
3167 +//
3168 +typedef struct _RCONDIS_MP_DEACTIVATE_VC_REQUEST
3169 +{
3170 + RNDIS_REQUEST_ID RequestId;
3171 + UINT32 Flags;
3172 + RNDIS_HANDLE DeviceVcHandle;
3173 +} RCONDIS_MP_DEACTIVATE_VC_REQUEST, *PRCONDIS_MP_DEACTIVATE_VC_REQUEST;
3174 +
3175 +//
3176 +// Response to CoNdisMiniportDeactivateVc
3177 +//
3178 +typedef struct _RCONDIS_MP_DEACTIVATE_VC_COMPLETE
3179 +{
3180 + RNDIS_REQUEST_ID RequestId;
3181 + RNDIS_STATUS Status;
3182 +} RCONDIS_MP_DEACTIVATE_VC_COMPLETE, *PRCONDIS_MP_DEACTIVATE_VC_COMPLETE;
3183 +
3184 +
3185 +//
3186 +// union with all of the RNDIS messages
3187 +//
3188 +typedef union _RNDIS_MESSAGE_CONTAINER
3189 +{
3190 + RNDIS_PACKET Packet;
3191 + RNDIS_INITIALIZE_REQUEST InitializeRequest;
3192 + RNDIS_HALT_REQUEST HaltRequest;
3193 + RNDIS_QUERY_REQUEST QueryRequest;
3194 + RNDIS_SET_REQUEST SetRequest;
3195 + RNDIS_RESET_REQUEST ResetRequest;
3196 + RNDIS_KEEPALIVE_REQUEST KeepaliveRequest;
3197 + RNDIS_INDICATE_STATUS IndicateStatus;
3198 + RNDIS_INITIALIZE_COMPLETE InitializeComplete;
3199 + RNDIS_QUERY_COMPLETE QueryComplete;
3200 + RNDIS_SET_COMPLETE SetComplete;
3201 + RNDIS_RESET_COMPLETE ResetComplete;
3202 + RNDIS_KEEPALIVE_COMPLETE KeepaliveComplete;
3203 + RCONDIS_MP_CREATE_VC CoMiniportCreateVc;
3204 + RCONDIS_MP_DELETE_VC CoMiniportDeleteVc;
3205 + RCONDIS_INDICATE_STATUS CoIndicateStatus;
3206 + RCONDIS_MP_ACTIVATE_VC_REQUEST CoMiniportActivateVc;
3207 + RCONDIS_MP_DEACTIVATE_VC_REQUEST CoMiniportDeactivateVc;
3208 + RCONDIS_MP_CREATE_VC_COMPLETE CoMiniportCreateVcComplete;
3209 + RCONDIS_MP_DELETE_VC_COMPLETE CoMiniportDeleteVcComplete;
3210 + RCONDIS_MP_ACTIVATE_VC_COMPLETE CoMiniportActivateVcComplete;
3211 + RCONDIS_MP_DEACTIVATE_VC_COMPLETE CoMiniportDeactivateVcComplete;
3212 +
3213 +
3214 +} RNDIS_MESSAGE_CONTAINER, *PRNDIS_MESSAGE_CONTAINER;
3215 +
3216 +//
3217 +// Remote NDIS message format
3218 +//
3219 +typedef __struct_bcount(MessageLength) struct _RNDIS_MESSAGE
3220 +{
3221 + UINT32 NdisMessageType;
3222 +
3223 + //
3224 + // Total length of this message, from the beginning
3225 + // of the RNDIS_MESSAGE struct, in bytes.
3226 + //
3227 + UINT32 MessageLength;
3228 +
3229 + // Actual message
3230 + RNDIS_MESSAGE_CONTAINER Message;
3231 +
3232 +} RNDIS_MESSAGE, *PRNDIS_MESSAGE;
3233 +
3234 +
3235 +
3236 +//
3237 +// Handy macros
3238 +
3239 +// get the size of an RNDIS message. Pass in the message type,
3240 +// RNDIS_SET_REQUEST, RNDIS_PACKET for example
3241 +#define RNDIS_MESSAGE_SIZE(Message) \
3242 + (sizeof(Message) + (sizeof(RNDIS_MESSAGE) - sizeof(RNDIS_MESSAGE_CONTAINER)))
3243 +
3244 +// get pointer to info buffer with message pointer
3245 +#define MESSAGE_TO_INFO_BUFFER(Message) \
3246 + (((PUCHAR)(Message)) + Message->InformationBufferOffset)
3247 +
3248 +// get pointer to status buffer with message pointer
3249 +#define MESSAGE_TO_STATUS_BUFFER(Message) \
3250 + (((PUCHAR)(Message)) + Message->StatusBufferOffset)
3251 +
3252 +// get pointer to OOBD buffer with message pointer
3253 +#define MESSAGE_TO_OOBD_BUFFER(Message) \
3254 + (((PUCHAR)(Message)) + Message->OOBDataOffset)
3255 +
3256 +// get pointer to data buffer with message pointer
3257 +#define MESSAGE_TO_DATA_BUFFER(Message) \
3258 + (((PUCHAR)(Message)) + Message->PerPacketInfoOffset)
3259 +
3260 +// get pointer to contained message from NDIS_MESSAGE pointer
3261 +#define RNDIS_MESSAGE_PTR_TO_MESSAGE_PTR(RndisMessage) \
3262 + ((PVOID) &RndisMessage->Message)
3263 +
3264 +// get pointer to contained message from NDIS_MESSAGE pointer
3265 +#define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(RndisMessage) \
3266 + ((PVOID) RndisMessage)
3267 +
3268 +#endif // _RNDIS_H_
3269 --- /dev/null
3270 +++ b/drivers/staging/hv/include/VmbusChannelInterface.h
3271 @@ -0,0 +1,131 @@
3272 +/*
3273 + *
3274 + * Copyright (c) 2009, Microsoft Corporation.
3275 + *
3276 + * This program is free software; you can redistribute it and/or modify it
3277 + * under the terms and conditions of the GNU General Public License,
3278 + * version 2, as published by the Free Software Foundation.
3279 + *
3280 + * This program is distributed in the hope it will be useful, but WITHOUT
3281 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3282 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
3283 + * more details.
3284 + *
3285 + * You should have received a copy of the GNU General Public License along with
3286 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
3287 + * Place - Suite 330, Boston, MA 02111-1307 USA.
3288 + *
3289 + * Authors:
3290 + * Haiyang Zhang <haiyangz@microsoft.com>
3291 + * Hank Janssen <hjanssen@microsoft.com>
3292 + *
3293 + */
3294 +
3295 +
3296 +#pragma once
3297 +// allow nameless unions
3298 +//#pragma warning(disable : 4201)
3299 +
3300 +//
3301 +// A revision number of vmbus that is used for ensuring both ends on a
3302 +// partition are using compatible versions.
3303 +//
3304 +#define VMBUS_REVISION_NUMBER 13
3305 +
3306 +//
3307 +// Make maximum size of pipe payload of 16K
3308 +//
3309 +#define MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384)
3310 +
3311 +//
3312 +// Define PipeMode values.
3313 +//
3314 +#define VMBUS_PIPE_TYPE_BYTE 0x00000000
3315 +#define VMBUS_PIPE_TYPE_MESSAGE 0x00000004
3316 +
3317 +//
3318 +// The size of the user defined data buffer for non-pipe offers.
3319 +//
3320 +#define MAX_USER_DEFINED_BYTES 120
3321 +
3322 +//
3323 +// The size of the user defined data buffer for pipe offers.
3324 +//
3325 +#define MAX_PIPE_USER_DEFINED_BYTES 116
3326 +
3327 +
3328 +//
3329 +// At the center of the Channel Management library is
3330 +// the Channel Offer. This struct contains the
3331 +// fundamental information about an offer.
3332 +//
3333 +#pragma pack(push,1)
3334 +
3335 +typedef struct
3336 +{
3337 +
3338 + GUID InterfaceType;
3339 + GUID InterfaceInstance;
3340 + UINT64 InterruptLatencyIn100nsUnits;
3341 + UINT32 InterfaceRevision;
3342 + UINT32 ServerContextAreaSize; // in bytes
3343 + UINT16 ChannelFlags;
3344 + UINT16 MmioMegabytes; // in bytes * 1024 * 1024
3345 +
3346 + union
3347 + {
3348 + //
3349 + // Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes.
3350 + //
3351 + struct
3352 + {
3353 + UCHAR UserDefined[MAX_USER_DEFINED_BYTES];
3354 + } Standard;
3355 +
3356 + //
3357 + // Pipes: The following sructure is an integrated pipe protocol, which
3358 + // is implemented on top of standard user-defined data. Pipe clients
3359 + // have MAX_PIPE_USER_DEFINED_BYTES left for their own use.
3360 + //
3361 + struct
3362 + {
3363 + UINT32 PipeMode;
3364 + UCHAR UserDefined[MAX_PIPE_USER_DEFINED_BYTES];
3365 + } Pipe;
3366 + } u;
3367 + UINT32 Padding;
3368 +} VMBUS_CHANNEL_OFFER, *PVMBUS_CHANNEL_OFFER;
3369 +#pragma pack(pop)
3370 +
3371 +
3372 +//
3373 +// Verify the MAX_PIPE_USER_DEFINED_BYTES value.
3374 +//
3375 +//C_ASSERT(MAX_PIPE_USER_DEFINED_BYTES ==
3376 +// MAX_USER_DEFINED_BYTES -
3377 +// (FIELD_OFFSET(VMBUS_CHANNEL_OFFER, u.Pipe.UserDefined) -
3378 +// FIELD_OFFSET(VMBUS_CHANNEL_OFFER, u.Standard.UserDefined)));
3379 +//
3380 +
3381 +typedef UINT32 GPADL_HANDLE;
3382 +
3383 +//
3384 +// Server Flags
3385 +//
3386 +
3387 +#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1
3388 +#define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2
3389 +#define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4
3390 +#define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10
3391 +#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100
3392 +#define VMBUS_CHANNEL_PARENT_OFFER 0x200
3393 +#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400
3394 +
3395 +//
3396 +// TEMPTEMP -- move this next define to devioctl.h some day
3397 +//
3398 +
3399 +#ifndef FILE_DEVICE_VMBUS
3400 +#define FILE_DEVICE_VMBUS 0x0000003E
3401 +#endif
3402 +
3403 --- /dev/null
3404 +++ b/drivers/staging/hv/include/VmbusPacketFormat.h
3405 @@ -0,0 +1,322 @@
3406 +/*
3407 + *
3408 + * Copyright (c) 2009, Microsoft Corporation.
3409 + *
3410 + * This program is free software; you can redistribute it and/or modify it
3411 + * under the terms and conditions of the GNU General Public License,
3412 + * version 2, as published by the Free Software Foundation.
3413 + *
3414 + * This program is distributed in the hope it will be useful, but WITHOUT
3415 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3416 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
3417 + * more details.
3418 + *
3419 + * You should have received a copy of the GNU General Public License along with
3420 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
3421 + * Place - Suite 330, Boston, MA 02111-1307 USA.
3422 + *
3423 + * Authors:
3424 + * Haiyang Zhang <haiyangz@microsoft.com>
3425 + * Hank Janssen <hjanssen@microsoft.com>
3426 + *
3427 + */
3428 +
3429 +
3430 +#pragma once
3431 +
3432 +//#ifndef PAGE_SIZE
3433 +//#if defined(_IA64_)
3434 +//#error This does not work for IA64
3435 +//#else
3436 +//#define PAGE_SIZE 0x1000
3437 +//#endif
3438 +//#endif
3439 +
3440 +// allow nameless unions
3441 +//#pragma warning(disable : 4201)
3442 +
3443 +typedef struct
3444 +{
3445 + union
3446 + {
3447 + struct
3448 + {
3449 + volatile UINT32 In; // Offset in bytes from the ring base
3450 + volatile UINT32 Out; // Offset in bytes from the ring base
3451 + };
3452 + volatile LONGLONG InOut;
3453 + };
3454 +
3455 + //
3456 + // If the receiving endpoint sets this to some non-zero value, the sending
3457 + // endpoint should not send any interrupts.
3458 + //
3459 +
3460 + volatile UINT32 InterruptMask;
3461 +
3462 +} VMRCB, *PVMRCB;
3463 +
3464 +typedef struct
3465 +{
3466 + union
3467 + {
3468 + struct
3469 + {
3470 + VMRCB Control;
3471 + };
3472 +
3473 + UINT8 Reserved[PAGE_SIZE];
3474 + };
3475 +
3476 + //
3477 + // Beginning of the ring data. Note: It must be guaranteed that
3478 + // this data does not share a page with the control structure.
3479 + //
3480 + UINT8 Data[1];
3481 +} VMRING, *PVMRING;
3482 +
3483 +#pragma pack(push, 1)
3484 +
3485 +typedef struct
3486 +{
3487 + UINT16 Type;
3488 + UINT16 DataOffset8;
3489 + UINT16 Length8;
3490 + UINT16 Flags;
3491 + UINT64 TransactionId;
3492 +} VMPACKET_DESCRIPTOR, *PVMPACKET_DESCRIPTOR;
3493 +
3494 +typedef UINT32 PREVIOUS_PACKET_OFFSET, *PPREVIOUS_PACKET_OFFSET;
3495 +
3496 +typedef struct
3497 +{
3498 + PREVIOUS_PACKET_OFFSET PreviousPacketStartOffset;
3499 + VMPACKET_DESCRIPTOR Descriptor;
3500 +} VMPACKET_HEADER, *PVMPACKET_HEADER;
3501 +
3502 +typedef struct
3503 +{
3504 + UINT32 ByteCount;
3505 + UINT32 ByteOffset;
3506 +} VMTRANSFER_PAGE_RANGE, *PVMTRANSFER_PAGE_RANGE;
3507 +
3508 +#ifdef __cplusplus
3509 +
3510 +typedef struct _VMTRANSFER_PAGE_PACKET_HEADER : VMPACKET_DESCRIPTOR {
3511 +
3512 +#else
3513 +
3514 +typedef struct VMTRANSFER_PAGE_PACKET_HEADER {
3515 +
3516 + VMPACKET_DESCRIPTOR d;
3517 +
3518 +#endif
3519 +
3520 + UINT16 TransferPageSetId;
3521 + BOOLEAN SenderOwnsSet;
3522 + UINT8 Reserved;
3523 + UINT32 RangeCount;
3524 + VMTRANSFER_PAGE_RANGE Ranges[1];
3525 +
3526 +} VMTRANSFER_PAGE_PACKET_HEADER, *PVMTRANSFER_PAGE_PACKET_HEADER;
3527 +
3528 +
3529 +#ifdef __cplusplus
3530 +
3531 +typedef struct _VMGPADL_PACKET_HEADER : VMPACKET_DESCRIPTOR {
3532 +
3533 +#else
3534 +
3535 +typedef struct _VMGPADL_PACKET_HEADER {
3536 +
3537 + VMPACKET_DESCRIPTOR d;
3538 +
3539 +#endif
3540 +
3541 +
3542 + UINT32 Gpadl;
3543 + UINT32 Reserved;
3544 +
3545 +} VMGPADL_PACKET_HEADER, *PVMGPADL_PACKET_HEADER;
3546 +
3547 +#ifdef __cplusplus
3548 +
3549 +typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET : VMPACKET_DESCRIPTOR {
3550 +
3551 +#else
3552 +
3553 +typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET {
3554 +
3555 + VMPACKET_DESCRIPTOR d;
3556 +
3557 +#endif
3558 +
3559 + UINT32 Gpadl;
3560 + UINT16 TransferPageSetId;
3561 + UINT16 Reserved;
3562 +
3563 +} VMADD_REMOVE_TRANSFER_PAGE_SET, *PVMADD_REMOVE_TRANSFER_PAGE_SET;
3564 +
3565 +#pragma pack(pop)
3566 +
3567 +//
3568 +// This structure defines a range in guest physical space that can be made
3569 +// to look virtually contiguous.
3570 +//
3571 +
3572 +typedef struct _GPA_RANGE {
3573 +
3574 + UINT32 ByteCount;
3575 + UINT32 ByteOffset;
3576 + UINT64 PfnArray[0];
3577 +
3578 +} GPA_RANGE, *PGPA_RANGE;
3579 +
3580 +
3581 +
3582 +#pragma pack(push, 1)
3583 +
3584 +//
3585 +// This is the format for an Establish Gpadl packet, which contains a handle
3586 +// by which this GPADL will be known and a set of GPA ranges associated with
3587 +// it. This can be converted to a MDL by the guest OS. If there are multiple
3588 +// GPA ranges, then the resulting MDL will be "chained," representing multiple
3589 +// VA ranges.
3590 +//
3591 +
3592 +#ifdef __cplusplus
3593 +
3594 +typedef struct _VMESTABLISH_GPADL : VMPACKET_DESCRIPTOR {
3595 +
3596 +#else
3597 +
3598 +typedef struct _VMESTABLISH_GPADL {
3599 +
3600 + VMPACKET_DESCRIPTOR d;
3601 +
3602 +#endif
3603 +
3604 + UINT32 Gpadl;
3605 + UINT32 RangeCount;
3606 + GPA_RANGE Range[1];
3607 +
3608 +} VMESTABLISH_GPADL, *PVMESTABLISH_GPADL;
3609 +
3610 +
3611 +//
3612 +// This is the format for a Teardown Gpadl packet, which indicates that the
3613 +// GPADL handle in the Establish Gpadl packet will never be referenced again.
3614 +//
3615 +
3616 +#ifdef __cplusplus
3617 +
3618 +typedef struct _VMTEARDOWN_GPADL : VMPACKET_DESCRIPTOR {
3619 +
3620 +#else
3621 +
3622 +typedef struct _VMTEARDOWN_GPADL {
3623 +
3624 + VMPACKET_DESCRIPTOR d;
3625 +
3626 +#endif
3627 +
3628 + UINT32 Gpadl;
3629 + UINT32 Reserved; // for alignment to a 8-byte boundary
3630 +} VMTEARDOWN_GPADL, *PVMTEARDOWN_GPADL;
3631 +
3632 +
3633 +//
3634 +// This is the format for a GPA-Direct packet, which contains a set of GPA
3635 +// ranges, in addition to commands and/or data.
3636 +//
3637 +
3638 +#ifdef __cplusplus
3639 +
3640 +typedef struct _VMDATA_GPA_DIRECT : VMPACKET_DESCRIPTOR {
3641 +
3642 +#else
3643 +
3644 +typedef struct _VMDATA_GPA_DIRECT {
3645 +
3646 + VMPACKET_DESCRIPTOR d;
3647 +
3648 +#endif
3649 +
3650 + UINT32 Reserved;
3651 + UINT32 RangeCount;
3652 + GPA_RANGE Range[1];
3653 +
3654 +} VMDATA_GPA_DIRECT, *PVMDATA_GPA_DIRECT;
3655 +
3656 +
3657 +
3658 +//
3659 +// This is the format for a Additional Data Packet.
3660 +//
3661 +
3662 +#ifdef __cplusplus
3663 +
3664 +typedef struct _VMADDITIONAL_DATA : VMPACKET_DESCRIPTOR {
3665 +
3666 +#else
3667 +
3668 +typedef struct _VMADDITIONAL_DATA {
3669 +
3670 + VMPACKET_DESCRIPTOR d;
3671 +
3672 +#endif
3673 +
3674 + UINT64 TotalBytes;
3675 + UINT32 ByteOffset;
3676 + UINT32 ByteCount;
3677 + UCHAR Data[1];
3678 +
3679 +} VMADDITIONAL_DATA, *PVMADDITIONAL_DATA;
3680 +
3681 +
3682 +#pragma pack(pop)
3683 +
3684 +typedef union {
3685 + VMPACKET_DESCRIPTOR SimpleHeader;
3686 + VMTRANSFER_PAGE_PACKET_HEADER TransferPageHeader;
3687 + VMGPADL_PACKET_HEADER GpadlHeader;
3688 + VMADD_REMOVE_TRANSFER_PAGE_SET AddRemoveTransferPageHeader;
3689 + VMESTABLISH_GPADL EstablishGpadlHeader;
3690 + VMTEARDOWN_GPADL TeardownGpadlHeader;
3691 + VMDATA_GPA_DIRECT DataGpaDirectHeader;
3692 +} VMPACKET_LARGEST_POSSIBLE_HEADER, *PVMPACKET_LARGEST_POSSIBLE_HEADER;
3693 +
3694 +#define VMPACKET_DATA_START_ADDRESS(__packet) \
3695 + (PVOID)(((PUCHAR)__packet) + ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8 * 8)
3696 +
3697 +#define VMPACKET_DATA_LENGTH(__packet) \
3698 + ((((PVMPACKET_DESCRIPTOR)__packet)->Length8 - ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8) * 8)
3699 +
3700 +#define VMPACKET_TRANSFER_MODE(__packet) ((PVMPACKET_DESCRIPTOR)__packet)->Type
3701 +
3702 +typedef enum {
3703 + VmbusServerEndpoint = 0,
3704 + VmbusClientEndpoint,
3705 + VmbusEndpointMaximum
3706 +} ENDPOINT_TYPE, *PENDPOINT_TYPE;
3707 +
3708 +typedef enum {
3709 + VmbusPacketTypeInvalid = 0x0,
3710 + VmbusPacketTypeSynch = 0x1,
3711 + VmbusPacketTypeAddTransferPageSet = 0x2,
3712 + VmbusPacketTypeRemoveTransferPageSet = 0x3,
3713 + VmbusPacketTypeEstablishGpadl = 0x4,
3714 + VmbusPacketTypeTearDownGpadl = 0x5,
3715 + VmbusPacketTypeDataInBand = 0x6,
3716 + VmbusPacketTypeDataUsingTransferPages = 0x7,
3717 + VmbusPacketTypeDataUsingGpadl = 0x8,
3718 + VmbusPacketTypeDataUsingGpaDirect = 0x9,
3719 + VmbusPacketTypeCancelRequest = 0xa,
3720 + VmbusPacketTypeCompletion = 0xb,
3721 + VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
3722 + VmbusPacketTypeAdditionalData = 0xd
3723 +} VMBUS_PACKET_TYPE, *PVMBUS_PACKET_TYPE;
3724 +
3725 +#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
3726 +
3727 +
3728 --- /dev/null
3729 +++ b/drivers/staging/hv/include/vstorage.h
3730 @@ -0,0 +1,309 @@
3731 +/*
3732 + *
3733 + * Copyright (c) 2009, Microsoft Corporation.
3734 + *
3735 + * This program is free software; you can redistribute it and/or modify it
3736 + * under the terms and conditions of the GNU General Public License,
3737 + * version 2, as published by the Free Software Foundation.
3738 + *
3739 + * This program is distributed in the hope it will be useful, but WITHOUT
3740 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3741 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
3742 + * more details.
3743 + *
3744 + * You should have received a copy of the GNU General Public License along with
3745 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
3746 + * Place - Suite 330, Boston, MA 02111-1307 USA.
3747 + *
3748 + * Authors:
3749 + * Haiyang Zhang <haiyangz@microsoft.com>
3750 + * Hank Janssen <hjanssen@microsoft.com>
3751 + *
3752 + */
3753 +
3754 +
3755 +#pragma once
3756 +
3757 +//#include <vmbuspacketformat.h>
3758 +//#include <ntddscsi.h>
3759 +
3760 +#define C_ASSERT(x)
3761 +//
3762 +// public interface to the server
3763 +//
3764 +
3765 +//
3766 +// Storvsp device interface guid
3767 +//
3768 +
3769 +
3770 +//
3771 +// Protocol versions.
3772 +//
3773 +
3774 +//
3775 +// vstorage.w revision number. This is used in the case of a version match,
3776 +// to alert the user that structure sizes may be mismatched even though the
3777 +// protocol versions match.
3778 +//
3779 +
3780 +#define REVISION_STRING(REVISION_) #REVISION_
3781 +#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
3782 +{ \
3783 + char *revisionString = REVISION_STRING($Revision: 6 $) + 11; \
3784 + RESULT_LVALUE_ = 0; \
3785 + while (*revisionString >= '0' && *revisionString <= '9') \
3786 + { \
3787 + RESULT_LVALUE_ *= 10; \
3788 + RESULT_LVALUE_ += *revisionString - '0'; \
3789 + revisionString++; \
3790 + } \
3791 +}
3792 +
3793 +//
3794 +// Major/minor macros. Minor version is in LSB, meaning that earlier flat
3795 +// version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1).
3796 +//
3797 +
3798 +#define VMSTOR_PROTOCOL_MAJOR(VERSION_) (((VERSION_) >> 8) & 0xff)
3799 +#define VMSTOR_PROTOCOL_MINOR(VERSION_) (((VERSION_) ) & 0xff)
3800 +#define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \
3801 + (((MINOR_) & 0xff) ))
3802 +
3803 +//
3804 +// Invalid version.
3805 +//
3806 +
3807 +#define VMSTOR_INVALID_PROTOCOL_VERSION -1
3808 +
3809 +//
3810 +// Version history:
3811 +// V1 Beta 0.1
3812 +// V1 RC < 2008/1/31 1.0
3813 +// V1 RC > 2008/1/31 2.0
3814 +//
3815 +#define VMSTOR_PROTOCOL_VERSION_CURRENT VMSTOR_PROTOCOL_VERSION(2, 0)
3816 +
3817 +
3818 +//
3819 +// This will get replaced with the max transfer length that is possible on
3820 +// the host adapter.
3821 +// The max transfer length will be published when we offer a vmbus channel.
3822 +//
3823 +
3824 +#define MAX_TRANSFER_LENGTH 0x40000
3825 +#define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) + \
3826 + sizeof(VSTOR_PACKET) + \
3827 + (sizeof(UINT64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
3828 +
3829 +
3830 +
3831 +//
3832 +// Packet structure describing virtual storage requests.
3833 +//
3834 +
3835 +typedef enum
3836 +{
3837 + VStorOperationCompleteIo = 1,
3838 + VStorOperationRemoveDevice = 2,
3839 + VStorOperationExecuteSRB = 3,
3840 + VStorOperationResetLun = 4,
3841 + VStorOperationResetAdapter = 5,
3842 + VStorOperationResetBus = 6,
3843 + VStorOperationBeginInitialization = 7,
3844 + VStorOperationEndInitialization = 8,
3845 + VStorOperationQueryProtocolVersion = 9,
3846 + VStorOperationQueryProperties = 10,
3847 + VStorOperationMaximum = 10
3848 +
3849 +} VSTOR_PACKET_OPERATION;
3850 +
3851 +
3852 +//
3853 +// Platform neutral description of a scsi request -
3854 +// this remains the same across the write regardless of 32/64 bit
3855 +// note: it's patterned off the SCSI_PASS_THROUGH structure
3856 +//
3857 +
3858 +
3859 +#pragma pack(push,1)
3860 +
3861 +
3862 +#define CDB16GENERIC_LENGTH 0x10
3863 +
3864 +#ifndef SENSE_BUFFER_SIZE
3865 +#define SENSE_BUFFER_SIZE 0x12
3866 +#endif
3867 +C_ASSERT(SENSE_BUFFER_SIZE == 0x12);
3868 +
3869 +#define MAX_DATA_BUFFER_LENGTH_WITH_PADDING 0x14
3870 +
3871 +
3872 +typedef struct
3873 +{
3874 + USHORT Length;
3875 + UCHAR SrbStatus;
3876 + UCHAR ScsiStatus;
3877 +
3878 + UCHAR PortNumber;
3879 + UCHAR PathId;
3880 + UCHAR TargetId;
3881 + UCHAR Lun;
3882 +
3883 + UCHAR CdbLength;
3884 + UCHAR SenseInfoLength;
3885 + UCHAR DataIn;
3886 + UCHAR Reserved;
3887 +
3888 + ULONG DataTransferLength;
3889 +
3890 + union
3891 + {
3892 + UCHAR Cdb[CDB16GENERIC_LENGTH];
3893 +
3894 + UCHAR SenseData[SENSE_BUFFER_SIZE];
3895 +
3896 + UCHAR ReservedArray[MAX_DATA_BUFFER_LENGTH_WITH_PADDING];
3897 + };
3898 +
3899 +} VMSCSI_REQUEST, *PVMSCSI_REQUEST;
3900 +
3901 +C_ASSERT((sizeof(VMSCSI_REQUEST) % 4) == 0);
3902 +
3903 +
3904 +//
3905 +// This structure is sent during the intialization phase to get the different
3906 +// properties of the channel.
3907 +//
3908 +
3909 +typedef struct
3910 +{
3911 + USHORT ProtocolVersion;
3912 + UCHAR PathId;
3913 + UCHAR TargetId;
3914 +
3915 + //
3916 + // Note: port number is only really known on the client side
3917 + //
3918 + ULONG PortNumber;
3919 +
3920 + ULONG Flags;
3921 +
3922 + ULONG MaxTransferBytes;
3923 +
3924 + //
3925 + // This id is unique for each channel and will correspond with
3926 + // vendor specific data in the inquirydata
3927 + //
3928 +
3929 + ULONGLONG UniqueId;
3930 +
3931 +} VMSTORAGE_CHANNEL_PROPERTIES, *PVMSTORAGE_CHANNEL_PROPERTIES;
3932 +
3933 +C_ASSERT((sizeof(VMSTORAGE_CHANNEL_PROPERTIES) % 4) == 0);
3934 +
3935 +
3936 +//
3937 +// This structure is sent during the storage protocol negotiations.
3938 +//
3939 +
3940 +typedef struct
3941 +{
3942 + //
3943 + // Major (MSW) and minor (LSW) version numbers.
3944 + //
3945 +
3946 + USHORT MajorMinor;
3947 +
3948 +
3949 + //
3950 + // Revision number is auto-incremented whenever this file is changed
3951 + // (See FILL_VMSTOR_REVISION macro above). Mismatch does not definitely
3952 + // indicate incompatibility--but it does indicate mismatched builds.
3953 + //
3954 +
3955 + USHORT Revision;
3956 +
3957 +} VMSTORAGE_PROTOCOL_VERSION, *PVMSTORAGE_PROTOCOL_VERSION;
3958 +
3959 +C_ASSERT((sizeof(VMSTORAGE_PROTOCOL_VERSION) % 4) == 0);
3960 +
3961 +
3962 +//
3963 +// Channel Property Flags
3964 +//
3965 +
3966 +#define STORAGE_CHANNEL_REMOVABLE_FLAG 0x1
3967 +#define STORAGE_CHANNEL_EMULATED_IDE_FLAG 0x2
3968 +
3969 +
3970 +typedef struct _VSTOR_PACKET
3971 +{
3972 + //
3973 + // Requested operation type
3974 + //
3975 +
3976 + VSTOR_PACKET_OPERATION Operation;
3977 +
3978 + //
3979 + // Flags - see below for values
3980 + //
3981 +
3982 + ULONG Flags;
3983 +
3984 + //
3985 + // Status of the request returned from the server side.
3986 + //
3987 +
3988 + ULONG Status;
3989 +
3990 + //
3991 + // Data payload area
3992 + //
3993 +
3994 + union
3995 + {
3996 + //
3997 + // Structure used to forward SCSI commands from the client to the server.
3998 + //
3999 +
4000 + VMSCSI_REQUEST VmSrb;
4001 +
4002 + //
4003 + // Structure used to query channel properties.
4004 + //
4005 +
4006 + VMSTORAGE_CHANNEL_PROPERTIES StorageChannelProperties;
4007 +
4008 + //
4009 + // Used during version negotiations.
4010 + //
4011 +
4012 + VMSTORAGE_PROTOCOL_VERSION Version;
4013 + };
4014 +
4015 +} VSTOR_PACKET, *PVSTOR_PACKET;
4016 +
4017 +C_ASSERT((sizeof(VSTOR_PACKET) % 4) == 0);
4018 +
4019 +//
4020 +// Packet flags
4021 +//
4022 +
4023 +//
4024 +// This flag indicates that the server should send back a completion for this
4025 +// packet.
4026 +//
4027 +
4028 +#define REQUEST_COMPLETION_FLAG 0x1
4029 +
4030 +//
4031 +// This is the set of flags that the vsc can set in any packets it sends
4032 +//
4033 +
4034 +#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)
4035 +
4036 +
4037 +#pragma pack(pop)
4038 +
4039 +