Procházet zdrojové kódy

Add search_for_rsdp_bios constructor on AcpiTables

This is just a convenience method that makes it easier to construct an
AcpiTables by searching for it on BIOS platforms. It outsources to the
`rsdp` crate.
Isaac Woods před 4 roky
rodič
revize
7138383846
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. 9 0
      acpi/src/lib.rs

+ 9 - 0
acpi/src/lib.rs

@@ -105,6 +105,15 @@ where
         Self::from_validated_rsdp(handler, rsdp_mapping)
     }
 
+    /// Search for the RSDP on a BIOS platform. This accesses BIOS-specific memory locations and will probably not
+    /// work on UEFI platforms. See [Rsdp::search_for_rsdp_bios](rsdp_search::Rsdp::search_for_rsdp_bios) for
+    /// details.
+    pub unsafe fn search_for_rsdp_bios(handler: H) -> Result<AcpiTables<H>, AcpiError> {
+        let rsdp_mapping =
+            unsafe { Rsdp::search_for_on_bios(handler.clone()) }.map_err(|err| AcpiError::Rsdp(err))?;
+        Self::from_validated_rsdp(handler, rsdp_mapping)
+    }
+
     /// Create an `AcpiTables` if you have a `PhysicalMapping` of the RSDP that you know is correct. This is called
     /// from `from_rsdp` after validation, but can also be used if you've searched for the RSDP manually on a BIOS
     /// system.