Isaac Woods vor 7 Jahren
Ursprung
Commit
4dab4f2efb
4 geänderte Dateien mit 207 neuen und 247 gelöschten Zeilen
  1. 70 83
      src/constructed_tables_test.rs
  2. 40 46
      src/lib.rs
  3. 56 63
      src/rsdp.rs
  4. 41 55
      src/sdt.rs

+ 70 - 83
src/constructed_tables_test.rs

@@ -1,123 +1,110 @@
+use super::{parse_rsdp, rsdp::Rsdp, sdt::SdtHeader, AcpiHandler, PhysicalMapping};
+use std::boxed::Box;
 /// These tests cover ideal sets of ACPI tables, which we construct on the fly. Eventually, this
 /// should cover all compliant implementations, but does not guarantee we'll be able to parse a
 /// particular hardware's tables, obviously.
-
 use std::mem;
 use std::ptr::NonNull;
-use std::boxed::Box;
-use super::{AcpiHandler, PhysicalMapping, rsdp::Rsdp, parse_rsdp, sdt::SdtHeader};
 
-const OEM_ID : &[u8; 6] = b"RUST  ";
+const OEM_ID: &[u8; 6] = b"RUST  ";
 
 /*
  * We use fake physical addresses to track what is being requested. When a particular table or
  * resource is requested, we just allocate it on the heap and return the "virtual address"
  * (a pointer onto the heap).
  */
-const RSDP_ADDRESS : usize = 0x0;
-const RSDT_ADDRESS : usize = 0x1;
+const RSDP_ADDRESS: usize = 0x0;
+const RSDT_ADDRESS: usize = 0x1;
 
 #[repr(C, packed)]
