/* Calculates the address that should be accessed to perform a PCIe configuration space access for a given device identified by the PCIe controller device @pcie and the bus, device & function numbers in @bdf. If access to the device is not valid then the function will return an error code. Otherwise the address to access will be written to the pointer pointed to by @paddress.  */
static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf, uint offset, void **paddress)
/* Calculates the address that should be accessed to perform a PCIe configuration space access for a given device identified by the PCIe controller device @pcie and the bus, device & function numbers in @bdf. If access to the device is not valid then the function will return an error code. Otherwise the address to access will be written to the pointer pointed to by @paddress.  */
static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf, uint offset, void **paddress)
{
	struct generic_ecam_pcie *pcie = dev_get_priv(bus);
	void *addr;
	addr = pcie->cfg_base;
	addr += PCI_BUS(bdf) << 20;
	addr += PCI_DEV(bdf) << 15;
	addr += PCI_FUNC(bdf) << 12;
	addr += offset;
	*paddress = addr;
	return 0;
}