mirror of
https://xff.cz/git/u-boot/
synced 2025-08-31 16:22:36 +02:00
fdtdec: Add API to read pci bus-range property
Add fdtdec_get_pci_bus_range to read bus-range property values. Signed-off-by: Suneel Garapati <sgarapati@marvell.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Stefan Roese
parent
1aa3966173
commit
1db7ee464f
@@ -444,6 +444,19 @@ int fdtdec_get_pci_vendev(const void *blob, int node,
|
|||||||
int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
|
int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
|
||||||
u32 *bar);
|
u32 *bar);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look at the bus range property of a device node and return the pci bus
|
||||||
|
* range for this node.
|
||||||
|
* The property must hold one fdt_pci_addr with a length.
|
||||||
|
* @param blob FDT blob
|
||||||
|
* @param node node to examine
|
||||||
|
* @param res the resource structure to return the bus range
|
||||||
|
* @return 0 if ok, negative on error
|
||||||
|
*/
|
||||||
|
|
||||||
|
int fdtdec_get_pci_bus_range(const void *blob, int node,
|
||||||
|
struct fdt_resource *res);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up a 32-bit integer property in a node and return it. The property
|
* Look up a 32-bit integer property in a node and return it. The property
|
||||||
* must have at least 4 bytes of data. The value of the first cell is
|
* must have at least 4 bytes of data. The value of the first cell is
|
||||||
|
16
lib/fdtdec.c
16
lib/fdtdec.c
@@ -243,6 +243,22 @@ int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int fdtdec_get_pci_bus_range(const void *blob, int node,
|
||||||
|
struct fdt_resource *res)
|
||||||
|
{
|
||||||
|
const u32 *values;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
values = fdt_getprop(blob, node, "bus-range", &len);
|
||||||
|
if (!values || len < sizeof(*values) * 2)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
res->start = fdt32_to_cpu(*values++);
|
||||||
|
res->end = fdt32_to_cpu(*values);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
|
uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name,
|
||||||
|
Reference in New Issue
Block a user