-struct TestRsdt
-{
-    header  : SdtHeader,
+struct TestRsdt {
+    header: SdtHeader,
     // TODO: We should probably actually add some SDTs
 }
 
 struct TestHandler;
 
-impl AcpiHandler for TestHandler
-{
-    fn map_physical_region<T>(&mut self, physical_address : usize) -> PhysicalMapping<T>
-    {
-        match physical_address
-        {
-            RSDP_ADDRESS =>
-            {
-                let rsdp = Box::new(Rsdp::make_testcase(*b"RSD PTR ",
-                                                        None,
-                                                        *OEM_ID,
-                                                        0,
-                                                        RSDT_ADDRESS as u32,
-                                                        0,
-                                                        0x0,
-                                                        None,
-                                                        [0, 0, 0]
-                                                       ));
+impl AcpiHandler for TestHandler {
+    fn map_physical_region<T>(&mut self, physical_address: usize) -> PhysicalMapping<T> {
+        match physical_address {
+            RSDP_ADDRESS => {
+                let rsdp = Box::new(Rsdp::make_testcase(
+                    *b"RSD PTR ",
+                    None,
+                    *OEM_ID,
+                    0,
+                    RSDT_ADDRESS as u32,
+                    0,
+                    0x0,
+                    None,
+                    [0, 0, 0],
+                ));
 
-                PhysicalMapping
-                {
-                    physical_start  : RSDP_ADDRESS,
-                    virtual_start   : unsafe
-                                      {
-                                          NonNull::<T>::new_unchecked(Box::into_raw(rsdp) as *mut T)
-                                      },
-                    region_length   : mem::size_of::<Rsdp>(),
-                    mapped_length   : mem::size_of::<Rsdp>(),
+                PhysicalMapping {
+                    physical_start: RSDP_ADDRESS,
+                    virtual_start: unsafe {
+                        NonNull::<T>::new_unchecked(Box::into_raw(rsdp) as *mut T)
+                    },
+                    region_length: mem::size_of::<Rsdp>(),
+                    mapped_length: mem::size_of::<Rsdp>(),
                 }
-            },
+            }
 
-            RSDT_ADDRESS =>
-            {
-                let checksum = 0;   // TODO: calculate real checksum
-                let rsdt = Box::new(TestRsdt
-                                    {
-                                        header  : SdtHeader::make_testcase(*b"RSDT",
-                                                                           mem::size_of::<TestRsdt>() as u32,
-                                                                           0,
-                                                                           checksum,
-                                                                           *OEM_ID,
-                                                                           *b"OEMRSDT ",
-                                                                           0xDEADBEEF,
-                                                                           0xDEADBEEF,
-                                                                           0xDEADBEEF),
+            RSDT_ADDRESS => {
+                let checksum = 0; // TODO: calculate real checksum
+                let rsdt = Box::new(TestRsdt {
+                    header: SdtHeader::make_testcase(
+                        *b"RSDT",
+                        mem::size_of::<TestRsdt>() as u32,
+                        0,
+                        checksum,
+                        *OEM_ID,
+                        *b"OEMRSDT ",
+                        0xDEADBEEF,
+                        0xDEADBEEF,
+                        0xDEADBEEF,
+                    ),
+                });
 
-                                    });
-
-                PhysicalMapping
-                {
-                    physical_start  : RSDT_ADDRESS,
-                    virtual_start   : unsafe
-                                      {
-                                          NonNull::<T>::new_unchecked(Box::into_raw(rsdt) as *mut T)
-                                      },
-                    region_length   : mem::size_of::<TestRsdt>(),
-                    mapped_length   : mem::size_of::<TestRsdt>(),
+                PhysicalMapping {
+                    physical_start: RSDT_ADDRESS,
+                    virtual_start: unsafe {
+                        NonNull::<T>::new_unchecked(Box::into_raw(rsdt) as *mut T)
+                    },
+                    region_length: mem::size_of::<TestRsdt>(),
+                    mapped_length: mem::size_of::<TestRsdt>(),
                 }
-            },
+            }
 
-            _ => panic!("ACPI requested invalid physical address: {:#x}", physical_address),
+            _ => panic!(
+                "ACPI requested invalid physical address: {:#x}",
+                physical_address
+            ),
         }
     }
 
-    fn unmap_physical_region<T>(&mut self, region : PhysicalMapping<T>)
-    {
-        match region.physical_start
-        {
-            RSDP_ADDRESS |
-            RSDT_ADDRESS =>
-            {
+    fn unmap_physical_region<T>(&mut self, region: PhysicalMapping<T>) {
+        match region.physical_start {
+            RSDP_ADDRESS | RSDT_ADDRESS => {
                 let _ = unsafe { Box::from_raw(region.virtual_start.as_ptr()) };
-            },
+            }
 
-            address => panic!("ACPI tried to unmap a region not created by test harness: {:#x}", address),
+            address => panic!(
+                "ACPI tried to unmap a region not created by test harness: {:#x}",
+                address
+            ),
         }
     }
 }
 
 #[test]
-fn test_constructed_tables()
-{
+fn test_constructed_tables() {
     let mut test_handler = TestHandler;
-    match parse_rsdp(&mut test_handler, RSDP_ADDRESS)
-    {
-        Ok(_) =>
-        {
-        },
+    match parse_rsdp(&mut test_handler, RSDP_ADDRESS) {
+        Ok(_) => {}
 
-        Err(err) =>
-        {
+        Err(err) => {
             panic!("Failed to parse ACPI: {:#?}", err);
-        },
+        }
     }
 }

+ 40 - 46
src/lib.rs

@@ -3,11 +3,13 @@
 #[cfg(test)]
 extern crate std;
 
-#[macro_use] extern crate log;
+#[macro_use]
+extern crate log;
 
+#[cfg(test)]
+mod constructed_tables_test;
 mod rsdp;
 mod sdt;
-#[cfg(test)] mod constructed_tables_test;
 
 use core::mem;
 use core::ops::Deref;
@@ -16,8 +18,7 @@ use rsdp::Rsdp;
 use sdt::SdtHeader;
 
 #[derive(Debug)]
-pub enum AcpiError
-{
+pub enum AcpiError {
     RsdpIncorrectSignature,
     RsdpInvalidOemId,
     RsdpInvalidChecksum,
@@ -31,24 +32,18 @@ pub enum AcpiError
 /// Describes a physical mapping created by `AcpiHandler::map_physical_region` and unmapped by
 /// `AcpiHandler::unmap_physical_region`. The region mapped must be at least `size_of::<T>()`
 /// bytes, but may be bigger.
-pub struct PhysicalMapping<T>
-{
-    pub physical_start  : usize,
-    pub virtual_start   : NonNull<T>,
-    pub region_length   : usize,    // Can be equal or larger than size_of::<T>()
-    pub mapped_length   : usize,    // Differs from `region_length` if padding is added for alignment
+pub struct PhysicalMapping<T> {
+    pub physical_start: usize,
+    pub virtual_start: NonNull<T>,
+    pub region_length: usize, // Can be equal or larger than size_of::<T>()
+    pub mapped_length: usize, // Differs from `region_length` if padding is added for alignment
 }
 
-impl<T> Deref for PhysicalMapping<T>
-{
+impl<T> Deref for PhysicalMapping<T> {
     type Target = T;
 
-    fn deref(&self) -> &T
-    {
-        unsafe
-        {
-            self.virtual_start.as_ref()
-        }
+    fn deref(&self) -> &T {
+        unsafe { self.virtual_start.as_ref() }
     }
 }
 
@@ -56,40 +51,37 @@ impl<T> Deref for PhysicalMapping<T>
 /// utility methods `acpi` uses to for e.g. mapping physical memory, but also an interface for
 /// `acpi` to tell the kernel about the tables it's parsing, such as how the kernel should
 /// configure the APIC or PCI routing.
-pub trait AcpiHandler
-{
+pub trait AcpiHandler {
     /// Given a starting physical address, map a region of physical memory that contains a `T`
     /// somewhere in the virtual address space. The address doesn't have to be page-aligned, so
     /// the implementation may have to add padding to either end. The supplied size must be large
     /// enough to hold a `T`, but may also be larger.
-    fn map_physical_region<T>(&mut self, physical_address : usize) -> PhysicalMapping<T>;
+    fn map_physical_region<T>(&mut self, physical_address: usize) -> PhysicalMapping<T>;
 
     /// Unmap the given physical mapping. Safe because we consume the mapping, and so it can't be
     /// used after being passed to this function.
-    fn unmap_physical_region<T>(&mut self, region : PhysicalMapping<T>);
+    fn unmap_physical_region<T>(&mut self, region: PhysicalMapping<T>);
 }
 
 /// This is the entry point of `acpi` if you have the **physical** address of the RSDP. It maps
 /// the RSDP, works out what version of ACPI the hardware supports, and passes the physical
 /// address of the RSDT/XSDT to `parse_rsdt`.
-pub fn parse_rsdp<H>(handler : &mut H, rsdp_address : usize) -> Result<(), AcpiError>
-    where H : AcpiHandler
+pub fn parse_rsdp<H>(handler: &mut H, rsdp_address: usize) -> Result<(), AcpiError>
+where
+    H: AcpiHandler,
 {
     let rsdp_mapping = handler.map_physical_region::<Rsdp>(rsdp_address);
     (*rsdp_mapping).validate()?;
     let revision = (*rsdp_mapping).revision();
 
-    if revision == 0
-    {
+    if revision == 0 {
         /*
          * We're running on ACPI Version 1.0. We should use the 32-bit RSDT address.
          */
         let rsdt_address = (*rsdp_mapping).rsdt_address();
         handler.unmap_physical_region(rsdp_mapping);
         parse_rsdt(handler, revision, rsdt_address as usize)?;
-    }
-    else
-    {
+    } else {
         /*
          * We're running on ACPI Version 2.0+. We should use the 64-bit XSDT address, truncated
          * to 32 bits on x86.
@@ -108,10 +100,13 @@ pub fn parse_rsdp<H>(handler : &mut H, rsdp_address : usize) -> Result<(), AcpiE
 ///
 /// If the given revision is 0, an address to the RSDT is expected. Otherwise, an address to
 /// the XSDT is expected.
-pub fn parse_rsdt<H>(handler            : &mut H,
-                     revision           : u8,
-                     physical_address   : usize) -> Result<(), AcpiError>
-    where H : AcpiHandler
+pub fn parse_rsdt<H>(
+    handler: &mut H,
+    revision: u8,
+    physical_address: usize,
+) -> Result<(), AcpiError>
+where
+    H: AcpiHandler,
 {
     let mapping = handler.map_physical_region::<SdtHeader>(physical_address);
 
@@ -119,29 +114,28 @@ pub fn parse_rsdt<H>(handler            : &mut H,
     // TODO: validate the signature and checksum (XXX: if it's a RSDT, the signature will be
     // "RSDT", whereas a XSDT will have a signature of "XSDT"
 
-    if revision == 0
-    {
+    if revision == 0 {
         /*
          * ACPI Version 1.0. It's a RSDT!
          */
-        let num_tables = ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u32>();
-        let tables_base = ((mapping.virtual_start.as_ptr() as usize) + mem::size_of::<SdtHeader>()) as *const u32;
+        let num_tables =
+            ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u32>();
+        let tables_base =
+            ((mapping.virtual_start.as_ptr() as usize) + mem::size_of::<SdtHeader>()) as *const u32;
 
-        for i in 0..num_tables
-        {
+        for i in 0..num_tables {
             sdt::dispatch_sdt(handler, unsafe { *tables_base.offset(i as isize) } as usize)?;
         }
-    }
-    else
-    {
+    } else {
         /*
          * ACPI Version 2.0+. It's a XSDT!
          */
-        let num_tables = ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u64>();
-        let tables_base = ((mapping.virtual_start.as_ptr() as usize) + mem::size_of::<SdtHeader>()) as *const u64;
+        let num_tables =
+            ((*mapping).length() as usize - mem::size_of::<SdtHeader>()) / mem::size_of::<u64>();
+        let tables_base =
+            ((mapping.virtual_start.as_ptr() as usize) + mem::size_of::<SdtHeader>()) as *const u64;
 
-        for i in 0..num_tables
-        {
+        for i in 0..num_tables {
             sdt::dispatch_sdt(handler, unsafe { *tables_base.offset(i as isize) } as usize)?;
         }
     }

+ 56 - 63
src/rsdp.rs

@@ -1,5 +1,5 @@
-use core::str;
 use super::AcpiError;
+use core::str;
 
 /// The first structure found in ACPI. It just tells us where the RSDT is.
 ///
@@ -15,68 +15,63 @@ use super::AcpiError;
 /// For ACPI Version 2.0+, `xsdt_address` should be used (truncated to `u32` on x86) instead of
 /// `rsdt_address`.
 #[repr(C, packed)]
-pub(crate) struct Rsdp
-{
-    signature       : [u8; 8],
-    checksum        : u8,
-    oem_id          : [u8; 6],
-    revision        : u8,
-    rsdt_address    : u32,
+pub(crate) struct Rsdp {
+    signature: [u8; 8],
+    checksum: u8,
+    oem_id: [u8; 6],
+    revision: u8,
+    rsdt_address: u32,
 
     /*
      * These fields are only valid for ACPI Version 2.0 and greater
      */
-    length          : u32,
-    xsdt_address    : u64,
-    ext_checksum    : u8,
-    reserved        : [u8; 3],
+    length: u32,
+    xsdt_address: u64,
+    ext_checksum: u8,
+    reserved: [u8; 3],
 }
 
-impl Rsdp
-{
+impl Rsdp {
     /// Checks that:
     ///     1) The signature is correct
     ///     2) The checksum is correct
     ///     3) For Version 2.0+, that the extension checksum is correct
-    pub(crate) fn validate(&self) -> Result<(), AcpiError>
-    {
+    pub(crate) fn validate(&self) -> Result<(), AcpiError> {
         // Check the signature
-        if &self.signature != b"RSD PTR "
-        {
+        if &self.signature != b"RSD PTR " {
             return Err(AcpiError::RsdpIncorrectSignature);
         }
 
         // Check the OEM id is valid UTF8 (allows use of unwrap)
-        if str::from_utf8(&self.oem_id).is_err()
-        {
+        if str::from_utf8(&self.oem_id).is_err() {
             return Err(AcpiError::RsdpInvalidOemId);
         }
 
         // Check the fields present in all versions against `checksum`
-        let mut sum : usize = 0;
-        sum += self.signature.iter().map(|&b| usize::from(b)).sum::<usize>();
+        let mut sum: usize = 0;
+        sum += self.signature
+            .iter()
+            .map(|&b| usize::from(b))
+            .sum::<usize>();
         sum += self.checksum as usize;
         sum += self.oem_id.iter().map(|&b| usize::from(b)).sum::<usize>();
         sum += self.revision as usize;
         sum += self.rsdt_address as usize;
 
         // Check that the lowest byte is 0
-        if sum & 0b1111_1111 != 0
-        {
+        if sum & 0b1111_1111 != 0 {
             return Err(AcpiError::RsdpInvalidChecksum);
         }
 
         // For Version 2.0+, check the extension checksum too
-        if self.revision > 0
-        {
-            let mut sum : usize = 0;
+        if self.revision > 0 {
+            let mut sum: usize = 0;
             sum += self.length as usize;
             sum += self.xsdt_address as usize;
             sum += self.ext_checksum as usize;
             sum += self.reserved.iter().map(|&b| usize::from(b)).sum::<usize>();
 
-            if sum & 0b1111_1111 != 0
-            {
+            if sum & 0b1111_1111 != 0 {
                 return Err(AcpiError::RsdpInvalidChecksum);
             }
         }
@@ -84,55 +79,53 @@ impl Rsdp
         Ok(())
     }
 
-    pub(crate) fn oem_id<'a>(&'a self) -> &'a str
-    {
+    pub(crate) fn oem_id<'a>(&'a self) -> &'a str {
         str::from_utf8(&self.oem_id).unwrap()
     }
 
-    pub(crate) fn revision(&self) -> u8
-    {
+    pub(crate) fn revision(&self) -> u8 {
         self.revision
     }
 
-    pub(crate) fn rsdt_address(&self) -> u32
-    {
+    pub(crate) fn rsdt_address(&self) -> u32 {
         self.rsdt_address
     }
 
-    pub(crate) fn xsdt_address(&self) -> u64
-    {
-        assert!(self.revision > 0, "Tried to read extended RSDP field with ACPI Version 1.0");
+    pub(crate) fn xsdt_address(&self) -> u64 {
+        assert!(
+            self.revision > 0,
+            "Tried to read extended RSDP field with ACPI Version 1.0"
+        );
         self.xsdt_address
     }
 
     /// Create a test RSDP. Checksums are passed as `Option<u8>`; if `None` is passed, the correct
     /// checksum is calculated and used.
     #[cfg(test)]
-    pub fn make_testcase(signature      : [u8; 8],
-                         checksum       : Option<u8>,
-                         oem_id         : [u8; 6],
-                         revision       : u8,
-                         rsdt_address   : u32,
-                         length         : u32,
-                         xsdt_address   : u64,
-                         ext_checksum   : Option<u8>,
-                         reserved       : [u8; 3]) -> Rsdp
-    {
-        let checksum = checksum.unwrap_or(((0isize -
-                                            signature.iter().map(|&b| isize::from(b)).sum::<isize>() -
-                                            oem_id.iter().map(|&b| isize::from(b)).sum::<isize>() -
-                                            revision as isize -
-                                            rsdt_address as isize
-                                           ) & 0b1111_1111) as u8);
-
-        let ext_checksum = ext_checksum.unwrap_or(((0isize -
-                                                    length as isize -
-                                                    xsdt_address as isize -
-                                                    reserved.iter().map(|&b| isize::from(b)).sum::<isize>()
-                                                   ) & 0b1111_1111) as u8);
-
-        Rsdp
-        {
+    pub fn make_testcase(
+        signature: [u8; 8],
+        checksum: Option<u8>,
+        oem_id: [u8; 6],
+        revision: u8,
+        rsdt_address: u32,
+        length: u32,
+        xsdt_address: u64,
+        ext_checksum: Option<u8>,
+        reserved: [u8; 3],
+    ) -> Rsdp {
+        let checksum = checksum.unwrap_or(
+            ((0isize - signature.iter().map(|&b| isize::from(b)).sum::<isize>()
+                - oem_id.iter().map(|&b| isize::from(b)).sum::<isize>()
+                - revision as isize - rsdt_address as isize) & 0b1111_1111) as u8,
+        );
+
+        let ext_checksum = ext_checksum.unwrap_or(
+            ((0isize - length as isize - xsdt_address as isize
+                - reserved.iter().map(|&b| isize::from(b)).sum::<isize>())
+                & 0b1111_1111) as u8,
+        );
+
+        Rsdp {
             signature,
             checksum,
             oem_id,

+ 41 - 55
src/sdt.rs

@@ -4,103 +4,90 @@ use {AcpiError, AcpiHandler};
 /// All SDTs share the same header, and are `length` bytes long. The signature tells us which SDT
 /// this is.
 #[repr(C, packed)]
-pub struct SdtHeader
-{
-    signature           : [u8; 4],
-    length              : u32,
-    revision            : u8,
-    checksum            : u8,
-    oem_id              : [u8; 6],
-    oem_table_id        : [u8; 8],
-    oem_revision        : u32,
-    creator_id          : u32,
-    creator_revision    : u32,
+pub struct SdtHeader {
+    signature: [u8; 4],
+    length: u32,
+    revision: u8,
+    checksum: u8,
+    oem_id: [u8; 6],
+    oem_table_id: [u8; 8],
+    oem_revision: u32,
+    creator_id: u32,
+    creator_revision: u32,
 }
 
-impl SdtHeader
-{
+impl SdtHeader {
     /// Check that:
     ///     a) The signature matches the one given
     ///     b) The checksum of the SDT
     ///
     /// This assumes that the whole SDT is mapped.
-    fn validate(&self, signature : &[u8; 4]) -> Result<(), AcpiError>
-    {
+    fn validate(&self, signature: &[u8; 4]) -> Result<(), AcpiError> {
         // Check the signature
-        if &self.signature == signature
-        {
+        if &self.signature == signature {
             return Err(AcpiError::SdtInvalidSignature);
         }
 
         // Check the OEM id
-        if str::from_utf8(&self.oem_id).is_err()
-        {
+        if str::from_utf8(&self.oem_id).is_err() {
             return Err(AcpiError::SdtInvalidOemId);
         }
 
         // Check the OEM table id
-        if str::from_utf8(&self.oem_table_id).is_err()
-        {
+        if str::from_utf8(&self.oem_table_id).is_err() {
             return Err(AcpiError::SdtInvalidTableId);
         }
 
         // Sum all bytes in the SDT (not just the header)
-        let mut sum : usize = 0;
-        for i in 0..self.length
-        {
+        let mut sum: usize = 0;
+        for i in 0..self.length {
             sum += unsafe { *(self as *const SdtHeader as *const u8).offset(i as isize) } as usize;
         }
 
         // Check that the lowest byte is 0
-        if sum & 0b1111_1111 != 0
-        {
+        if sum & 0b1111_1111 != 0 {
             return Err(AcpiError::SdtInvalidChecksum);
         }
 
         Ok(())
     }
 
-    pub fn signature<'a>(&'a self) -> &'a str
-    {
+    pub fn signature<'a>(&'a self) -> &'a str {
         // Safe to unwrap because we check signature is valid UTF8 in `validate`
         str::from_utf8(&self.signature).unwrap()
     }
 
-    pub fn length(&self) -> u32
-    {
+    pub fn length(&self) -> u32 {
         self.length
     }
 
-    pub fn revision(&self) -> u8
-    {
+    pub fn revision(&self) -> u8 {
         self.revision
     }
 
-    pub fn oem_id<'a>(&'a self) -> &'a str
-    {
+    pub fn oem_id<'a>(&'a self) -> &'a str {
         // Safe to unwrap because checked in `validate`
         str::from_utf8(&self.oem_id).unwrap()
     }
 
-    pub fn oem_table_id<'a>(&'a self) -> &'a str
-    {
+    pub fn oem_table_id<'a>(&'a self) -> &'a str {
         // Safe to unwrap because checked in `validate`
         str::from_utf8(&self.oem_table_id).unwrap()
     }
 
     #[cfg(test)]
-    pub(crate) fn make_testcase(signature           : [u8; 4],
-                                length              : u32,
-                                revision            : u8,
-                                checksum            : u8,
-                                oem_id              : [u8; 6],
-                                oem_table_id        : [u8; 8],
-                                oem_revision        : u32,
-                                creator_id          : u32,
-                                creator_revision    : u32) -> SdtHeader
-    {
-        SdtHeader
-        {
+    pub(crate) fn make_testcase(
+        signature: [u8; 4],
+        length: u32,
+        revision: u8,
+        checksum: u8,
+        oem_id: [u8; 6],
+        oem_table_id: [u8; 8],
+        oem_revision: u32,
+        creator_id: u32,
+        creator_revision: u32,
+    ) -> SdtHeader {
+        SdtHeader {
             signature,
             length,
             revision,
@@ -116,8 +103,9 @@ impl SdtHeader
 
 /// This takes the physical address of an SDT, maps it correctly and dispatches it to whatever
 /// function parses that table.
-pub(crate) fn dispatch_sdt<H>(handler : &mut H, physical_address : usize) -> Result<(), AcpiError>
-    where H : AcpiHandler
+pub(crate) fn dispatch_sdt<H>(handler: &mut H, physical_address: usize) -> Result<(), AcpiError>
+where
+    H: AcpiHandler,
 {
     let header_mapping = handler.map_physical_region::<SdtHeader>(physical_address);
     {
@@ -128,16 +116,14 @@ pub(crate) fn dispatch_sdt<H>(handler : &mut H, physical_address : usize) -> Res
          * For a recognised signature, a new physical mapping should be created with the correct type
          * and length, and then the dispatched to the correct function to actually parse the table.
          */
-        match signature
-        {
-            _ =>
-            {
+        match signature {
+            _ => {
                 /*
                  * We don't recognise this signature. Early on, this probably just means we don't
                  * have support yet, but later on maybe this should become an actual error
                  */
                 warn!("Unsupported SDT signature: {}. Skipping.", signature);
-            },
+            }
         }
     }