mirror of
https://github.com/AsahiLinux/m1n1
synced 2025-02-16 13:48:29 +00:00
m1n1.adt: Add to_bus_addr() method
So that one knows what to put in reg properties. Signed-off-by: Martin Povišer <povik@cutebit.org>
This commit is contained in:
parent
6f460b1f6a
commit
d94f918433
1 changed files with 17 additions and 0 deletions
|
@ -601,6 +601,23 @@ class ADTNode:
|
|||
|
||||
return addr
|
||||
|
||||
def to_bus_addr(self, addr):
|
||||
node = self._parent
|
||||
|
||||
descend = []
|
||||
while node is not None:
|
||||
if "ranges" not in node._properties:
|
||||
break
|
||||
descend.append(node)
|
||||
node = node._parent
|
||||
|
||||
for node in reversed(descend):
|
||||
for r in node.ranges:
|
||||
if r.parent_addr <= addr < (r.parent_addr + r.size):
|
||||
addr = addr - r.parent_addr + r.bus_addr
|
||||
break
|
||||
return addr
|
||||
|
||||
def tostruct(self):
|
||||
properties = []
|
||||
for k,v in itertools.chain(self._properties.items()):
|
||||
|
|
Loading…
Add table
Reference in a new issue