ACPI: thinkpad-acpi: add development version tag
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / hv / VmbusPrivate.h
blob5a37ccec92e853ad204ab9e1077170c34dee4864
1 /*
3 * Copyright (c) 2009, Microsoft Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
25 #ifndef _VMBUS_PRIVATE_H_
26 #define _VMBUS_PRIVATE_H_
28 #include "Hv.h"
29 #include "VmbusApi.h"
30 #include "Channel.h"
31 #include "ChannelMgmt.h"
32 #include "ChannelInterface.h"
33 #include "RingBuffer.h"
34 #include <linux/list.h>
35 #include <asm/sync_bitops.h>
39 * Maximum channels is determined by the size of the interrupt page
40 * which is PAGE_SIZE. 1/2 of PAGE_SIZE is for send endpoint interrupt
41 * and the other is receive endpoint interrupt
43 #define MAX_NUM_CHANNELS ((PAGE_SIZE >> 1) << 3) /* 16348 channels */
45 /* The value here must be in multiple of 32 */
46 /* TODO: Need to make this configurable */
47 #define MAX_NUM_CHANNELS_SUPPORTED 256
50 enum VMBUS_CONNECT_STATE {
51 Disconnected,
52 Connecting,
53 Connected,
54 Disconnecting
57 #define MAX_SIZE_CHANNEL_MESSAGE HV_MESSAGE_PAYLOAD_BYTE_COUNT
59 struct VMBUS_CONNECTION {
60 enum VMBUS_CONNECT_STATE ConnectState;
62 atomic_t NextGpadlHandle;
65 * Represents channel interrupts. Each bit position represents a
66 * channel. When a channel sends an interrupt via VMBUS, it finds its
67 * bit in the sendInterruptPage, set it and calls Hv to generate a port
68 * event. The other end receives the port event and parse the
69 * recvInterruptPage to see which bit is set
71 void *InterruptPage;
72 void *SendInterruptPage;
73 void *RecvInterruptPage;
76 * 2 pages - 1st page for parent->child notification and 2nd
77 * is child->parent notification
79 void *MonitorPages;
80 struct list_head ChannelMsgList;
81 spinlock_t channelmsg_lock;
83 /* List of channels */
84 struct list_head ChannelList;
85 spinlock_t channel_lock;
87 struct workqueue_struct *WorkQueue;
91 struct VMBUS_MSGINFO {
92 /* Bookkeeping stuff */
93 struct list_head MsgListEntry;
95 /* Synchronize the request/response if needed */
96 struct osd_waitevent *WaitEvent;
98 /* The message itself */
99 unsigned char Msg[0];
103 extern struct VMBUS_CONNECTION gVmbusConnection;
105 /* General vmbus interface */
107 struct hv_device *VmbusChildDeviceCreate(struct hv_guid *deviceType,
108 struct hv_guid *deviceInstance,
109 void *context);
111 int VmbusChildDeviceAdd(struct hv_device *Device);
113 void VmbusChildDeviceRemove(struct hv_device *Device);
115 /* static void */
116 /* VmbusChildDeviceDestroy( */
117 /* struct hv_device *); */
119 struct vmbus_channel *GetChannelFromRelId(u32 relId);
122 /* Connection interface */
124 int VmbusConnect(void);
126 int VmbusDisconnect(void);
128 int VmbusPostMessage(void *buffer, size_t bufSize);
130 int VmbusSetEvent(u32 childRelId);
132 void VmbusOnEvents(void);
135 #endif /* _VMBUS_PRIVATE_H_ */