summaryrefslogtreecommitdiff
path: root/drivers/staging/hv/include/vmbus.h
blob: 6f7eecb4b83ecf951b59e65c37d4e7baf2fbfc0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 *
 * Copyright (c) 2009, Microsoft Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307 USA.
 *
 * Authors:
 *   Haiyang Zhang <haiyangz@microsoft.com>
 *   Hank Janssen  <hjanssen@microsoft.com>
 *
 */


#ifndef _VMBUS_H_
#define _VMBUS_H_

#include <linux/device.h>

#include "VmbusApi.h"


/* Data types */


typedef int (*PFN_DRIVERINITIALIZE)(struct hv_driver *drv);
typedef int (*PFN_DRIVEREXIT)(struct hv_driver *drv);

struct driver_context {
	GUID					class_id;

	struct device_driver	driver;

	/* Use these methods instead of the struct device_driver so 2.6 kernel stops complaining */
	int (*probe)(struct device *);
	int (*remove)(struct device *);
	void (*shutdown)(struct device *);
};

struct device_context {
	struct work_struct              probe_failed_work_item;
	GUID					class_id;
	GUID					device_id;
	int						probe_error;
	struct device			device;
	struct hv_device device_obj;
};



/* Global */



/* Inlines */

static inline struct device_context *to_device_context(struct hv_device *device_obj)
{
	return container_of(device_obj, struct device_context, device_obj);
}

static inline struct device_context *device_to_device_context(struct device *device)
{
	return container_of(device, struct device_context, device);
}

static inline struct driver_context *driver_to_driver_context(struct device_driver *driver)
{
	return container_of(driver, struct driver_context, driver);
}


/* Vmbus interface */

int vmbus_child_driver_register(
	struct driver_context* driver_ctx
	);

void
vmbus_child_driver_unregister(
	struct driver_context *driver_ctx
	);

void
vmbus_get_interface(
	VMBUS_CHANNEL_INTERFACE *interface
	);

#endif /* _VMBUS_H_ */