Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FdtNode::interrupts() can not handle ARM interrupt properties #12

Open
ravenexp opened this issue May 30, 2023 · 1 comment
Open

FdtNode::interrupts() can not handle ARM interrupt properties #12

ravenexp opened this issue May 30, 2023 · 1 comment
Milestone

Comments

@ravenexp
Copy link

On ARM, #interrupt-cells property value is usually 3:
https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic.txt.

This common case is not handled by the current method implementation:

fdt/src/node.rs

Lines 256 to 260 in 0c2fb5b

let interrupt = match sizes {
1 => stream.u32()?.get() as usize,
2 => stream.u64()?.get() as usize,
_ => return None,
};

Also, interpreting the #interrupt-cells = <2> case as a single u64 interrupt number does not seem correct either,
because the Linux kernel docs say that those two cells encode entirely different things:

b) two cells
  ------------
  The #interrupt-cells property is set to 2 and the first cell defines the
  index of the interrupt within the controller, while the second cell is used
  to specify any of the following flags:

Source: https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt

To handle all variants of interrupts correctly, this method should probably return an iterator over a custom Interrupt type,
just like FdtNode::reg() returns an iterator over MemoryRegion items.

@repnop
Copy link
Owner

repnop commented Sep 24, 2023

Sorry for the long delay in response, but you're correct! I mainly wrote and tested all of this code for RISC-V, so its not something I caught, so I'll have this in mind for the set of improvements I'm planning on making here hopefully soon.

@repnop repnop added this to the v0.2.0 milestone Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants