Merge branch 'move-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/davej...
[linux-2.6/next.git] / drivers / staging / hv / channel.h
blobde4f867de171e161cae3324cdc8fa4596b9c3038
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 "channel_mgmt.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 } __packed;
42 /* The format must be the same as struct vmdata_gpa_direct */
43 struct vmbus_channel_packet_multipage_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 } __packed;
55 extern int vmbus_open(struct vmbus_channel *channel,
56 u32 send_ringbuffersize,
57 u32 recv_ringbuffersize,
58 void *userdata,
59 u32 userdatalen,
60 void(*onchannel_callback)(void *context),
61 void *context);
63 extern void vmbus_close(struct vmbus_channel *channel);
65 extern int vmbus_sendpacket(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 vmbus_sendpacket_pagebuffer(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 vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
80 struct hv_multipage_buffer *mpb,
81 void *buffer,
82 u32 bufferlen,
83 u64 requestid);
85 extern int vmbus_establish_gpadl(struct vmbus_channel *channel,
86 void *kbuffer,
87 u32 size,
88 u32 *gpadl_handle);
90 extern int vmbus_teardown_gpadl(struct vmbus_channel *channel,
91 u32 gpadl_handle);
93 extern int vmbus_recvpacket(struct vmbus_channel *channel,
94 void *buffer,
95 u32 bufferlen,
96 u32 *buffer_actual_len,
97 u64 *requestid);
99 extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
100 void *buffer,
101 u32 bufferlen,
102 u32 *buffer_actual_len,
103 u64 *requestid);
105 extern void vmbus_onchannel_event(struct vmbus_channel *channel);
107 extern void vmbus_get_debug_info(struct vmbus_channel *channel,
108 struct vmbus_channel_debug_info *debug);
110 extern void vmbus_ontimer(unsigned long data);
112 #endif /* _CHANNEL_H_ */