1 #include <console/console.h>
2 #include <device/device.h>
5 * Given a bus and a devfn number, find the device structure
6 * @param bus The bus number
7 * @param devfn a device/function number
8 * @return pointer to the device structure
10 struct device *dev_find_slot(unsigned int bus, unsigned int devfn)
14 for (dev = all_devices; dev; dev = dev->next)
15 if (dev->bus->secondary == bus && dev->devfn == devfn)
20 /** Find a device of a given vendor and type
21 * @param vendor Vendor ID (e.g. 0x8086 for Intel)
22 * @param device Device ID
23 * @param from Pointer to the device structure, used as a starting point
24 * in the linked list of all_devices, which can be 0 to start at the
25 * head of the list (i.e. all_devices)
26 * @return Pointer to the device struct
28 struct device *dev_find_device(unsigned int vendor, unsigned int device, struct device *from)
34 while (from && (from->vendor != vendor || from->device != device))
39 /** Find a device of a given class
40 * @param class Class of the device
41 * @param from Pointer to the device structure, used as a starting point
42 * in the linked list of all_devices, which can be 0 to start at the
43 * head of the list (i.e. all_devices)
44 * @return Pointer to the device struct
46 struct device *dev_find_class(unsigned int class, struct device *from)
52 while (from && from->class != class)