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
6 From: Hank Janssen <hjanssen@microsoft.com>
8 These are the header files for the API to talk to the Hyper-V
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>
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
46 +++ b/drivers/staging/hv/include/ChannelMessages.h
50 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
66 + * Haiyang Zhang <haiyangz@microsoft.com>
67 + * Hank Janssen <hjanssen@microsoft.com>
74 +#include <VmbusPacketFormat.h>
77 +typedef UINT32 NTSTATUS;
82 +// Version 1 messages
85 +typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE
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,
108 + ChannelMessageCount
109 +} VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE;
112 +// CUSTOM_TYPE(ChannelMessageType, ItemEnum(_VMBUS_CHANNEL_MESSAGE_TYPE));
115 +typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER
117 + VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
119 +} VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
121 +// Query VMBus Version parameters
122 +typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION
124 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
126 +} VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
128 +// VMBus Version Supported parameters
129 +typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED
131 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
132 + BOOLEAN VersionSupported;
133 +} VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
135 +// Offer Channel parameters
136 +typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL
138 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
139 + VMBUS_CHANNEL_OFFER Offer;
142 + BOOLEAN MonitorAllocated;
143 +} VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
146 +// Make sure VMBUS_CHANNEL_OFFER_CHANNEL fits into Synic message.
148 +C_ASSERT(sizeof(VMBUS_CHANNEL_OFFER_CHANNEL) <= MAXIMUM_SYNIC_MESSAGE_BYTES);
150 +// Rescind Offer parameters
151 +typedef struct _VMBUS_CHANNEL_RESCIND_OFFER
153 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
155 +} VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
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
163 +// Open Channel parameters
164 +typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL
166 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
169 + // Identifies the specific VMBus channel that is being opened.
174 + // ID making a particular open request at a channel offer unique.
179 + // GPADL for the channel's ring buffer.
181 + GPADL_HANDLE RingBufferGpadlHandle;
184 + // GPADL for the channel's server context save area.
186 + GPADL_HANDLE ServerContextAreaGpadlHandle;
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).
193 + UINT32 DownstreamRingBufferPageOffset;
196 + // User-specific data to be passed along to the server endpoint.
198 + UCHAR UserData[MAX_USER_DEFINED_BYTES];
200 +} VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL;
202 +// Reopen Channel parameters;
203 +typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL;
205 +// Open Channel Result parameters
206 +typedef struct _VMBUS_CHANNEL_OPEN_RESULT
208 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
212 +} VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
214 +// Close channel parameters;
215 +typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL
217 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
219 +} VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
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
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
233 +typedef struct _VMBUS_CHANNEL_GPADL_HEADER
235 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
238 + UINT16 RangeBufLen;
240 + GPA_RANGE Range[0];
241 +} VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
245 +// This is the followup packet that contains more PFNs.
248 +typedef struct _VMBUS_CHANNEL_GPADL_BODY
250 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
251 + UINT32 MessageNumber;
254 +} VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY;
257 +typedef struct _VMBUS_CHANNEL_GPADL_CREATED
259 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
262 + UINT32 CreationStatus;
263 +} VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED;
265 +typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN
267 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
270 +} VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
272 +typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN
274 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
276 +} VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
278 +#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
279 +typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD
281 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
282 + PHYSICAL_ADDRESS ViewRangeBase;
283 + UINT64 ViewRangeLength;
285 +} VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
287 +typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE
289 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
290 + PHYSICAL_ADDRESS ViewRangeBase;
292 +} VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
295 +typedef struct _VMBUS_CHANNEL_RELID_RELEASED
297 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
299 +} VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
301 +typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT
303 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
304 + UINT32 VMBusVersionRequested;
306 + UINT64 InterruptPage;
307 + UINT64 MonitorPage1;
308 + UINT64 MonitorPage2;
309 +} VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT;
311 +typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE
313 + VMBUS_CHANNEL_MESSAGE_HEADER Header;
314 + BOOLEAN VersionSupported;
315 +} VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
317 +typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD;
320 +// Kind of a table to use the preprocessor to get us the right type for a
321 +// specified message ID. Used with ChAllocateSendMessage()
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
346 +// Preprocessor wrapper to ChAllocateSendMessageSize() converting the return
347 +// value to the correct pointer and calculate the needed size.
351 +// Id - the numberic ID (type VMBUS_CHANNEL_MESSAGE_TYPE) of the message to
354 +#define ChAllocateSendMessage(Id, Fn, Context) \
355 + (Id##_TYPE*)ChAllocateSendMessageSized(sizeof(Id##_TYPE), Id, Fn, Context)
361 +++ b/drivers/staging/hv/include/HvHalApi.h
365 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
381 + * Haiyang Zhang <haiyangz@microsoft.com>
382 + * Hank Janssen <hjanssen@microsoft.com>
391 +// Time in the hypervisor is measured in 100 nanosecond units
393 +typedef UINT64 HV_NANO100_TIME, *PHV_NANO100_TIME;
394 +typedef UINT64 HV_NANO100_DURATION, *PHV_NANO100_DURATION;
396 +++ b/drivers/staging/hv/include/HvHcApi.h
400 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
416 + * Haiyang Zhang <haiyangz@microsoft.com>
417 + * Hank Janssen <hjanssen@microsoft.com>
425 +// Declare the various hypercall operations.
427 +typedef enum _HV_CALL_CODE
430 + HvCallPostMessage = 0x005c,
431 + HvCallSignalEvent = 0x005d,
433 +} HV_CALL_CODE, *PHV_CALL_CODE;
435 +// Definition of the HvPostMessage hypercall input structure.
438 +typedef struct _HV_INPUT_POST_MESSAGE
440 + HV_CONNECTION_ID ConnectionId;
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;
449 +// Definition of the HvSignalEvent hypercall input structure.
452 +typedef struct _HV_INPUT_SIGNAL_EVENT
454 + HV_CONNECTION_ID ConnectionId;
457 +} HV_INPUT_SIGNAL_EVENT, *PHV_INPUT_SIGNAL_EVENT;
459 +++ b/drivers/staging/hv/include/HvPtApi.h
463 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
479 + * Haiyang Zhang <haiyangz@microsoft.com>
480 + * Hank Janssen <hjanssen@microsoft.com>
488 +// Versioning definitions used for guests reporting themselves to the
489 +// hypervisor, and visa versa.
490 +// ==================================================================
494 +// Version info reported by guest OS's
496 +typedef enum _HV_GUEST_OS_VENDOR
498 + HvGuestOsVendorMicrosoft = 0x0001
500 +} HV_GUEST_OS_VENDOR, *PHV_GUEST_OS_VENDOR;
502 +typedef enum _HV_GUEST_OS_MICROSOFT_IDS
504 + HvGuestOsMicrosoftUndefined = 0x00,
505 + HvGuestOsMicrosoftMSDOS = 0x01,
506 + HvGuestOsMicrosoftWindows3x = 0x02,
507 + HvGuestOsMicrosoftWindows9x = 0x03,
508 + HvGuestOsMicrosoftWindowsNT = 0x04,
509 + HvGuestOsMicrosoftWindowsCE = 0x05
511 +} HV_GUEST_OS_MICROSOFT_IDS, *PHV_GUEST_OS_MICROSOFT_IDS;
514 +// Declare the MSR used to identify the guest OS.
516 +#define HV_X64_MSR_GUEST_OS_ID 0x40000000
518 +typedef union _HV_X64_MSR_GUEST_OS_ID_CONTENTS
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
530 +} HV_X64_MSR_GUEST_OS_ID_CONTENTS, *PHV_X64_MSR_GUEST_OS_ID_CONTENTS;
533 +// Declare the MSR used to setup pages used to communicate with the hypervisor.
535 +#define HV_X64_MSR_HYPERCALL 0x40000001
537 +typedef union _HV_X64_MSR_HYPERCALL_CONTENTS
543 + UINT64 Reserved : 11;
544 + UINT64 GuestPhysicalAddress : 52;
546 +} HV_X64_MSR_HYPERCALL_CONTENTS, *PHV_X64_MSR_HYPERCALL_CONTENTS;
548 +++ b/drivers/staging/hv/include/HvStatus.h
552 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
568 + * Haiyang Zhang <haiyangz@microsoft.com>
569 + * Hank Janssen <hjanssen@microsoft.com>
576 +// Status codes for hypervisor operations.
578 +typedef UINT16 HV_STATUS, *PHV_STATUS;
581 +// MessageId: HV_STATUS_SUCCESS
585 +// The specified hypercall succeeded
587 +#define HV_STATUS_SUCCESS ((HV_STATUS)0x0000)
590 +// MessageId: HV_STATUS_INVALID_HYPERCALL_CODE
594 +// The hypervisor does not support the operation because the specified hypercall code is not supported.
596 +#define HV_STATUS_INVALID_HYPERCALL_CODE ((HV_STATUS)0x0002)
599 +// MessageId: HV_STATUS_INVALID_HYPERCALL_INPUT
603 +// The hypervisor does not support the operation because the encoding for the hypercall input register is not supported.
605 +#define HV_STATUS_INVALID_HYPERCALL_INPUT ((HV_STATUS)0x0003)
608 +// MessageId: HV_STATUS_INVALID_ALIGNMENT
612 +// The hypervisor could not perform the operation beacuse a parameter has an invalid alignment.
614 +#define HV_STATUS_INVALID_ALIGNMENT ((HV_STATUS)0x0004)
617 +// MessageId: HV_STATUS_INVALID_PARAMETER
621 +// The hypervisor could not perform the operation beacuse an invalid parameter was specified.
623 +#define HV_STATUS_INVALID_PARAMETER ((HV_STATUS)0x0005)
626 +// MessageId: HV_STATUS_ACCESS_DENIED
630 +// Access to the specified object was denied.
632 +#define HV_STATUS_ACCESS_DENIED ((HV_STATUS)0x0006)
635 +// MessageId: HV_STATUS_INVALID_PARTITION_STATE
639 +// The hypervisor could not perform the operation because the partition is entering or in an invalid state.
641 +#define HV_STATUS_INVALID_PARTITION_STATE ((HV_STATUS)0x0007)
644 +// MessageId: HV_STATUS_OPERATION_DENIED
648 +// The operation is not allowed in the current state.
650 +#define HV_STATUS_OPERATION_DENIED ((HV_STATUS)0x0008)
653 +// MessageId: HV_STATUS_UNKNOWN_PROPERTY
657 +// The hypervisor does not recognize the specified partition property.
659 +#define HV_STATUS_UNKNOWN_PROPERTY ((HV_STATUS)0x0009)
662 +// MessageId: HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE
666 +// The specified value of a partition property is out of range or violates an invariant.
668 +#define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE ((HV_STATUS)0x000A)
671 +// MessageId: HV_STATUS_INSUFFICIENT_MEMORY
675 +// There is not enough memory in the hypervisor pool to complete the operation.
677 +#define HV_STATUS_INSUFFICIENT_MEMORY ((HV_STATUS)0x000B)
680 +// MessageId: HV_STATUS_PARTITION_TOO_DEEP
684 +// The maximum partition depth has been exceeded for the partition hierarchy.
686 +#define HV_STATUS_PARTITION_TOO_DEEP ((HV_STATUS)0x000C)
689 +// MessageId: HV_STATUS_INVALID_PARTITION_ID
693 +// A partition with the specified partition Id does not exist.
695 +#define HV_STATUS_INVALID_PARTITION_ID ((HV_STATUS)0x000D)
698 +// MessageId: HV_STATUS_INVALID_VP_INDEX
702 +// The hypervisor could not perform the operation because the specified VP index is invalid.
704 +#define HV_STATUS_INVALID_VP_INDEX ((HV_STATUS)0x000E)
707 +// MessageId: HV_STATUS_NOT_FOUND
711 +// The iteration is complete; no addition items in the iteration could be found.
713 +#define HV_STATUS_NOT_FOUND ((HV_STATUS)0x0010)
716 +// MessageId: HV_STATUS_INVALID_PORT_ID
720 +// The hypervisor could not perform the operation because the specified port identifier is invalid.
722 +#define HV_STATUS_INVALID_PORT_ID ((HV_STATUS)0x0011)
725 +// MessageId: HV_STATUS_INVALID_CONNECTION_ID
729 +// The hypervisor could not perform the operation because the specified connection identifier is invalid.
731 +#define HV_STATUS_INVALID_CONNECTION_ID ((HV_STATUS)0x0012)
734 +// MessageId: HV_STATUS_INSUFFICIENT_BUFFERS
738 +// You did not supply enough message buffers to send a message.
740 +#define HV_STATUS_INSUFFICIENT_BUFFERS ((HV_STATUS)0x0013)
743 +// MessageId: HV_STATUS_NOT_ACKNOWLEDGED
747 +// The previous virtual interrupt has not been acknowledged.
749 +#define HV_STATUS_NOT_ACKNOWLEDGED ((HV_STATUS)0x0014)
752 +// MessageId: HV_STATUS_INVALID_VP_STATE
756 +// A virtual processor is not in the correct state for the performance of the indicated operation.
758 +#define HV_STATUS_INVALID_VP_STATE ((HV_STATUS)0x0015)
761 +// MessageId: HV_STATUS_ACKNOWLEDGED
765 +// The previous virtual interrupt has already been acknowledged.
767 +#define HV_STATUS_ACKNOWLEDGED ((HV_STATUS)0x0016)
770 +// MessageId: HV_STATUS_INVALID_SAVE_RESTORE_STATE
774 +// The indicated partition is not in a valid state for saving or restoring.
776 +#define HV_STATUS_INVALID_SAVE_RESTORE_STATE ((HV_STATUS)0x0017)
779 +// MessageId: HV_STATUS_INVALID_SYNIC_STATE
783 +// The hypervisor could not complete the operation because a required feature of the synthetic interrupt controller (SynIC) was disabled.
785 +#define HV_STATUS_INVALID_SYNIC_STATE ((HV_STATUS)0x0018)
788 +// MessageId: HV_STATUS_OBJECT_IN_USE
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.
794 +#define HV_STATUS_OBJECT_IN_USE ((HV_STATUS)0x0019)
797 +// MessageId: HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO
801 +// The proximity domain information is invalid.
803 +#define HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO ((HV_STATUS)0x001A)
806 +// MessageId: HV_STATUS_NO_DATA
810 +// An attempt to retrieve debugging data failed because none was available.
812 +#define HV_STATUS_NO_DATA ((HV_STATUS)0x001B)
815 +// MessageId: HV_STATUS_INACTIVE
819 +// The physical connection being used for debuggging has not recorded any receive activity since the last operation.
821 +#define HV_STATUS_INACTIVE ((HV_STATUS)0x001C)
824 +// MessageId: HV_STATUS_NO_RESOURCES
828 +// There are not enough resources to complete the operation.
830 +#define HV_STATUS_NO_RESOURCES ((HV_STATUS)0x001D)
833 +// MessageId: HV_STATUS_FEATURE_UNAVAILABLE
837 +// A hypervisor feature is not available to the user.
839 +#define HV_STATUS_FEATURE_UNAVAILABLE ((HV_STATUS)0x001E)
844 +// MessageId: HV_STATUS_UNSUCCESSFUL
848 +// {Operation Failed}
849 +// The requested operation was unsuccessful.
851 +#define HV_STATUS_UNSUCCESSFUL ((HV_STATUS)0x1001)
854 +// MessageId: HV_STATUS_INSUFFICIENT_BUFFER
858 +// The specified buffer was too small to contain all of the requested data.
860 +#define HV_STATUS_INSUFFICIENT_BUFFER ((HV_STATUS)0x1002)
863 +// MessageId: HV_STATUS_GPA_NOT_PRESENT
867 +// The guest physical address is not currently associated with a system physical address.
869 +#define HV_STATUS_GPA_NOT_PRESENT ((HV_STATUS)0x1003)
872 +// MessageId: HV_STATUS_GUEST_PAGE_FAULT
876 +// The operation would have resulted in a page fault in the guest.
878 +#define HV_STATUS_GUEST_PAGE_FAULT ((HV_STATUS)0x1004)
881 +// MessageId: HV_STATUS_RUNDOWN_DISABLED
885 +// The operation cannot proceed as the rundown object was marked disabled.
887 +#define HV_STATUS_RUNDOWN_DISABLED ((HV_STATUS)0x1005)
890 +// MessageId: HV_STATUS_KEY_ALREADY_EXISTS
894 +// The entry cannot be added as another entry with the same key already exists.
896 +#define HV_STATUS_KEY_ALREADY_EXISTS ((HV_STATUS)0x1006)
899 +// MessageId: HV_STATUS_GPA_INTERCEPT
903 +// The operation resulted an intercept on a region of guest physical memory.
905 +#define HV_STATUS_GPA_INTERCEPT ((HV_STATUS)0x1007)
908 +// MessageId: HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT
912 +// The operation would have resulted in a general protection fault in the guest.
914 +#define HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT ((HV_STATUS)0x1008)
917 +// MessageId: HV_STATUS_GUEST_STACK_FAULT
921 +// The operation would have resulted in a stack fault in the guest.
923 +#define HV_STATUS_GUEST_STACK_FAULT ((HV_STATUS)0x1009)
926 +// MessageId: HV_STATUS_GUEST_INVALID_OPCODE_FAULT
930 +// The operation would have resulted in an invalid opcode fault in the guest.
932 +#define HV_STATUS_GUEST_INVALID_OPCODE_FAULT ((HV_STATUS)0x100A)
935 +// MessageId: HV_STATUS_FINALIZE_INCOMPLETE
939 +// The partition is not completely finalized.
941 +#define HV_STATUS_FINALIZE_INCOMPLETE ((HV_STATUS)0x100B)
944 +// MessageId: HV_STATUS_GUEST_MACHINE_CHECK_ABORT
948 +// The operation would have resulted in an machine check abort in the guest.
950 +#define HV_STATUS_GUEST_MACHINE_CHECK_ABORT ((HV_STATUS)0x100C)
953 +// MessageId: HV_STATUS_ILLEGAL_OVERLAY_ACCESS
957 +// An illegal access was attempted to an overlay page.
959 +#define HV_STATUS_ILLEGAL_OVERLAY_ACCESS ((HV_STATUS)0x100D)
962 +// MessageId: HV_STATUS_INSUFFICIENT_SYSTEM_VA
966 +// There is not enough system VA space available to satisfy the request,
968 +#define HV_STATUS_INSUFFICIENT_SYSTEM_VA ((HV_STATUS)0x100E)
971 +// MessageId: HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED
975 +// The passed virtual address was not mapped in the hypervisor address space.
977 +#define HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED ((HV_STATUS)0x100F)
980 +// MessageId: HV_STATUS_NOT_IMPLEMENTED
984 +// The requested operation is not implemented in this version of the hypervisor.
986 +#define HV_STATUS_NOT_IMPLEMENTED ((HV_STATUS)0x1010)
989 +// MessageId: HV_STATUS_VMX_INSTRUCTION_FAILED
993 +// The requested VMX instruction failed to complete succesfully.
995 +#define HV_STATUS_VMX_INSTRUCTION_FAILED ((HV_STATUS)0x1011)
998 +// MessageId: HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS
1002 +// The requested VMX instruction failed to complete succesfully indicating status.
1004 +#define HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS ((HV_STATUS)0x1012)
1007 +// MessageId: HV_STATUS_MSR_ACCESS_FAILED
1011 +// The requested access to the model specific register failed.
1013 +#define HV_STATUS_MSR_ACCESS_FAILED ((HV_STATUS)0x1013)
1016 +// MessageId: HV_STATUS_CR_ACCESS_FAILED
1020 +// The requested access to the control register failed.
1022 +#define HV_STATUS_CR_ACCESS_FAILED ((HV_STATUS)0x1014)
1025 +// MessageId: HV_STATUS_TIMEOUT
1029 +// The specified timeout expired before the operation completed.
1031 +#define HV_STATUS_TIMEOUT ((HV_STATUS)0x1016)
1034 +// MessageId: HV_STATUS_MSR_INTERCEPT
1038 +// The requested access to the model specific register generated an intercept.
1040 +#define HV_STATUS_MSR_INTERCEPT ((HV_STATUS)0x1017)
1043 +// MessageId: HV_STATUS_CPUID_INTERCEPT
1047 +// The CPUID instruction generated an intercept.
1049 +#define HV_STATUS_CPUID_INTERCEPT ((HV_STATUS)0x1018)
1052 +// MessageId: HV_STATUS_REPEAT_INSTRUCTION
1056 +// The current instruction should be repeated and the instruction pointer not advanced.
1058 +#define HV_STATUS_REPEAT_INSTRUCTION ((HV_STATUS)0x1019)
1061 +// MessageId: HV_STATUS_PAGE_PROTECTION_VIOLATION
1065 +// The current instruction should be repeated and the instruction pointer not advanced.
1067 +#define HV_STATUS_PAGE_PROTECTION_VIOLATION ((HV_STATUS)0x101A)
1070 +// MessageId: HV_STATUS_PAGE_TABLE_INVALID
1074 +// The current instruction should be repeated and the instruction pointer not advanced.
1076 +#define HV_STATUS_PAGE_TABLE_INVALID ((HV_STATUS)0x101B)
1079 +// MessageId: HV_STATUS_PAGE_NOT_PRESENT
1083 +// The current instruction should be repeated and the instruction pointer not advanced.
1085 +#define HV_STATUS_PAGE_NOT_PRESENT ((HV_STATUS)0x101C)
1088 +// MessageId: HV_STATUS_IO_INTERCEPT
1092 +// The requested access to the I/O port generated an intercept.
1094 +#define HV_STATUS_IO_INTERCEPT ((HV_STATUS)0x101D)
1097 +// MessageId: HV_STATUS_NOTHING_TO_DO
1101 +// There is nothing to do.
1103 +#define HV_STATUS_NOTHING_TO_DO ((HV_STATUS)0x101E)
1106 +// MessageId: HV_STATUS_THREAD_TERMINATING
1110 +// The requested thread is terminating.
1112 +#define HV_STATUS_THREAD_TERMINATING ((HV_STATUS)0x101F)
1115 +// MessageId: HV_STATUS_SECTION_ALREADY_CONSTRUCTED
1119 +// The specified section was already constructed.
1121 +#define HV_STATUS_SECTION_ALREADY_CONSTRUCTED ((HV_STATUS)0x1020)
1124 +// MessageId: HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED
1128 +// The specified section was not already constructed.
1130 +#define HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED ((HV_STATUS)0x1021)
1133 +// MessageId: HV_STATUS_PAGE_ALREADY_COMMITTED
1137 +// The specified virtual address was already backed by physical memory.
1139 +#define HV_STATUS_PAGE_ALREADY_COMMITTED ((HV_STATUS)0x1022)
1142 +// MessageId: HV_STATUS_PAGE_NOT_ALREADY_COMMITTED
1146 +// The specified virtual address was not already backed by physical memory.
1148 +#define HV_STATUS_PAGE_NOT_ALREADY_COMMITTED ((HV_STATUS)0x1023)
1151 +// MessageId: HV_STATUS_COMMITTED_PAGES_REMAIN
1155 +// Committed pages remain in the section.
1157 +#define HV_STATUS_COMMITTED_PAGES_REMAIN ((HV_STATUS)0x1024)
1160 +// MessageId: HV_STATUS_NO_REMAINING_COMMITTED_PAGES
1164 +// No additional committed pages beyond the specified page exist in the section.
1166 +#define HV_STATUS_NO_REMAINING_COMMITTED_PAGES ((HV_STATUS)0x1025)
1169 +// MessageId: HV_STATUS_INSUFFICIENT_COMPARTMENT_VA
1173 +// The VA space of the compartment is exhausted.
1175 +#define HV_STATUS_INSUFFICIENT_COMPARTMENT_VA ((HV_STATUS)0x1026)
1178 +// MessageId: HV_STATUS_DEREF_SPA_LIST_FULL
1182 +// The SPA dereference list is full, and there are additional entries
1183 +// to be added to it.
1185 +#define HV_STATUS_DEREF_SPA_LIST_FULL ((HV_STATUS)0x1027)
1188 +// MessageId: HV_STATUS_GPA_OUT_OF_RANGE
1192 +// The supplied GPA is out of range.
1194 +#define HV_STATUS_GPA_OUT_OF_RANGE ((HV_STATUS)0x1027)
1197 +// MessageId: HV_STATUS_NONVOLATILE_XMM_STALE
1201 +// The XMM register that was being accessed is stale.
1203 +#define HV_STATUS_NONVOLATILE_XMM_STALE ((HV_STATUS)0x1028)
1206 +// MessageId: HV_STATUS_UNSUPPORTED_PROCESSOR
1210 +// The hypervisor does not support the processors in this system.
1212 +#define HV_STATUS_UNSUPPORTED_PROCESSOR ((HV_STATUS)0x1029)
1215 +// MessageId: HV_STATUS_INSUFFICIENT_CROM_SPACE
1219 +// Insufficient space existed for copying over the CROM contents.
1221 +#define HV_STATUS_INSUFFICIENT_CROM_SPACE ((HV_STATUS)0x2000)
1224 +// MessageId: HV_STATUS_BAD_CROM_FORMAT
1228 +// The contents of the CROM failed validation attempts.
1230 +#define HV_STATUS_BAD_CROM_FORMAT ((HV_STATUS)0x2001)
1233 +// MessageId: HV_STATUS_UNSUPPORTED_CROM_FORMAT
1237 +// The contents of the CROM contain contents the parser doesn't support.
1239 +#define HV_STATUS_UNSUPPORTED_CROM_FORMAT ((HV_STATUS)0x2002)
1242 +// MessageId: HV_STATUS_UNSUPPORTED_CONTROLLER
1246 +// The register format of the OHCI controller specified for debugging is not supported.
1248 +#define HV_STATUS_UNSUPPORTED_CONTROLLER ((HV_STATUS)0x2003)
1251 +// MessageId: HV_STATUS_CROM_TOO_LARGE
1255 +// The CROM contents were to large to copy over.
1257 +#define HV_STATUS_CROM_TOO_LARGE ((HV_STATUS)0x2004)
1260 +// MessageId: HV_STATUS_CONTROLLER_IN_USE
1264 +// The OHCI controller specified for debugging cannot be used as it is already in use.
1266 +#define HV_STATUS_CONTROLLER_IN_USE ((HV_STATUS)0x2005)
1269 +++ b/drivers/staging/hv/include/HvSynicApi.h
1273 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
1289 + * Haiyang Zhang <haiyangz@microsoft.com>
1290 + * Hank Janssen <hjanssen@microsoft.com>
1297 +// Define the virtual APIC registers
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)
1305 +// Define version of the synthetic interrupt controller.
1308 +#define HV_SYNIC_VERSION (1)
1312 +// Define synthetic interrupt controller model specific registers.
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)
1338 +// Define the expected SynIC version.
1340 +#define HV_SYNIC_VERSION_1 (0x1)
1343 +// Define synthetic interrupt controller message constants.
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)
1352 +// Define synthetic interrupt controller flag constants.
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))
1360 +// Define hypervisor message types.
1362 +typedef enum _HV_MESSAGE_TYPE
1364 + HvMessageTypeNone = 0x00000000,
1367 + // Memory access messages.
1369 + HvMessageTypeUnmappedGpa = 0x80000000,
1370 + HvMessageTypeGpaIntercept = 0x80000001,
1373 + // Timer notification messages.
1375 + HvMessageTimerExpired = 0x80000010,
1378 + // Error messages.
1380 + HvMessageTypeInvalidVpRegisterValue = 0x80000020,
1381 + HvMessageTypeUnrecoverableException = 0x80000021,
1382 + HvMessageTypeUnsupportedFeature = 0x80000022,
1385 + // Trace buffer complete messages.
1387 + HvMessageTypeEventLogBufferComplete = 0x80000040,
1390 + // Platform-specific processor intercept messages.
1392 + HvMessageTypeX64IoPortIntercept = 0x80010000,
1393 + HvMessageTypeX64MsrIntercept = 0x80010001,
1394 + HvMessageTypeX64CpuidIntercept = 0x80010002,
1395 + HvMessageTypeX64ExceptionIntercept = 0x80010003,
1396 + HvMessageTypeX64ApicEoi = 0x80010004,
1397 + HvMessageTypeX64LegacyFpError = 0x80010005
1399 +} HV_MESSAGE_TYPE, *PHV_MESSAGE_TYPE;
1402 +// Define the number of synthetic interrupt sources.
1405 +#define HV_SYNIC_SINT_COUNT (16)
1406 +#define HV_SYNIC_STIMER_COUNT (4)
1409 +// Define the synthetic interrupt source index type.
1412 +typedef UINT32 HV_SYNIC_SINT_INDEX, *PHV_SYNIC_SINT_INDEX;
1415 +// Define partition identifier type.
1418 +typedef UINT64 HV_PARTITION_ID, *PHV_PARTITION_ID;
1421 +// Define invalid partition identifier.
1423 +#define HV_PARTITION_ID_INVALID ((HV_PARTITION_ID) 0x0)
1426 +// Define connection identifier type.
1429 +typedef union _HV_CONNECTION_ID
1436 + UINT32 Reserved:8;
1439 +} HV_CONNECTION_ID, *PHV_CONNECTION_ID;
1442 +// Define port identifier type.
1445 +typedef union _HV_PORT_ID
1452 + UINT32 Reserved:8;
1455 +} HV_PORT_ID, *PHV_PORT_ID;
1458 +// Define port type.
1461 +typedef enum _HV_PORT_TYPE
1463 + HvPortTypeMessage = 1,
1464 + HvPortTypeEvent = 2,
1465 + HvPortTypeMonitor = 3
1466 +} HV_PORT_TYPE, *PHV_PORT_TYPE;
1469 +// Define port information structure.
1472 +typedef struct _HV_PORT_INFO
1474 + HV_PORT_TYPE PortType;
1481 + HV_SYNIC_SINT_INDEX TargetSint;
1482 + HV_VP_INDEX TargetVp;
1484 + } MessagePortInfo;
1488 + HV_SYNIC_SINT_INDEX TargetSint;
1489 + HV_VP_INDEX TargetVp;
1490 + UINT16 BaseFlagNumber;
1497 + HV_GPA MonitorAddress;
1499 + } MonitorPortInfo;
1501 +} HV_PORT_INFO, *PHV_PORT_INFO;
1503 +typedef const HV_PORT_INFO *PCHV_PORT_INFO;
1505 +typedef struct _HV_CONNECTION_INFO
1507 + HV_PORT_TYPE PortType;
1515 + } MessageConnectionInfo;
1520 + } EventConnectionInfo;
1524 + HV_GPA MonitorAddress;
1525 + } MonitorConnectionInfo;
1527 +} HV_CONNECTION_INFO, *PHV_CONNECTION_INFO;
1529 +typedef const HV_CONNECTION_INFO *PCHV_CONNECTION_INFO;
1532 +// Define synthetic interrupt controller message flags.
1535 +typedef union _HV_MESSAGE_FLAGS
1540 + UINT8 MessagePending:1;
1543 +} HV_MESSAGE_FLAGS, *PHV_MESSAGE_FLAGS;
1547 +// Define synthetic interrupt controller message header.
1550 +typedef struct _HV_MESSAGE_HEADER
1552 + HV_MESSAGE_TYPE MessageType;
1553 + UINT8 PayloadSize;
1554 + HV_MESSAGE_FLAGS MessageFlags;
1555 + UINT8 Reserved[2];
1558 + HV_PARTITION_ID Sender;
1562 +} HV_MESSAGE_HEADER, *PHV_MESSAGE_HEADER;
1565 +// Define timer message payload structure.
1567 +typedef struct _HV_TIMER_MESSAGE_PAYLOAD
1569 + UINT32 TimerIndex;
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;
1576 +// Define synthetic interrupt controller message format.
1579 +typedef struct _HV_MESSAGE
1581 + HV_MESSAGE_HEADER Header;
1584 + UINT64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
1586 +} HV_MESSAGE, *PHV_MESSAGE;
1589 +// Define the number of message buffers associated with each port.
1592 +#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
1595 +// Define the synthetic interrupt message page layout.
1598 +typedef struct _HV_MESSAGE_PAGE
1600 + volatile HV_MESSAGE SintMessage[HV_SYNIC_SINT_COUNT];
1601 +} HV_MESSAGE_PAGE, *PHV_MESSAGE_PAGE;
1605 +// Define the synthetic interrupt controller event flags format.
1608 +typedef union _HV_SYNIC_EVENT_FLAGS
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;
1616 +// Define the synthetic interrupt flags page layout.
1619 +typedef struct _HV_SYNIC_EVENT_FLAGS_PAGE
1621 + volatile HV_SYNIC_EVENT_FLAGS SintEventFlags[HV_SYNIC_SINT_COUNT];
1622 +} HV_SYNIC_EVENT_FLAGS_PAGE, *PHV_SYNIC_EVENT_FLAGS_PAGE;
1626 +// Define SynIC control register.
1628 +typedef union _HV_SYNIC_SCONTROL
1634 + UINT64 Reserved:63;
1636 +} HV_SYNIC_SCONTROL, *PHV_SYNIC_SCONTROL;
1639 +// Define synthetic interrupt source.
1642 +typedef union _HV_SYNIC_SINT
1648 + UINT64 Reserved1 :8;
1650 + UINT64 AutoEoi :1;
1651 + UINT64 Reserved2 :46;
1653 +} HV_SYNIC_SINT, *PHV_SYNIC_SINT;
1656 +// Define the format of the SIMP register
1659 +typedef union _HV_SYNIC_SIMP
1664 + UINT64 SimpEnabled : 1;
1665 + UINT64 Preserved : 11;
1666 + UINT64 BaseSimpGpa : 52;
1668 +} HV_SYNIC_SIMP, *PHV_SYNIC_SIMP;
1671 +// Define the format of the SIEFP register
1674 +typedef union _HV_SYNIC_SIEFP
1679 + UINT64 SiefpEnabled : 1;
1680 + UINT64 Preserved : 11;
1681 + UINT64 BaseSiefpGpa : 52;
1683 +} HV_SYNIC_SIEFP, *PHV_SYNIC_SIEFP;
1686 +// Definitions for the monitored notification facility
1689 +typedef union _HV_MONITOR_TRIGGER_GROUP
1699 +} HV_MONITOR_TRIGGER_GROUP, *PHV_MONITOR_TRIGGER_GROUP;
1701 +typedef struct _HV_MONITOR_PARAMETER
1703 + HV_CONNECTION_ID ConnectionId;
1704 + UINT16 FlagNumber;
1706 +} HV_MONITOR_PARAMETER, *PHV_MONITOR_PARAMETER;
1708 +typedef union _HV_MONITOR_TRIGGER_STATE
1714 + UINT32 GroupEnable : 4;
1715 + UINT32 RsvdZ : 28;
1718 +} HV_MONITOR_TRIGGER_STATE, *PHV_MONITOR_TRIGGER_STATE;
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] |
1733 +// | 240 | Latency[0][0..3] |
1734 +// | 340 | Rsvz3[0] |
1735 +// | 440 | Parameter[0][0] |
1736 +// | 448 | Parameter[0][1] |
1738 +// | 840 | Rsvd4[0] |
1739 +// ------------------------------------------------------
1741 +typedef struct _HV_MONITOR_PAGE
1743 + HV_MONITOR_TRIGGER_STATE TriggerState;
1746 + HV_MONITOR_TRIGGER_GROUP TriggerGroup[4];
1749 + INT32 NextCheckTime[4][32];
1751 + UINT16 Latency[4][32];
1752 + UINT64 RsvdZ3[32];
1754 + HV_MONITOR_PARAMETER Parameter[4][32];
1756 + UINT8 RsvdZ4[1984];
1758 +} HV_MONITOR_PAGE, *PHV_MONITOR_PAGE;
1760 +typedef volatile HV_MONITOR_PAGE* PVHV_MONITOR_PAGE;
1762 +++ b/drivers/staging/hv/include/HvTypes.h
1766 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
1782 + * Haiyang Zhang <haiyangz@microsoft.com>
1783 + * Hank Janssen <hjanssen@microsoft.com>
1790 +typedef UINT64 HV_GPA, *PHV_GPA;
1792 +#define HV_X64_PAGE_SIZE (4096)
1793 +#define HV_PAGE_SIZE HV_X64_PAGE_SIZE
1796 +++ b/drivers/staging/hv/include/HvVpApi.h
1800 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
1816 + * Haiyang Zhang <haiyangz@microsoft.com>
1817 + * Hank Janssen <hjanssen@microsoft.com>
1824 +// Virtual Processor Indices
1826 +typedef UINT32 HV_VP_INDEX, *PHV_VP_INDEX;
1829 +// The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
1830 +// is set by CPUID(HvCpuIdFunctionVersionAndFeatures).
1831 +// ==========================================================================
1834 +typedef enum _HV_CPUID_FUNCTION
1836 + HvCpuIdFunctionVersionAndFeatures = 0x00000001,
1837 + HvCpuIdFunctionHvVendorAndMaxFunction = 0x40000000,
1838 + HvCpuIdFunctionHvInterface = 0x40000001,
1841 + // The remaining functions depend on the value of HvCpuIdFunctionInterface
1843 + HvCpuIdFunctionMsHvVersion = 0x40000002,
1844 + HvCpuIdFunctionMsHvFeatures = 0x40000003,
1845 + HvCpuIdFunctionMsHvEnlightenmentInformation = 0x40000004,
1846 + HvCpuIdFunctionMsHvImplementationLimits = 0x40000005
1848 +} HV_CPUID_FUNCTION, *PHV_CPUID_FUNCTION;
1850 +++ b/drivers/staging/hv/include/List.h
1854 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
1870 + * Haiyang Zhang <haiyangz@microsoft.com>
1871 + * Hank Janssen <hjanssen@microsoft.com>
1882 + * Doubly-linked list manipulation routines. Implemented as macros
1883 + * but logically these are procedures.
1887 +typedef DLIST_ENTRY LIST_ENTRY;
1888 +typedef DLIST_ENTRY *PLIST_ENTRY;
1890 +//typedef struct LIST_ENTRY {
1891 +// struct LIST_ENTRY * volatile Flink;
1892 +// struct LIST_ENTRY * volatile Blink;
1893 +//} LIST_ENTRY, *PLIST_ENTRY;
1899 + * InitializeListHead(
1900 + * PLIST_ENTRY ListHead
1903 +#define INITIALIZE_LIST_HEAD InitializeListHead
1905 +#define InitializeListHead(ListHead) (\
1906 + (ListHead)->Flink = (ListHead)->Blink = (ListHead))
1912 + * PLIST_ENTRY ListHead
1915 +#define IS_LIST_EMPTY IsListEmpty
1917 +#define IsListEmpty(ListHead) \
1918 + ((ListHead)->Flink == (ListHead))
1924 + * PLIST_ENTRY Entry
1927 +#define NEXT_LIST_ENTRY NextListEntry
1929 +#define NextListEntry(Entry) \
1936 + * PLIST_ENTRY Entry
1939 +#define PREV_LIST_ENTRY PrevListEntry
1941 +#define PrevListEntry(Entry) \
1948 + * PLIST_ENTRY ListHead
1951 +#define TOP_LIST_ENTRY TopListEntry
1953 +#define TopListEntry(ListHead) \
1961 + * PLIST_ENTRY ListHead
1965 +#define REMOVE_HEAD_LIST RemoveHeadList
1967 +#define RemoveHeadList(ListHead) \
1968 + (ListHead)->Flink;\
1969 + {RemoveEntryList((ListHead)->Flink)}
1975 + * PLIST_ENTRY ListHead
1978 +#define REMOVE_TAIL_LIST RemoveTailList
1980 +#define RemoveTailList(ListHead) \
1981 + (ListHead)->Blink;\
1982 + {RemoveEntryList((ListHead)->Blink)}
1987 + * RemoveEntryList(
1988 + * PLIST_ENTRY Entry
1991 +#define REMOVE_ENTRY_LIST RemoveEntryList
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;\
2004 + * PLIST_ENTRY ListHead,
2005 + * PLIST_ENTRY ListEntry
2008 +#define ATTACH_LIST AttachList
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;\
2024 + * PLIST_ENTRY ListHead,
2025 + * PLIST_ENTRY Entry
2029 +#define INSERT_TAIL_LIST InsertTailList
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);\
2044 + * PLIST_ENTRY ListHead,
2045 + * PLIST_ENTRY Entry
2048 +#define INSERT_HEAD_LIST InsertHeadList
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);\
2062 + * IterateListEntries(
2063 + * PLIST_ENTRY anchor,
2064 + * PLIST_ENTRY index,
2065 + * PLIST_ENTRY listp
2069 +#define ITERATE_LIST_ENTRIES IterateListEntries
2071 +#define IterateListEntries(anchor, index, listp) \
2072 + (anchor) = (LIST_ENTRY *)(listp); \
2073 + for((index) = (anchor)->Flink; (index) != (anchor); (index) = (index)->Flink)
2078 + * PSINGLE_LIST_ENTRY
2080 + * PSINGLE_LIST_ENTRY ListHead
2084 +#define POP_ENTRY_LIST PopEntryList
2086 +#define PopEntryList(ListHead) \
2087 + (ListHead)->Next;\
2089 + PSINGLE_LIST_ENTRY FirstEntry;\
2090 + FirstEntry = (ListHead)->Next;\
2091 + if (FirstEntry != NULL) { \
2092 + (ListHead)->Next = FirstEntry->Next;\
2101 + * PSINGLE_LIST_ENTRY ListHead,
2102 + * PSINGLE_LIST_ENTRY Entry
2106 +#define PUSH_ENTRY_LIST PushEntryList
2108 +#define PushEntryList(ListHead,Entry) \
2109 + (Entry)->Next = (ListHead)->Next; \
2110 + (ListHead)->Next = (Entry)
2112 +#ifndef CONTAINING_RECORD
2113 +#define CONTAINING_RECORD(address, type, field) ((type *)( \
2114 + (PCHAR)(address) - \
2115 + (PCHAR)(&((type *)0)->field)))
2116 +#endif /* CONTAINING_RECORD */
2118 +#endif /* _LIST_H_ */
2122 +++ b/drivers/staging/hv/include/nvspprotocol.h
2126 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
2142 + * Haiyang Zhang <haiyangz@microsoft.com>
2143 + * Hank Janssen <hjanssen@microsoft.com>
2150 +#include <VmbusChannelInterface.h>
2152 +#define NVSP_INVALID_PROTOCOL_VERSION ((UINT32)0xFFFFFFFF)
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
2158 +typedef enum _NVSP_MESSAGE_TYPE
2160 + NvspMessageTypeNone = 0,
2165 + NvspMessageTypeInit = 1,
2166 + NvspMessageTypeInitComplete = 2,
2168 + NvspVersionMessageStart = 100,
2171 + // Version 1 Messages
2173 + NvspMessage1TypeSendNdisVersion = NvspVersionMessageStart,
2175 + NvspMessage1TypeSendReceiveBuffer,
2176 + NvspMessage1TypeSendReceiveBufferComplete,
2177 + NvspMessage1TypeRevokeReceiveBuffer,
2179 + NvspMessage1TypeSendSendBuffer,
2180 + NvspMessage1TypeSendSendBufferComplete,
2181 + NvspMessage1TypeRevokeSendBuffer,
2183 + NvspMessage1TypeSendRNDISPacket,
2184 + NvspMessage1TypeSendRNDISPacketComplete,
2187 + // This should be set to the number of messages for the version
2188 + // with the maximum number of messages.
2190 + NvspNumMessagePerVersion = 9,
2192 +} NVSP_MESSAGE_TYPE, *PNVSP_MESSAGE_TYPE;
2194 +typedef enum _NVSP_STATUS
2196 + NvspStatusNone = 0,
2197 + NvspStatusSuccess,
2198 + NvspStatusFailure,
2199 + NvspStatusProtocolVersionRangeTooNew,
2200 + NvspStatusProtocolVersionRangeTooOld,
2201 + NvspStatusInvalidRndisPacket,
2204 +} NVSP_STATUS, *PNVSP_STATUS;
2206 +#pragma pack(push, 1)
2208 +typedef struct _NVSP_MESSAGE_HEADER
2210 + UINT32 MessageType;
2211 +} NVSP_MESSAGE_HEADER, *PNVSP_MESSAGE_HEADER;
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).
2223 +typedef struct _NVSP_MESSAGE_INIT
2225 + UINT32 MinProtocolVersion;
2226 + UINT32 MaxProtocolVersion;
2227 +} NVSP_MESSAGE_INIT, *PNVSP_MESSAGE_INIT;
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).
2234 +typedef struct _NVSP_MESSAGE_INIT_COMPLETE
2236 + UINT32 NegotiatedProtocolVersion;
2237 + UINT32 MaximumMdlChainLength;
2239 +} NVSP_MESSAGE_INIT_COMPLETE, *PNVSP_MESSAGE_INIT_COMPLETE;
2241 +typedef union _NVSP_MESSAGE_INIT_UBER
2243 + NVSP_MESSAGE_INIT Init;
2244 + NVSP_MESSAGE_INIT_COMPLETE InitComplete;
2245 +} NVSP_MESSAGE_INIT_UBER;
2248 +// Version 1 Messages
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.
2256 +typedef struct _NVSP_1_MESSAGE_SEND_NDIS_VERSION
2258 + UINT32 NdisMajorVersion;
2259 + UINT32 NdisMinorVersion;
2260 +} NVSP_1_MESSAGE_SEND_NDIS_VERSION, *PNVSP_1_MESSAGE_SEND_NDIS_VERSION;
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.
2267 +typedef struct _NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER
2269 + GPADL_HANDLE GpadlHandle;
2271 +} NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER, *PNVSP_1_MESSAGE_SEND_RECEIVE_BUFFER;
2273 +typedef struct _NVSP_1_RECEIVE_BUFFER_SECTION
2276 + UINT32 SubAllocationSize;
2277 + UINT32 NumSubAllocations;
2279 +} NVSP_1_RECEIVE_BUFFER_SECTION, *PNVSP_1_RECEIVE_BUFFER_SECTION;
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.
2286 +typedef struct _NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE
2289 + UINT32 NumSections;
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
2297 + // For example, the following break up of the receive
2298 + // buffer has 6 large suballocations and 10 small
2299 + // suballocations.
2301 + // | Large Section | | Small Section |
2302 + // ------------------------------------------------------------
2303 + // | | | | | | | | | | | | | | | | | |
2305 + // LargeOffset SmallOffset
2307 + NVSP_1_RECEIVE_BUFFER_SECTION Sections[1];
2309 +} NVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE, *PNVSP_1_MESSAGE_SEND_RECEIVE_BUFFER_COMPLETE;
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.
2316 +typedef struct _NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER
2319 +} NVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER, *PNVSP_1_MESSAGE_REVOKE_RECEIVE_BUFFER;
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.
2326 +typedef struct _NVSP_1_MESSAGE_SEND_SEND_BUFFER
2328 + GPADL_HANDLE GpadlHandle;
2330 +} NVSP_1_MESSAGE_SEND_SEND_BUFFER, *PNVSP_1_MESSAGE_SEND_SEND_BUFFER;
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.
2337 +typedef struct _NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE
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.
2347 + UINT32 SectionSize;
2348 +} NVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE, *PNVSP_1_MESSAGE_SEND_SEND_BUFFER_COMPLETE;
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.
2355 +typedef struct _NVSP_1_MESSAGE_REVOKE_SEND_BUFFER
2358 +} NVSP_1_MESSAGE_REVOKE_SEND_BUFFER, *PNVSP_1_MESSAGE_REVOKE_SEND_BUFFER;
2361 +// This message is used by both the VSP and the VSC to send
2362 +// a RNDIS message to the opposite channel endpoint.
2364 +typedef struct _NVSP_1_MESSAGE_SEND_RNDIS_PACKET
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.
2372 + UINT32 ChannelType;
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
2382 + UINT32 SendBufferSectionIndex;
2383 + UINT32 SendBufferSectionSize;
2384 +} NVSP_1_MESSAGE_SEND_RNDIS_PACKET, *PNVSP_1_MESSAGE_SEND_RNDIS_PACKET;
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.
2392 +typedef struct _NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE
2395 +} NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE, *PNVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE;
2397 +typedef union _NVSP_MESSAGE_1_UBER
2399 + NVSP_1_MESSAGE_SEND_NDIS_VERSION SendNdisVersion;
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;
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;
2409 + NVSP_1_MESSAGE_SEND_RNDIS_PACKET SendRNDISPacket;
2410 + NVSP_1_MESSAGE_SEND_RNDIS_PACKET_COMPLETE SendRNDISPacketComplete;
2411 +} NVSP_1_MESSAGE_UBER;
2413 +typedef union _NVSP_ALL_MESSAGES
2415 + NVSP_MESSAGE_INIT_UBER InitMessages;
2416 + NVSP_1_MESSAGE_UBER Version1Messages;
2418 +} NVSP_ALL_MESSAGES;
2423 +typedef struct _NVSP_MESSAGE
2425 + NVSP_MESSAGE_HEADER Header;
2426 + NVSP_ALL_MESSAGES Messages;
2427 +} NVSP_MESSAGE, *PNVSP_MESSAGE;
2431 +++ b/drivers/staging/hv/include/rndis.h
2435 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
2451 + * Haiyang Zhang <haiyangz@microsoft.com>
2452 + * Hank Janssen <hjanssen@microsoft.com>
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;
2483 +#ifndef STATUS_SUCCESS
2484 +#define STATUS_SUCCESS (0x00000000L)
2487 +#ifndef STATUS_UNSUCCESSFUL
2488 +#define STATUS_UNSUCCESSFUL (0xC0000001L)
2491 +#ifndef STATUS_PENDING
2492 +#define STATUS_PENDING (0x00000103L)
2495 +#ifndef STATUS_INSUFFICIENT_RESOURCES
2496 +#define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
2499 +#ifndef STATUS_BUFFER_OVERFLOW
2500 +#define STATUS_BUFFER_OVERFLOW (0x80000005L)
2503 +#ifndef STATUS_NOT_SUPPORTED
2504 +#define STATUS_NOT_SUPPORTED (0xC00000BBL)
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)
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)
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)
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)
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)
2582 +#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR ((RNDIS_STATUS)0xC0011000L)
2586 +// Object Identifiers used by NdisRequest Query/Set Information
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
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
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
2639 +#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
2640 +#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
2642 +#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
2643 +#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
2646 +// These are connection-oriented general OIDs.
2647 +// These replace the above OIDs for connection-oriented media.
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
2663 +#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
2664 +#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
2667 +// These are connection-oriented statistics OIDs.
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
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
2684 +// These are objects for Connection-oriented media call-managers.
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
2698 +// 802.3 Objects (Ethernet)
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
2709 +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
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
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
2725 +// Remote NDIS message types
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
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
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
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
2756 +// Reserved message type for private communication between lower-layer
2757 +// host driver and remote device, if necessary.
2759 +#define REMOTE_NDIS_BUS_MSG 0xff000001
2764 +// Defines for DeviceFlags in RNDIS_INITIALIZE_COMPLETE
2766 +#define RNDIS_DF_CONNECTIONLESS 0x00000001
2767 +#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002
2768 +#define RNDIS_DF_RAW_DATA 0x00000004
2771 +// Remote NDIS medium types.
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
2787 +// Remote NDIS medium connection states.
2789 +#define RNdisMediaStateConnected 0x00000000
2790 +#define RNdisMediaStateDisconnected 0x00000001
2793 +// Remote NDIS version numbers
2795 +#define RNDIS_MAJOR_VERSION 0x00000001
2796 +#define RNDIS_MINOR_VERSION 0x00000000
2799 +// NdisInitialize message
2801 +typedef struct _RNDIS_INITIALIZE_REQUEST
2803 + RNDIS_REQUEST_ID RequestId;
2804 + UINT32 MajorVersion;
2805 + UINT32 MinorVersion;
2806 + UINT32 MaxTransferSize;
2807 +} RNDIS_INITIALIZE_REQUEST, *PRNDIS_INITIALIZE_REQUEST;
2811 +// Response to NdisInitialize
2813 +typedef struct _RNDIS_INITIALIZE_COMPLETE
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;
2830 +// Call manager devices only: Information about an address family
2831 +// supported by the device is appended to the response to NdisInitialize.
2833 +typedef struct _RNDIS_CO_ADDRESS_FAMILY
2835 + RNDIS_AF AddressFamily;
2836 + UINT32 MajorVersion;
2837 + UINT32 MinorVersion;
2838 +} RNDIS_CO_ADDRESS_FAMILY, *PRNDIS_CO_ADDRESS_FAMILY;
2842 +// NdisHalt message
2844 +typedef struct _RNDIS_HALT_REQUEST
2846 + RNDIS_REQUEST_ID RequestId;
2847 +} RNDIS_HALT_REQUEST, *PRNDIS_HALT_REQUEST;
2851 +// NdisQueryRequest message
2853 +typedef struct _RNDIS_QUERY_REQUEST
2855 + RNDIS_REQUEST_ID RequestId;
2857 + UINT32 InformationBufferLength;
2858 + UINT32 InformationBufferOffset;
2859 + RNDIS_HANDLE DeviceVcHandle;
2860 +} RNDIS_QUERY_REQUEST, *PRNDIS_QUERY_REQUEST;
2864 +// Response to NdisQueryRequest
2866 +typedef struct _RNDIS_QUERY_COMPLETE
2868 + RNDIS_REQUEST_ID RequestId;
2869 + RNDIS_STATUS Status;
2870 + UINT32 InformationBufferLength;
2871 + UINT32 InformationBufferOffset;
2872 +} RNDIS_QUERY_COMPLETE, *PRNDIS_QUERY_COMPLETE;
2876 +// NdisSetRequest message
2878 +typedef struct _RNDIS_SET_REQUEST
2880 + RNDIS_REQUEST_ID RequestId;
2882 + UINT32 InformationBufferLength;
2883 + UINT32 InformationBufferOffset;
2884 + RNDIS_HANDLE DeviceVcHandle;
2885 +} RNDIS_SET_REQUEST, *PRNDIS_SET_REQUEST;
2889 +// Response to NdisSetRequest
2891 +typedef struct _RNDIS_SET_COMPLETE
2893 + RNDIS_REQUEST_ID RequestId;
2894 + RNDIS_STATUS Status;
2895 +} RNDIS_SET_COMPLETE, *PRNDIS_SET_COMPLETE;
2899 +// NdisReset message
2901 +typedef struct _RNDIS_RESET_REQUEST
2904 +} RNDIS_RESET_REQUEST, *PRNDIS_RESET_REQUEST;
2907 +// Response to NdisReset
2909 +typedef struct _RNDIS_RESET_COMPLETE
2911 + RNDIS_STATUS Status;
2912 + UINT32 AddressingReset;
2913 +} RNDIS_RESET_COMPLETE, *PRNDIS_RESET_COMPLETE;
2917 +// NdisMIndicateStatus message
2919 +typedef struct _RNDIS_INDICATE_STATUS
2921 + RNDIS_STATUS Status;
2922 + UINT32 StatusBufferLength;
2923 + UINT32 StatusBufferOffset;
2924 +} RNDIS_INDICATE_STATUS, *PRNDIS_INDICATE_STATUS;
2928 +// Diagnostic information passed as the status buffer in
2929 +// RNDIS_INDICATE_STATUS messages signifying error conditions.
2931 +typedef struct _RNDIS_DIAGNOSTIC_INFO
2933 + RNDIS_STATUS DiagStatus;
2934 + UINT32 ErrorOffset;
2935 +} RNDIS_DIAGNOSTIC_INFO, *PRNDIS_DIAGNOSTIC_INFO;
2940 +// NdisKeepAlive message
2942 +typedef struct _RNDIS_KEEPALIVE_REQUEST
2944 + RNDIS_REQUEST_ID RequestId;
2945 +} RNDIS_KEEPALIVE_REQUEST, *PRNDIS_KEEPALIVE_REQUEST;
2949 +// Response to NdisKeepAlive
2951 +typedef struct _RNDIS_KEEPALIVE_COMPLETE
2953 + RNDIS_REQUEST_ID RequestId;
2954 + RNDIS_STATUS Status;
2955 +} RNDIS_KEEPALIVE_COMPLETE, *PRNDIS_KEEPALIVE_COMPLETE;
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.
2964 +typedef struct _RNDIS_PACKET
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;
2975 +} RNDIS_PACKET, *PRNDIS_PACKET;
2978 +// Optional Out of Band data associated with a Data message.
2980 +typedef struct _RNDIS_OOBD
2983 + RNDIS_CLASS_ID Type;
2984 + UINT32 ClassInformationOffset;
2985 +} RNDIS_OOBD, *PRNDIS_OOBD;
2988 +// Packet extension field contents associated with a Data message.
2990 +typedef struct _RNDIS_PER_PACKET_INFO
2994 + UINT32 PerPacketInformationOffset;
2995 +} RNDIS_PER_PACKET_INFO, *PRNDIS_PER_PACKET_INFO;
2999 +// Format of Information buffer passed in a SetRequest for the OID
3000 +// OID_GEN_RNDIS_CONFIG_PARAMETER.
3002 +typedef struct _RNDIS_CONFIG_PARAMETER_INFO
3004 + UINT32 ParameterNameOffset;
3005 + UINT32 ParameterNameLength;
3006 + UINT32 ParameterType;
3007 + UINT32 ParameterValueOffset;
3008 + UINT32 ParameterValueLength;
3009 +} RNDIS_CONFIG_PARAMETER_INFO, *PRNDIS_CONFIG_PARAMETER_INFO;
3012 +// Values for ParameterType in RNDIS_CONFIG_PARAMETER_INFO
3014 +#define RNDIS_CONFIG_PARAM_TYPE_INTEGER 0
3015 +#define RNDIS_CONFIG_PARAM_TYPE_STRING 2
3019 +// CONDIS Miniport messages for connection oriented devices
3020 +// that do not implement a call manager.
3024 +// CoNdisMiniportCreateVc message
3026 +typedef struct _RCONDIS_MP_CREATE_VC
3028 + RNDIS_REQUEST_ID RequestId;
3029 + RNDIS_HANDLE NdisVcHandle;
3030 +} RCONDIS_MP_CREATE_VC, *PRCONDIS_MP_CREATE_VC;
3033 +// Response to CoNdisMiniportCreateVc
3035 +typedef struct _RCONDIS_MP_CREATE_VC_COMPLETE
3037 + RNDIS_REQUEST_ID RequestId;
3038 + RNDIS_HANDLE DeviceVcHandle;
3039 + RNDIS_STATUS Status;
3040 +} RCONDIS_MP_CREATE_VC_COMPLETE, *PRCONDIS_MP_CREATE_VC_COMPLETE;
3044 +// CoNdisMiniportDeleteVc message
3046 +typedef struct _RCONDIS_MP_DELETE_VC
3048 + RNDIS_REQUEST_ID RequestId;
3049 + RNDIS_HANDLE DeviceVcHandle;
3050 +} RCONDIS_MP_DELETE_VC, *PRCONDIS_MP_DELETE_VC;
3053 +// Response to CoNdisMiniportDeleteVc
3055 +typedef struct _RCONDIS_MP_DELETE_VC_COMPLETE
3057 + RNDIS_REQUEST_ID RequestId;
3058 + RNDIS_STATUS Status;
3059 +} RCONDIS_MP_DELETE_VC_COMPLETE, *PRCONDIS_MP_DELETE_VC_COMPLETE;
3063 +// CoNdisMiniportQueryRequest message
3065 +typedef struct _RCONDIS_MP_QUERY_REQUEST
3067 + RNDIS_REQUEST_ID RequestId;
3068 + RNDIS_REQUEST_TYPE RequestType;
3070 + RNDIS_HANDLE DeviceVcHandle;
3071 + UINT32 InformationBufferLength;
3072 + UINT32 InformationBufferOffset;
3073 +} RCONDIS_MP_QUERY_REQUEST, *PRCONDIS_MP_QUERY_REQUEST;
3077 +// CoNdisMiniportSetRequest message
3079 +typedef struct _RCONDIS_MP_SET_REQUEST
3081 + RNDIS_REQUEST_ID RequestId;
3082 + RNDIS_REQUEST_TYPE RequestType;
3084 + RNDIS_HANDLE DeviceVcHandle;
3085 + UINT32 InformationBufferLength;
3086 + UINT32 InformationBufferOffset;
3087 +} RCONDIS_MP_SET_REQUEST, *PRCONDIS_MP_SET_REQUEST;
3091 +// CoNdisIndicateStatus message
3093 +typedef struct _RCONDIS_INDICATE_STATUS
3095 + RNDIS_HANDLE NdisVcHandle;
3096 + RNDIS_STATUS Status;
3097 + UINT32 StatusBufferLength;
3098 + UINT32 StatusBufferOffset;
3099 +} RCONDIS_INDICATE_STATUS, *PRCONDIS_INDICATE_STATUS;
3103 +// CONDIS Call/VC parameters
3106 +typedef struct _RCONDIS_SPECIFIC_PARAMETERS
3108 + UINT32 ParameterType;
3109 + UINT32 ParameterLength;
3110 + UINT32 ParameterOffset;
3111 +} RCONDIS_SPECIFIC_PARAMETERS, *PRCONDIS_SPECIFIC_PARAMETERS;
3113 +typedef struct _RCONDIS_MEDIA_PARAMETERS
3118 + RCONDIS_SPECIFIC_PARAMETERS MediaSpecific;
3119 +} RCONDIS_MEDIA_PARAMETERS, *PRCONDIS_MEDIA_PARAMETERS;
3122 +typedef struct _RNDIS_FLOWSPEC
3125 + UINT32 TokenBucketSize;
3126 + UINT32 PeakBandwidth;
3128 + UINT32 DelayVariation;
3129 + UINT32 ServiceType;
3130 + UINT32 MaxSduSize;
3131 + UINT32 MinimumPolicedSize;
3132 +} RNDIS_FLOWSPEC, *PRNDIS_FLOWSPEC;
3134 +typedef struct _RCONDIS_CALL_MANAGER_PARAMETERS
3136 + RNDIS_FLOWSPEC Transmit;
3137 + RNDIS_FLOWSPEC Receive;
3138 + RCONDIS_SPECIFIC_PARAMETERS CallMgrSpecific;
3139 +} RCONDIS_CALL_MANAGER_PARAMETERS, *PRCONDIS_CALL_MANAGER_PARAMETERS;
3142 +// CoNdisMiniportActivateVc message
3144 +typedef struct _RCONDIS_MP_ACTIVATE_VC_REQUEST
3146 + RNDIS_REQUEST_ID RequestId;
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;
3156 +// Response to CoNdisMiniportActivateVc
3158 +typedef struct _RCONDIS_MP_ACTIVATE_VC_COMPLETE
3160 + RNDIS_REQUEST_ID RequestId;
3161 + RNDIS_STATUS Status;
3162 +} RCONDIS_MP_ACTIVATE_VC_COMPLETE, *PRCONDIS_MP_ACTIVATE_VC_COMPLETE;
3166 +// CoNdisMiniportDeactivateVc message
3168 +typedef struct _RCONDIS_MP_DEACTIVATE_VC_REQUEST
3170 + RNDIS_REQUEST_ID RequestId;
3172 + RNDIS_HANDLE DeviceVcHandle;
3173 +} RCONDIS_MP_DEACTIVATE_VC_REQUEST, *PRCONDIS_MP_DEACTIVATE_VC_REQUEST;
3176 +// Response to CoNdisMiniportDeactivateVc
3178 +typedef struct _RCONDIS_MP_DEACTIVATE_VC_COMPLETE
3180 + RNDIS_REQUEST_ID RequestId;
3181 + RNDIS_STATUS Status;
3182 +} RCONDIS_MP_DEACTIVATE_VC_COMPLETE, *PRCONDIS_MP_DEACTIVATE_VC_COMPLETE;
3186 +// union with all of the RNDIS messages
3188 +typedef union _RNDIS_MESSAGE_CONTAINER
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;
3214 +} RNDIS_MESSAGE_CONTAINER, *PRNDIS_MESSAGE_CONTAINER;
3217 +// Remote NDIS message format
3219 +typedef __struct_bcount(MessageLength) struct _RNDIS_MESSAGE
3221 + UINT32 NdisMessageType;
3224 + // Total length of this message, from the beginning
3225 + // of the RNDIS_MESSAGE struct, in bytes.
3227 + UINT32 MessageLength;
3230 + RNDIS_MESSAGE_CONTAINER Message;
3232 +} RNDIS_MESSAGE, *PRNDIS_MESSAGE;
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)))
3244 +// get pointer to info buffer with message pointer
3245 +#define MESSAGE_TO_INFO_BUFFER(Message) \
3246 + (((PUCHAR)(Message)) + Message->InformationBufferOffset)
3248 +// get pointer to status buffer with message pointer
3249 +#define MESSAGE_TO_STATUS_BUFFER(Message) \
3250 + (((PUCHAR)(Message)) + Message->StatusBufferOffset)
3252 +// get pointer to OOBD buffer with message pointer
3253 +#define MESSAGE_TO_OOBD_BUFFER(Message) \
3254 + (((PUCHAR)(Message)) + Message->OOBDataOffset)
3256 +// get pointer to data buffer with message pointer
3257 +#define MESSAGE_TO_DATA_BUFFER(Message) \
3258 + (((PUCHAR)(Message)) + Message->PerPacketInfoOffset)
3260 +// get pointer to contained message from NDIS_MESSAGE pointer
3261 +#define RNDIS_MESSAGE_PTR_TO_MESSAGE_PTR(RndisMessage) \
3262 + ((PVOID) &RndisMessage->Message)
3264 +// get pointer to contained message from NDIS_MESSAGE pointer
3265 +#define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(RndisMessage) \
3266 + ((PVOID) RndisMessage)
3268 +#endif // _RNDIS_H_
3270 +++ b/drivers/staging/hv/include/VmbusChannelInterface.h
3274 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
3290 + * Haiyang Zhang <haiyangz@microsoft.com>
3291 + * Hank Janssen <hjanssen@microsoft.com>
3297 +// allow nameless unions
3298 +//#pragma warning(disable : 4201)
3301 +// A revision number of vmbus that is used for ensuring both ends on a
3302 +// partition are using compatible versions.
3304 +#define VMBUS_REVISION_NUMBER 13
3307 +// Make maximum size of pipe payload of 16K
3309 +#define MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384)
3312 +// Define PipeMode values.
3314 +#define VMBUS_PIPE_TYPE_BYTE 0x00000000
3315 +#define VMBUS_PIPE_TYPE_MESSAGE 0x00000004
3318 +// The size of the user defined data buffer for non-pipe offers.
3320 +#define MAX_USER_DEFINED_BYTES 120
3323 +// The size of the user defined data buffer for pipe offers.
3325 +#define MAX_PIPE_USER_DEFINED_BYTES 116
3329 +// At the center of the Channel Management library is
3330 +// the Channel Offer. This struct contains the
3331 +// fundamental information about an offer.
3333 +#pragma pack(push,1)
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
3349 + // Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes.
3353 + UCHAR UserDefined[MAX_USER_DEFINED_BYTES];
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.
3364 + UCHAR UserDefined[MAX_PIPE_USER_DEFINED_BYTES];
3368 +} VMBUS_CHANNEL_OFFER, *PVMBUS_CHANNEL_OFFER;
3373 +// Verify the MAX_PIPE_USER_DEFINED_BYTES value.
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)));
3381 +typedef UINT32 GPADL_HANDLE;
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
3396 +// TEMPTEMP -- move this next define to devioctl.h some day
3399 +#ifndef FILE_DEVICE_VMBUS
3400 +#define FILE_DEVICE_VMBUS 0x0000003E
3404 +++ b/drivers/staging/hv/include/VmbusPacketFormat.h
3408 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
3424 + * Haiyang Zhang <haiyangz@microsoft.com>
3425 + * Hank Janssen <hjanssen@microsoft.com>
3432 +//#ifndef PAGE_SIZE
3433 +//#if defined(_IA64_)
3434 +//#error This does not work for IA64
3436 +//#define PAGE_SIZE 0x1000
3440 +// allow nameless unions
3441 +//#pragma warning(disable : 4201)
3449 + volatile UINT32 In; // Offset in bytes from the ring base
3450 + volatile UINT32 Out; // Offset in bytes from the ring base
3452 + volatile LONGLONG InOut;
3456 + // If the receiving endpoint sets this to some non-zero value, the sending
3457 + // endpoint should not send any interrupts.
3460 + volatile UINT32 InterruptMask;
3473 + UINT8 Reserved[PAGE_SIZE];
3477 + // Beginning of the ring data. Note: It must be guaranteed that
3478 + // this data does not share a page with the control structure.
3481 +} VMRING, *PVMRING;
3483 +#pragma pack(push, 1)
3488 + UINT16 DataOffset8;
3491 + UINT64 TransactionId;
3492 +} VMPACKET_DESCRIPTOR, *PVMPACKET_DESCRIPTOR;
3494 +typedef UINT32 PREVIOUS_PACKET_OFFSET, *PPREVIOUS_PACKET_OFFSET;
3498 + PREVIOUS_PACKET_OFFSET PreviousPacketStartOffset;
3499 + VMPACKET_DESCRIPTOR Descriptor;
3500 +} VMPACKET_HEADER, *PVMPACKET_HEADER;
3505 + UINT32 ByteOffset;
3506 +} VMTRANSFER_PAGE_RANGE, *PVMTRANSFER_PAGE_RANGE;
3510 +typedef struct _VMTRANSFER_PAGE_PACKET_HEADER : VMPACKET_DESCRIPTOR {
3514 +typedef struct VMTRANSFER_PAGE_PACKET_HEADER {
3516 + VMPACKET_DESCRIPTOR d;
3520 + UINT16 TransferPageSetId;
3521 + BOOLEAN SenderOwnsSet;
3523 + UINT32 RangeCount;
3524 + VMTRANSFER_PAGE_RANGE Ranges[1];
3526 +} VMTRANSFER_PAGE_PACKET_HEADER, *PVMTRANSFER_PAGE_PACKET_HEADER;
3531 +typedef struct _VMGPADL_PACKET_HEADER : VMPACKET_DESCRIPTOR {
3535 +typedef struct _VMGPADL_PACKET_HEADER {
3537 + VMPACKET_DESCRIPTOR d;
3545 +} VMGPADL_PACKET_HEADER, *PVMGPADL_PACKET_HEADER;
3549 +typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET : VMPACKET_DESCRIPTOR {
3553 +typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET {
3555 + VMPACKET_DESCRIPTOR d;
3560 + UINT16 TransferPageSetId;
3563 +} VMADD_REMOVE_TRANSFER_PAGE_SET, *PVMADD_REMOVE_TRANSFER_PAGE_SET;
3568 +// This structure defines a range in guest physical space that can be made
3569 +// to look virtually contiguous.
3572 +typedef struct _GPA_RANGE {
3575 + UINT32 ByteOffset;
3576 + UINT64 PfnArray[0];
3578 +} GPA_RANGE, *PGPA_RANGE;
3582 +#pragma pack(push, 1)
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
3594 +typedef struct _VMESTABLISH_GPADL : VMPACKET_DESCRIPTOR {
3598 +typedef struct _VMESTABLISH_GPADL {
3600 + VMPACKET_DESCRIPTOR d;
3605 + UINT32 RangeCount;
3606 + GPA_RANGE Range[1];
3608 +} VMESTABLISH_GPADL, *PVMESTABLISH_GPADL;
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.
3618 +typedef struct _VMTEARDOWN_GPADL : VMPACKET_DESCRIPTOR {
3622 +typedef struct _VMTEARDOWN_GPADL {
3624 + VMPACKET_DESCRIPTOR d;
3629 + UINT32 Reserved; // for alignment to a 8-byte boundary
3630 +} VMTEARDOWN_GPADL, *PVMTEARDOWN_GPADL;
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.
3640 +typedef struct _VMDATA_GPA_DIRECT : VMPACKET_DESCRIPTOR {
3644 +typedef struct _VMDATA_GPA_DIRECT {
3646 + VMPACKET_DESCRIPTOR d;
3651 + UINT32 RangeCount;
3652 + GPA_RANGE Range[1];
3654 +} VMDATA_GPA_DIRECT, *PVMDATA_GPA_DIRECT;
3659 +// This is the format for a Additional Data Packet.
3664 +typedef struct _VMADDITIONAL_DATA : VMPACKET_DESCRIPTOR {
3668 +typedef struct _VMADDITIONAL_DATA {
3670 + VMPACKET_DESCRIPTOR d;
3674 + UINT64 TotalBytes;
3675 + UINT32 ByteOffset;
3679 +} VMADDITIONAL_DATA, *PVMADDITIONAL_DATA;
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;
3694 +#define VMPACKET_DATA_START_ADDRESS(__packet) \
3695 + (PVOID)(((PUCHAR)__packet) + ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8 * 8)
3697 +#define VMPACKET_DATA_LENGTH(__packet) \
3698 + ((((PVMPACKET_DESCRIPTOR)__packet)->Length8 - ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8) * 8)
3700 +#define VMPACKET_TRANSFER_MODE(__packet) ((PVMPACKET_DESCRIPTOR)__packet)->Type
3703 + VmbusServerEndpoint = 0,
3704 + VmbusClientEndpoint,
3705 + VmbusEndpointMaximum
3706 +} ENDPOINT_TYPE, *PENDPOINT_TYPE;
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;
3725 +#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
3729 +++ b/drivers/staging/hv/include/vstorage.h
3733 + * Copyright (c) 2009, Microsoft Corporation.
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.
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
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.
3749 + * Haiyang Zhang <haiyangz@microsoft.com>
3750 + * Hank Janssen <hjanssen@microsoft.com>
3757 +//#include <vmbuspacketformat.h>
3758 +//#include <ntddscsi.h>
3760 +#define C_ASSERT(x)
3762 +// public interface to the server
3766 +// Storvsp device interface guid
3771 +// Protocol versions.
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.
3780 +#define REVISION_STRING(REVISION_) #REVISION_
3781 +#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
3783 + char *revisionString = REVISION_STRING($Revision: 6 $) + 11; \
3784 + RESULT_LVALUE_ = 0; \
3785 + while (*revisionString >= '0' && *revisionString <= '9') \
3787 + RESULT_LVALUE_ *= 10; \
3788 + RESULT_LVALUE_ += *revisionString - '0'; \
3789 + revisionString++; \
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).
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) ))
3804 +// Invalid version.
3807 +#define VMSTOR_INVALID_PROTOCOL_VERSION -1
3810 +// Version history:
3812 +// V1 RC < 2008/1/31 1.0
3813 +// V1 RC > 2008/1/31 2.0
3815 +#define VMSTOR_PROTOCOL_VERSION_CURRENT VMSTOR_PROTOCOL_VERSION(2, 0)
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.
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)))
3832 +// Packet structure describing virtual storage requests.
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
3849 +} VSTOR_PACKET_OPERATION;
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
3859 +#pragma pack(push,1)
3862 +#define CDB16GENERIC_LENGTH 0x10
3864 +#ifndef SENSE_BUFFER_SIZE
3865 +#define SENSE_BUFFER_SIZE 0x12
3867 +C_ASSERT(SENSE_BUFFER_SIZE == 0x12);
3869 +#define MAX_DATA_BUFFER_LENGTH_WITH_PADDING 0x14
3884 + UCHAR SenseInfoLength;
3888 + ULONG DataTransferLength;
3892 + UCHAR Cdb[CDB16GENERIC_LENGTH];
3894 + UCHAR SenseData[SENSE_BUFFER_SIZE];
3896 + UCHAR ReservedArray[MAX_DATA_BUFFER_LENGTH_WITH_PADDING];
3899 +} VMSCSI_REQUEST, *PVMSCSI_REQUEST;
3901 +C_ASSERT((sizeof(VMSCSI_REQUEST) % 4) == 0);
3905 +// This structure is sent during the intialization phase to get the different
3906 +// properties of the channel.
3911 + USHORT ProtocolVersion;
3916 + // Note: port number is only really known on the client side
3922 + ULONG MaxTransferBytes;
3925 + // This id is unique for each channel and will correspond with
3926 + // vendor specific data in the inquirydata
3929 + ULONGLONG UniqueId;
3931 +} VMSTORAGE_CHANNEL_PROPERTIES, *PVMSTORAGE_CHANNEL_PROPERTIES;
3933 +C_ASSERT((sizeof(VMSTORAGE_CHANNEL_PROPERTIES) % 4) == 0);
3937 +// This structure is sent during the storage protocol negotiations.
3943 + // Major (MSW) and minor (LSW) version numbers.
3946 + USHORT MajorMinor;
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.
3957 +} VMSTORAGE_PROTOCOL_VERSION, *PVMSTORAGE_PROTOCOL_VERSION;
3959 +C_ASSERT((sizeof(VMSTORAGE_PROTOCOL_VERSION) % 4) == 0);
3963 +// Channel Property Flags
3966 +#define STORAGE_CHANNEL_REMOVABLE_FLAG 0x1
3967 +#define STORAGE_CHANNEL_EMULATED_IDE_FLAG 0x2
3970 +typedef struct _VSTOR_PACKET
3973 + // Requested operation type
3976 + VSTOR_PACKET_OPERATION Operation;
3979 + // Flags - see below for values
3985 + // Status of the request returned from the server side.
3991 + // Data payload area
3997 + // Structure used to forward SCSI commands from the client to the server.
4000 + VMSCSI_REQUEST VmSrb;
4003 + // Structure used to query channel properties.
4006 + VMSTORAGE_CHANNEL_PROPERTIES StorageChannelProperties;
4009 + // Used during version negotiations.
4012 + VMSTORAGE_PROTOCOL_VERSION Version;
4015 +} VSTOR_PACKET, *PVSTOR_PACKET;
4017 +C_ASSERT((sizeof(VSTOR_PACKET) % 4) == 0);
4024 +// This flag indicates that the server should send back a completion for this
4028 +#define REQUEST_COMPLETION_FLAG 0x1
4031 +// This is the set of flags that the vsc can set in any packets it sends
4034 +#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)