1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2019-12-06 21:41:38 -07:00
committed by Bin Meng
parent 2206ac248a
commit 6dd4b01432
4 changed files with 65 additions and 26 deletions

View File

@@ -482,6 +482,8 @@
#ifndef __ASSEMBLY__
#include <dm/pci.h>
#ifdef CONFIG_SYS_PCI_64BIT
typedef u64 pci_addr_t;
typedef u64 pci_size_t;
@@ -1619,16 +1621,6 @@ int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
*/
int sandbox_pci_get_client(struct udevice *emul, struct udevice **devp);
/**
* pci_get_devfn() - Extract the devfn from fdt_pci_addr of the device
*
* Get devfn from fdt_pci_addr of the specified device
*
* @dev: PCI device
* @return devfn in bits 15...8 if found, -ENODEV if not found
*/
int pci_get_devfn(struct udevice *dev);
#endif /* CONFIG_DM_PCI */
/**