11 FILE_LICENCE ( GPL2_OR_LATER );
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
57 /** A hardware device */
62 const char *driver_name;
63 /** Device description */
64 struct device_description desc;
65 /** Devices on the same bus */
66 struct list_head siblings;
67 /** Devices attached to this device */
68 struct list_head children;
70 struct device *parent;
76 * Root devices are system buses such as PCI, EISA, etc.
82 * A root device has a NULL parent field.
85 /** Root device driver */
86 struct root_driver *driver;
89 /** A root device driver */
94 * @v rootdev Root device
95 * @ret rc Return status code
97 * Called from probe_devices() for all root devices in the build.
99 int ( * probe ) ( struct root_device *rootdev );
103 * @v rootdev Root device
105 * Called from remove_device() for all successfully-probed
108 void ( * remove ) ( struct root_device *rootdev );
111 /** Root device table */
112 #define ROOT_DEVICES __table ( struct root_device, "root_devices" )
114 /** Declare a root device */
115 #define __root_device __table_entry ( ROOT_DEVICES, 01 )
117 extern int device_keep_count;
120 * Prevent devices from being removed on shutdown
123 static inline void devices_get ( void ) {
128 * Allow devices to be removed on shutdown
131 static inline void devices_put ( void ) {
135 extern struct device * identify_device ( struct interface *intf );
136 #define identify_device_TYPE( object_type ) \
137 typeof ( struct device * ( object_type ) )
139 #endif /* _IPXE_DEVICE_H */