Merge branch 'virtio' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / hv / channel.h
CommitLineData
3e7ee490
HJ
1/*
2 *
3 * Copyright (c) 2009, Microsoft Corporation.
4 *
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.
8 *
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.
13 *
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.
17 *
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 *
22 */
23
24
25#ifndef _CHANNEL_H_
26#define _CHANNEL_H_
27
ff39524b 28#include "channel_mgmt.h"
3e7ee490 29
8dc0a06a 30/* The format must be the same as struct vmdata_gpa_direct */
0cf4fa80 31struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
46a05253
GKH
32 u16 Type;
33 u16 DataOffset8;
34 u16 Length8;
35 u16 Flags;
36 u64 TransactionId;
37 u32 Reserved;
38 u32 RangeCount;
ee3d7ddf 39 struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT];
46a05253 40} __attribute__((packed));
3e7ee490 41
8dc0a06a 42/* The format must be the same as struct vmdata_gpa_direct */
3fcc523a 43struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
46a05253
GKH
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 */
ee3d7ddf 51 struct hv_multipage_buffer Range;
46a05253
GKH
52} __attribute__((packed));
53
54
aded7165 55extern int VmbusChannelOpen(struct vmbus_channel *channel,
46a05253
GKH
56 u32 SendRingBufferSize,
57 u32 RecvRingBufferSize,
58 void *UserData,
59 u32 UserDataLen,
79035069 60 void(*OnChannelCallback)(void *context),
46a05253
GKH
61 void *Context);
62
aded7165 63extern void VmbusChannelClose(struct vmbus_channel *channel);
46a05253 64
aded7165 65extern int VmbusChannelSendPacket(struct vmbus_channel *channel,
46a05253
GKH
66 const void *Buffer,
67 u32 BufferLen,
68 u64 RequestId,
8dc0a06a 69 enum vmbus_packet_type Type,
46a05253
GKH
70 u32 Flags);
71
aded7165 72extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
ee3d7ddf 73 struct hv_page_buffer PageBuffers[],
46a05253
GKH
74 u32 PageCount,
75 void *Buffer,
76 u32 BufferLen,
77 u64 RequestId);
78
aded7165 79extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
ee3d7ddf 80 struct hv_multipage_buffer *mpb,
46a05253
GKH
81 void *Buffer,
82 u32 BufferLen,
83 u64 RequestId);
84
aded7165 85extern int VmbusChannelEstablishGpadl(struct vmbus_channel *channel,
46a05253
GKH
86 void *Kbuffer,
87 u32 Size,
88 u32 *GpadlHandle);
89
aded7165 90extern int VmbusChannelTeardownGpadl(struct vmbus_channel *channel,
46a05253
GKH
91 u32 GpadlHandle);
92
aded7165 93extern int VmbusChannelRecvPacket(struct vmbus_channel *channel,
46a05253
GKH
94 void *Buffer,
95 u32 BufferLen,
96 u32 *BufferActualLen,
97 u64 *RequestId);
98
aded7165 99extern int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel,
46a05253
GKH
100 void *Buffer,
101 u32 BufferLen,
102 u32 *BufferActualLen,
103 u64 *RequestId);
104
aded7165 105extern void VmbusChannelOnChannelEvent(struct vmbus_channel *channel);
46a05253 106
aded7165
GKH
107extern void VmbusChannelGetDebugInfo(struct vmbus_channel *channel,
108 struct vmbus_channel_debug_info *debug);
46a05253
GKH
109
110extern void VmbusChannelOnTimer(unsigned long data);
111
454f18a9 112#endif /* _CHANNEL_H_ */