Staging: hv: remove UINT16 and INT16 typedefs
[linux-2.6/linux-2.6-openrd.git] / drivers / staging / hv / Channel.h
blob1461f49162cf901d56911a736c35b06fe14bb948
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 _CHANNEL_H_
26 #define _CHANNEL_H_
28 #include "include/osd.h"
29 #include "ChannelMgmt.h"
31 #pragma pack(push,1)
34 // The format must be the same as VMDATA_GPA_DIRECT
35 typedef struct _VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
36 u16 Type;
37 u16 DataOffset8;
38 u16 Length8;
39 u16 Flags;
40 UINT64 TransactionId;
41 UINT32 Reserved;
42 UINT32 RangeCount;
43 PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT];
44 } VMBUS_CHANNEL_PACKET_PAGE_BUFFER;
47 // The format must be the same as VMDATA_GPA_DIRECT
48 typedef struct _VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
49 u16 Type;
50 u16 DataOffset8;
51 u16 Length8;
52 u16 Flags;
53 UINT64 TransactionId;
54 UINT32 Reserved;
55 UINT32 RangeCount; // Always 1 in this case
56 MULTIPAGE_BUFFER Range;
57 } VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER;
59 #pragma pack(pop)
62 // Routines
65 static int
66 VmbusChannelOpen(
67 VMBUS_CHANNEL *Channel,
68 UINT32 SendRingBufferSize,
69 UINT32 RecvRingBufferSize,
70 void * UserData,
71 UINT32 UserDataLen,
72 PFN_CHANNEL_CALLBACK pfnOnChannelCallback,
73 void * Context
76 static void
77 VmbusChannelClose(
78 VMBUS_CHANNEL *Channel
81 static int
82 VmbusChannelSendPacket(
83 VMBUS_CHANNEL *Channel,
84 const void * Buffer,
85 UINT32 BufferLen,
86 UINT64 RequestId,
87 VMBUS_PACKET_TYPE Type,
88 UINT32 Flags
91 static int
92 VmbusChannelSendPacketPageBuffer(
93 VMBUS_CHANNEL *Channel,
94 PAGE_BUFFER PageBuffers[],
95 UINT32 PageCount,
96 void * Buffer,
97 UINT32 BufferLen,
98 UINT64 RequestId
101 static int
102 VmbusChannelSendPacketMultiPageBuffer(
103 VMBUS_CHANNEL *Channel,
104 MULTIPAGE_BUFFER *MultiPageBuffer,
105 void * Buffer,
106 UINT32 BufferLen,
107 UINT64 RequestId
110 static int
111 VmbusChannelEstablishGpadl(
112 VMBUS_CHANNEL *Channel,
113 void * Kbuffer, // from kmalloc()
114 UINT32 Size, // page-size multiple
115 UINT32 *GpadlHandle
118 static int
119 VmbusChannelTeardownGpadl(
120 VMBUS_CHANNEL *Channel,
121 UINT32 GpadlHandle
124 static int
125 VmbusChannelRecvPacket(
126 VMBUS_CHANNEL *Channel,
127 void * Buffer,
128 UINT32 BufferLen,
129 UINT32* BufferActualLen,
130 UINT64* RequestId
133 static int
134 VmbusChannelRecvPacketRaw(
135 VMBUS_CHANNEL *Channel,
136 void * Buffer,
137 UINT32 BufferLen,
138 UINT32* BufferActualLen,
139 UINT64* RequestId
142 static void
143 VmbusChannelOnChannelEvent(
144 VMBUS_CHANNEL *Channel
147 static void
148 VmbusChannelGetDebugInfo(
149 VMBUS_CHANNEL *Channel,
150 VMBUS_CHANNEL_DEBUG_INFO *DebugInfo
153 static void
154 VmbusChannelOnTimer(
155 void *Context
157 #endif //_CHANNEL_H_