Skip to content

Commit 184ddbf

Browse files
committed
acpi: include revision of AML tables in AmlTable
1 parent 6331744 commit 184ddbf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

acpi/src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ where
346346
let dsdt_address = fadt.dsdt_address()?;
347347
let dsdt = unsafe { read_table::<H, Dsdt>(self.handler.clone(), dsdt_address)? };
348348

349-
Ok(AmlTable::new(dsdt_address, dsdt.header().length))
349+
Ok(AmlTable::new(dsdt_address, dsdt.header().length, dsdt.header().revision))
350350
})
351351
}
352352

@@ -393,14 +393,16 @@ pub struct AmlTable {
393393
pub address: usize,
394394
/// Length (in bytes) of the AML stream.
395395
pub length: u32,
396+
pub revision: u8,
396397
}
397398

398399
impl AmlTable {
399400
/// Create an `AmlTable` from the address and length of the table **including the SDT header**.
400-
pub(crate) fn new(address: usize, length: u32) -> AmlTable {
401+
pub(crate) fn new(address: usize, length: u32, revision: u8) -> AmlTable {
401402
AmlTable {
402403
address: address + mem::size_of::<SdtHeader>(),
403404
length: length - mem::size_of::<SdtHeader>() as u32,
405+
revision,
404406
}
405407
}
406408
}
@@ -458,7 +460,11 @@ where
458460
self.tables_phys_ptrs.find_map(|table_phys_ptr| {
459461
// SAFETY: Table guarantees its contained addresses to be valid.
460462
match unsafe { read_table::<_, Ssdt>(handler.clone(), table_phys_ptr as usize) } {
461-
Ok(ssdt_mapping) => Some(AmlTable::new(ssdt_mapping.physical_start(), ssdt_mapping.header.length)),
463+
Ok(ssdt_mapping) => Some(AmlTable::new(
464+
ssdt_mapping.physical_start(),
465+
ssdt_mapping.header.length,
466+
ssdt_mapping.header.revision,
467+
)),
462468
Err(AcpiError::SdtInvalidSignature(_)) => None,
463469
Err(e) => {
464470
log::warn!("Found invalid SSDT at physical address {:p}: {:?}", table_phys_ptr, e);

0 commit comments

Comments
 (0)