Re: How do I find whatever combination of things end up defining pcib_get_bus(. . .)?

From: Mark Millard <marklmi_at_yahoo.com>
Date: Wed, 28 Dec 2022 03:40:26 UTC
On Dec 27, 2022, at 17:41, Yuri <yuri@aetern.org> wrote:

> Mark Millard wrote:
>> # grep -r "\<pcib_get_bus\>" /usr/13S-src/ | more
>> /usr/13S-src/sys/mips/nlm/xlp_pci.c:    busno = pcib_get_bus(dev);
>> /usr/13S-src/sys/powerpc/ofw/ofw_pcibus.c:      busno = pcib_get_bus(dev);
>> /usr/13S-src/sys/dev/pci/pci.c: busno = pcib_get_bus(dev);
>> /usr/13S-src/sys/dev/pci/pci.c: busno = pcib_get_bus(dev);
>> /usr/13S-src/sys/dev/pci/pci.c: busno = pcib_get_bus(dev);
>> /usr/13S-src/sys/dev/cardbus/cardbus.c:     pcib_get_bus(cbdev), pcib_get_bus(cbdev), 1, 0);
>> /usr/13S-src/sys/dev/cardbus/cardbus.c: bus = pcib_get_bus(cbdev);
>> /usr/13S-src/sys/dev/hyperv/pcib/vmbus_pcib.c:  busno = pcib_get_bus(dev);
>> /usr/13S-src/sys/dev/pccbb/pccbb.c:             b = pcib_get_bus(child);
>> /usr/13S-src/sys/dev/pccbb/pccbb_pci.c: sc->pribus = pcib_get_bus(parent);
>> /usr/13S-src/sys/x86/pci/qpi.c:         *result = pcib_get_bus(dev);
>> /usr/13S-src/sys/x86/pci/pci_bus.c:     bus = pcib_get_bus(dev);
>> /usr/13S-src/sys/x86/iommu/intel_drv.c:                 *busno = pcib_get_bus(bus);
>> 
>> Everything found is a use, not a definition. (I also tried:
>> # grep -r "\<pcib_get_bus\>" /usr/obj/BUILDs/13S-CA72-nodbg-clang/ .)
>> 
>> Historically I've managed to eventually track down definitions
>> are are less direct, such as ones that are formed via macros
>> that put together names. But, so far, I've not managed to for
>> pcib_get_bus .
>> 
>> So, hopefully, someone can point me to what I've missed.
> 
> See __BUS_ACCESSOR() macro in sys/bus.h (I had to have a bit of fun with
> `cc -E` to get at it).

Thanks.

Looks like could have explored with just PCIB_ and found:

/usr/13S-src/sys/dev/pci/pcivar.h:#define       PCIB_ACCESSOR(var, ivar, type)                                   \
/usr/13S-src/sys/dev/pci/pcivar.h:PCIB_ACCESSOR(domain,         DOMAIN,         uint32_t)
/usr/13S-src/sys/dev/pci/pcivar.h:PCIB_ACCESSOR(bus,            BUS,            uint32_t)
/usr/13S-src/sys/dev/pci/pcivar.h:#undef PCIB_ACCESSOR

and the #define line would have shown:

#define PCIB_ACCESSOR(var, ivar, type)                                   \
    __BUS_ACCESSOR(pcib, var, PCIB, ivar, type)

But in everything I did I was explicit about "get" as part of the
text I explored with.

===
Mark Millard
marklmi at yahoo.com