1 /******************************************************************************
4 * Talks to Xen Store to figure out what devices we have.
6 * Copyright (C) 2005 Rusty Russell, IBM Corporation
7 * Copyright (C) 2005 XenSource Ltd.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation; or, when distributed
12 * separately from the Linux kernel or incorporated into other
13 * software packages, subject to the following license:
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34 #ifndef _XENBUS_PROBE_H
35 #define _XENBUS_PROBE_H
38 #define XEN_BUS_ID_SIZE 20
40 #define XEN_BUS_ID_SIZE BUS_ID_SIZE
43 #ifdef CONFIG_PARAVIRT_XEN
44 #define is_running_on_xen() xen_domain()
45 #define is_initial_xendomain() xen_initial_domain()
46 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
47 #define dev_name(dev) ((dev)->bus_id)
50 #if defined(CONFIG_XEN_BACKEND) || defined(CONFIG_XEN_BACKEND_MODULE)
51 extern void xenbus_backend_suspend(int (*fn)(struct device *, void *));
52 extern void xenbus_backend_resume(int (*fn)(struct device *, void *));
53 extern void xenbus_backend_probe_and_watch(void);
54 extern void xenbus_backend_bus_register(void);
55 extern void xenbus_backend_device_register(void);
57 static inline void xenbus_backend_suspend(int (*fn)(struct device *, void *)) {}
58 static inline void xenbus_backend_resume(int (*fn)(struct device *, void *)) {}
59 static inline void xenbus_backend_probe_and_watch(void) {}
60 static inline void xenbus_backend_bus_register(void) {}
61 static inline void xenbus_backend_device_register(void) {}
68 int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename);
69 int (*probe)(struct xen_bus_type *bus, const char *type,
71 #if !defined(CONFIG_XEN) && !defined(HAVE_XEN_PLATFORM_COMPAT_H)
72 void (*otherend_changed)(struct xenbus_watch *watch, const char **vec,
80 extern struct device_attribute xenbus_dev_attrs[];
82 extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
83 extern int xenbus_dev_probe(struct device *_dev);
84 extern int xenbus_dev_remove(struct device *_dev);
85 extern int xenbus_register_driver_common(struct xenbus_driver *drv,
86 struct xen_bus_type *bus);
87 extern int xenbus_probe_node(struct xen_bus_type *bus,
89 const char *nodename);
90 extern int xenbus_probe_devices(struct xen_bus_type *bus);
92 extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
94 extern void xenbus_dev_shutdown(struct device *_dev);
96 extern int xenbus_dev_suspend(struct device *dev);
97 extern int xenbus_dev_resume(struct device *dev);
98 extern int xenbus_dev_cancel(struct device *dev);
100 extern void xenbus_otherend_changed(struct xenbus_watch *watch,
101 const char **vec, unsigned int len,
102 int ignore_on_shutdown);
104 extern int xenbus_read_otherend_details(struct xenbus_device *xendev,
105 char *id_node, char *path_node);
107 void xenbus_ring_ops_init(void);