edtlib: Improve _interrupt_parent() function
According to the following comment on github https://github.com/zephyrproject-rtos/zephyr/pull/77900/files#r1750393745 edtlib implementation is partially correct and it is missing two things: 1. If an ancestor has an interrupt-controller or interrupt-map property, the walk must terminate. 2. If an interrupt-parent property is found, the linked node must be a valid interrupt controller or nexus. This commit add these checks. Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
This commit is contained in:
parent
f548f45d1f
commit
1b1bfc9cc8
@ -2904,8 +2904,14 @@ def _interrupt_parent(start_node: dtlib_Node) -> dtlib_Node:
|
||||
|
||||
while node:
|
||||
if "interrupt-parent" in node.props:
|
||||
return node.props["interrupt-parent"].to_node()
|
||||
iparent = node.props["interrupt-parent"].to_node()
|
||||
assert "interrupt-controller" in iparent.props or "interrupt-map" in iparent.props
|
||||
return iparent
|
||||
node = node.parent
|
||||
if node is None:
|
||||
_err(f"{start_node!r} no interrupt parent found")
|
||||
if ("interrupt-controller" in node.props) or ("interrupt-map" in node.props):
|
||||
return node
|
||||
|
||||
_err(f"{start_node!r} has an 'interrupts' property, but neither the node "
|
||||
f"nor any of its parents has an 'interrupt-parent' property")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user