device_romstage: Add a way to move to the next device
When trying to loop through all the devices in romstage, there was no function to just go from one to the next. This allows an easy way to go all the way down the chain of devices. Change-Id: Id205b24610d75de060b0d48fa283a2ab92d1df0a Signed-off-by: Martin Roth <gaumless@gmail.com> Reviewed-on: http://review.coreboot.org/5732 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones <marc.jones@se-eng.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
db0e0e2c54
commit
16d953a460
|
@ -54,6 +54,30 @@ ROMSTAGE_CONST struct device *dev_find_slot(unsigned int bus,
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a device pointer, find the next PCI device.
|
||||
*
|
||||
* @param previous_dev A pointer to a PCI device structure.
|
||||
* @return Pointer to the next device structure (if found), 0 otherwise.
|
||||
*/
|
||||
ROMSTAGE_CONST struct device *dev_find_next_pci_device(
|
||||
ROMSTAGE_CONST struct device *previous_dev)
|
||||
{
|
||||
ROMSTAGE_CONST struct device *dev, *result;
|
||||
|
||||
if (previous_dev == NULL)
|
||||
previous_dev = all_devices;
|
||||
|
||||
result = 0;
|
||||
for (dev = previous_dev->next; dev; dev = dev->next) {
|
||||
if (dev->path.type == DEVICE_PATH_PCI) {
|
||||
result = dev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an SMBus bus and a device number, find the device structure.
|
||||
*
|
||||
|
|
|
@ -236,6 +236,8 @@ u32 find_pci_tolm(struct bus *bus);
|
|||
|
||||
ROMSTAGE_CONST struct device * dev_find_slot (unsigned int bus,
|
||||
unsigned int devfn);
|
||||
ROMSTAGE_CONST struct device *dev_find_next_pci_device(
|
||||
ROMSTAGE_CONST struct device *previous_dev);
|
||||
ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus,
|
||||
unsigned int addr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue