First Support on Ginger and OMAP TI
[linux-ginger.git] / drivers / staging / hv / Channel.h
blob6b283edcae68b9513c0e872cfd7d9cb7fbddac70
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 "ChannelMgmt.h"
30 /* The format must be the same as struct vmdata_gpa_direct */
31 struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
32 u16 Type;
33 u16 DataOffset8;
34 u16 Length8;
35 u16 Flags;
36 u64 TransactionId;
37 u32 Reserved;
38 u32 RangeCount;
39 struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT];
40 } __attribute__((packed));
42 /* The format must be the same as struct vmdata_gpa_direct */
43 struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
44 u16 Type;
45 u16 DataOffset8;
46 u16 Length8;
47 u16 Flags;
48 u64 TransactionId;
49 u32 Reserved;
50 u32 RangeCount; /* Always 1 in this case */
51 struct hv_multipage_buffer Range;
52 } __attribute__((packed));
55 extern int VmbusChannelOpen(struct vmbus_channel *channel,
56 u32 SendRingBufferSize,
57 u32 RecvRingBufferSize,
58 void *UserData,
59 u32 UserDataLen,
60 void(*OnChannelCallback)(void *context),
61 void *Context);
63 extern void VmbusChannelClose(struct vmbus_channel *channel);
65 extern int VmbusChannelSendPacket(struct vmbus_channel *channel,
66 const void *Buffer,
67 u32 BufferLen,
68 u64 RequestId,
69 enum vmbus_packet_type Type,
70 u32 Flags);
72 extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
73 struct hv_page_buffer PageBuffers[],
74 u32 PageCount,
75 void *Buffer,
76 u32 BufferLen,
77 u64 RequestId);
79 extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
80 struct hv_multipage_buffer *mpb,
81 void *Buffer,
82 u32 BufferLen,
83 u64 RequestId);
85 extern int VmbusChannelEstablishGpadl(struct vmbus_channel *channel,
86 void *Kbuffer,
87 u32 Size,
88 u32 *GpadlHandle);
90 extern int VmbusChannelTeardownGpadl(struct vmbus_channel *channel,
91 u32 GpadlHandle);
93 extern int VmbusChannelRecvPacket(struct vmbus_channel *channel,
94 void *Buffer,
95 u32 BufferLen,
96 u32 *BufferActualLen,
97 u64 *RequestId);
99 extern int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel,
100 void *Buffer,
101 u32 BufferLen,
102 u32 *BufferActualLen,
103 u64 *RequestId);
105 extern void VmbusChannelOnChannelEvent(struct vmbus_channel *channel);
107 extern void VmbusChannelGetDebugInfo(struct vmbus_channel *channel,
108 struct vmbus_channel_debug_info *debug);
110 extern void VmbusChannelOnTimer(unsigned long data);
112 #endif /* _CHANNEL_H_ */