Staging: hv: remove struct vmbus_driver
[deliverable/linux.git] / drivers / staging / hv / vmbus_api.h
CommitLineData
ab057781
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 _VMBUS_API_H_
26#define _VMBUS_API_H_
27
ab057781 28#define MAX_PAGE_BUFFER_COUNT 16
454f18a9
BP
29#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
30
54b2b847 31#pragma pack(push, 1)
ab057781 32
454f18a9 33/* Single-page buffer */
ee3d7ddf 34struct hv_page_buffer {
54b2b847
GKH
35 u32 Length;
36 u32 Offset;
37 u64 Pfn;
ee3d7ddf 38};
ab057781 39
454f18a9 40/* Multiple-page buffer */
ee3d7ddf 41struct hv_multipage_buffer {
454f18a9 42 /* Length and Offset determines the # of pfns in the array */
54b2b847
GKH
43 u32 Length;
44 u32 Offset;
45 u64 PfnArray[MAX_MULTIPAGE_BUFFER_COUNT];
ee3d7ddf 46};
ab057781 47
454f18a9 48/* 0x18 includes the proprietary packet header */
54b2b847 49#define MAX_PAGE_BUFFER_PACKET (0x18 + \
ee3d7ddf 50 (sizeof(struct hv_page_buffer) * \
54b2b847 51 MAX_PAGE_BUFFER_COUNT))
ee3d7ddf
GKH
52#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
53 sizeof(struct hv_multipage_buffer))
ab057781
HJ
54
55
56#pragma pack(pop)
57
775ef25e 58struct hv_driver;
3d3b5518
NP
59struct hv_device;
60
ee3d7ddf 61struct hv_dev_port_info {
54b2b847
GKH
62 u32 InterruptMask;
63 u32 ReadIndex;
64 u32 WriteIndex;
65 u32 BytesAvailToRead;
66 u32 BytesAvailToWrite;
ee3d7ddf 67};
ab057781 68
ee3d7ddf 69struct hv_device_info {
54b2b847
GKH
70 u32 ChannelId;
71 u32 ChannelState;
caf26a31
GKH
72 struct hv_guid ChannelType;
73 struct hv_guid ChannelInstance;
ab057781 74
54b2b847
GKH
75 u32 MonitorId;
76 u32 ServerMonitorPending;
77 u32 ServerMonitorLatency;
78 u32 ServerMonitorConnectionId;
79 u32 ClientMonitorPending;
80 u32 ClientMonitorLatency;
81 u32 ClientMonitorConnectionId;
ab057781 82
ee3d7ddf
GKH
83 struct hv_dev_port_info Inbound;
84 struct hv_dev_port_info Outbound;
85};
ab057781 86
454f18a9 87/* Base driver object */
775ef25e 88struct hv_driver {
54b2b847
GKH
89 const char *name;
90
91 /* the device type supported by this driver */
92 struct hv_guid deviceType;
ab057781 93
74982610
GKH
94 int (*OnDeviceAdd)(struct hv_device *device, void *data);
95 int (*OnDeviceRemove)(struct hv_device *device);
96 void (*OnCleanup)(struct hv_driver *driver);
775ef25e 97};
ab057781 98
454f18a9 99/* Base device object */
3d3b5518 100struct hv_device {
54b2b847
GKH
101 /* the driver for this device */
102 struct hv_driver *Driver;
103
104 char name[64];
105
106 /* the device type id of this device */
107 struct hv_guid deviceType;
ab057781 108
54b2b847
GKH
109 /* the device instance id of this device */
110 struct hv_guid deviceInstance;
111
cae5b843 112 struct vmbus_channel *channel;
54b2b847
GKH
113
114 /* Device extension; */
115 void *Extension;
116};
ab057781 117
54b2b847 118int VmbusInitialize(struct hv_driver *drv);
097e3103 119int vmbus_on_isr(struct hv_driver *drv);
4a1494fc 120void vmbus_on_msg_dpc(struct hv_driver *drv);
c722bd3e 121void vmbus_on_event_dpc(struct hv_driver *drv);
ab057781 122
454f18a9 123#endif /* _VMBUS_API_H_ */
This page took 0.163075 seconds and 5 git commands to generate.