Skip to content

Commit 62895ef

Browse files
timw-rivosrbradford
authored andcommitted
acpi_tables: Fix VIOT
The PCI segment accidentally also contained the BDF in the lower 16 bits, which is wrong. Linux is now able to recognize a VIOT after this change. Signed-off-by: Tim Wawrzynczak <tim@rivosinc.com>
1 parent 838b24a commit 62895ef

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/viot.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ impl VIOT {
103103
/// past (e.g. IORT for ARM, DMAR for Intel, IVRS for AMD, etc.).
104104
impl Aml for VIOT {
105105
fn to_aml_bytes(&self, sink: &mut dyn AmlSink) {
106-
for byte in self.header.as_bytes() {
107-
sink.byte(*byte);
108-
}
109-
106+
sink.vec(self.header.as_bytes());
110107
sink.word(self.nodes.len() as u16);
111108
sink.word(NODE_OFFSET);
112109
sink.qword(0); // reserved
@@ -192,8 +189,8 @@ impl Aml for PciRange {
192189
sink.byte(0); // reserved
193190
sink.word(Self::len() as u16);
194191
sink.dword(self.first.as_endpoint());
195-
sink.word(self.first.as_segment());
196-
sink.word(self.last.as_segment());
192+
sink.word(self.first.segment);
193+
sink.word(self.last.segment);
197194
sink.word(self.first.as_bdf());
198195
sink.word(self.last.as_bdf());
199196
sink.word(self.translation_offset);
@@ -266,7 +263,8 @@ impl Aml for VirtIoPciIommu {
266263
sink.byte(ViotEntryType::VirtIoPciIommu as u8);
267264
sink.byte(0); // reserved
268265
sink.word(Self::len() as u16);
269-
sink.dword(self.device.as_endpoint());
266+
sink.word(self.device.segment);
267+
sink.word(self.device.as_bdf());
270268
sink.qword(0); // reserved
271269
}
272270
}

0 commit comments

Comments
 (0)