summaryrefslogtreecommitdiff
path: root/lib/fdtdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r--lib/fdtdec.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index b3c43be..4f66ae1 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -765,4 +765,18 @@ int fdt_get_named_resource(const void *fdt, int node, const char *property,
return fdt_get_resource(fdt, node, property, index, res);
}
+
+int fdtdec_pci_get_bdf(const void *fdt, int node, int *bdf)
+{
+ const fdt32_t *prop;
+ int len;
+
+ prop = fdt_getprop(fdt, node, "reg", &len);
+ if (!prop)
+ return len;
+
+ *bdf = fdt32_to_cpu(*prop) & 0xffffff;
+
+ return 0;
+}
#endif