FreeBSD kernel /amd64 XEN device code
xenstored_dev.c File Reference
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/uio.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/module.h>
#include <xen/xen-os.h>
#include <xen/hypervisor.h>
#include <xen/xenstore/xenstorevar.h>
#include <vm/vm.h>
#include <vm/pmap.h>
Include dependency graph for xenstored_dev.c:

Go to the source code of this file.

Macros

#define XSD_READ_SIZE   20
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int xsd_dev_read (struct cdev *dev, struct uio *uio, int ioflag)
 
static int xsd_dev_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
 
static void xsd_dev_identify (driver_t *driver __unused, device_t parent)
 Identify instances of this device type in the system. More...
 
static int xsd_dev_probe (device_t dev)
 Probe for the existence of the Xenstored device. More...
 
static int xsd_dev_attach (device_t dev)
 Attach the Xenstored device. More...
 
 DEFINE_CLASS_0 (xsd_dev, xsd_dev_driver, xsd_dev_methods, 0)
 
 DRIVER_MODULE (xsd_dev, xenpv, xsd_dev_driver, xsd_dev_devclass, NULL, NULL)
 

Variables

static struct cdevsw xsd_dev_cdevsw
 
static device_method_t xsd_dev_methods []
 
devclass_t xsd_dev_devclass
 

Macro Definition Documentation

◆ XSD_READ_SIZE

#define XSD_READ_SIZE   20

Definition at line 50 of file xenstored_dev.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DEFINE_CLASS_0()

DEFINE_CLASS_0 ( xsd_dev  ,
xsd_dev_driver  ,
xsd_dev_methods  ,
 
)

◆ DRIVER_MODULE()

DRIVER_MODULE ( xsd_dev  ,
xenpv  ,
xsd_dev_driver  ,
xsd_dev_devclass  ,
NULL  ,
NULL   
)

◆ xsd_dev_attach()

static int xsd_dev_attach ( device_t  dev)
static

Attach the Xenstored device.

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

Definition at line 138 of file xenstored_dev.c.

References xsd_dev_cdevsw.

◆ xsd_dev_identify()

static void xsd_dev_identify ( driver_t *driver  __unused,
device_t  parent 
)
static

Identify instances of this device type in the system.

Parameters
driverThe driver performing this identify action.
parentThe NewBus parent device for any devices this method adds.

Definition at line 101 of file xenstored_dev.c.

References xs_initialized().

Here is the call graph for this function:

◆ xsd_dev_mmap()

static int xsd_dev_mmap ( struct cdev *  dev,
vm_ooffset_t  offset,
vm_paddr_t *  paddr,
int  nprot,
vm_memattr_t *  memattr 
)
static

Definition at line 81 of file xenstored_dev.c.

References xs_address().

Here is the call graph for this function:

◆ xsd_dev_probe()

static int xsd_dev_probe ( device_t  dev)
static

Probe for the existence of the Xenstored device.

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

Definition at line 122 of file xenstored_dev.c.

◆ xsd_dev_read()

static int xsd_dev_read ( struct cdev *  dev,
struct uio *  uio,
int  ioflag 
)
static

Definition at line 64 of file xenstored_dev.c.

References xs_evtchn(), and XSD_READ_SIZE.

Here is the call graph for this function:

Variable Documentation

◆ xsd_dev_cdevsw

struct cdevsw xsd_dev_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_read = xsd_dev_read,
.d_mmap = xsd_dev_mmap,
.d_name = "xsd_dev",
}
static int xsd_dev_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
Definition: xenstored_dev.c:81
static int xsd_dev_read(struct cdev *dev, struct uio *uio, int ioflag)
Definition: xenstored_dev.c:64

Definition at line 56 of file xenstored_dev.c.

Referenced by xsd_dev_attach().

◆ xsd_dev_devclass

devclass_t xsd_dev_devclass

Definition at line 161 of file xenstored_dev.c.

◆ xsd_dev_methods

device_method_t xsd_dev_methods[]
static
Initial value:
= {
DEVMETHOD(device_identify, xsd_dev_identify),
DEVMETHOD(device_probe, xsd_dev_probe),
DEVMETHOD(device_attach, xsd_dev_attach),
DEVMETHOD_END
}
static int xsd_dev_probe(device_t dev)
Probe for the existence of the Xenstored device.
static void xsd_dev_identify(driver_t *driver __unused, device_t parent)
Identify instances of this device type in the system.
static int xsd_dev_attach(device_t dev)
Attach the Xenstored device.

Definition at line 151 of file xenstored_dev.c.