Commit | Line | Data |
---|---|---|
5c473400 S |
1 | /* |
2 | * | |
3 | * Copyright (c) 2011, 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 | * K. Y. Srinivasan <kys@microsoft.com> | |
22 | * | |
23 | */ | |
3f335ea2 S |
24 | |
25 | #ifndef _HYPERV_H | |
26 | #define _HYPERV_H | |
27 | ||
28 | struct hv_guid { | |
29 | unsigned char data[16]; | |
30 | }; | |
31 | ||
a363bf7b S |
32 | #define MAX_PAGE_BUFFER_COUNT 16 |
33 | #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ | |
34 | ||
35 | #pragma pack(push, 1) | |
36 | ||
37 | /* Single-page buffer */ | |
38 | struct hv_page_buffer { | |
39 | u32 len; | |
40 | u32 offset; | |
41 | u64 pfn; | |
42 | }; | |
43 | ||
44 | /* Multiple-page buffer */ | |
45 | struct hv_multipage_buffer { | |
46 | /* Length and Offset determines the # of pfns in the array */ | |
47 | u32 len; | |
48 | u32 offset; | |
49 | u64 pfn_array[MAX_MULTIPAGE_BUFFER_COUNT]; | |
50 | }; | |
51 | ||
52 | /* 0x18 includes the proprietary packet header */ | |
53 | #define MAX_PAGE_BUFFER_PACKET (0x18 + \ | |
54 | (sizeof(struct hv_page_buffer) * \ | |
55 | MAX_PAGE_BUFFER_COUNT)) | |
56 | #define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \ | |
57 | sizeof(struct hv_multipage_buffer)) | |
58 | ||
59 | ||
60 | #pragma pack(pop) | |
61 | ||
7effffb7 S |
62 | struct hv_ring_buffer { |
63 | /* Offset in bytes from the start of ring data below */ | |
64 | u32 write_index; | |
65 | ||
66 | /* Offset in bytes from the start of ring data below */ | |
67 | u32 read_index; | |
68 | ||
69 | u32 interrupt_mask; | |
70 | ||
71 | /* Pad it to PAGE_SIZE so that data starts on page boundary */ | |
72 | u8 reserved[4084]; | |
73 | ||
74 | /* NOTE: | |
75 | * The interrupt_mask field is used only for channels but since our | |
76 | * vmbus connection also uses this data structure and its data starts | |
77 | * here, we commented out this field. | |
78 | */ | |
79 | ||
80 | /* | |
81 | * Ring data starts here + RingDataStartOffset | |
82 | * !!! DO NOT place any fields below this !!! | |
83 | */ | |
84 | u8 buffer[0]; | |
85 | } __packed; | |
86 | ||
87 | struct hv_ring_buffer_info { | |
88 | struct hv_ring_buffer *ring_buffer; | |
89 | u32 ring_size; /* Include the shared header */ | |
90 | spinlock_t ring_lock; | |
91 | ||
92 | u32 ring_datasize; /* < ring_size */ | |
93 | u32 ring_data_startoffset; | |
94 | }; | |
95 | ||
96 | struct hv_ring_buffer_debug_info { | |
97 | u32 current_interrupt_mask; | |
98 | u32 current_read_index; | |
99 | u32 current_write_index; | |
100 | u32 bytes_avail_toread; | |
101 | u32 bytes_avail_towrite; | |
102 | }; | |
3f335ea2 S |
103 | |
104 | #endif /* _HYPERV_H */ |