mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-26 00:51:33 +00:00
dm: core: Add API to read PCI bus-range property
Add dev_read_pci_bus_range() to read bus-range property values Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
1db7ee464f
commit
68f81b8575
2 changed files with 29 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <mapmem.h>
|
#include <mapmem.h>
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
#include <linux/ioport.h>
|
||||||
|
|
||||||
int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp)
|
int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp)
|
||||||
{
|
{
|
||||||
|
@ -359,3 +360,19 @@ int dev_get_child_count(const struct udevice *dev)
|
||||||
{
|
{
|
||||||
return ofnode_get_child_count(dev_ofnode(dev));
|
return ofnode_get_child_count(dev_ofnode(dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dev_read_pci_bus_range(const struct udevice *dev,
|
||||||
|
struct resource *res)
|
||||||
|
{
|
||||||
|
const u32 *values;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
values = dev_read_prop(dev, "bus-range", &len);
|
||||||
|
if (!values || len < sizeof(*values) * 2)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
res->start = *values++;
|
||||||
|
res->end = *values;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -680,6 +680,18 @@ int dev_read_alias_highest_id(const char *stem);
|
||||||
*/
|
*/
|
||||||
int dev_get_child_count(const struct udevice *dev);
|
int dev_get_child_count(const struct udevice *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dev_read_pci_bus_range - Read PCI bus-range resource
|
||||||
|
*
|
||||||
|
* Look at the bus range property of a device node and return the pci bus
|
||||||
|
* range for this node.
|
||||||
|
*
|
||||||
|
* @dev: device to examine
|
||||||
|
* @res returns the resource
|
||||||
|
* @return 0 if ok, negative on error
|
||||||
|
*/
|
||||||
|
int dev_read_pci_bus_range(const struct udevice *dev, struct resource *res);
|
||||||
|
|
||||||
#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
|
#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
|
||||||
|
|
||||||
static inline int dev_read_u32(const struct udevice *dev,
|
static inline int dev_read_u32(const struct udevice *dev,
|
||||||
|
|
Loading…
Add table
Reference in a new issue