From: Hank Janssen <hjanssen@microsoft.com>
These are the header files for the API to talk to the Hyper-V
core.
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/staging/hv/include/ChannelMessages.h | 312 ++++++++
drivers/staging/hv/include/HvHalApi.h | 32 +
drivers/staging/hv/include/HvHcApi.h | 60 ++
drivers/staging/hv/include/HvPtApi.h | 86 ++
drivers/staging/hv/include/HvStatus.h | 718 +++++++++++++++++
drivers/staging/hv/include/HvSynicApi.h | 490 ++++++++++++
drivers/staging/hv/include/HvTypes.h | 31 +
drivers/staging/hv/include/HvVpApi.h | 51 ++
drivers/staging/hv/include/List.h | 269 +++++++
drivers/staging/hv/include/VmbusChannelInterface.h | 131 +++
drivers/staging/hv/include/VmbusPacketFormat.h | 322 ++++++++
drivers/staging/hv/include/nvspprotocol.h | 306 +++++++
drivers/staging/hv/include/rndis.h | 836 ++++++++++++++++++++
drivers/staging/hv/include/vstorage.h | 309 ++++++++
14 files changed, 3953 insertions(+), 0 deletions(-)
create mode 100644 drivers/staging/hv/include/ChannelMessages.h
create mode 100644 drivers/staging/hv/include/HvHalApi.h
create mode 100644 drivers/staging/hv/include/HvHcApi.h
create mode 100644 drivers/staging/hv/include/HvPtApi.h
create mode 100644 drivers/staging/hv/include/HvStatus.h
create mode 100644 drivers/staging/hv/include/HvSynicApi.h
create mode 100644 drivers/staging/hv/include/HvTypes.h
create mode 100644 drivers/staging/hv/include/HvVpApi.h
create mode 100644 drivers/staging/hv/include/List.h
create mode 100644 drivers/staging/hv/include/VmbusChannelInterface.h
create mode 100644 drivers/staging/hv/include/VmbusPacketFormat.h
create mode 100644 drivers/staging/hv/include/nvspprotocol.h
create mode 100644 drivers/staging/hv/include/rndis.h
create mode 100644 drivers/staging/hv/include/vstorage.h
diff --git a/drivers/staging/hv/include/ChannelMessages.h b/drivers/staging/hv/include/ChannelMessages.h
new file mode 100644
index 0000000..bd2159b
--- /dev/null
+++ b/drivers/staging/hv/include/ChannelMessages.h
@@ -0,0 +1,312 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+
+#include <VmbusPacketFormat.h>
+
+#define C_ASSERT(x)
+typedef UINT32 NTSTATUS;
+
+#pragma pack(push,1)
+
+//
+// Version 1 messages
+//
+
+typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE
+{
+ ChannelMessageInvalid = 0,
+ ChannelMessageOfferChannel = 1,
+ ChannelMessageRescindChannelOffer = 2,
+ ChannelMessageRequestOffers = 3,
+ ChannelMessageAllOffersDelivered = 4,
+ ChannelMessageOpenChannel = 5,
+ ChannelMessageOpenChannelResult = 6,
+ ChannelMessageCloseChannel = 7,
+ ChannelMessageGpadlHeader = 8,
+ ChannelMessageGpadlBody = 9,
+ ChannelMessageGpadlCreated = 10,
+ ChannelMessageGpadlTeardown = 11,
+ ChannelMessageGpadlTorndown = 12,
+ ChannelMessageRelIdReleased = 13,
+ ChannelMessageInitiateContact = 14,
+ ChannelMessageVersionResponse = 15,
+ ChannelMessageUnload = 16,
+#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
+ ChannelMessageViewRangeAdd = 17,
+ ChannelMessageViewRangeRemove = 18,
+#endif
+ ChannelMessageCount
+} VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE;
+
+// begin_wpp config
+// CUSTOM_TYPE(ChannelMessageType, ItemEnum(_VMBUS_CHANNEL_MESSAGE_TYPE));
+// end_wpp
+
+typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER
+{
+ VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
+ UINT32 Padding;
+} VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
+
+// Query VMBus Version parameters
+typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 Version;
+} VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
+
+// VMBus Version Supported parameters
+typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ BOOLEAN VersionSupported;
+} VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
+
+// Offer Channel parameters
+typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ VMBUS_CHANNEL_OFFER Offer;
+ UINT32 ChildRelId;
+ UINT8 MonitorId;
+ BOOLEAN MonitorAllocated;
+} VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
+
+//
+// Make sure VMBUS_CHANNEL_OFFER_CHANNEL fits into Synic message.
+//
+C_ASSERT(sizeof(VMBUS_CHANNEL_OFFER_CHANNEL) <= MAXIMUM_SYNIC_MESSAGE_BYTES);
+
+// Rescind Offer parameters
+typedef struct _VMBUS_CHANNEL_RESCIND_OFFER
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+} VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
+
+// Request Offer -- no parameters, SynIC message contains the partition ID
+// Set Snoop -- no parameters, SynIC message contains the partition ID
+// Clear Snoop -- no parameters, SynIC message contains the partition ID
+// All Offers Delivered -- no parameters, SynIC message contains the partition ID
+// Flush Client -- no parameters, SynIC message contains the partition ID
+
+// Open Channel parameters
+typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+
+ //
+ // Identifies the specific VMBus channel that is being opened.
+ //
+ UINT32 ChildRelId;
+
+ //
+ // ID making a particular open request at a channel offer unique.
+ //
+ UINT32 OpenId;
+
+ //
+ // GPADL for the channel's ring buffer.
+ //
+ GPADL_HANDLE RingBufferGpadlHandle;
+
+ //
+ // GPADL for the channel's server context save area.
+ //
+ GPADL_HANDLE ServerContextAreaGpadlHandle;
+
+ //
+ // The upstream ring buffer begins at offset zero in the memory described
+ // by RingBufferGpadlHandle. The downstream ring buffer follows it at this
+ // offset (in pages).
+ //
+ UINT32 DownstreamRingBufferPageOffset;
+
+ //
+ // User-specific data to be passed along to the server endpoint.
+ //
+ UCHAR UserData[MAX_USER_DEFINED_BYTES];
+
+} VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL;
+
+// Reopen Channel parameters;
+typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL;
+
+// Open Channel Result parameters
+typedef struct _VMBUS_CHANNEL_OPEN_RESULT
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+ UINT32 OpenId;
+ NTSTATUS Status;
+} VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
+
+// Close channel parameters;
+typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+} VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
+
+// Channel Message GPADL
+#define GPADL_TYPE_RING_BUFFER 1
+#define GPADL_TYPE_SERVER_SAVE_AREA 2
+#define GPADL_TYPE_TRANSACTION 8
+
+//
+// The number of PFNs in a GPADL message is defined by the number of pages
+// that would be spanned by ByteCount and ByteOffset. If the implied number
+// of PFNs won't fit in this packet, there will be a follow-up packet that
+// contains more.
+//
+
+typedef struct _VMBUS_CHANNEL_GPADL_HEADER
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+ UINT32 Gpadl;
+ UINT16 RangeBufLen;
+ UINT16 RangeCount;
+ GPA_RANGE Range[0];
+} VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
+
+
+//
+// This is the followup packet that contains more PFNs.
+//
+
+typedef struct _VMBUS_CHANNEL_GPADL_BODY
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 MessageNumber;
+ UINT32 Gpadl;
+ UINT64 Pfn[0];
+} VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY;
+
+
+typedef struct _VMBUS_CHANNEL_GPADL_CREATED
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+ UINT32 Gpadl;
+ UINT32 CreationStatus;
+} VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED;
+
+typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+ UINT32 Gpadl;
+} VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
+
+typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 Gpadl;
+} VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
+
+#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
+typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ PHYSICAL_ADDRESS ViewRangeBase;
+ UINT64 ViewRangeLength;
+ UINT32 ChildRelId;
+} VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
+
+typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ PHYSICAL_ADDRESS ViewRangeBase;
+ UINT32 ChildRelId;
+} VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
+#endif
+
+typedef struct _VMBUS_CHANNEL_RELID_RELEASED
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 ChildRelId;
+} VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
+
+typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ UINT32 VMBusVersionRequested;
+ UINT32 Padding2;
+ UINT64 InterruptPage;
+ UINT64 MonitorPage1;
+ UINT64 MonitorPage2;
+} VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT;
+
+typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE
+{
+ VMBUS_CHANNEL_MESSAGE_HEADER Header;
+ BOOLEAN VersionSupported;
+} VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
+
+typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD;
+
+//
+// Kind of a table to use the preprocessor to get us the right type for a
+// specified message ID. Used with ChAllocateSendMessage()
+//
+#define ChannelMessageQueryVmbusVersion_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
+#define ChannelMessageVmbusVersionSupported_TYPE VMBUS_CHANNEL_VERSION_SUPPORTED
+#define ChannelMessageOfferChannel_TYPE VMBUS_CHANNEL_OFFER_CHANNEL
+#define ChannelMessageRescindChannelOffer_TYPE VMBUS_CHANNEL_RESCIND_OFFER
+#define ChannelMessageRequestOffers_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
+#define ChannelMessageAllOffersDelivered_TYPE VMBUS_CHANNEL_MESSAGE_HEADER
+#define ChannelMessageOpenChannel_TYPE VMBUS_CHANNEL_OPEN_CHANNEL
+#define ChannelMessageOpenChannelResult_TYPE VMBUS_CHANNEL_OPEN_RESULT
+#define ChannelMessageCloseChannel_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
+#define ChannelMessageAllGpadlsUnmapped_TYPE VMBUS_CHANNEL_CLOSE_CHANNEL
+#define ChannelMessageGpadlHeader_TYPE VMBUS_CHANNEL_GPADL_HEADER
+#define ChannelMessageGpadlBody_TYPE VMBUS_CHANNEL_GPADL_BODY
+#define ChannelMessageGpadlCreated_TYPE VMBUS_CHANNEL_GPADL_CREATED
+#define ChannelMessageGpadlTeardown_TYPE VMBUS_CHANNEL_GPADL_TEARDOWN
+#define ChannelMessageGpadlTorndown_TYPE VMBUS_CHANNEL_GPADL_TORNDOWN
+#define ChannelMessageViewRangeAdd_TYPE VMBUS_CHANNEL_VIEW_RANGE_ADD
+#define ChannelMessageViewRangeRemove_TYPE VMBUS_CHANNEL_VIEW_RANGE_REMOVE
+#define ChannelMessageRelIdReleased_TYPE VMBUS_CHANNEL_RELID_RELEASED
+#define ChannelMessageInitiateContact_TYPE VMBUS_CHANNEL_INITIATE_CONTACT
+#define ChannelMessageVersionResponse_TYPE VMBUS_CHANNEL_VERSION_RESPONSE
+#define ChannelMessageUnload_TYPE VMBUS_CHANNEL_UNLOAD
+
+//
+// Preprocessor wrapper to ChAllocateSendMessageSize() converting the return
+// value to the correct pointer and calculate the needed size.
+//
+// Argument:
+//
+// Id - the numberic ID (type VMBUS_CHANNEL_MESSAGE_TYPE) of the message to
+// send.
+//
+#define ChAllocateSendMessage(Id, Fn, Context) \
+ (Id##_TYPE*)ChAllocateSendMessageSized(sizeof(Id##_TYPE), Id, Fn, Context)
+
+
+#pragma pack(pop)
+
diff --git a/drivers/staging/hv/include/HvHalApi.h b/drivers/staging/hv/include/HvHalApi.h
new file mode 100644
index 0000000..89ddb74
--- /dev/null
+++ b/drivers/staging/hv/include/HvHalApi.h
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+
+
+//
+// Time in the hypervisor is measured in 100 nanosecond units
+//
+typedef UINT64 HV_NANO100_TIME, *PHV_NANO100_TIME;
+typedef UINT64 HV_NANO100_DURATION, *PHV_NANO100_DURATION;
diff --git a/drivers/staging/hv/include/HvHcApi.h b/drivers/staging/hv/include/HvHcApi.h
new file mode 100644
index 0000000..774bf35
--- /dev/null
+++ b/drivers/staging/hv/include/HvHcApi.h
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+
+//
+// Declare the various hypercall operations.
+//
+typedef enum _HV_CALL_CODE
+{
+
+ HvCallPostMessage = 0x005c,
+ HvCallSignalEvent = 0x005d,
+
+} HV_CALL_CODE, *PHV_CALL_CODE;
+//
+// Definition of the HvPostMessage hypercall input structure.
+//
+
+typedef struct _HV_INPUT_POST_MESSAGE
+{
+ HV_CONNECTION_ID ConnectionId;
+ UINT32 Reserved;
+ HV_MESSAGE_TYPE MessageType;
+ UINT32 PayloadSize;
+ UINT64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
+} HV_INPUT_POST_MESSAGE, *PHV_INPUT_POST_MESSAGE;
+
+
+//
+// Definition of the HvSignalEvent hypercall input structure.
+//
+
+typedef struct _HV_INPUT_SIGNAL_EVENT
+{
+ HV_CONNECTION_ID ConnectionId;
+ UINT16 FlagNumber;
+ UINT16 RsvdZ;
+} HV_INPUT_SIGNAL_EVENT, *PHV_INPUT_SIGNAL_EVENT;
diff --git a/drivers/staging/hv/include/HvPtApi.h b/drivers/staging/hv/include/HvPtApi.h
new file mode 100644
index 0000000..7b59234
--- /dev/null
+++ b/drivers/staging/hv/include/HvPtApi.h
@@ -0,0 +1,86 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+
+//
+// Versioning definitions used for guests reporting themselves to the
+// hypervisor, and visa versa.
+// ==================================================================
+//
+
+//
+// Version info reported by guest OS's
+//
+typedef enum _HV_GUEST_OS_VENDOR
+{
+ HvGuestOsVendorMicrosoft = 0x0001
+
+} HV_GUEST_OS_VENDOR, *PHV_GUEST_OS_VENDOR;
+
+typedef enum _HV_GUEST_OS_MICROSOFT_IDS
+{
+ HvGuestOsMicrosoftUndefined = 0x00,
+ HvGuestOsMicrosoftMSDOS = 0x01,
+ HvGuestOsMicrosoftWindows3x = 0x02,
+ HvGuestOsMicrosoftWindows9x = 0x03,
+ HvGuestOsMicrosoftWindowsNT = 0x04,
+ HvGuestOsMicrosoftWindowsCE = 0x05
+
+} HV_GUEST_OS_MICROSOFT_IDS, *PHV_GUEST_OS_MICROSOFT_IDS;
+
+//
+// Declare the MSR used to identify the guest OS.
+//
+#define HV_X64_MSR_GUEST_OS_ID 0x40000000
+
+typedef union _HV_X64_MSR_GUEST_OS_ID_CONTENTS
+{
+ UINT64 AsUINT64;
+ struct
+ {
+ UINT64 BuildNumber : 16;
+ UINT64 ServiceVersion : 8; // Service Pack, etc.
+ UINT64 MinorVersion : 8;
+ UINT64 MajorVersion : 8;
+ UINT64 OsId : 8; // HV_GUEST_OS_MICROSOFT_IDS (If Vendor=MS)
+ UINT64 VendorId : 16; // HV_GUEST_OS_VENDOR
+ };
+} HV_X64_MSR_GUEST_OS_ID_CONTENTS, *PHV_X64_MSR_GUEST_OS_ID_CONTENTS;
+
+//
+// Declare the MSR used to setup pages used to communicate with the hypervisor.
+//
+#define HV_X64_MSR_HYPERCALL 0x40000001
+
+typedef union _HV_X64_MSR_HYPERCALL_CONTENTS
+{
+ UINT64 AsUINT64;
+ struct
+ {
+ UINT64 Enable : 1;
+ UINT64 Reserved : 11;
+ UINT64 GuestPhysicalAddress : 52;
+ };
+} HV_X64_MSR_HYPERCALL_CONTENTS, *PHV_X64_MSR_HYPERCALL_CONTENTS;
diff --git a/drivers/staging/hv/include/HvStatus.h b/drivers/staging/hv/include/HvStatus.h
new file mode 100644
index 0000000..4a2692f
--- /dev/null
+++ b/drivers/staging/hv/include/HvStatus.h
@@ -0,0 +1,718 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+// begin_hvgdk
+//
+// Status codes for hypervisor operations.
+//
+typedef UINT16 HV_STATUS, *PHV_STATUS;
+
+//
+// MessageId: HV_STATUS_SUCCESS
+//
+// MessageText:
+//
+// The specified hypercall succeeded
+//
+#define HV_STATUS_SUCCESS ((HV_STATUS)0x0000)
+
+//
+// MessageId: HV_STATUS_INVALID_HYPERCALL_CODE
+//
+// MessageText:
+//
+// The hypervisor does not support the operation because the specified hypercall code is not supported.
+//
+#define HV_STATUS_INVALID_HYPERCALL_CODE ((HV_STATUS)0x0002)
+
+//
+// MessageId: HV_STATUS_INVALID_HYPERCALL_INPUT
+//
+// MessageText:
+//
+// The hypervisor does not support the operation because the encoding for the hypercall input register is not supported.
+//
+#define HV_STATUS_INVALID_HYPERCALL_INPUT ((HV_STATUS)0x0003)
+
+//
+// MessageId: HV_STATUS_INVALID_ALIGNMENT
+//
+// MessageText:
+//
+// The hypervisor could not perform the operation beacuse a parameter has an invalid alignment.
+//
+#define HV_STATUS_INVALID_ALIGNMENT ((HV_STATUS)0x0004)
+
+//
+// MessageId: HV_STATUS_INVALID_PARAMETER
+//
+// MessageText:
+//
+// The hypervisor could not perform the operation beacuse an invalid parameter was specified.
+//
+#define HV_STATUS_INVALID_PARAMETER ((HV_STATUS)0x0005)
+
+//
+// MessageId: HV_STATUS_ACCESS_DENIED
+//
+// MessageText:
+//
+// Access to the specified object was denied.
+//
+#define HV_STATUS_ACCESS_DENIED ((HV_STATUS)0x0006)
+
+//
+// MessageId: HV_STATUS_INVALID_PARTITION_STATE
+//
+// MessageText:
+//
+// The hypervisor could not perform the operation because the partition is entering or in an invalid state.
+//
+#define HV_STATUS_INVALID_PARTITION_STATE ((HV_STATUS)0x0007)
+
+//
+// MessageId: HV_STATUS_OPERATION_DENIED
+//
+// MessageText:
+//
+// The operation is not allowed in the current state.
+//
+#define HV_STATUS_OPERATION_DENIED ((HV_STATUS)0x0008)
+
+//
+// MessageId: HV_STATUS_UNKNOWN_PROPERTY
+//
+// MessageText:
+//
+// The hypervisor does not recognize the specified partition property.
+//
+#define HV_STATUS_UNKNOWN_PROPERTY ((HV_STATUS)0x0009)
+
+//
+// MessageId: HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE
+//
+// MessageText:
+//
+// The specified value of a partition property is out of range or violates an invariant.
+//
+#define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE ((HV_STATUS)0x000A)
+
+//
+// MessageId: HV_STATUS_INSUFFICIENT_MEMORY
+//
+// MessageText:
+//
+// There is not enough memory in the hypervisor pool to complete the operation.
+//
+#define HV_STATUS_INSUFFICIENT_MEMORY ((HV_STATUS)0x000B)
+
+//
+// MessageId: HV_STATUS_PARTITION_TOO_DEEP
+//
+// MessageText:
+//
+// The maximum partition depth has been exceeded for the partition hierarchy.
+//
+#define HV_STATUS_PARTITION_TOO_DEEP ((HV_STATUS)0x000C)
+
+//
+// MessageId: HV_STATUS_INVALID_PARTITION_ID
+//
+// MessageText:
+//
+// A partition with the specified partition Id does not exist.
+//
+#define HV_STATUS_INVALID_PARTITION_ID ((HV_STATUS)0x000D)
+
+//
+// MessageId: HV_STATUS_INVALID_VP_INDEX
+//
+// MessageText:
+//
+// The hypervisor could not perform the operation because the specified VP index is invalid.
+//
+#define HV_STATUS_INVALID_VP_INDEX ((HV_STATUS)0x000E)
+
+//
+// MessageId: HV_STATUS_NOT_FOUND
+//
+// MessageText:
+//
+// The iteration is complete; no addition items in the iteration could be found.
+//
+#define HV_STATUS_NOT_FOUND ((HV_STATUS)0x0010)
+
+//
+// MessageId: HV_STATUS_INVALID_PORT_ID
+//
+// MessageText:
+//
+// The hypervisor could not perform the operation because the specified port identifier is invalid.
+//
+#define HV_STATUS_INVALID_PORT_ID ((HV_STATUS)0x0011)
+
+//
+// MessageId: HV_STATUS_INVALID_CONNECTION_ID
+//
+// MessageText:
+//
+// The hypervisor could not perform the operation because the specified connection identifier is invalid.
+//
+#define HV_STATUS_INVALID_CONNECTION_ID ((HV_STATUS)0x0012)
+
+//
+// MessageId: HV_STATUS_INSUFFICIENT_BUFFERS
+//
+// MessageText:
+//
+// You did not supply enough message buffers to send a message.
+//
+#define HV_STATUS_INSUFFICIENT_BUFFERS ((HV_STATUS)0x0013)
+
+//
+// MessageId: HV_STATUS_NOT_ACKNOWLEDGED
+//
+// MessageText:
+//
+// The previous virtual interrupt has not been acknowledged.
+//
+#define HV_STATUS_NOT_ACKNOWLEDGED ((HV_STATUS)0x0014)
+
+//
+// MessageId: HV_STATUS_INVALID_VP_STATE
+//
+// MessageText:
+//
+// A virtual processor is not in the correct state for the performance of the indicated operation.
+//
+#define HV_STATUS_INVALID_VP_STATE ((HV_STATUS)0x0015)
+
+//
+// MessageId: HV_STATUS_ACKNOWLEDGED
+//
+// MessageText:
+//
+// The previous virtual interrupt has already been acknowledged.
+//
+#define HV_STATUS_ACKNOWLEDGED ((HV_STATUS)0x0016)
+
+//
+// MessageId: HV_STATUS_INVALID_SAVE_RESTORE_STATE
+//
+// MessageText:
+//
+// The indicated partition is not in a valid state for saving or restoring.
+//
+#define HV_STATUS_INVALID_SAVE_RESTORE_STATE ((HV_STATUS)0x0017)
+
+//
+// MessageId: HV_STATUS_INVALID_SYNIC_STATE
+//
+// MessageText:
+//
+// The hypervisor could not complete the operation because a required feature of the synthetic interrupt controller (SynIC) was disabled.
+//
+#define HV_STATUS_INVALID_SYNIC_STATE ((HV_STATUS)0x0018)
+
+//
+// MessageId: HV_STATUS_OBJECT_IN_USE
+//
+// MessageText:
+//
+// 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.
+//
+#define HV_STATUS_OBJECT_IN_USE ((HV_STATUS)0x0019)
+
+//
+// MessageId: HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO
+//
+// MessageText:
+//
+// The proximity domain information is invalid.
+//
+#define HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO ((HV_STATUS)0x001A)
+
+//
+// MessageId: HV_STATUS_NO_DATA
+//
+// MessageText:
+//
+// An attempt to retrieve debugging data failed because none was available.
+//
+#define HV_STATUS_NO_DATA ((HV_STATUS)0x001B)
+
+//
+// MessageId: HV_STATUS_INACTIVE
+//
+// MessageText:
+//
+// The physical connection being used for debuggging has not recorded any receive activity since the last operation.
+//
+#define HV_STATUS_INACTIVE ((HV_STATUS)0x001C)
+
+//
+// MessageId: HV_STATUS_NO_RESOURCES
+//
+// MessageText:
+//
+// There are not enough resources to complete the operation.
+//
+#define HV_STATUS_NO_RESOURCES ((HV_STATUS)0x001D)
+
+//
+// MessageId: HV_STATUS_FEATURE_UNAVAILABLE
+//
+// MessageText:
+//
+// A hypervisor feature is not available to the user.
+//
+#define HV_STATUS_FEATURE_UNAVAILABLE ((HV_STATUS)0x001E)
+
+// end_hvgdk
+
+//
+// MessageId: HV_STATUS_UNSUCCESSFUL
+//
+// MessageText:
+//
+// {Operation Failed}
+// The requested operation was unsuccessful.
+//
+#define HV_STATUS_UNSUCCESSFUL ((HV_STATUS)0x1001)
+
+//
+// MessageId: HV_STATUS_INSUFFICIENT_BUFFER
+//
+// MessageText:
+//
+// The specified buffer was too small to contain all of the requested data.
+//
+#define HV_STATUS_INSUFFICIENT_BUFFER ((HV_STATUS)0x1002)
+
+//
+// MessageId: HV_STATUS_GPA_NOT_PRESENT
+//
+// MessageText:
+//
+// The guest physical address is not currently associated with a system physical address.
+//
+#define HV_STATUS_GPA_NOT_PRESENT ((HV_STATUS)0x1003)
+
+//
+// MessageId: HV_STATUS_GUEST_PAGE_FAULT
+//
+// MessageText:
+//
+// The operation would have resulted in a page fault in the guest.
+//
+#define HV_STATUS_GUEST_PAGE_FAULT ((HV_STATUS)0x1004)
+
+//
+// MessageId: HV_STATUS_RUNDOWN_DISABLED
+//
+// MessageText:
+//
+// The operation cannot proceed as the rundown object was marked disabled.
+//
+#define HV_STATUS_RUNDOWN_DISABLED ((HV_STATUS)0x1005)
+
+//
+// MessageId: HV_STATUS_KEY_ALREADY_EXISTS
+//
+// MessageText:
+//
+// The entry cannot be added as another entry with the same key already exists.
+//
+#define HV_STATUS_KEY_ALREADY_EXISTS ((HV_STATUS)0x1006)
+
+//
+// MessageId: HV_STATUS_GPA_INTERCEPT
+//
+// MessageText:
+//
+// The operation resulted an intercept on a region of guest physical memory.
+//
+#define HV_STATUS_GPA_INTERCEPT ((HV_STATUS)0x1007)
+
+//
+// MessageId: HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT
+//
+// MessageText:
+//
+// The operation would have resulted in a general protection fault in the guest.
+//
+#define HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT ((HV_STATUS)0x1008)
+
+//
+// MessageId: HV_STATUS_GUEST_STACK_FAULT
+//
+// MessageText:
+//
+// The operation would have resulted in a stack fault in the guest.
+//
+#define HV_STATUS_GUEST_STACK_FAULT ((HV_STATUS)0x1009)
+
+//
+// MessageId: HV_STATUS_GUEST_INVALID_OPCODE_FAULT
+//
+// MessageText:
+//
+// The operation would have resulted in an invalid opcode fault in the guest.
+//
+#define HV_STATUS_GUEST_INVALID_OPCODE_FAULT ((HV_STATUS)0x100A)
+
+//
+// MessageId: HV_STATUS_FINALIZE_INCOMPLETE
+//
+// MessageText:
+//
+// The partition is not completely finalized.
+//
+#define HV_STATUS_FINALIZE_INCOMPLETE ((HV_STATUS)0x100B)
+
+//
+// MessageId: HV_STATUS_GUEST_MACHINE_CHECK_ABORT
+//
+// MessageText:
+//
+// The operation would have resulted in an machine check abort in the guest.
+//
+#define HV_STATUS_GUEST_MACHINE_CHECK_ABORT ((HV_STATUS)0x100C)
+
+//
+// MessageId: HV_STATUS_ILLEGAL_OVERLAY_ACCESS
+//
+// MessageText:
+//
+// An illegal access was attempted to an overlay page.
+//
+#define HV_STATUS_ILLEGAL_OVERLAY_ACCESS ((HV_STATUS)0x100D)
+
+//
+// MessageId: HV_STATUS_INSUFFICIENT_SYSTEM_VA
+//
+// MessageText:
+//
+// There is not enough system VA space available to satisfy the request,
+//
+#define HV_STATUS_INSUFFICIENT_SYSTEM_VA ((HV_STATUS)0x100E)
+
+//
+// MessageId: HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED
+//
+// MessageText:
+//
+// The passed virtual address was not mapped in the hypervisor address space.
+//
+#define HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED ((HV_STATUS)0x100F)
+
+//
+// MessageId: HV_STATUS_NOT_IMPLEMENTED
+//
+// MessageText:
+//
+// The requested operation is not implemented in this version of the hypervisor.
+//
+#define HV_STATUS_NOT_IMPLEMENTED ((HV_STATUS)0x1010)
+
+//
+// MessageId: HV_STATUS_VMX_INSTRUCTION_FAILED
+//
+// MessageText:
+//
+// The requested VMX instruction failed to complete succesfully.
+//
+#define HV_STATUS_VMX_INSTRUCTION_FAILED ((HV_STATUS)0x1011)
+
+//
+// MessageId: HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS
+//
+// MessageText:
+//
+// The requested VMX instruction failed to complete succesfully indicating status.
+//
+#define HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS ((HV_STATUS)0x1012)
+
+//
+// MessageId: HV_STATUS_MSR_ACCESS_FAILED
+//
+// MessageText:
+//
+// The requested access to the model specific register failed.
+//
+#define HV_STATUS_MSR_ACCESS_FAILED ((HV_STATUS)0x1013)
+
+//
+// MessageId: HV_STATUS_CR_ACCESS_FAILED
+//
+// MessageText:
+//
+// The requested access to the control register failed.
+//
+#define HV_STATUS_CR_ACCESS_FAILED ((HV_STATUS)0x1014)
+
+//
+// MessageId: HV_STATUS_TIMEOUT
+//
+// MessageText:
+//
+// The specified timeout expired before the operation completed.
+//
+#define HV_STATUS_TIMEOUT ((HV_STATUS)0x1016)
+
+//
+// MessageId: HV_STATUS_MSR_INTERCEPT
+//
+// MessageText:
+//
+// The requested access to the model specific register generated an intercept.
+//
+#define HV_STATUS_MSR_INTERCEPT ((HV_STATUS)0x1017)
+
+//
+// MessageId: HV_STATUS_CPUID_INTERCEPT
+//
+// MessageText:
+//
+// The CPUID instruction generated an intercept.
+//
+#define HV_STATUS_CPUID_INTERCEPT ((HV_STATUS)0x1018)
+
+//
+// MessageId: HV_STATUS_REPEAT_INSTRUCTION
+//
+// MessageText:
+//
+// The current instruction should be repeated and the instruction pointer not advanced.
+//
+#define HV_STATUS_REPEAT_INSTRUCTION ((HV_STATUS)0x1019)
+
+//
+// MessageId: HV_STATUS_PAGE_PROTECTION_VIOLATION
+//
+// MessageText:
+//
+// The current instruction should be repeated and the instruction pointer not advanced.
+//
+#define HV_STATUS_PAGE_PROTECTION_VIOLATION ((HV_STATUS)0x101A)
+
+//
+// MessageId: HV_STATUS_PAGE_TABLE_INVALID
+//
+// MessageText:
+//
+// The current instruction should be repeated and the instruction pointer not advanced.
+//
+#define HV_STATUS_PAGE_TABLE_INVALID ((HV_STATUS)0x101B)
+
+//
+// MessageId: HV_STATUS_PAGE_NOT_PRESENT
+//
+// MessageText:
+//
+// The current instruction should be repeated and the instruction pointer not advanced.
+//
+#define HV_STATUS_PAGE_NOT_PRESENT ((HV_STATUS)0x101C)
+
+//
+// MessageId: HV_STATUS_IO_INTERCEPT
+//
+// MessageText:
+//
+// The requested access to the I/O port generated an intercept.
+//
+#define HV_STATUS_IO_INTERCEPT ((HV_STATUS)0x101D)
+
+//
+// MessageId: HV_STATUS_NOTHING_TO_DO
+//
+// MessageText:
+//
+// There is nothing to do.
+//
+#define HV_STATUS_NOTHING_TO_DO ((HV_STATUS)0x101E)
+
+//
+// MessageId: HV_STATUS_THREAD_TERMINATING
+//
+// MessageText:
+//
+// The requested thread is terminating.
+//
+#define HV_STATUS_THREAD_TERMINATING ((HV_STATUS)0x101F)
+
+//
+// MessageId: HV_STATUS_SECTION_ALREADY_CONSTRUCTED
+//
+// MessageText:
+//
+// The specified section was already constructed.
+//
+#define HV_STATUS_SECTION_ALREADY_CONSTRUCTED ((HV_STATUS)0x1020)
+
+//
+// MessageId: HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED
+//
+// MessageText:
+//
+// The specified section was not already constructed.
+//
+#define HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED ((HV_STATUS)0x1021)
+
+//
+// MessageId: HV_STATUS_PAGE_ALREADY_COMMITTED
+//
+// MessageText:
+//
+// The specified virtual address was already backed by physical memory.
+//
+#define HV_STATUS_PAGE_ALREADY_COMMITTED ((HV_STATUS)0x1022)
+
+//
+// MessageId: HV_STATUS_PAGE_NOT_ALREADY_COMMITTED
+//
+// MessageText:
+//
+// The specified virtual address was not already backed by physical memory.
+//
+#define HV_STATUS_PAGE_NOT_ALREADY_COMMITTED ((HV_STATUS)0x1023)
+
+//
+// MessageId: HV_STATUS_COMMITTED_PAGES_REMAIN
+//
+// MessageText:
+//
+// Committed pages remain in the section.
+//
+#define HV_STATUS_COMMITTED_PAGES_REMAIN ((HV_STATUS)0x1024)
+
+//
+// MessageId: HV_STATUS_NO_REMAINING_COMMITTED_PAGES
+//
+// MessageText:
+//
+// No additional committed pages beyond the specified page exist in the section.
+//
+#define HV_STATUS_NO_REMAINING_COMMITTED_PAGES ((HV_STATUS)0x1025)
+
+//
+// MessageId: HV_STATUS_INSUFFICIENT_COMPARTMENT_VA
+//
+// MessageText:
+//
+// The VA space of the compartment is exhausted.
+//
+#define HV_STATUS_INSUFFICIENT_COMPARTMENT_VA ((HV_STATUS)0x1026)
+
+//
+// MessageId: HV_STATUS_DEREF_SPA_LIST_FULL
+//
+// MessageText:
+//
+// The SPA dereference list is full, and there are additional entries
+// to be added to it.
+//
+#define HV_STATUS_DEREF_SPA_LIST_FULL ((HV_STATUS)0x1027)
+
+//
+// MessageId: HV_STATUS_GPA_OUT_OF_RANGE
+//
+// MessageText:
+//
+// The supplied GPA is out of range.
+//
+#define HV_STATUS_GPA_OUT_OF_RANGE ((HV_STATUS)0x1027)
+
+//
+// MessageId: HV_STATUS_NONVOLATILE_XMM_STALE
+//
+// MessageText:
+//
+// The XMM register that was being accessed is stale.
+//
+#define HV_STATUS_NONVOLATILE_XMM_STALE ((HV_STATUS)0x1028)
+
+//
+// MessageId: HV_STATUS_UNSUPPORTED_PROCESSOR
+//
+// MessageText:
+//
+// The hypervisor does not support the processors in this system.
+//
+#define HV_STATUS_UNSUPPORTED_PROCESSOR ((HV_STATUS)0x1029)
+
+//
+// MessageId: HV_STATUS_INSUFFICIENT_CROM_SPACE
+//
+// MessageText:
+//
+// Insufficient space existed for copying over the CROM contents.
+//
+#define HV_STATUS_INSUFFICIENT_CROM_SPACE ((HV_STATUS)0x2000)
+
+//
+// MessageId: HV_STATUS_BAD_CROM_FORMAT
+//
+// MessageText:
+//
+// The contents of the CROM failed validation attempts.
+//
+#define HV_STATUS_BAD_CROM_FORMAT ((HV_STATUS)0x2001)
+
+//
+// MessageId: HV_STATUS_UNSUPPORTED_CROM_FORMAT
+//
+// MessageText:
+//
+// The contents of the CROM contain contents the parser doesn't support.
+//
+#define HV_STATUS_UNSUPPORTED_CROM_FORMAT ((HV_STATUS)0x2002)
+
+//
+// MessageId: HV_STATUS_UNSUPPORTED_CONTROLLER
+//
+// MessageText:
+//
+// The register format of the OHCI controller specified for debugging is not supported.
+//
+#define HV_STATUS_UNSUPPORTED_CONTROLLER ((HV_STATUS)0x2003)
+
+//
+// MessageId: HV_STATUS_CROM_TOO_LARGE
+//
+// MessageText:
+//
+// The CROM contents were to large to copy over.
+//
+#define HV_STATUS_CROM_TOO_LARGE ((HV_STATUS)0x2004)
+
+//
+// MessageId: HV_STATUS_CONTROLLER_IN_USE
+//
+// MessageText:
+//
+// The OHCI controller specified for debugging cannot be used as it is already in use.
+//
+#define HV_STATUS_CONTROLLER_IN_USE ((HV_STATUS)0x2005)
+
diff --git a/drivers/staging/hv/include/HvSynicApi.h b/drivers/staging/hv/include/HvSynicApi.h
new file mode 100644
index 0000000..dd4fa0e
--- /dev/null
+++ b/drivers/staging/hv/include/HvSynicApi.h
@@ -0,0 +1,490 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+#pragma once
+
+//
+// Define the virtual APIC registers
+//
+#define HV_X64_MSR_EOI (0x40000070)
+#define HV_X64_MSR_ICR (0x40000071)
+#define HV_X64_MSR_TPR (0x40000072)
+#define HV_X64_MSR_APIC_ASSIST_PAGE (0x40000073)
+
+//
+// Define version of the synthetic interrupt controller.
+//
+
+#define HV_SYNIC_VERSION (1)
+
+
+//
+// Define synthetic interrupt controller model specific registers.
+//
+
+#define HV_X64_MSR_SCONTROL (0x40000080)
+#define HV_X64_MSR_SVERSION (0x40000081)
+#define HV_X64_MSR_SIEFP (0x40000082)
+#define HV_X64_MSR_SIMP (0x40000083)
+#define HV_X64_MSR_EOM (0x40000084)
+#define HV_X64_MSR_SINT0 (0x40000090)
+#define HV_X64_MSR_SINT1 (0x40000091)
+#define HV_X64_MSR_SINT2 (0x40000092)
+#define HV_X64_MSR_SINT3 (0x40000093)
+#define HV_X64_MSR_SINT4 (0x40000094)
+#define HV_X64_MSR_SINT5 (0x40000095)
+#define HV_X64_MSR_SINT6 (0x40000096)
+#define HV_X64_MSR_SINT7 (0x40000097)
+#define HV_X64_MSR_SINT8 (0x40000098)
+#define HV_X64_MSR_SINT9 (0x40000099)
+#define HV_X64_MSR_SINT10 (0x4000009A)
+#define HV_X64_MSR_SINT11 (0x4000009B)
+#define HV_X64_MSR_SINT12 (0x4000009C)
+#define HV_X64_MSR_SINT13 (0x4000009D)
+#define HV_X64_MSR_SINT14 (0x4000009E)
+#define HV_X64_MSR_SINT15 (0x4000009F)
+
+//
+// Define the expected SynIC version.
+//
+#define HV_SYNIC_VERSION_1 (0x1)
+
+//
+// Define synthetic interrupt controller message constants.
+//
+
+#define HV_MESSAGE_SIZE (256)
+#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240)
+#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30)
+#define HV_ANY_VP (0xFFFFFFFF)
+
+//
+// Define synthetic interrupt controller flag constants.
+//
+
+#define HV_EVENT_FLAGS_COUNT (256 * 8)
+#define HV_EVENT_FLAGS_BYTE_COUNT (256)
+#define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(UINT32))
+
+//
+// Define hypervisor message types.
+//
+typedef enum _HV_MESSAGE_TYPE
+{
+ HvMessageTypeNone = 0x00000000,
+
+ //
+ // Memory access messages.
+ //
+ HvMessageTypeUnmappedGpa = 0x80000000,
+ HvMessageTypeGpaIntercept = 0x80000001,
+
+ //
+ // Timer notification messages.
+ //
+ HvMessageTimerExpired = 0x80000010,
+
+ //
+ // Error messages.
+ //
+ HvMessageTypeInvalidVpRegisterValue = 0x80000020,
+ HvMessageTypeUnrecoverableException = 0x80000021,
+ HvMessageTypeUnsupportedFeature = 0x80000022,
+
+ //
+ // Trace buffer complete messages.
+ //
+ HvMessageTypeEventLogBufferComplete = 0x80000040,
+
+ //
+ // Platform-specific processor intercept messages.
+ //
+ HvMessageTypeX64IoPortIntercept = 0x80010000,
+ HvMessageTypeX64MsrIntercept = 0x80010001,
+ HvMessageTypeX64CpuidIntercept = 0x80010002,
+ HvMessageTypeX64ExceptionIntercept = 0x80010003,
+ HvMessageTypeX64ApicEoi = 0x80010004,
+ HvMessageTypeX64LegacyFpError = 0x80010005
+
+} HV_MESSAGE_TYPE, *PHV_MESSAGE_TYPE;
+
+//
+// Define the number of synthetic interrupt sources.
+//
+
+#define HV_SYNIC_SINT_COUNT (16)
+#define HV_SYNIC_STIMER_COUNT (4)
+
+//
+// Define the synthetic interrupt source index type.
+//
+
+typedef UINT32 HV_SYNIC_SINT_INDEX, *PHV_SYNIC_SINT_INDEX;
+
+//
+// Define partition identifier type.
+//
+
+typedef UINT64 HV_PARTITION_ID, *PHV_PARTITION_ID;
+
+//
+// Define invalid partition identifier.
+//
+#define HV_PARTITION_ID_INVALID ((HV_PARTITION_ID) 0x0)
+
+//
+// Define connection identifier type.
+//
+
+typedef union _HV_CONNECTION_ID
+{
+ UINT32 AsUINT32;
+
+ struct
+ {
+ UINT32 Id:24;
+ UINT32 Reserved:8;
+ } u;
+
+} HV_CONNECTION_ID, *PHV_CONNECTION_ID;
+
+//
+// Define port identifier type.
+//
+
+typedef union _HV_PORT_ID
+{
+ UINT32 AsUINT32;
+
+ struct
+ {
+ UINT32 Id:24;
+ UINT32 Reserved:8;
+ } u ;
+
+} HV_PORT_ID, *PHV_PORT_ID;
+
+//
+// Define port type.
+//
+
+typedef enum _HV_PORT_TYPE
+{
+ HvPortTypeMessage = 1,
+ HvPortTypeEvent = 2,
+ HvPortTypeMonitor = 3
+} HV_PORT_TYPE, *PHV_PORT_TYPE;
+
+//
+// Define port information structure.
+//
+
+typedef struct _HV_PORT_INFO
+{
+ HV_PORT_TYPE PortType;
+ UINT32 Padding;
+
+ union
+ {
+ struct
+ {
+ HV_SYNIC_SINT_INDEX TargetSint;
+ HV_VP_INDEX TargetVp;
+ UINT64 RsvdZ;
+ } MessagePortInfo;
+
+ struct
+ {
+ HV_SYNIC_SINT_INDEX TargetSint;
+ HV_VP_INDEX TargetVp;
+ UINT16 BaseFlagNumber;
+ UINT16 FlagCount;
+ UINT32 RsvdZ;
+ } EventPortInfo;
+
+ struct
+ {
+ HV_GPA MonitorAddress;
+ UINT64 RsvdZ;
+ } MonitorPortInfo;
+ };
+} HV_PORT_INFO, *PHV_PORT_INFO;
+
+typedef const HV_PORT_INFO *PCHV_PORT_INFO;
+
+typedef struct _HV_CONNECTION_INFO
+{
+ HV_PORT_TYPE PortType;
+ UINT32 Padding;
+
+ union
+ {
+ struct
+ {
+ UINT64 RsvdZ;
+ } MessageConnectionInfo;
+
+ struct
+ {
+ UINT64 RsvdZ;
+ } EventConnectionInfo;
+
+ struct
+ {
+ HV_GPA MonitorAddress;
+ } MonitorConnectionInfo;
+ };
+} HV_CONNECTION_INFO, *PHV_CONNECTION_INFO;
+
+typedef const HV_CONNECTION_INFO *PCHV_CONNECTION_INFO;
+
+//
+// Define synthetic interrupt controller message flags.
+//
+
+typedef union _HV_MESSAGE_FLAGS
+{
+ UINT8 AsUINT8;
+ struct
+ {
+ UINT8 MessagePending:1;
+ UINT8 Reserved:7;
+ };
+} HV_MESSAGE_FLAGS, *PHV_MESSAGE_FLAGS;
+
+
+//
+// Define synthetic interrupt controller message header.
+//
+
+typedef struct _HV_MESSAGE_HEADER
+{
+ HV_MESSAGE_TYPE MessageType;
+ UINT8 PayloadSize;
+ HV_MESSAGE_FLAGS MessageFlags;
+ UINT8 Reserved[2];
+ union
+ {
+ HV_PARTITION_ID Sender;
+ HV_PORT_ID Port;
+ };
+
+} HV_MESSAGE_HEADER, *PHV_MESSAGE_HEADER;
+
+//
+// Define timer message payload structure.
+//
+typedef struct _HV_TIMER_MESSAGE_PAYLOAD
+{
+ UINT32 TimerIndex;
+ UINT32 Reserved;
+ HV_NANO100_TIME ExpirationTime; // When the timer expired
+ HV_NANO100_TIME DeliveryTime; // When the message was delivered
+} HV_TIMER_MESSAGE_PAYLOAD, *PHV_TIMER_MESSAGE_PAYLOAD;
+
+//
+// Define synthetic interrupt controller message format.
+//
+
+typedef struct _HV_MESSAGE
+{
+ HV_MESSAGE_HEADER Header;
+ union
+ {
+ UINT64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
+ } u ;
+} HV_MESSAGE, *PHV_MESSAGE;
+
+//
+// Define the number of message buffers associated with each port.
+//
+
+#define HV_PORT_MESSAGE_BUFFER_COUNT (16)
+
+//
+// Define the synthetic interrupt message page layout.
+//
+
+typedef struct _HV_MESSAGE_PAGE
+{
+ volatile HV_MESSAGE SintMessage[HV_SYNIC_SINT_COUNT];
+} HV_MESSAGE_PAGE, *PHV_MESSAGE_PAGE;
+
+
+//
+// Define the synthetic interrupt controller event flags format.
+//
+
+typedef union _HV_SYNIC_EVENT_FLAGS
+{
+ UINT8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT];
+ UINT32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT];
+} HV_SYNIC_EVENT_FLAGS, *PHV_SYNIC_EVENT_FLAGS;
+
+
+//
+// Define the synthetic interrupt flags page layout.
+//
+
+typedef struct _HV_SYNIC_EVENT_FLAGS_PAGE
+{
+ volatile HV_SYNIC_EVENT_FLAGS SintEventFlags[HV_SYNIC_SINT_COUNT];
+} HV_SYNIC_EVENT_FLAGS_PAGE, *PHV_SYNIC_EVENT_FLAGS_PAGE;
+
+
+//
+// Define SynIC control register.
+//
+typedef union _HV_SYNIC_SCONTROL
+{
+ UINT64 AsUINT64;
+ struct
+ {
+ UINT64 Enable:1;
+ UINT64 Reserved:63;
+ };
+} HV_SYNIC_SCONTROL, *PHV_SYNIC_SCONTROL;
+
+//
+// Define synthetic interrupt source.
+//
+
+typedef union _HV_SYNIC_SINT
+{
+ UINT64 AsUINT64;
+ struct
+ {
+ UINT64 Vector :8;
+ UINT64 Reserved1 :8;
+ UINT64 Masked :1;
+ UINT64 AutoEoi :1;
+ UINT64 Reserved2 :46;
+ };
+} HV_SYNIC_SINT, *PHV_SYNIC_SINT;
+
+//
+// Define the format of the SIMP register
+//
+
+typedef union _HV_SYNIC_SIMP
+{
+ UINT64 AsUINT64;
+ struct
+ {
+ UINT64 SimpEnabled : 1;
+ UINT64 Preserved : 11;
+ UINT64 BaseSimpGpa : 52;
+ };
+} HV_SYNIC_SIMP, *PHV_SYNIC_SIMP;
+
+//
+// Define the format of the SIEFP register
+//
+
+typedef union _HV_SYNIC_SIEFP
+{
+ UINT64 AsUINT64;
+ struct
+ {
+ UINT64 SiefpEnabled : 1;
+ UINT64 Preserved : 11;
+ UINT64 BaseSiefpGpa : 52;
+ };
+} HV_SYNIC_SIEFP, *PHV_SYNIC_SIEFP;
+
+//
+// Definitions for the monitored notification facility
+//
+
+typedef union _HV_MONITOR_TRIGGER_GROUP
+{
+ UINT64 AsUINT64;
+
+ struct
+ {
+ UINT32 Pending;
+ UINT32 Armed;
+ };
+
+} HV_MONITOR_TRIGGER_GROUP, *PHV_MONITOR_TRIGGER_GROUP;
+
+typedef struct _HV_MONITOR_PARAMETER
+{
+ HV_CONNECTION_ID ConnectionId;
+ UINT16 FlagNumber;
+ UINT16 RsvdZ;
+} HV_MONITOR_PARAMETER, *PHV_MONITOR_PARAMETER;
+
+typedef union _HV_MONITOR_TRIGGER_STATE
+{
+ UINT32 AsUINT32;
+
+ struct
+ {
+ UINT32 GroupEnable : 4;
+ UINT32 RsvdZ : 28;
+ };
+
+} HV_MONITOR_TRIGGER_STATE, *PHV_MONITOR_TRIGGER_STATE;
+
+//
+// HV_MONITOR_PAGE Layout
+// ------------------------------------------------------
+// | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) |
+// | 8 | TriggerGroup[0] |
+// | 10 | TriggerGroup[1] |
+// | 18 | TriggerGroup[2] |
+// | 20 | TriggerGroup[3] |
+// | 28 | Rsvd2[0] |
+// | 30 | Rsvd2[1] |
+// | 38 | Rsvd2[2] |
+// | 40 | NextCheckTime[0][0] | NextCheckTime[0][1] |
+// | ... |
+// | 240 | Latency[0][0..3] |
+// | 340 | Rsvz3[0] |
+// | 440 | Parameter[0][0] |
+// | 448 | Parameter[0][1] |
+// | ... |
+// | 840 | Rsvd4[0] |
+// ------------------------------------------------------
+
+typedef struct _HV_MONITOR_PAGE
+{
+ HV_MONITOR_TRIGGER_STATE TriggerState;
+ UINT32 RsvdZ1;
+
+ HV_MONITOR_TRIGGER_GROUP TriggerGroup[4];
+ UINT64 RsvdZ2[3];
+
+ INT32 NextCheckTime[4][32];
+
+ UINT16 Latency[4][32];
+ UINT64 RsvdZ3[32];
+
+ HV_MONITOR_PARAMETER Parameter[4][32];
+
+ UINT8 RsvdZ4[1984];
+
+} HV_MONITOR_PAGE, *PHV_MONITOR_PAGE;
+
+typedef volatile HV_MONITOR_PAGE* PVHV_MONITOR_PAGE;
diff --git a/drivers/staging/hv/include/HvTypes.h b/drivers/staging/hv/include/HvTypes.h
new file mode 100644
index 0000000..bbf9891
--- /dev/null
+++ b/drivers/staging/hv/include/HvTypes.h
@@ -0,0 +1,31 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+
+typedef UINT64 HV_GPA, *PHV_GPA;
+
+#define HV_X64_PAGE_SIZE (4096)
+#define HV_PAGE_SIZE HV_X64_PAGE_SIZE
+
diff --git a/drivers/staging/hv/include/HvVpApi.h b/drivers/staging/hv/include/HvVpApi.h
new file mode 100644
index 0000000..7e5128a
--- /dev/null
+++ b/drivers/staging/hv/include/HvVpApi.h
@@ -0,0 +1,51 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+//
+// Virtual Processor Indices
+//
+typedef UINT32 HV_VP_INDEX, *PHV_VP_INDEX;
+
+//
+// The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
+// is set by CPUID(HvCpuIdFunctionVersionAndFeatures).
+// ==========================================================================
+//
+
+typedef enum _HV_CPUID_FUNCTION
+{
+ HvCpuIdFunctionVersionAndFeatures = 0x00000001,
+ HvCpuIdFunctionHvVendorAndMaxFunction = 0x40000000,
+ HvCpuIdFunctionHvInterface = 0x40000001,
+
+ //
+ // The remaining functions depend on the value of HvCpuIdFunctionInterface
+ //
+ HvCpuIdFunctionMsHvVersion = 0x40000002,
+ HvCpuIdFunctionMsHvFeatures = 0x40000003,
+ HvCpuIdFunctionMsHvEnlightenmentInformation = 0x40000004,
+ HvCpuIdFunctionMsHvImplementationLimits = 0x40000005
+
+} HV_CPUID_FUNCTION, *PHV_CPUID_FUNCTION;
diff --git a/drivers/staging/hv/include/List.h b/drivers/staging/hv/include/List.h
new file mode 100644
index 0000000..117a45f
--- /dev/null
+++ b/drivers/staging/hv/include/List.h
@@ -0,0 +1,269 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#ifndef _LIST_H_
+#define _LIST_H_
+
+#include "osd.h"
+/*
+ *
+ * Doubly-linked list manipulation routines. Implemented as macros
+ * but logically these are procedures.
+ *
+ */
+
+typedef DLIST_ENTRY LIST_ENTRY;
+typedef DLIST_ENTRY *PLIST_ENTRY;
+
+//typedef struct LIST_ENTRY {
+// struct LIST_ENTRY * volatile Flink;
+// struct LIST_ENTRY * volatile Blink;
+//} LIST_ENTRY, *PLIST_ENTRY;
+
+
+
+/*
+ * VOID
+ * InitializeListHead(
+ * PLIST_ENTRY ListHead
+ * );
+ */
+#define INITIALIZE_LIST_HEAD InitializeListHead
+
+#define InitializeListHead(ListHead) (\
+ (ListHead)->Flink = (ListHead)->Blink = (ListHead))
+
+
+/*
+ * BOOLEAN
+ * IsListEmpty(
+ * PLIST_ENTRY ListHead
+ * );
+ */
+#define IS_LIST_EMPTY IsListEmpty
+
+#define IsListEmpty(ListHead) \
+ ((ListHead)->Flink == (ListHead))
+
+
+/*
+ * PLIST_ENTRY
+ * NextListEntry(
+ * PLIST_ENTRY Entry
+ * );
+ */
+#define NEXT_LIST_ENTRY NextListEntry
+
+#define NextListEntry(Entry) \
+ (Entry)->Flink
+
+
+/*
+ * PLIST_ENTRY
+ * PrevListEntry(
+ * PLIST_ENTRY Entry
+ * );
+ */
+#define PREV_LIST_ENTRY PrevListEntry
+
+#define PrevListEntry(Entry) \
+ (Entry)->Blink
+
+
+/*
+ * PLIST_ENTRY
+ * TopListEntry(
+ * PLIST_ENTRY ListHead
+ * );
+ */
+#define TOP_LIST_ENTRY TopListEntry
+
+#define TopListEntry(ListHead) \
+ (ListHead)->Flink
+
+
+
+/*
+ * PLIST_ENTRY
+ * RemoveHeadList(
+ * PLIST_ENTRY ListHead
+ * );
+ */
+
+#define REMOVE_HEAD_LIST RemoveHeadList
+
+#define RemoveHeadList(ListHead) \
+ (ListHead)->Flink;\
+ {RemoveEntryList((ListHead)->Flink)}
+
+
+/*
+ * PLIST_ENTRY
+ * RemoveTailList(
+ * PLIST_ENTRY ListHead
+ * );
+ */
+#define REMOVE_TAIL_LIST RemoveTailList
+
+#define RemoveTailList(ListHead) \
+ (ListHead)->Blink;\
+ {RemoveEntryList((ListHead)->Blink)}
+
+
+/*
+ * VOID
+ * RemoveEntryList(
+ * PLIST_ENTRY Entry
+ * );
+ */
+#define REMOVE_ENTRY_LIST RemoveEntryList
+
+#define RemoveEntryList(Entry) {\
+ PLIST_ENTRY _EX_Flink = (Entry)->Flink;\
+ PLIST_ENTRY _EX_Blink = (Entry)->Blink;\
+ _EX_Blink->Flink = _EX_Flink;\
+ _EX_Flink->Blink = _EX_Blink;\
+ }
+
+
+/*
+ * VOID
+ * AttachList(
+ * PLIST_ENTRY ListHead,
+ * PLIST_ENTRY ListEntry
+ * );
+ */
+#define ATTACH_LIST AttachList
+
+#define AttachList(ListHead,ListEntry) {\
+ PLIST_ENTRY _EX_ListHead = (ListHead);\
+ PLIST_ENTRY _EX_Blink = (ListHead)->Blink;\
+ (ListEntry)->Blink->Flink = _EX_ListHead;\
+ _EX_Blink->Flink = (ListEntry);\
+ _EX_ListHead->Blink = (ListEntry)->Blink;\
+ (ListEntry)->Blink = _EX_Blink;\
+ }
+
+
+
+/*
+ * VOID
+ * InsertTailList(
+ * PLIST_ENTRY ListHead,
+ * PLIST_ENTRY Entry
+ * );
+ */
+
+#define INSERT_TAIL_LIST InsertTailList
+
+#define InsertTailList(ListHead,Entry) {\
+ PLIST_ENTRY _EX_ListHead = (ListHead);\
+ PLIST_ENTRY _EX_Blink = (ListHead)->Blink;\
+ (Entry)->Flink = _EX_ListHead;\
+ (Entry)->Blink = _EX_Blink;\
+ _EX_Blink->Flink = (Entry);\
+ _EX_ListHead->Blink = (Entry);\
+ }
+
+
+/*
+ * VOID
+ * InsertHeadList(
+ * PLIST_ENTRY ListHead,
+ * PLIST_ENTRY Entry
+ * );
+ */
+#define INSERT_HEAD_LIST InsertHeadList
+
+#define InsertHeadList(ListHead,Entry) {\
+ PLIST_ENTRY _EX_ListHead = (ListHead);\
+ PLIST_ENTRY _EX_Flink = (ListHead)->Flink;\
+ (Entry)->Flink = _EX_Flink;\
+ (Entry)->Blink = _EX_ListHead;\
+ _EX_Flink->Blink = (Entry);\
+ _EX_ListHead->Flink = (Entry);\
+ }
+
+
+/*
+ * VOID
+ * IterateListEntries(
+ * PLIST_ENTRY anchor,
+ * PLIST_ENTRY index,
+ * PLIST_ENTRY listp
+ * );
+ */
+
+#define ITERATE_LIST_ENTRIES IterateListEntries
+
+#define IterateListEntries(anchor, index, listp) \
+ (anchor) = (LIST_ENTRY *)(listp); \
+ for((index) = (anchor)->Flink; (index) != (anchor); (index) = (index)->Flink)
+
+
+
+/*
+ * PSINGLE_LIST_ENTRY
+ * PopEntryList(
+ * PSINGLE_LIST_ENTRY ListHead
+ * );
+ */
+
+#define POP_ENTRY_LIST PopEntryList
+
+#define PopEntryList(ListHead) \
+ (ListHead)->Next;\
+ {\
+ PSINGLE_LIST_ENTRY FirstEntry;\
+ FirstEntry = (ListHead)->Next;\
+ if (FirstEntry != NULL) { \
+ (ListHead)->Next = FirstEntry->Next;\
+ } \
+ }
+
+
+
+/*
+ * VOID
+ * PushEntryList(
+ * PSINGLE_LIST_ENTRY ListHead,
+ * PSINGLE_LIST_ENTRY Entry
+ * );
+ */
+
+#define PUSH_ENTRY_LIST PushEntryList
+
+#define PushEntryList(ListHead,Entry) \
+ (Entry)->Next = (ListHead)->Next; \
+ (ListHead)->Next = (Entry)
+
+#ifndef CONTAINING_RECORD
+#define CONTAINING_RECORD(address, type, field) ((type *)( \
+ (PCHAR)(address) - \
+ (PCHAR)(&((type *)0)->field)))
+#endif /* CONTAINING_RECORD */
+
+#endif /* _LIST_H_ */
+
+/* EOF */
diff --git a/drivers/staging/hv/include/VmbusChannelInterface.h b/drivers/staging/hv/include/VmbusChannelInterface.h
new file mode 100644
index 0000000..dcafbe6
--- /dev/null
+++ b/drivers/staging/hv/include/VmbusChannelInterface.h
@@ -0,0 +1,131 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Authors:
+ * Haiyang Zhang <haiyangz@microsoft.com>
+ * Hank Janssen <hjanssen@microsoft.com>
+ *
+ */
+
+
+#pragma once
+// allow nameless unions
+//#pragma warning(disable : 4201)
+
+//
+// A revision number of vmbus that is used for ensuring both ends on a
+// partition are using compatible versions.
+//
+#define VMBUS_REVISION_NUMBER 13
+
+//
+// Make maximum size of pipe payload of 16K
+//
+#define MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384)
+
+//
+// Define PipeMode values.
+//
+#define VMBUS_PIPE_TYPE_BYTE 0x00000000
+#define VMBUS_PIPE_TYPE_MESSAGE 0x00000004
+
+//
+// The size of the user defined data buffer for non-pipe offers.
+//
+#define MAX_USER_DEFINED_BYTES 120
+
+//
+// The size of the user defined data buffer for pipe offers.
+//
+#define MAX_PIPE_USER_DEFINED_BYTES 116
+
+
+//
+// At the center of the Channel Management library is
+// the Channel Offer. This struct contains the
+// fundamental information about an offer.
+//
+#pragma pack(push,1)
+
+typedef struct
+{
+
+ GUID InterfaceType;
+ GUID InterfaceInstance;
+ UINT64 InterruptLatencyIn100nsUnits;
+ UINT32 InterfaceRevision;
+ UINT32 ServerContextAreaSize; // in bytes
+ UINT16 ChannelFlags;
+ UINT16 MmioMegabytes; // in bytes * 1024 * 1024
+
+ union
+ {
+ //
+ // Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes.
+ //
+ struct
+ {
+ UCHAR UserDefined[MAX_USER_DEFINED_BYTES];
+ } Standard;
+
+ //
+ // Pipes: The following sructure is an integrated pipe protocol, which
+ // is implemented on top of standard user-defined data. Pipe clients
+ // have MAX_PIPE_USER_DEFINED_BYTES left for their own use.
+ //
+ struct
+ {
+ UINT32 PipeMode;
+ UCHAR UserDefined[MAX_PIPE_USER_DEFINED_BYTES];
+ } Pipe;
+ } u;
+ UINT32 Padding;
+} VMBUS_CHANNEL_OFFER, *PVMBUS_CHANNEL_OFFER;
+#pragma pack(pop)
+
+
+//
+// Verify the MAX_PIPE_USER_DEFINED_BYTES value.
+//
+//C_ASSERT(MAX_PIPE_USER_DEFINED_BYTES ==
+// MAX_USER_DEFINED_BYTES -
+// (FIELD_OFFSET(VMBUS_CHANNEL_OFFER, u.Pipe.UserDefined) -
+// FIELD_OFFSET(VMBUS_CHANNEL_OFFER, u.Standard.UserDefined)));
+//
+
+typedef UINT32 GPADL_HANDLE;
+
+//
+// Server Flags
+//
+
+#define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1
+#define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2
+#define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4
+#define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10
+#define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100
+#define VMBUS_CHANNEL_PARENT_OFFER 0x200
+#define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400
+
+//
+// TEMPTEMP -- move this next define to devioctl.h some day
+//
+
+#ifndef FILE_DEVICE_VMBUS
+#define FILE_DEVICE_VMBUS 0x0000003E
+#endif
+
diff --git a/drivers/staging/hv/include/VmbusPacketFormat.h b/drivers/staging/hv/include/VmbusPacketFormat.h
new file mode 100644
index 0000000..bb0c927
--- /dev/null
+++ b/drivers/staging/hv/include/VmbusPacketFormat.h
@@ -0,0 +1,322 @@
+/*
+ *
+ * Copyright (c) 2009, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Softw