Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * xenbus_probe.h |
| 3 | * |
| 4 | * Talks to Xen Store to figure out what devices we have. |
| 5 | * |
| 6 | * Copyright (C) 2005 Rusty Russell, IBM Corporation |
| 7 | * Copyright (C) 2005 XenSource Ltd. |
| 8 | * |
| 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: |
| 14 | * |
| 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: |
| 21 | * |
| 22 | * The above copyright notice and this permission notice shall be included in |
| 23 | * all copies or substantial portions of the Software. |
| 24 | * |
| 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 |
| 31 | * IN THE SOFTWARE. |
| 32 | */ |
| 33 | |
| 34 | #ifndef _XENBUS_PROBE_H |
| 35 | #define _XENBUS_PROBE_H |
| 36 | |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 37 | #define XEN_BUS_ID_SIZE 20 |
| 38 | |
Ruslan Pisarev | 822a259 | 2011-07-26 14:17:01 +0300 | [diff] [blame] | 39 | struct xen_bus_type { |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 40 | char *root; |
| 41 | unsigned int levels; |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 42 | int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); |
Ian Campbell | 6bac7f9 | 2010-12-10 14:39:15 +0000 | [diff] [blame] | 43 | int (*probe)(struct xen_bus_type *bus, const char *type, |
| 44 | const char *dir); |
| 45 | void (*otherend_changed)(struct xenbus_watch *watch, const char **vec, |
| 46 | unsigned int len); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 47 | struct bus_type bus; |
| 48 | }; |
| 49 | |
Aurelien Chartier | 33c1174 | 2013-05-28 18:09:55 +0100 | [diff] [blame] | 50 | enum xenstore_init { |
| 51 | XS_UNKNOWN, |
| 52 | XS_PV, |
| 53 | XS_HVM, |
| 54 | XS_LOCAL, |
| 55 | }; |
| 56 | |
Greg Kroah-Hartman | 85dd926 | 2013-10-06 23:55:49 -0700 | [diff] [blame] | 57 | extern const struct attribute_group *xenbus_dev_groups[]; |
Bastian Blank | cc85e93 | 2011-06-29 14:39:26 +0200 | [diff] [blame] | 58 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 59 | extern int xenbus_match(struct device *_dev, struct device_driver *_drv); |
| 60 | extern int xenbus_dev_probe(struct device *_dev); |
| 61 | extern int xenbus_dev_remove(struct device *_dev); |
| 62 | extern int xenbus_register_driver_common(struct xenbus_driver *drv, |
David Vrabel | 95afae4 | 2014-09-08 17:30:41 +0100 | [diff] [blame] | 63 | struct xen_bus_type *bus, |
| 64 | struct module *owner, |
| 65 | const char *mod_name); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 66 | extern int xenbus_probe_node(struct xen_bus_type *bus, |
| 67 | const char *type, |
| 68 | const char *nodename); |
| 69 | extern int xenbus_probe_devices(struct xen_bus_type *bus); |
| 70 | |
| 71 | extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); |
| 72 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 73 | extern void xenbus_dev_shutdown(struct device *_dev); |
| 74 | |
Kazuhiro SUZUKI | c7853ae | 2011-02-18 14:43:07 -0800 | [diff] [blame] | 75 | extern int xenbus_dev_suspend(struct device *dev); |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 76 | extern int xenbus_dev_resume(struct device *dev); |
Kazuhiro SUZUKI | c7853ae | 2011-02-18 14:43:07 -0800 | [diff] [blame] | 77 | extern int xenbus_dev_cancel(struct device *dev); |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 78 | |
| 79 | extern void xenbus_otherend_changed(struct xenbus_watch *watch, |
| 80 | const char **vec, unsigned int len, |
| 81 | int ignore_on_shutdown); |
| 82 | |
| 83 | extern int xenbus_read_otherend_details(struct xenbus_device *xendev, |
| 84 | char *id_node, char *path_node); |
| 85 | |
Daniel De Graaf | 2c5d37d | 2011-12-19 14:55:14 -0500 | [diff] [blame] | 86 | void xenbus_ring_ops_init(void); |
| 87 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 88 | #endif |