Commit | Line | Data |
---|---|---|
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 | ||
09d50ff8 | 28 | #include "include/osd.h" |
3e7ee490 HJ |
29 | #include "ChannelMgmt.h" |
30 | ||
454f18a9 | 31 | /* The format must be the same as VMDATA_GPA_DIRECT */ |
0cf4fa80 | 32 | struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER { |
46a05253 GKH |
33 | u16 Type; |
34 | u16 DataOffset8; | |
35 | u16 Length8; | |
36 | u16 Flags; | |
37 | u64 TransactionId; | |
38 | u32 Reserved; | |
39 | u32 RangeCount; | |
40 | PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT]; | |
41 | } __attribute__((packed)); | |
3e7ee490 | 42 | |
454f18a9 | 43 | /* The format must be the same as VMDATA_GPA_DIRECT */ |
3fcc523a | 44 | struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER { |
46a05253 GKH |
45 | u16 Type; |
46 | u16 DataOffset8; | |
47 | u16 Length8; | |
48 | u16 Flags; | |
49 | u64 TransactionId; | |
50 | u32 Reserved; | |
51 | u32 RangeCount; /* Always 1 in this case */ | |
52 | MULTIPAGE_BUFFER Range; | |
53 | } __attribute__((packed)); | |
54 | ||
55 | ||
aded7165 | 56 | extern int VmbusChannelOpen(struct vmbus_channel *channel, |
46a05253 GKH |
57 | u32 SendRingBufferSize, |
58 | u32 RecvRingBufferSize, | |
59 | void *UserData, | |
60 | u32 UserDataLen, | |
61 | PFN_CHANNEL_CALLBACK pfnOnChannelCallback, | |
62 | void *Context); | |
63 | ||
aded7165 | 64 | extern void VmbusChannelClose(struct vmbus_channel *channel); |
46a05253 | 65 | |
aded7165 | 66 | extern int VmbusChannelSendPacket(struct vmbus_channel *channel, |
46a05253 GKH |
67 | const void *Buffer, |
68 | u32 BufferLen, | |
69 | u64 RequestId, | |
70 | VMBUS_PACKET_TYPE Type, | |
71 | u32 Flags); | |
72 | ||
aded7165 | 73 | extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel, |
46a05253 GKH |
74 | PAGE_BUFFER PageBuffers[], |
75 | u32 PageCount, | |
76 | void *Buffer, | |
77 | u32 BufferLen, | |
78 | u64 RequestId); | |
79 | ||
aded7165 | 80 | extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel, |
46a05253 GKH |
81 | MULTIPAGE_BUFFER *MultiPageBuffer, |
82 | void *Buffer, | |
83 | u32 BufferLen, | |
84 | u64 RequestId); | |
85 | ||
aded7165 | 86 | extern int VmbusChannelEstablishGpadl(struct vmbus_channel *channel, |
46a05253 GKH |
87 | void *Kbuffer, |
88 | u32 Size, | |
89 | u32 *GpadlHandle); | |
90 | ||
aded7165 | 91 | extern int VmbusChannelTeardownGpadl(struct vmbus_channel *channel, |
46a05253 GKH |
92 | u32 GpadlHandle); |
93 | ||
aded7165 | 94 | extern int VmbusChannelRecvPacket(struct vmbus_channel *channel, |
46a05253 GKH |
95 | void *Buffer, |
96 | u32 BufferLen, | |
97 | u32 *BufferActualLen, | |
98 | u64 *RequestId); | |
99 | ||
aded7165 | 100 | extern int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel, |
46a05253 GKH |
101 | void *Buffer, |
102 | u32 BufferLen, | |
103 | u32 *BufferActualLen, | |
104 | u64 *RequestId); | |
105 | ||
aded7165 | 106 | extern void VmbusChannelOnChannelEvent(struct vmbus_channel *channel); |
46a05253 | 107 | |
aded7165 GKH |
108 | extern void VmbusChannelGetDebugInfo(struct vmbus_channel *channel, |
109 | struct vmbus_channel_debug_info *debug); | |
46a05253 GKH |
110 | |
111 | extern void VmbusChannelOnTimer(unsigned long data); | |
112 | ||
454f18a9 | 113 | #endif /* _CHANNEL_H_ */ |