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
58 #define BUS_TYPE_TAP 6
61 #define BUS_TYPE_EFI 7
64 #define BUS_TYPE_XEN 8
66 /** A hardware device */
71 const char *driver_name;
72 /** Device description */
73 struct device_description desc;
74 /** Devices on the same bus */
75 struct list_head siblings;
76 /** Devices attached to this device */
77 struct list_head children;
79 struct device *parent;
85 * Root devices are system buses such as PCI, EISA, etc.
91 * A root device has a NULL parent field.
94 /** Root device driver */
95 struct root_driver *driver;
98 /** A root device driver */
103 * @v rootdev Root device
104 * @ret rc Return status code
106 * Called from probe_devices() for all root devices in the build.
108 int ( * probe ) ( struct root_device *rootdev );
112 * @v rootdev Root device
114 * Called from remove_device() for all successfully-probed
117 void ( * remove ) ( struct root_device *rootdev );
120 /** Root device table */
121 #define ROOT_DEVICES __table ( struct root_device, "root_devices" )
123 /** Declare a root device */
124 #define __root_device __table_entry ( ROOT_DEVICES, 01 )
126 extern int device_keep_count;
129 * Prevent devices from being removed on shutdown
132 static inline void devices_get ( void ) {
137 * Allow devices to be removed on shutdown
140 static inline void devices_put ( void ) {
144 extern struct device * identify_device ( struct interface *intf );
145 #define identify_device_TYPE( object_type ) \
146 typeof ( struct device * ( object_type ) )
148 #endif /* _IPXE_DEVICE_H */