Commit | Line | Data |
---|---|---|
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_H_ | |
26 | #define _VMBUS_H_ | |
27 | ||
28 | #include <linux/device.h> | |
447fc67e | 29 | #include "vmbus_api.h" |
ab057781 | 30 | |
ab057781 | 31 | struct driver_context { |
caf26a31 | 32 | struct hv_guid class_id; |
ab057781 | 33 | |
08978655 | 34 | struct device_driver driver; |
ab057781 | 35 | |
08978655 GKH |
36 | /* |
37 | * Use these methods instead of the struct device_driver so 2.6 kernel | |
38 | * stops complaining | |
39 | * TODO - fix this! | |
40 | */ | |
ab057781 HJ |
41 | int (*probe)(struct device *); |
42 | int (*remove)(struct device *); | |
43 | void (*shutdown)(struct device *); | |
44 | }; | |
45 | ||
f916a34d | 46 | struct vm_device { |
08978655 | 47 | struct work_struct probe_failed_work_item; |
caf26a31 GKH |
48 | struct hv_guid class_id; |
49 | struct hv_guid device_id; | |
08978655 | 50 | int probe_error; |
3d3b5518 | 51 | struct hv_device device_obj; |
f916a34d | 52 | struct device device; |
ab057781 HJ |
53 | }; |
54 | ||
f916a34d | 55 | static inline struct vm_device *to_vm_device(struct hv_device *d) |
ab057781 | 56 | { |
f916a34d | 57 | return container_of(d, struct vm_device, device_obj); |
ab057781 HJ |
58 | } |
59 | ||
f916a34d | 60 | static inline struct vm_device *device_to_vm_device(struct device *d) |
ab057781 | 61 | { |
f916a34d | 62 | return container_of(d, struct vm_device, device); |
ab057781 HJ |
63 | } |
64 | ||
08978655 | 65 | static inline struct driver_context *driver_to_driver_context(struct device_driver *d) |
ab057781 | 66 | { |
08978655 | 67 | return container_of(d, struct driver_context, driver); |
ab057781 HJ |
68 | } |
69 | ||
454f18a9 BP |
70 | |
71 | /* Vmbus interface */ | |
72 | ||
08978655 GKH |
73 | int vmbus_child_driver_register(struct driver_context *driver_ctx); |
74 | void vmbus_child_driver_unregister(struct driver_context *driver_ctx); | |
ee3d7ddf | 75 | void vmbus_get_interface(struct vmbus_channel_interface *interface); |
ab057781 | 76 | |
8b5d6d3b HZ |
77 | extern struct completion hv_channel_ready; |
78 | ||
454f18a9 | 79 | #endif /* _VMBUS_H_ */ |