of_address_to_resource — Translate device tree address and return as resource
int of_address_to_resource ( | struct device_node * dev, |
int index, | |
struct resource * r) ; |
dev
Devicetree node
index
Index into the node addresses array
r
Pointer used to return the resource
Get the “reg” or “assigned-adresses” property of node dev
, as apppropriate
for the bus type of the parent of dev
. Use index
to select the element of
the property to translate.
Translate the address from node dev
into a CPU physical address.
r
->start and r
->end are the translated address.
r
->flags pertain to the address from node dev
, not the translated address.
r
->name is from the “reg-names” property of node dev
, if available, else
it is the full name of node dev
.
Note that if your address is a PIO address, the conversion will fail if
the physical address can't be internally converted to an IO token with
pci_address_to_pio
, that is because it's either called too early or it
can't be matched to any host bridge IO space.