Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/aml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ pub struct Interrupt {
edge_triggered: bool,
active_low: bool,
shared: bool,
number: u32,
numbers: Vec<u32>,
}

impl Interrupt {
Expand All @@ -733,29 +733,29 @@ impl Interrupt {
edge_triggered: bool,
active_low: bool,
shared: bool,
number: u32,
numbers: Vec<u32>,
) -> Self {
Interrupt {
consumer,
edge_triggered,
active_low,
shared,
number,
numbers,
}
}
}

impl Aml for Interrupt {
fn to_aml_bytes(&self, sink: &mut dyn AmlSink) {
sink.byte(EXTIRQDESC); /* Extended IRQ Descriptor */
sink.word(6);
sink.word(2 + 4 * self.numbers.len() as u16);
let flags = ((self.shared as u8) << 3)
| ((self.active_low as u8) << 2)
| ((self.edge_triggered as u8) << 1)
| self.consumer as u8;
sink.byte(flags);
sink.byte(1); /* count */
sink.dword(self.number);
sink.byte(self.numbers.len() as u8); /* count */
self.numbers.iter().for_each(|n| sink.dword(*n));
}
}

Expand Down Expand Up @@ -1698,7 +1698,7 @@ mod tests {
&Name::new(
"_CRS".into(),
&ResourceTemplate::new(vec![
&Interrupt::new(true, true, false, false, 4),
&Interrupt::new(true, true, false, false, vec![4]),
&IO::new(0x3f8, 0x3f8, 0, 0x8),
]),
),
Expand Down Expand Up @@ -1928,14 +1928,15 @@ mod tests {

*/
let interrupt_io_data = [
0x08, 0x5F, 0x43, 0x52, 0x53, 0x11, 0x16, 0x0A, 0x13, 0x89, 0x06, 0x00, 0x03, 0x01,
0x04, 0x00, 0x00, 0x00, 0x47, 0x01, 0xF8, 0x03, 0xF8, 0x03, 0x00, 0x08, 0x79, 0x00,
0x08, 0x5F, 0x43, 0x52, 0x53, 0x11, 0x1A, 0x0A, 0x17, 0x89, 0x0A, 0x00, 0x03, 0x02,
0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x01, 0xF8, 0x03, 0xF8, 0x03,
0x00, 0x08, 0x79, 0x00,
];
aml.clear();
Name::new(
"_CRS".into(),
&ResourceTemplate::new(vec![
&Interrupt::new(true, true, false, false, 4),
&Interrupt::new(true, true, false, false, vec![4, 5]),
&IO::new(0x3f8, 0x3f8, 0, 0x8),
]),
)
Expand Down