FreeBSD xen subsystem code
xenbusb_front.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/sx.h>
#include <sys/taskqueue.h>
#include <machine/stdarg.h>
#include <xen/xen-os.h>
#include <xen/gnttab.h>
#include <xen/xenbus/xenbusvar.h>
#include <xen/xenbus/xenbusb.h>
Include dependency graph for xenbusb_front.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
static int xenbusb_front_probe (device_t dev)
 Probe for the existence of the XenBus front bus. More...
 
static int xenbusb_front_attach (device_t dev)
 Attach the XenBus front bus. More...
 
static int xenbusb_front_enumerate_type (device_t dev, const char *type)
 Enumerate all devices of the given type on this bus. More...
 
static int xenbusb_front_get_otherend_node (device_t dev, struct xenbus_device_ivars *ivars)
 Determine and store the XenStore path for the other end of a split device whose local end is represented by ivars. More...
 
 DEFINE_CLASS_0 (xenbusb_front, xenbusb_front_driver, xenbusb_front_methods, sizeof(struct xenbusb_softc))
 
 DRIVER_MODULE (xenbusb_front, xenstore, xenbusb_front_driver, xenbusb_front_devclass, 0, 0)
 

Variables

static device_method_t xenbusb_front_methods []
 
devclass_t xenbusb_front_devclass
 

Detailed Description

XenBus management of the NewBus bus containing the frontend instances of Xen split devices.

Definition in file xenbusb_front.c.

Function Documentation

◆ xenbusb_front_attach()

static int xenbusb_front_attach ( device_t  dev)
static

Attach the XenBus front bus.

Parameters
devNewBus device_t for this XenBus front bus instance.
Returns
On success, 0. Otherwise an errno value indicating the type of failure.

Definition at line 86 of file xenbusb_front.c.

References xenbusb_attach().

Here is the call graph for this function:

◆ xenbusb_front_enumerate_type()

static int xenbusb_front_enumerate_type ( device_t  dev,
const char *  type 
)
static

Enumerate all devices of the given type on this bus.

Parameters
devNewBus device_t for this XenBus front bus instance.
typeString indicating the device sub-tree (e.g. "vfb", "vif") to enumerate.
Returns
On success, 0. Otherwise an errno value indicating the type of failure.

Devices that are found are entered into the NewBus hierarchy via xenbusb_add_device(). xenbusb_add_device() ignores duplicate detects and ignores duplicate devices, so it can be called unconditionally for any device found in the XenStore.

Definition at line 107 of file xenbusb_front.c.

References xenbusb_softc::xbs_node, and xenbusb_add_device().

Here is the call graph for this function:

◆ xenbusb_front_get_otherend_node()

static int xenbusb_front_get_otherend_node ( device_t  dev,
struct xenbus_device_ivars ivars 
)
static

Determine and store the XenStore path for the other end of a split device whose local end is represented by ivars.

If successful, the xd_otherend_path field of the child's instance variables will be updated.

Parameters
devNewBus device_t for this XenBus front bus instance.
ivarsInstance variables from the XenBus child device for which to perform this function.
Returns
On success, 0. Otherwise an errno value indicating the type of failure.

Definition at line 141 of file xenbusb_front.c.

References xenbus_device_ivars::xd_node, xenbus_device_ivars::xd_otherend_id, xenbus_device_ivars::xd_otherend_path, and xenbus_device_ivars::xd_otherend_path_len.

◆ xenbusb_front_probe()

static int xenbusb_front_probe ( device_t  dev)
static

Probe for the existence of the XenBus front bus.

Parameters
devNewBus device_t for this XenBus front bus instance.
Returns
Always returns 0 indicating success.

Definition at line 70 of file xenbusb_front.c.

Variable Documentation

◆ xenbusb_front_devclass

devclass_t xenbusb_front_devclass

Definition at line 192 of file xenbusb_front.c.

◆ xenbusb_front_methods

device_method_t xenbusb_front_methods[]
static
Initial value:
= {
DEVMETHOD(device_identify, xenbusb_identify),
DEVMETHOD(device_probe, xenbusb_front_probe),
DEVMETHOD(device_attach, xenbusb_front_attach),
DEVMETHOD(device_detach, bus_generic_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, xenbusb_resume),
DEVMETHOD(bus_print_child, xenbusb_print_child),
DEVMETHOD(bus_read_ivar, xenbusb_read_ivar),
DEVMETHOD(bus_write_ivar, xenbusb_write_ivar),
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(xenbusb_enumerate_type, xenbusb_front_enumerate_type),
DEVMETHOD(xenbusb_get_otherend_node, xenbusb_front_get_otherend_node),
{ 0, 0 }
}
int xenbusb_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
Common XenBus child instance variable read access method.
Definition: xenbusb.c:870
int xenbusb_print_child(device_t dev, device_t child)
Pretty-prints information about a child of a XenBus bus.
Definition: xenbusb.c:857
void xenbusb_identify(driver_t *driver __unused, device_t parent)
Identify instances of this device type in the system.
Definition: xenbusb.c:627
int xenbusb_resume(device_t dev)
Perform common XenBus bus resume handling.
Definition: xenbusb.c:791
int xenbusb_write_ivar(device_t dev, device_t child, int index, uintptr_t value)
Common XenBus child instance variable write access method.
Definition: xenbusb.c:900
static int xenbusb_front_attach(device_t dev)
Attach the XenBus front bus.
Definition: xenbusb_front.c:86
static int xenbusb_front_probe(device_t dev)
Probe for the existence of the XenBus front bus.
Definition: xenbusb_front.c:70
static int xenbusb_front_enumerate_type(device_t dev, const char *type)
Enumerate all devices of the given type on this bus.
static int xenbusb_front_get_otherend_node(device_t dev, struct xenbus_device_ivars *ivars)
Determine and store the XenStore path for the other end of a split device whose local end is represen...

Definition at line 165 of file xenbusb_front.c.