1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef _VMBUSPACKETFORMAT_H_
25
26struct vmpacket_descriptor {
27 u16 Type;
28 u16 DataOffset8;
29 u16 Length8;
30 u16 Flags;
31 u64 TransactionId;
32} __attribute__((packed));
33
34struct vmpacket_header {
35 u32 PreviousPacketStartOffset;
36 struct vmpacket_descriptor Descriptor;
37} __attribute__((packed));
38
39struct vmtransfer_page_range {
40 u32 ByteCount;
41 u32 ByteOffset;
42} __attribute__((packed));
43
44struct vmtransfer_page_packet_header {
45 struct vmpacket_descriptor d;
46 u16 TransferPageSetId;
47 bool SenderOwnsSet;
48 u8 Reserved;
49 u32 RangeCount;
50 struct vmtransfer_page_range Ranges[1];
51} __attribute__((packed));
52
53struct vmgpadl_packet_header {
54 struct vmpacket_descriptor d;
55 u32 Gpadl;
56 u32 Reserved;
57} __attribute__((packed));
58
59struct vmadd_remove_transfer_page_set {
60 struct vmpacket_descriptor d;
61 u32 Gpadl;
62 u16 TransferPageSetId;
63 u16 Reserved;
64} __attribute__((packed));
65
66
67
68
69
70struct gpa_range {
71 u32 ByteCount;
72 u32 ByteOffset;
73 u64 PfnArray[0];
74};
75
76
77
78
79
80
81
82
83struct vmestablish_gpadl {
84 struct vmpacket_descriptor d;
85 u32 Gpadl;
86 u32 RangeCount;
87 struct gpa_range Range[1];
88} __attribute__((packed));
89
90
91
92
93
94struct vmteardown_gpadl {
95 struct vmpacket_descriptor d;
96 u32 Gpadl;
97 u32 Reserved;
98} __attribute__((packed));
99
100
101
102
103
104struct vmdata_gpa_direct {
105 struct vmpacket_descriptor d;
106 u32 Reserved;
107 u32 RangeCount;
108 struct gpa_range Range[1];
109} __attribute__((packed));
110
111
112struct vmadditional_data {
113 struct vmpacket_descriptor d;
114 u64 TotalBytes;
115 u32 ByteOffset;
116 u32 ByteCount;
117 unsigned char Data[1];
118} __attribute__((packed));
119
120union vmpacket_largest_possible_header {
121 struct vmpacket_descriptor SimpleHeader;
122 struct vmtransfer_page_packet_header TransferPageHeader;
123 struct vmgpadl_packet_header GpadlHeader;
124 struct vmadd_remove_transfer_page_set AddRemoveTransferPageHeader;
125 struct vmestablish_gpadl EstablishGpadlHeader;
126 struct vmteardown_gpadl TeardownGpadlHeader;
127 struct vmdata_gpa_direct DataGpaDirectHeader;
128};
129
130#define VMPACKET_DATA_START_ADDRESS(__packet) \
131 (void *)(((unsigned char *)__packet) + \
132 ((struct vmpacket_descriptor)__packet)->DataOffset8 * 8)
133
134#define VMPACKET_DATA_LENGTH(__packet) \
135 ((((struct vmpacket_descriptor)__packet)->Length8 - \
136 ((struct vmpacket_descriptor)__packet)->DataOffset8) * 8)
137
138#define VMPACKET_TRANSFER_MODE(__packet) \
139 (((struct IMPACT)__packet)->Type)
140
141enum vmbus_packet_type {
142 VmbusPacketTypeInvalid = 0x0,
143 VmbusPacketTypeSynch = 0x1,
144 VmbusPacketTypeAddTransferPageSet = 0x2,
145 VmbusPacketTypeRemoveTransferPageSet = 0x3,
146 VmbusPacketTypeEstablishGpadl = 0x4,
147 VmbusPacketTypeTearDownGpadl = 0x5,
148 VmbusPacketTypeDataInBand = 0x6,
149 VmbusPacketTypeDataUsingTransferPages = 0x7,
150 VmbusPacketTypeDataUsingGpadl = 0x8,
151 VmbusPacketTypeDataUsingGpaDirect = 0x9,
152 VmbusPacketTypeCancelRequest = 0xa,
153 VmbusPacketTypeCompletion = 0xb,
154 VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
155 VmbusPacketTypeAdditionalData = 0xd
156};
157
158#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
159
160#endif
161