Skip to content

Commit bc88428

Browse files
jellllly420IsaacWoods
authored andcommitted
acpi: fix build errors
1 parent d4faad2 commit bc88428

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Diff for: acpi/src/handler.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::{fmt, ops::Deref, pin::Pin, ptr::NonNull};
1+
use core::{fmt, ops::{Deref, DerefMut}, pin::Pin, ptr::NonNull};
22

33
/// Describes a physical mapping created by `AcpiHandler::map_physical_region` and unmapped by
44
/// `AcpiHandler::unmap_physical_region`. The region mapped must be at least `size_of::<T>()`
@@ -102,6 +102,7 @@ where
102102

103103
impl<H, T> DerefMut for PhysicalMapping<H, T>
104104
where
105+
T: Unpin,
105106
H: AcpiHandler,
106107
{
107108
fn deref_mut(&mut self) -> &mut T {

Diff for: acpi/src/madt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub enum MadtError {
4242
/// This type only contains the static portion, and then uses pointer arithmetic to parse the following entries.
4343
/// To make this sound, this type is `!Unpin` - this prevents you from getting anything other than a `Pin<&Madt>`
4444
/// out of a `PhysicalMapping`, thereby preventing a `Madt` from being moved before [`Madt::entries`] is called.
45-
#[repr(C)]
45+
#[repr(C, packed)]
4646
#[derive(Debug)]
4747
pub struct Madt {
4848
pub header: SdtHeader,
@@ -61,7 +61,7 @@ unsafe impl AcpiTable for Madt {
6161
}
6262

6363
impl Madt {
64-
pub fn get_mpwk_mailbox_addr(&self) -> Result<u64, AcpiError> {
64+
pub fn get_mpwk_mailbox_addr(self: Pin<&Self>) -> Result<u64, AcpiError> {
6565
for entry in self.entries() {
6666
if let MadtEntry::MultiprocessorWakeup(entry) = entry {
6767
return Ok(entry.mailbox_address);

Diff for: acpi/src/platform/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ where
153153
H: AcpiHandler,
154154
{
155155
let madt = tables.find_table::<Madt>()?;
156-
let mailbox_addr = madt.get_mpwk_mailbox_addr()?;
156+
let mailbox_addr = madt.get().get_mpwk_mailbox_addr()?;
157157
let mut mpwk_mapping = unsafe {
158158
handler.map_physical_region::<MultiprocessorWakeupMailbox>(
159159
mailbox_addr as usize,

0 commit comments

Comments
 (0)