1 /******************************************************************************
2 * Talks to Xen Store to figure out what devices we have.
4 * Copyright (C) 2005 Rusty Russell, IBM Corporation
5 * Copyright (C) 2005 Mike Wray, Hewlett-Packard
6 * Copyright (C) 2005 XenSource Ltd
8 * This file may be distributed separately from the Linux kernel, or
9 * incorporated into other software packages, subject to the following license:
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this source file (the "Software"), to deal in the Software without
13 * restriction, including without limitation the rights to use, copy, modify,
14 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
15 * and to permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 #define DPRINTK(fmt, args...) \
32 printf("xenbus_probe (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
34 #define DPRINTK(fmt, args...) ((void)0)
37 #include <sys/cdefs.h>
38 __FBSDID("$FreeBSD$");
40 #include <sys/param.h>
41 #include <sys/types.h>
42 #include <sys/cdefs.h>
45 #include <sys/eventhandler.h>
46 #include <sys/errno.h>
47 #include <sys/kernel.h>
48 #include <sys/malloc.h>
49 #include <sys/module.h>
51 #include <sys/systm.h>
52 #include <sys/syslog.h>
57 #include <machine/xen/xen-os.h>
58 #include <machine/xen/hypervisor.h>
59 #include <machine/xen/xenbus.h>
60 #include <machine/xen/evtchn.h>
61 #include <machine/stdarg.h>
63 #include <xen/xenbus/xenbus_comms.h>
65 struct xendev_list_head xenbus_device_frontend_list;
66 struct xendev_list_head xenbus_device_backend_list;
67 static LIST_HEAD(, xenbus_driver) xendrv_list;
69 extern struct sx xenwatch_mutex;
71 EVENTHANDLER_DECLARE(xenstore_event, xenstore_event_handler_t);
72 static struct eventhandler_list *xenstore_chain;
74 device_t xenbus_backend_dev;
75 static MALLOC_DEFINE(M_XENDEV, "xenintrdrv", "xen system device");
77 #define streq(a, b) (strcmp((a), (b)) == 0)
79 static int watch_otherend(struct xenbus_device *dev);
82 /* If something in array of ids matches this device, return it. */
83 static const struct xenbus_device_id *
84 match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev)
86 for (; !streq(arr->devicetype, ""); arr++) {
87 if (streq(arr->devicetype, dev->devicetype))
94 static int xenbus_match(device_t _dev)
96 struct xenbus_driver *drv;
97 struct xenbus_device *dev;
99 dev = device_get_softc(_dev);
105 return match_device(drv->ids, to_xenbus_device(_dev)) != NULL;
110 /* device/<type>/<id> => <type>-<id> */
111 static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
113 nodename = strchr(nodename, '/');
114 if (!nodename || strlen(nodename + 1) >= BUS_ID_SIZE) {
115 log(LOG_WARNING, "XENBUS: bad frontend %s\n", nodename);
119 strlcpy(bus_id, nodename + 1, BUS_ID_SIZE);
120 if (!strchr(bus_id, '/')) {
121 log(LOG_WARNING, "XENBUS: bus_id %s no slash\n", bus_id);
124 *strchr(bus_id, '/') = '-';
129 static void free_otherend_details(struct xenbus_device *dev)
131 kfree((void*)(uintptr_t)dev->otherend);
132 dev->otherend = NULL;
136 static void free_otherend_watch(struct xenbus_device *dev)
138 if (dev->otherend_watch.node) {
139 unregister_xenbus_watch(&dev->otherend_watch);
140 kfree(dev->otherend_watch.node);
141 dev->otherend_watch.node = NULL;
146 read_otherend_details(struct xenbus_device *xendev, char *id_node,
149 int err = xenbus_gather(XBT_NIL, xendev->nodename,
150 id_node, "%i", &xendev->otherend_id,
151 path_node, NULL, &xendev->otherend,
154 xenbus_dev_fatal(xendev, err,
155 "reading other end details from %s",
159 if (strlen(xendev->otherend) == 0 ||
160 !xenbus_exists(XBT_NIL, xendev->otherend, "")) {
161 xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
163 kfree((void *)(uintptr_t)xendev->otherend);
164 xendev->otherend = NULL;
172 static int read_backend_details(struct xenbus_device *xendev)
174 return read_otherend_details(xendev, "backend-id", "backend");
178 /* XXX - move to probe backend */
179 static int read_frontend_details(struct xenbus_device *xendev)
181 if (strncmp(xendev->nodename, "backend", 7))
183 return read_otherend_details(xendev, "frontend-id", "frontend");
187 /* Bus type for frontend drivers. */
188 static int xenbus_probe_frontend(const char *type, const char *name);
189 static struct xen_bus_type xenbus_frontend = {
191 .levels = 2, /* device/type/<id> */
192 .get_bus_id = frontend_bus_id,
193 .probe = xenbus_probe_frontend,
194 .bus = &xenbus_device_frontend_list,
196 /* this initialization needs to happen dynamically */
199 .match = xenbus_match,
208 static int xenbus_hotplug_backend(device_t dev, char **envp,
209 int num_envp, char *buffer, int buffer_size)
211 panic("implement me");
213 struct xenbus_device *xdev;
214 struct xenbus_driver *drv = NULL;
225 xdev = to_xenbus_device(dev);
230 drv = to_xenbus_driver(dev->driver);
232 /* stuff we want to pass to /sbin/hotplug */
233 add_hotplug_env_var(envp, num_envp, &i,
234 buffer, buffer_size, &length,
235 "XENBUS_TYPE=%s", xdev->devicetype);
237 add_hotplug_env_var(envp, num_envp, &i,
238 buffer, buffer_size, &length,
239 "XENBUS_PATH=%s", xdev->nodename);
241 add_hotplug_env_var(envp, num_envp, &i,
242 buffer, buffer_size, &length,
243 "XENBUS_BASE_PATH=%s", xdev->nodename);
245 basepath_end = strrchr(envp[i - 1], '/');
246 length -= strlen(basepath_end);
247 *basepath_end = '\0';
248 basepath_end = strrchr(envp[i - 1], '/');
249 length -= strlen(basepath_end);
250 *basepath_end = '\0';
253 frontend_id = kmalloc(strlen(basepath_end) + 1, GFP_KERNEL);
254 strcpy(frontend_id, basepath_end);
255 add_hotplug_env_var(envp, num_envp, &i,
256 buffer, buffer_size, &length,
257 "XENBUS_FRONTEND_ID=%s", frontend_id);
260 /* terminate, set to next free slot, shrink available space */
264 buffer = &buffer[length];
265 buffer_size -= length;
267 if (drv && drv->hotplug)
268 return drv->hotplug(xdev, envp, num_envp, buffer, buffer_size);
276 static int xenbus_probe_backend(const char *type, const char *domid, int unit);
277 static struct xen_bus_type xenbus_backend = {
279 .levels = 3, /* backend/type/<frontend>/<id> */
280 .get_bus_id = backend_bus_id,
281 .probe = xenbus_probe_backend,
283 .bus = &xenbus_device_backend_list,
286 .name = "xen-backend",
287 .match = xenbus_match,
288 .hotplug = xenbus_hotplug_backend,
291 .bus_id = "xen-backend",
297 static void otherend_changed(struct xenbus_watch *watch,
298 const char **vec, unsigned int len)
301 struct xenbus_device *dev = (struct xenbus_device *)watch;
302 struct xenbus_driver *drv = dev->driver;
305 /* Protect us against watches firing on old details when the otherend
306 details change, say immediately after a resume. */
307 if (!dev->otherend || strncmp(dev->otherend, vec[XS_WATCH_PATH],
308 strlen(dev->otherend))) {
309 DPRINTK("Ignoring watch at %s", vec[XS_WATCH_PATH]);
313 state = xenbus_read_driver_state(dev->otherend);
315 DPRINTK("state is %d, %s, %s", state, dev->otherend_watch.node,
319 * Ignore xenbus transitions during shutdown. This prevents us doing
320 * work that can fail e.g., when the rootfs is gone.
323 if (system_state > SYSTEM_RUNNING) {
324 struct xen_bus_type *bus = bus;
325 bus = container_of(dev->dev.bus, struct xen_bus_type, bus);
326 /* If we're frontend, drive the state machine to Closed. */
327 /* This should cause the backend to release our resources. */
328 if ((bus == &xenbus_frontend) && (state == XenbusStateClosing))
329 xenbus_frontend_closed(dev);
333 if (drv->otherend_changed)
334 drv->otherend_changed(dev, state);
339 static int talk_to_otherend(struct xenbus_device *dev)
341 struct xenbus_driver *drv;
345 free_otherend_watch(dev);
346 free_otherend_details(dev);
348 return drv->read_otherend_details(dev);
351 static int watch_otherend(struct xenbus_device *dev)
353 return xenbus_watch_path2(dev, dev->otherend, "state",
354 &dev->otherend_watch, otherend_changed);
358 xenbus_dev_probe(struct xenbus_device *dev)
360 struct xenbus_driver *drv = dev->driver;
361 const struct xenbus_device_id *id;
371 id = match_device(drv->ids, dev);
377 err = talk_to_otherend(dev);
380 "xenbus_probe: talk_to_otherend on %s failed.\n",
385 err = drv->probe(dev, id);
389 err = watch_otherend(dev);
392 "xenbus_probe: watch_otherend on %s failed.\n",
399 xenbus_dev_error(dev, err, "xenbus_dev_probe on %s", dev->nodename);
400 xenbus_switch_state(dev, XenbusStateClosed);
404 static void xenbus_dev_free(struct xenbus_device *xendev)
406 LIST_REMOVE(xendev, list);
411 xenbus_remove_device(struct xenbus_device *dev)
413 struct xenbus_driver *drv = dev->driver;
417 free_otherend_watch(dev);
418 free_otherend_details(dev);
423 xenbus_switch_state(dev, XenbusStateClosed);
425 if (drv->cleanup_device)
426 return drv->cleanup_device(dev);
428 xenbus_dev_free(dev);
435 xenbus_dev_remove(device_t _dev)
437 return xenbus_remove_device(to_xenbus_device(_dev));
441 int xenbus_register_driver_common(struct xenbus_driver *drv,
442 struct xen_bus_type *bus)
444 struct xenbus_device *xdev;
448 /* this all happens in the driver itself
449 * doing this here simple serves to obfuscate
452 drv->driver.name = drv->name;
453 drv->driver.bus = &bus->bus;
454 drv->driver.owner = drv->owner;
455 drv->driver.probe = xenbus_dev_probe;
456 drv->driver.remove = xenbus_dev_remove;
460 sx_xlock(&xenwatch_mutex);
461 LIST_INSERT_HEAD(&xendrv_list, drv, list);
462 sx_xunlock(&xenwatch_mutex);
463 LIST_FOREACH(xdev, bus->bus, list) {
464 if (match_device(drv->ids, xdev)) {
466 xenbus_dev_probe(xdev);
472 int xenbus_register_frontend(struct xenbus_driver *drv)
474 drv->read_otherend_details = read_backend_details;
476 return xenbus_register_driver_common(drv, &xenbus_frontend);
478 EXPORT_SYMBOL(xenbus_register_frontend);
481 void xenbus_unregister_driver(struct xenbus_driver *drv)
484 driver_unregister(&drv->driver);
487 EXPORT_SYMBOL(xenbus_unregister_driver);
491 struct xenbus_device *dev;
492 const char *nodename;
495 static struct xenbus_device *
496 xenbus_device_find(const char *nodename, struct xendev_list_head *bus)
498 struct xenbus_device *xdev;
499 LIST_FOREACH(xdev, bus, list) {
500 if (streq(xdev->nodename, nodename)) {
510 static int cleanup_dev(device_t dev, void *data)
512 struct xenbus_device *xendev = device_get_softc(dev);
513 struct xb_find_info *info = data;
514 int len = strlen(info->nodename);
516 DPRINTK("%s", info->nodename);
518 if (!strncmp(xendev->nodename, info->nodename, len)) {
529 static void xenbus_cleanup_devices(const char *path, struct xendev_list_head * bus)
532 struct xb_find_info info = { .nodename = path };
536 bus_for_each_dev(bus, NULL, &info, cleanup_dev);
538 device_unregister(&info.dev->dev);
539 put_device(&info.dev->dev);
546 void xenbus_dev_release(device_t dev)
549 * nothing to do softc gets freed with the device
554 /* Simplified asprintf. */
555 char *kasprintf(const char *fmt, ...)
562 /* FIXME: vsnprintf has a bug, NULL should work */
563 len = vsnprintf(dummy, 0, fmt, ap);
566 p = kmalloc(len + 1, GFP_KERNEL);
570 vsprintf(p, fmt, ap);
576 static ssize_t xendev_show_nodename(struct device *dev, char *buf)
578 return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
580 DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
582 static ssize_t xendev_show_devtype(struct device *dev, char *buf)
584 return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
586 DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
589 int xenbus_probe_node(struct xen_bus_type *bus, const char *type,
590 const char *nodename)
601 struct xenbus_device *xendev;
602 struct xenbus_driver *xdrv;
606 XenbusState state = xenbus_read_driver_state(nodename);
612 if (state != XenbusStateInitialising) {
613 /* Device is not new, so ignore it. This can happen if a
614 device is going away after switching to Closed. */
618 stringlen = strlen(nodename) + 1 + strlen(type) + 1;
619 xendev = kmalloc(sizeof(*xendev) + stringlen, GFP_KERNEL);
622 memset(xendev, 0, sizeof(*xendev));
623 xendev->state = XenbusStateInitialising;
625 /* Copy the strings into the extra space. */
627 tmpstring = (char *)(xendev + 1);
628 strcpy(tmpstring, nodename);
629 xendev->nodename = tmpstring;
631 tmpstring += strlen(tmpstring) + 1;
632 strcpy(tmpstring, type);
633 xendev->devicetype = tmpstring;
635 * equivalent to device registration
638 LIST_INSERT_HEAD(bus->bus, xendev, list);
639 LIST_FOREACH(xdrv, &xendrv_list, list) {
640 if (match_device(xdrv->ids, xendev)) {
641 xendev->driver = xdrv;
642 if (!xenbus_dev_probe(xendev))
648 xendev->dev.parent = &bus->dev;
649 xendev->dev.bus = &bus->bus;
650 xendev->dev.release = xenbus_dev_release;
652 err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename);
655 /* Register with generic device framework. */
656 err = device_register(&xendev->dev);
659 device_create_file(&xendev->dev, &dev_attr_nodename);
660 device_create_file(&xendev->dev, &dev_attr_devtype);
667 xenbus_dev_free(xendev);
672 /* device/<typename>/<name> */
673 static int xenbus_probe_frontend(const char *type, const char *name)
678 nodename = kasprintf("%s/%s/%s", xenbus_frontend.root, type, name);
682 DPRINTK("%s", nodename);
684 err = xenbus_probe_node(&xenbus_frontend, type, nodename);
689 static int xenbus_probe_device_type(struct xen_bus_type *bus, const char *type)
693 unsigned int dir_n = 0;
696 dir = xenbus_directory(XBT_NIL, bus->root, type, &dir_n);
700 for (i = 0; i < dir_n; i++) {
701 err = bus->probe(type, dir[i]);
709 int xenbus_probe_devices(struct xen_bus_type *bus)
713 unsigned int i, dir_n;
715 dir = xenbus_directory(XBT_NIL, bus->root, "", &dir_n);
719 for (i = 0; i < dir_n; i++) {
720 err = xenbus_probe_device_type(bus, dir[i]);
729 static unsigned int char_count(const char *str, char c)
731 unsigned int i, ret = 0;
733 for (i = 0; str[i]; i++)
739 static int strsep_len(const char *str, char c, unsigned int len)
743 for (i = 0; str[i]; i++)
749 return (len == 0) ? i : -ERANGE;
752 void dev_changed(const char *node, struct xen_bus_type *bus)
755 struct xenbus_device *dev;
756 char type[BUS_ID_SIZE];
761 if (char_count(node, '/') < 2)
764 exists = xenbus_exists(XBT_NIL, node, "");
766 xenbus_cleanup_devices(node, bus->bus);
770 /* backend/<type>/... or device/<type>/... */
771 p = strchr(node, '/') + 1;
772 snprintf(type, BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p);
773 type[BUS_ID_SIZE-1] = '\0';
775 rootlen = strsep_len(node, '/', bus->levels);
778 root = kasprintf("%.*s", rootlen, node);
782 dev = xenbus_device_find(root, bus->bus);
784 xenbus_probe_node(bus, type, root);
787 put_device(&dev->dev);
792 static void frontend_changed(struct xenbus_watch *watch,
793 const char **vec, unsigned int len)
797 dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
800 /* We watch for devices appearing and vanishing. */
801 static struct xenbus_watch fe_watch = {
803 .callback = frontend_changed,
808 static int suspend_dev(device_t dev, void *data)
811 struct xenbus_driver *drv;
812 struct xenbus_device *xdev;
816 xdev = device_get_softc(dev);
820 if (device_get_driver(dev) == NULL)
824 err = drv->suspend(xdev);
828 log(LOG_WARNING, "xenbus: suspend %s failed: %i\n",
836 static int resume_dev(device_t dev, void *data)
839 struct xenbus_driver *drv;
840 struct xenbus_device *xdev;
844 if (device_get_driver(dev) == NULL)
846 xdev = device_get_softc(dev);
849 err = talk_to_otherend(xdev);
853 "xenbus: resume (talk_to_otherend) %s failed: %i\n",
859 err = drv->resume(xdev);
861 err = watch_otherend(xdev);
866 "xenbus: resume %s failed: %i\n", dev->bus_id, err);
872 void xenbus_suspend(void)
875 panic("implement me");
877 bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_dev);
878 bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, suspend_dev);
882 EXPORT_SYMBOL(xenbus_suspend);
884 void xenbus_resume(void)
888 panic("implement me");
890 bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev);
891 bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, resume_dev);
894 EXPORT_SYMBOL(xenbus_resume);
898 xenbus_add_child(device_t bus, int order, const char *name, int unit)
902 child = device_add_child_ordered(bus, order, name, unit);
908 /* A flag to determine if xenstored is 'ready' (i.e. has started) */
909 int xenstored_ready = 0;
912 int register_xenstore_notifier(xenstore_event_handler_t func, void *arg, int priority)
916 if (xenstored_ready > 0)
919 eventhandler_register(xenstore_chain, "xenstore", func, arg, priority);
923 EXPORT_SYMBOL(register_xenstore_notifier);
925 void unregister_xenstore_notifier(struct notifier_block *nb)
927 notifier_chain_unregister(&xenstore_chain, nb);
929 EXPORT_SYMBOL(unregister_xenstore_notifier);
935 static struct proc_dir_entry *xsd_mfn_intf;
936 static struct proc_dir_entry *xsd_port_intf;
939 static int xsd_mfn_read(char *page, char **start, off_t off,
940 int count, int *eof, void *data)
943 len = sprintf(page, "%ld", xen_start_info->store_mfn);
948 static int xsd_port_read(char *page, char **start, off_t off,
949 int count, int *eof, void *data)
953 len = sprintf(page, "%d", xen_start_info->store_evtchn);
963 xenbus_probe_sysinit(void *unused)
969 LIST_INIT(&xenbus_device_frontend_list);
970 LIST_INIT(&xenbus_device_backend_list);
971 LIST_INIT(&xendrv_list);
973 if (xen_init() < 0) {
979 /* Register ourselves with the kernel bus & device subsystems */
980 bus_register(&xenbus_frontend.bus);
981 bus_register(&xenbus_backend.bus);
982 device_register(&xenbus_frontend.dev);
983 device_register(&xenbus_backend.dev);
987 ** Domain0 doesn't have a store_evtchn or store_mfn yet.
989 dom0 = (xen_start_info->store_evtchn == 0);
996 evtchn_op_t op = { 0 };
1000 /* Allocate page. */
1001 page = get_zeroed_page(GFP_KERNEL);
1005 /* We don't refcnt properly, so set reserved on page.
1006 * (this allocation is permanent) */
1007 SetPageReserved(virt_to_page(page));
1009 xen_start_info->store_mfn =
1010 pfn_to_mfn(virt_to_phys((void *)page) >>
1013 /* Next allocate a local port which xenstored can bind to */
1014 op.cmd = EVTCHNOP_alloc_unbound;
1015 op.u.alloc_unbound.dom = DOMID_SELF;
1016 op.u.alloc_unbound.remote_dom = 0;
1018 ret = HYPERVISOR_event_channel_op(&op);
1020 xen_start_info->store_evtchn = op.u.alloc_unbound.port;
1022 /* And finally publish the above info in /proc/xen */
1023 if((xsd_mfn_intf = create_xen_proc_entry("xsd_mfn", 0400)))
1024 xsd_mfn_intf->read_proc = xsd_mfn_read;
1025 if((xsd_port_intf = create_xen_proc_entry("xsd_port", 0400)))
1026 xsd_port_intf->read_proc = xsd_port_read;
1029 /* Initialize the interface to xenstore. */
1033 "XENBUS: Error initializing xenstore comms: %i\n", err);
1042 xenbus_probe_sysinit2(void *unused)
1045 xenstored_ready = 1;
1047 xenbus_dev = BUS_ADD_CHILD(parent, 0, "xenbus", 0);
1048 if (xenbus_dev == NULL)
1049 panic("xenbus: could not attach");
1050 xenbus_backend_dev = BUS_ADD_CHILD(parent, 0, "xb_be", 0);
1051 if (xenbus_backend_dev == NULL)
1052 panic("xenbus: could not attach");
1054 BUG_ON((xenstored_ready <= 0));
1058 /* Enumerate devices in xenstore. */
1059 xenbus_probe_devices(&xenbus_frontend);
1060 register_xenbus_watch(&fe_watch);
1061 xenbus_backend_probe_and_watch();
1063 /* Notify others that xenstore is up */
1064 EVENTHANDLER_INVOKE(xenstore_event);
1070 SYSINIT(xenbus_probe_sysinit, SI_SUB_PSEUDO, SI_ORDER_FIRST, xenbus_probe_sysinit, NULL);
1071 SYSINIT(xenbus_probe_sysinit2, SI_SUB_PSEUDO, SI_ORDER_ANY,
1072 xenbus_probe_sysinit2, NULL);
1075 static device_method_t xenbus_methods[] = {
1076 /* Device interface */
1078 DEVMETHOD(device_identify, xenbus_identify),
1079 DEVMETHOD(device_probe, xenbus_probe),
1080 DEVMETHOD(device_attach, xenbus_attach),
1082 DEVMETHOD(device_detach, bus_generic_detach),
1083 DEVMETHOD(device_shutdown, bus_generic_shutdown),
1085 DEVMETHOD(device_suspend, xenbus_suspend),
1086 DEVMETHOD(device_resume, xenbus_resume),
1089 DEVMETHOD(bus_print_child, bus_generic_print_child),
1090 DEVMETHOD(bus_add_child, xenbus_add_child),
1091 DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),
1092 DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
1094 DEVMETHOD(bus_set_resource, bus_generic_set_resource),
1095 DEVMETHOD(bus_get_resource, bus_generic_get_resource),
1097 DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
1098 DEVMETHOD(bus_release_resource, bus_generic_release_resource),
1100 DEVMETHOD(bus_delete_resource, bus_generic_delete_resource),
1102 DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
1103 DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
1104 DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
1105 DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
1110 static char driver_name[] = "xenbus";
1111 static driver_t xenbus_driver = {
1114 sizeof(struct xenbus_device),
1116 devclass_t xenbus_devclass;
1118 DRIVER_MODULE(xenbus, nexus, xenbus_driver, xenbus_devclass, 0, 0);
1128 * c-file-style: "bsd"
1129 * indent-tabs-mode: t