Add api for creating resource list based on 'assigned-addresses'
According to device tree binding 'assigned-addresses' can refer to PCIE MMIO register space. New function ofw_bus_assigned_addresses_to_rl is provided to support it. Submitted by: Rafal Kozik <rk@semihalf.com> Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14750
This commit is contained in:
parent
c7dbc00c34
commit
d310c9e018
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332016
@ -489,9 +489,9 @@ ofw_bus_msimap(phandle_t node, uint16_t pci_rid, phandle_t *msi_parent,
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
ofw_bus_reg_to_rl(device_t dev, phandle_t node, pcell_t acells, pcell_t scells,
|
||||
struct resource_list *rl)
|
||||
static int
|
||||
ofw_bus_reg_to_rl_helper(device_t dev, phandle_t node, pcell_t acells, pcell_t scells,
|
||||
struct resource_list *rl, const char *reg_source)
|
||||
{
|
||||
uint64_t phys, size;
|
||||
ssize_t i, j, rid, nreg, ret;
|
||||
@ -506,7 +506,7 @@ ofw_bus_reg_to_rl(device_t dev, phandle_t node, pcell_t acells, pcell_t scells,
|
||||
if (ret == -1)
|
||||
name = NULL;
|
||||
|
||||
ret = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)®);
|
||||
ret = OF_getencprop_alloc(node, reg_source, sizeof(*reg), (void **)®);
|
||||
nreg = (ret == -1) ? 0 : ret;
|
||||
|
||||
if (nreg % (acells + scells) != 0) {
|
||||
@ -537,6 +537,23 @@ ofw_bus_reg_to_rl(device_t dev, phandle_t node, pcell_t acells, pcell_t scells,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
ofw_bus_reg_to_rl(device_t dev, phandle_t node, pcell_t acells, pcell_t scells,
|
||||
struct resource_list *rl)
|
||||
{
|
||||
|
||||
return (ofw_bus_reg_to_rl_helper(dev, node, acells, scells, rl, "reg"));
|
||||
}
|
||||
|
||||
int
|
||||
ofw_bus_assigned_addresses_to_rl(device_t dev, phandle_t node, pcell_t acells,
|
||||
pcell_t scells, struct resource_list *rl)
|
||||
{
|
||||
|
||||
return (ofw_bus_reg_to_rl_helper(dev, node, acells, scells,
|
||||
rl, "assigned-addresses"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Get interrupt parent for given node.
|
||||
* Returns 0 if interrupt parent doesn't exist.
|
||||
|
@ -95,6 +95,8 @@ int ofw_bus_msimap(phandle_t, uint16_t, phandle_t *, uint32_t *);
|
||||
/* Routines for parsing device-tree data into resource lists. */
|
||||
int ofw_bus_reg_to_rl(device_t, phandle_t, pcell_t, pcell_t,
|
||||
struct resource_list *);
|
||||
int ofw_bus_assigned_addresses_to_rl(device_t, phandle_t, pcell_t, pcell_t,
|
||||
struct resource_list *);
|
||||
int ofw_bus_intr_to_rl(device_t, phandle_t, struct resource_list *, int *);
|
||||
int ofw_bus_intr_by_rid(device_t, phandle_t, int, phandle_t *, int *,
|
||||
pcell_t **);
|
||||
|
Loading…
Reference in New Issue
Block a user