فهرست منبع

Fix FADT signature

Isaac Woods 7 سال پیش
والد
کامیت
06f9879455
2فایلهای تغییر یافته به همراه9 افزوده شده و 6 حذف شده
  1. 5 3
      src/fadt.rs
  2. 4 3
      src/sdt.rs

+ 5 - 3
src/fadt.rs

@@ -92,7 +92,7 @@ pub struct Fadt {
 
 impl Fadt {
     pub fn validate(&self) -> Result<(), AcpiError> {
-        self.header.validate(b"FADT")
+        self.header.validate(b"FACP")
     }
 
     #[cfg(test)]
@@ -105,7 +105,7 @@ impl Fadt {
     ) -> Fadt {
         Fadt {
             header: SdtHeader::make_testcase(
-                *b"FADT",
+                *b"FACP",
                 mem::size_of::<Fadt>() as u32,
                 6,
                 5, //checksum
@@ -178,5 +178,7 @@ impl Fadt {
 }
 
 pub fn parse_fadt(mapping: &PhysicalMapping<Fadt>) -> Result<(), AcpiError> {
-    (*mapping).validate()
+    (*mapping).validate()?;
+
+    Ok(())
 }

+ 4 - 3
src/sdt.rs

@@ -1,5 +1,5 @@
 use core::str;
-use fadt::{parse_fadt, Fadt};
+use fadt::Fadt;
 use {AcpiError, AcpiHandler};
 
 /// All SDTs share the same header, and are `length` bytes long. The signature tells us which SDT
@@ -118,11 +118,12 @@ where
          * and length, and then the dispatched to the correct function to actually parse the table.
          */
         match signature {
-            "FADT" => {
+            "FACP" => {
                 let fadt_mapping = handler.map_physical_region::<Fadt>(physical_address);
-                parse_fadt(&fadt_mapping)?;
+                ::fadt::parse_fadt(&fadt_mapping)?;
                 handler.unmap_physical_region(fadt_mapping);
             }
+
             _ => {
                 /*
                  * We don't recognise this signature. Early on, this probably just means we don't