On Tue, Nov 06, 2007 at 02:33:53AM -0800, akpm@linux-foundation.org wrote:
[mmotm.git] / include / linux / vbus_driver.h
blob9cfbf60df684fcd49718d8106c785fe8491f0a78
1 /*
2 * Copyright 2009 Novell. All Rights Reserved.
4 * Mediates access to a host VBUS from a guest kernel by providing a
5 * global view of all VBUS devices
7 * Author:
8 * Gregory Haskins <ghaskins@novell.com>
10 * This file is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef _LINUX_VBUS_DRIVER_H
25 #define _LINUX_VBUS_DRIVER_H
27 #include <linux/device.h>
28 #include <linux/shm_signal.h>
29 #include <linux/ioq.h>
31 struct vbus_device_proxy;
32 struct vbus_driver;
34 struct vbus_device_proxy_ops {
35 int (*open)(struct vbus_device_proxy *dev, int version, int flags);
36 int (*close)(struct vbus_device_proxy *dev, int flags);
37 int (*shm)(struct vbus_device_proxy *dev, int id, int prio,
38 void *ptr, size_t len,
39 struct shm_signal_desc *sigdesc, struct shm_signal **signal,
40 int flags);
41 int (*call)(struct vbus_device_proxy *dev, u32 func,
42 void *data, size_t len, int flags);
43 void (*release)(struct vbus_device_proxy *dev);
46 struct vbus_device_proxy {
47 char *type;
48 u64 id;
49 void *priv; /* Used by drivers */
50 struct vbus_device_proxy_ops *ops;
51 struct device dev;
54 int vbus_device_proxy_register(struct vbus_device_proxy *dev);
55 void vbus_device_proxy_unregister(struct vbus_device_proxy *dev);
57 struct vbus_device_proxy *vbus_device_proxy_find(u64 id);
59 struct vbus_driver_ops {
60 int (*probe)(struct vbus_device_proxy *dev);
61 int (*remove)(struct vbus_device_proxy *dev);
64 struct vbus_driver {
65 char *type;
66 struct module *owner;
67 struct vbus_driver_ops *ops;
68 struct device_driver drv;
71 int vbus_driver_register(struct vbus_driver *drv);
72 void vbus_driver_unregister(struct vbus_driver *drv);
75 * driver-side IOQ helper - allocates device-shm and maps an IOQ on it
77 int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, int id, int prio,
78 size_t ringsize, struct ioq **ioq);
80 #endif /* _LINUX_VBUS_DRIVER_H */