summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-04-08 08:32:59 -0600
committerTom Rini <trini@konsulko.com>2020-04-24 16:40:09 -0400
commitf05970380e4c72a198cce29affc622a8e543b4de (patch)
treed7af1df10ef69c36e1b81da035fdb1cf5fcf9a61 /include
parent2c2ca207e4ed7def3f3f33ab930e673a45bb3743 (diff)
downloadu-boot-f05970380e4c72a198cce29affc622a8e543b4de.tar.gz
u-boot-f05970380e4c72a198cce29affc622a8e543b4de.tar.bz2
u-boot-f05970380e4c72a198cce29affc622a8e543b4de.zip
pci: Add a macro to convert BDF from linux to U-Boot
U-Boot's BDF format has its bits in the same position as the device tree PCI definition. Some x86 devices use linux format in their register format and it is useful to be able to convert to U-Boot format. Add a macro for this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/pci.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/pci.h b/include/pci.h
index 174ddd4460..aff56b24f9 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -543,6 +543,9 @@ typedef int pci_dev_t;
#define PCI_VENDEV(v, d) (((v) << 16) | (d))
#define PCI_ANY_ID (~0)
+/* Convert from Linux format to U-Boot format */
+#define PCI_TO_BDF(val) ((val) << 8)
+
struct pci_device_id {
unsigned int vendor, device; /* Vendor and device ID or PCI_ANY_ID */
unsigned int subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */