Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 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 | #pragma once |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 26 | /* allow nameless unions */ |
| 27 | /* #pragma warning(disable : 4201) */ |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 28 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 29 | |
| 30 | /* A revision number of vmbus that is used for ensuring both ends on a */ |
| 31 | /* partition are using compatible versions. */ |
| 32 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 33 | #define VMBUS_REVISION_NUMBER 13 |
| 34 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 35 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 36 | /* Make maximum size of pipe payload of 16K */ |
| 37 | |
| 38 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(BYTE) * 16384) |
| 39 | |
| 40 | |
| 41 | /* Define PipeMode values. */ |
| 42 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 43 | #define VMBUS_PIPE_TYPE_BYTE 0x00000000 |
| 44 | #define VMBUS_PIPE_TYPE_MESSAGE 0x00000004 |
| 45 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 46 | |
| 47 | /* The size of the user defined data buffer for non-pipe offers. */ |
| 48 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 49 | #define MAX_USER_DEFINED_BYTES 120 |
| 50 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 51 | |
| 52 | /* The size of the user defined data buffer for pipe offers. */ |
| 53 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 54 | #define MAX_PIPE_USER_DEFINED_BYTES 116 |
| 55 | |
| 56 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 57 | |
| 58 | /* At the center of the Channel Management library is */ |
| 59 | /* the Channel Offer. This struct contains the */ |
| 60 | /* fundamental information about an offer. */ |
| 61 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 62 | #pragma pack(push,1) |
| 63 | |
| 64 | typedef struct |
| 65 | { |
| 66 | |
| 67 | GUID InterfaceType; |
| 68 | GUID InterfaceInstance; |
Greg Kroah-Hartman | 5947143 | 2009-07-14 15:10:26 -0700 | [diff] [blame] | 69 | u64 InterruptLatencyIn100nsUnits; |
Greg Kroah-Hartman | 4d64311 | 2009-07-14 15:09:36 -0700 | [diff] [blame] | 70 | u32 InterfaceRevision; |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 71 | u32 ServerContextAreaSize; /* in bytes */ |
Greg Kroah-Hartman | 5cd508b | 2009-07-14 15:09:10 -0700 | [diff] [blame] | 72 | u16 ChannelFlags; |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 73 | u16 MmioMegabytes; /* in bytes * 1024 * 1024 */ |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 74 | |
| 75 | union |
| 76 | { |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 77 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 78 | /* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */ |
| 79 | |
| 80 | struct |
| 81 | { |
| 82 | unsigned char UserDefined[MAX_USER_DEFINED_BYTES]; |
| 83 | } Standard; |
| 84 | |
| 85 | |
| 86 | /* Pipes: The following sructure is an integrated pipe protocol, which */ |
| 87 | /* is implemented on top of standard user-defined data. Pipe clients */ |
| 88 | /* have MAX_PIPE_USER_DEFINED_BYTES left for their own use. */ |
| 89 | |
| 90 | struct |
| 91 | { |
| 92 | u32 PipeMode; |
| 93 | unsigned char UserDefined[MAX_PIPE_USER_DEFINED_BYTES]; |
| 94 | } Pipe; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 95 | } u; |
Greg Kroah-Hartman | 4d64311 | 2009-07-14 15:09:36 -0700 | [diff] [blame] | 96 | u32 Padding; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 97 | } VMBUS_CHANNEL_OFFER, *PVMBUS_CHANNEL_OFFER; |
| 98 | #pragma pack(pop) |
| 99 | |
| 100 | |
Greg Kroah-Hartman | 4d64311 | 2009-07-14 15:09:36 -0700 | [diff] [blame] | 101 | typedef u32 GPADL_HANDLE; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 102 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 103 | |
| 104 | /* Server Flags */ |
| 105 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 106 | |
| 107 | #define VMBUS_CHANNEL_ENUMERATE_DEVICE_INTERFACE 1 |
| 108 | #define VMBUS_CHANNEL_SERVER_SUPPORTS_TRANSFER_PAGES 2 |
| 109 | #define VMBUS_CHANNEL_SERVER_SUPPORTS_GPADLS 4 |
| 110 | #define VMBUS_CHANNEL_NAMED_PIPE_MODE 0x10 |
| 111 | #define VMBUS_CHANNEL_LOOPBACK_OFFER 0x100 |
| 112 | #define VMBUS_CHANNEL_PARENT_OFFER 0x200 |
| 113 | #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION 0x400 |
| 114 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 115 | |
| 116 | /* TEMPTEMP -- move this next define to devioctl.h some day */ |
| 117 | |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 118 | |
| 119 | #ifndef FILE_DEVICE_VMBUS |
| 120 | #define FILE_DEVICE_VMBUS 0x0000003E |
| 121 | #endif |