From d2f67cd765e32c03842b9f4430229606f6c0f030 Mon Sep 17 00:00:00 2001 From: Zejun Zhao Date: Fri, 31 Jan 2025 14:07:15 +0000 Subject: [PATCH] acpi: fix build errors --- acpi/src/handler.rs | 3 ++- acpi/src/madt.rs | 4 ++-- acpi/src/platform/mod.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/acpi/src/handler.rs b/acpi/src/handler.rs index 6a93d057..3a954511 100644 --- a/acpi/src/handler.rs +++ b/acpi/src/handler.rs @@ -1,4 +1,4 @@ -use core::{fmt, ops::Deref, pin::Pin, ptr::NonNull}; +use core::{fmt, ops::{Deref, DerefMut}, pin::Pin, ptr::NonNull}; /// 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::()` @@ -102,6 +102,7 @@ where impl DerefMut for PhysicalMapping where + T: Unpin, H: AcpiHandler, { fn deref_mut(&mut self) -> &mut T { diff --git a/acpi/src/madt.rs b/acpi/src/madt.rs index 4f65c17b..9f1427dd 100644 --- a/acpi/src/madt.rs +++ b/acpi/src/madt.rs @@ -42,7 +42,7 @@ pub enum MadtError { /// This type only contains the static portion, and then uses pointer arithmetic to parse the following entries. /// To make this sound, this type is `!Unpin` - this prevents you from getting anything other than a `Pin<&Madt>` /// out of a `PhysicalMapping`, thereby preventing a `Madt` from being moved before [`Madt::entries`] is called. -#[repr(C)] +#[repr(C, packed)] #[derive(Debug)] pub struct Madt { pub header: SdtHeader, @@ -61,7 +61,7 @@ unsafe impl AcpiTable for Madt { } impl Madt { - pub fn get_mpwk_mailbox_addr(&self) -> Result { + pub fn get_mpwk_mailbox_addr(self: Pin<&Self>) -> Result { for entry in self.entries() { if let MadtEntry::MultiprocessorWakeup(entry) = entry { return Ok(entry.mailbox_address); diff --git a/acpi/src/platform/mod.rs b/acpi/src/platform/mod.rs index ea8d1624..bf4097c3 100644 --- a/acpi/src/platform/mod.rs +++ b/acpi/src/platform/mod.rs @@ -153,7 +153,7 @@ where H: AcpiHandler, { let madt = tables.find_table::()?; - let mailbox_addr = madt.get_mpwk_mailbox_addr()?; + let mailbox_addr = madt.get().get_mpwk_mailbox_addr()?; let mut mpwk_mapping = unsafe { handler.map_physical_region::( mailbox_addr as usize,