blob: ef2b5496f8f09c01a2ee256d29b395177ec14db5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#ifndef _IPXE_XENBUS_H
#define _IPXE_XENBUS_H
/** @file
*
* Xen device bus
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/device.h>
#include <ipxe/tables.h>
#include <ipxe/xen.h>
#include <xen/io/xenbus.h>
/** A Xen device */
struct xen_device {
/** Generic iPXE device */
struct device dev;
/** Xen hypervisor */
struct xen_hypervisor *xen;
/** XenStore key */
char *key;
/** Backend XenStore key */
char *backend;
/** Backend domain ID */
unsigned long backend_id;
/** Driver */
struct xen_driver *driver;
/** Driver-private data */
void *priv;
};
/** A Xen device driver */
struct xen_driver {
/** Name */
const char *name;
/** Device type */
const char *type;
/** Probe device
*
* @v xendev Xen device
* @ret rc Return status code
*/
int ( * probe ) ( struct xen_device *xendev );
/** Remove device
*
* @v xendev Xen device
*/
void ( * remove ) ( struct xen_device *xendev );
};
/** Xen device driver table */
#define XEN_DRIVERS __table ( struct xen_driver, "xen_drivers" )
/** Declare a Xen device driver */
#define __xen_driver __table_entry ( XEN_DRIVERS, 01 )
/**
* Set Xen device driver-private data
*
* @v xendev Xen device
* @v priv Private data
*/
static inline void xen_set_drvdata ( struct xen_device *xendev, void *priv ) {
xendev->priv = priv;
}
/**
* Get Xen device driver-private data
*
* @v xendev Xen device
* @ret priv Private data
*/
static inline void * xen_get_drvdata ( struct xen_device *xendev ) {
return xendev->priv;
}
extern int xenbus_set_state ( struct xen_device *xendev, int state );
extern int xenbus_backend_state ( struct xen_device *xendev );
extern int xenbus_backend_wait ( struct xen_device *xendev, int state );
extern int xenbus_probe ( struct xen_hypervisor *xen, struct device *parent );
extern void xenbus_remove ( struct xen_hypervisor *xen, struct device *parent );
#endif /* _IPXE_XENBUS_H */
|