iPXE
xenbus.h
Go to the documentation of this file.
1#ifndef _IPXE_XENBUS_H
2#define _IPXE_XENBUS_H
3
4/** @file
5 *
6 * Xen device bus
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <ipxe/device.h>
14#include <ipxe/tables.h>
15#include <ipxe/xen.h>
16#include <xen/io/xenbus.h>
17
18/** A Xen device */
19struct xen_device {
20 /** Generic iPXE device */
21 struct device dev;
22 /** Xen hypervisor */
24 /** XenStore key */
25 char *key;
26 /** Backend XenStore key */
27 char *backend;
28 /** Backend domain ID */
29 unsigned long backend_id;
30 /** Driver */
32 /** Driver-private data */
33 void *priv;
34};
35
36/** A Xen device driver */
37struct xen_driver {
38 /** Name */
39 const char *name;
40 /** Device type */
41 const char *type;
42 /** Probe device
43 *
44 * @v xendev Xen device
45 * @ret rc Return status code
46 */
47 int ( * probe ) ( struct xen_device *xendev );
48 /** Remove device
49 *
50 * @v xendev Xen device
51 */
52 void ( * remove ) ( struct xen_device *xendev );
53};
54
55/** Xen device driver table */
56#define XEN_DRIVERS __table ( struct xen_driver, "xen_drivers" )
57
58/** Declare a Xen device driver */
59#define __xen_driver __table_entry ( XEN_DRIVERS, 01 )
60
61/** Define build rules for a Xen device driver */
62#define XEN_ROM( _name, _desc )
63
64/**
65 * Set Xen device driver-private data
66 *
67 * @v xendev Xen device
68 * @v priv Private data
69 */
70static inline void xen_set_drvdata ( struct xen_device *xendev, void *priv ) {
71 xendev->priv = priv;
72}
73
74/**
75 * Get Xen device driver-private data
76 *
77 * @v xendev Xen device
78 * @ret priv Private data
79 */
80static inline void * xen_get_drvdata ( struct xen_device *xendev ) {
81 return xendev->priv;
82}
83
84extern int xenbus_set_state ( struct xen_device *xendev, int state );
85extern int xenbus_backend_state ( struct xen_device *xendev );
86extern int xenbus_backend_wait ( struct xen_device *xendev, int state );
87extern int xenbus_probe ( struct xen_hypervisor *xen, struct device *parent );
88extern void xenbus_remove ( struct xen_hypervisor *xen, struct device *parent );
89
90#endif /* _IPXE_XENBUS_H */
Device model.
uint8_t state
State.
Definition eth_slow.h:36
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
Xen interface.
int xenbus_backend_state(struct xen_device *xendev)
Get backend state.
Definition xenbus.c:127
static void * xen_get_drvdata(struct xen_device *xendev)
Get Xen device driver-private data.
Definition xenbus.h:80
int xenbus_set_state(struct xen_device *xendev, int state)
Set device state.
Definition xenbus.c:107
void xenbus_remove(struct xen_hypervisor *xen, struct device *parent)
int xenbus_backend_wait(struct xen_device *xendev, int state)
Wait for backend to reach a given state.
Definition xenbus.c:149
static void xen_set_drvdata(struct xen_device *xendev, void *priv)
Set Xen device driver-private data.
Definition xenbus.h:70
int xenbus_probe(struct xen_hypervisor *xen, struct device *parent)
Probe Xen bus.
Definition xenbus.c:355
A hardware device.
Definition device.h:77
A Xen device.
Definition xenbus.h:19
struct xen_driver * driver
Driver.
Definition xenbus.h:31
void * priv
Driver-private data.
Definition xenbus.h:33
unsigned long backend_id
Backend domain ID.
Definition xenbus.h:29
struct device dev
Generic iPXE device.
Definition xenbus.h:21
char * key
XenStore key.
Definition xenbus.h:25
struct xen_hypervisor * xen
Xen hypervisor.
Definition xenbus.h:23
char * backend
Backend XenStore key.
Definition xenbus.h:27
A Xen device driver.
Definition xenbus.h:37
const char * type
Device type.
Definition xenbus.h:41
const char * name
Name.
Definition xenbus.h:39
void(* remove)(struct xen_device *xendev)
Remove device.
Definition xenbus.h:52
int(* probe)(struct xen_device *xendev)
Probe device.
Definition xenbus.h:47
A Xen hypervisor.
Definition xen.h:51
Linker tables.
static struct tlan_private * priv
Definition tlan.c:225