[SeaBIOS] [PATCH 1/8] seabios: pci: introduce foreachpci_in_bus() helper macro.

Kevin O'Connor kevin at koconnor.net
Tue Jun 22 03:57:01 CEST 2010


On Thu, Jun 17, 2010 at 08:03:09PM +0900, Isaku Yamahata wrote:
> This patch introduces foreachpci_in_bus() helper macro for
> depth first recursion. foreachpci() is for width first recursion.
> The macro will be used later to initialize pci bridge
> that requires depth first recursion.

Instead of introducing pci_next_in_bus(), can't we just use the
existing pci_next() call?  Something like:

#define foreachpci_in_bus(BDF, MAX, BUS)              \
    for (MAX=(BUS + 0x0100), BDF = BUS                \
         ; BDF >= 0 && BDF < (BUS + 0x0100)           \
         ; BDF = pci_next(BDF+1, &MAX))

-Kevin



More information about the SeaBIOS mailing list