11
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13
#include <ipxe/list.h>
14
#include <ipxe/tables.h>
18
/** A hardware device description */
19
struct device_description {
22
* This must be a BUS_TYPE_XXX constant.
24
unsigned int bus_type;
27
* The interpretation of this field is bus-type-specific.
29
unsigned int location;
43
#define BUS_TYPE_PCI 1
45
/** ISAPnP bus type */
46
#define BUS_TYPE_ISAPNP 2
49
#define BUS_TYPE_EISA 3
52
#define BUS_TYPE_MCA 4
55
#define BUS_TYPE_ISA 5
58
#define BUS_TYPE_TAP 6
61
#define BUS_TYPE_EFI 7
64
#define BUS_TYPE_XEN 8
66
/** Hyper-V bus type */
70
#define BUS_TYPE_USB 10
72
/** A hardware device */
77
const char *driver_name;
78
/** Device description */
79
struct device_description desc;
80
/** Devices on the same bus */
81
struct list_head siblings;
82
/** Devices attached to this device */
83
struct list_head children;
85
struct device *parent;
91
* Root devices are system buses such as PCI, EISA, etc.
97
* A root device has a NULL parent field.
100
/** Root device driver */
101
struct root_driver *driver;
102
/** Driver-private data */
106
/** A root device driver */
111
* @v rootdev Root device
112
* @ret rc Return status code
114
* Called from probe_devices() for all root devices in the build.
116
int ( * probe ) ( struct root_device *rootdev );
120
* @v rootdev Root device
122
* Called from remove_device() for all successfully-probed
125
void ( * remove ) ( struct root_device *rootdev );
128
/** Root device table */
129
#define ROOT_DEVICES __table ( struct root_device, "root_devices" )
131
/** Declare a root device */
132
#define __root_device __table_entry ( ROOT_DEVICES, 01 )
135
* Set root device driver-private data
137
* @v rootdev Root device
138
* @v priv Private data
140
static inline void rootdev_set_drvdata ( struct root_device *rootdev,
142
rootdev->priv = priv;
146
* Get root device driver-private data
148
* @v rootdev Root device
149
* @ret priv Private data
151
static inline void * rootdev_get_drvdata ( struct root_device *rootdev ) {
152
return rootdev->priv;
155
extern int device_keep_count;
158
* Prevent devices from being removed on shutdown
161
static inline void devices_get ( void ) {
166
* Allow devices to be removed on shutdown
169
static inline void devices_put ( void ) {
173
extern struct device * identify_device ( struct interface *intf );
174
#define identify_device_TYPE( object_type ) \
175
typeof ( struct device * ( object_type ) )
177
#endif /* _IPXE_DEVICE_H */