upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / hv / vmbus_channel_interface.h
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 #ifndef __VMBUSCHANNELINTERFACE_H
25 #define __VMBUSCHANNELINTERFACE_H
26
27 /*
28  * A revision number of vmbus that is used for ensuring both ends on a
29  * partition are using compatible versions.
30  */
31 #define VMBUS_REVISION_NUMBER           13
32
33 /* Make maximum size of pipe payload of 16K */
34 #define MAX_PIPE_DATA_PAYLOAD           (sizeof(u8) * 16384)
35
36 /* Define PipeMode values. */
37 #define VMBUS_PIPE_TYPE_BYTE            0x00000000
38 #define VMBUS_PIPE_TYPE_MESSAGE         0x00000004
39
40 /* The size of the user defined data buffer for non-pipe offers. */
41 #define MAX_USER_DEFINED_BYTES          120
42
43 /* The size of the user defined data buffer for pipe offers. */
44 #define MAX_PIPE_USER_DEFINED_BYTES     116
45
46 /*
47  * At the center of the Channel Management library is the Channel Offer. This
48  * struct contains the fundamental information about an offer.
49  */
50 struct vmbus_channel_offer {
51         struct hv_guid InterfaceType;
52         struct hv_guid InterfaceInstance;
53         u64 InterruptLatencyIn100nsUnits;
54         u32 InterfaceRevision;
55         u32 ServerContextAreaSize;      /* in bytes */
56         u16 ChannelFlags;
57         u16 MmioMegabytes;              /* in bytes * 1024 * 1024 */
58
59         union {
60                 /* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
61                 struct {
62                         unsigned char UserDefined[MAX_USER_DEFINED_BYTES];
63                 } Standard;
64
65                 /*
66                  * Pipes:
67                  * The following sructure is an integrated pipe protocol, which
68                  * is implemented on top of standard user-defined data. Pipe
69                  * clients have MAX_PIPE_USER_DEFINED_BYTES left for their own
70                  * use.
71                  */
72                 struct {
73                         u32  PipeMode;
74                         unsigned char UserDefined[MAX_PIPE_USER_DEFINED_BYTES];
75                 } Pipe;
76         } u;
77         u32 Padding;
78 } __attribute__((packed));
79
80 /* Server Flags */
81 #define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE        1
82 #define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES    2
83 #define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS            4
84 #define VMBUS_CHANNEL_NAMED_PIPE_MODE                   0x10
85 #define VMBUS_CHANNEL_LOOPBACK_OFFER                    0x100
86 #define VMBUS_CHANNEL_PARENT_OFFER                      0x200
87 #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION    0x400
88
89 #endif