Staging: hv: Get rid of the priv pointer in struct hv_driver
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / hv / vmbus_api.h
blob51fa952dd574a28e954d6aee3f3c67dcb069423b
1 /*
3 * Copyright (c) 2009, Microsoft Corporation.
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.
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.
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.
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
25 #ifndef _VMBUS_API_H_
26 #define _VMBUS_API_H_
28 #include <linux/device.h>
29 #include <linux/workqueue.h>
31 #define MAX_PAGE_BUFFER_COUNT 16
32 #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
34 #pragma pack(push, 1)
36 /* Single-page buffer */
37 struct hv_page_buffer {
38 u32 len;
39 u32 offset;
40 u64 pfn;
43 /* Multiple-page buffer */
44 struct hv_multipage_buffer {
45 /* Length and Offset determines the # of pfns in the array */
46 u32 len;
47 u32 offset;
48 u64 pfn_array[MAX_MULTIPAGE_BUFFER_COUNT];
51 /* 0x18 includes the proprietary packet header */
52 #define MAX_PAGE_BUFFER_PACKET (0x18 + \
53 (sizeof(struct hv_page_buffer) * \
54 MAX_PAGE_BUFFER_COUNT))
55 #define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
56 sizeof(struct hv_multipage_buffer))
59 #pragma pack(pop)
61 struct hv_driver;
62 struct hv_device;
64 struct hv_dev_port_info {
65 u32 int_mask;
66 u32 read_idx;
67 u32 write_idx;
68 u32 bytes_avail_toread;
69 u32 bytes_avail_towrite;
72 struct hv_device_info {
73 u32 chn_id;
74 u32 chn_state;
75 struct hv_guid chn_type;
76 struct hv_guid chn_instance;
78 u32 monitor_id;
79 u32 server_monitor_pending;
80 u32 server_monitor_latency;
81 u32 server_monitor_conn_id;
82 u32 client_monitor_pending;
83 u32 client_monitor_latency;
84 u32 client_monitor_conn_id;
86 struct hv_dev_port_info inbound;
87 struct hv_dev_port_info outbound;
90 /* Base driver object */
91 struct hv_driver {
92 const char *name;
94 /* the device type supported by this driver */
95 struct hv_guid dev_type;
97 struct device_driver driver;
99 int (*dev_add)(struct hv_device *device, void *data);
100 int (*dev_rm)(struct hv_device *device);
101 void (*cleanup)(struct hv_driver *driver);
104 /* Base device object */
105 struct hv_device {
106 /* the driver for this device */
107 struct hv_driver *drv;
109 char name[64];
111 struct work_struct probe_failed_work_item;
113 int probe_error;
115 /* the device type id of this device */
116 struct hv_guid dev_type;
118 /* the device instance id of this device */
119 struct hv_guid dev_instance;
121 struct device device;
123 struct vmbus_channel *channel;
125 /* Device extension; */
126 void *ext;
129 #endif /* _VMBUS_API_H_ */