[sundance] Add reset completion check
[gpxe.git] / src / include / gpxe / device.h
blobf40cc95a274dcc0a138faa9b2c73e6485e4b187b
1 #ifndef _GPXE_DEVICE_H
2 #define _GPXE_DEVICE_H
4 /**
5 * @file
7 * Device model
9 */
11 #include <gpxe/list.h>
12 #include <gpxe/tables.h>
14 /** A hardware device description */
15 struct device_description {
16 /** Bus type
18 * This must be a BUS_TYPE_XXX constant.
20 unsigned int bus_type;
21 /** Location
23 * The interpretation of this field is bus-type-specific.
25 unsigned int location;
26 /** Vendor ID */
27 unsigned int vendor;
28 /** Device ID */
29 unsigned int device;
30 /** Device class */
31 unsigned long class;
32 /** I/O address */
33 unsigned long ioaddr;
34 /** IRQ */
35 unsigned int irq;
38 /** PCI bus type */
39 #define BUS_TYPE_PCI 1
41 /** ISAPnP bus type */
42 #define BUS_TYPE_ISAPNP 2
44 /** EISA bus type */
45 #define BUS_TYPE_EISA 3
47 /** MCA bus type */
48 #define BUS_TYPE_MCA 4
50 /** ISA bus type */
51 #define BUS_TYPE_ISA 5
53 /** A hardware device */
54 struct device {
55 /** Name */
56 char name[16];
57 /** Device description */
58 struct device_description desc;
59 /** Devices on the same bus */
60 struct list_head siblings;
61 /** Devices attached to this device */
62 struct list_head children;
63 /** Bus device */
64 struct device *parent;
67 /**
68 * A root device
70 * Root devices are system buses such as PCI, EISA, etc.
73 struct root_device {
74 /** Device chain
76 * A root device has a NULL parent field.
78 struct device dev;
79 /** Root device driver */
80 struct root_driver *driver;
83 /** A root device driver */
84 struct root_driver {
85 /**
86 * Add root device
88 * @v rootdev Root device
89 * @ret rc Return status code
91 * Called from probe_devices() for all root devices in the build.
93 int ( * probe ) ( struct root_device *rootdev );
94 /**
95 * Remove root device
97 * @v rootdev Root device
99 * Called from remove_device() for all successfully-probed
100 * root devices.
102 void ( * remove ) ( struct root_device *rootdev );
105 /** Declare a root device */
106 #define __root_device __table ( struct root_device, root_devices, 01 )
108 #endif /* _GPXE_DEVICE_H */