aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/hv/ChannelMgmt.h
diff options
context:
space:
mode:
authorHank Janssen <hjanssen@microsoft.com>2009-07-13 16:02:34 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 12:01:43 -0700
commit3e7ee4902fe6996048f03433dd111426db3cfa92 (patch)
treec42d158ecca25ddb0b99a400fa2682eeaa0aa82e /drivers/staging/hv/ChannelMgmt.h
parentStaging: hv: add the Hyper-V driver header files (diff)
downloadlinux-dev-3e7ee4902fe6996048f03433dd111426db3cfa92.tar.xz
linux-dev-3e7ee4902fe6996048f03433dd111426db3cfa92.zip
Staging: hv: add the Hyper-V virtual bus
This is the virtual bus that all of the Linux Hyper-V drivers use. 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>
Diffstat (limited to 'drivers/staging/hv/ChannelMgmt.h')
-rw-r--r--drivers/staging/hv/ChannelMgmt.h156
1 files changed, 156 insertions, 0 deletions
diff --git a/drivers/staging/hv/ChannelMgmt.h b/drivers/staging/hv/ChannelMgmt.h
new file mode 100644
index 000000000000..d5ba5d135949
--- /dev/null
+++ b/drivers/staging/hv/ChannelMgmt.h
@@ -0,0 +1,156 @@
+/*
+ *
+ * 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 _CHANNEL_MGMT_H_
+#define _CHANNEL_MGMT_H_
+
+#include "osd.h"
+#include "List.h"
+#include "RingBuffer.h"
+
+#include "VmbusChannelInterface.h"
+#include "ChannelMessages.h"
+
+
+
+typedef void (*PFN_CHANNEL_CALLBACK)(PVOID context);
+
+typedef enum {
+ CHANNEL_OFFER_STATE,
+ CHANNEL_OPENING_STATE,
+ CHANNEL_OPEN_STATE,
+} VMBUS_CHANNEL_STATE;
+
+typedef struct _VMBUS_CHANNEL {
+ LIST_ENTRY ListEntry;
+
+ DEVICE_OBJECT* DeviceObject;
+
+ HANDLE PollTimer; // SA-111 workaround
+
+ VMBUS_CHANNEL_STATE State;
+
+ VMBUS_CHANNEL_OFFER_CHANNEL OfferMsg;
+ // These are based on the OfferMsg.MonitorId. Save it here for easy access.
+ UINT8 MonitorGroup;
+ UINT8 MonitorBit;
+
+ UINT32 RingBufferGpadlHandle;
+
+ // Allocated memory for ring buffer
+ VOID* RingBufferPages;
+ UINT32 RingBufferPageCount;
+ RING_BUFFER_INFO Outbound; // send to parent
+ RING_BUFFER_INFO Inbound; // receive from parent
+ HANDLE InboundLock;
+ HANDLE ControlWQ;
+
+ // Channel callback are invoked in this workqueue context
+ //HANDLE dataWorkQueue;
+
+ PFN_CHANNEL_CALLBACK OnChannelCallback;
+ PVOID ChannelCallbackContext;
+
+} VMBUS_CHANNEL;
+
+
+typedef struct _VMBUS_CHANNEL_DEBUG_INFO {
+ UINT32 RelId;
+ VMBUS_CHANNEL_STATE State;
+ GUID InterfaceType;
+ GUID InterfaceInstance;
+ UINT32 MonitorId;
+ UINT32 ServerMonitorPending;
+ UINT32 ServerMonitorLatency;
+ UINT32 ServerMonitorConnectionId;
+ UINT32 ClientMonitorPending;
+ UINT32 ClientMonitorLatency;
+ UINT32 ClientMonitorConnectionId;
+
+ RING_BUFFER_DEBUG_INFO Inbound;
+ RING_BUFFER_DEBUG_INFO Outbound;
+} VMBUS_CHANNEL_DEBUG_INFO;
+
+
+typedef union {
+ VMBUS_CHANNEL_VERSION_SUPPORTED VersionSupported;
+ VMBUS_CHANNEL_OPEN_RESULT OpenResult;
+ VMBUS_CHANNEL_GPADL_TORNDOWN GpadlTorndown;
+ VMBUS_CHANNEL_GPADL_CREATED GpadlCreated;
+ VMBUS_CHANNEL_VERSION_RESPONSE VersionResponse;
+} VMBUS_CHANNEL_MESSAGE_RESPONSE;
+
+
+// Represents each channel msg on the vmbus connection
+// This is a variable-size data structure depending on
+// the msg type itself
+typedef struct _VMBUS_CHANNEL_MSGINFO {
+ // Bookkeeping stuff
+ LIST_ENTRY MsgListEntry;
+
+ // So far, this is only used to handle gpadl body message
+ LIST_ENTRY SubMsgList;
+
+ // Synchronize the request/response if needed
+ HANDLE WaitEvent;
+
+ VMBUS_CHANNEL_MESSAGE_RESPONSE Response;
+
+ UINT32 MessageSize;
+ // The channel message that goes out on the "wire".
+ // It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
+ unsigned char Msg[0];
+} VMBUS_CHANNEL_MSGINFO;
+
+
+//
+// Routines
+//
+
+INTERNAL VMBUS_CHANNEL*
+AllocVmbusChannel(
+ void
+ );
+
+INTERNAL void
+FreeVmbusChannel(
+ VMBUS_CHANNEL *Channel
+ );
+
+INTERNAL void
+VmbusOnChannelMessage(
+ void *Context
+ );
+
+INTERNAL int
+VmbusChannelRequestOffers(
+ void
+ );
+
+INTERNAL void
+VmbusChannelReleaseUnattachedChannels(
+ void
+ );
+
+#endif //_CHANNEL_MGMT_H_