diff --git a/src/acpi-tables/src/dsdt.rs b/src/acpi-tables/src/dsdt.rs index d42b261787b..49b05918937 100644 --- a/src/acpi-tables/src/dsdt.rs +++ b/src/acpi-tables/src/dsdt.rs @@ -4,7 +4,7 @@ use std::mem::size_of; use vm_memory::{Address, Bytes, GuestAddress, GuestMemory}; -use zerocopy::AsBytes; +use zerocopy::IntoBytes; use crate::{checksum, AcpiError, Result, Sdt, SdtHeader}; diff --git a/src/acpi-tables/src/fadt.rs b/src/acpi-tables/src/fadt.rs index 302e41cddc5..5a3a8e5694b 100644 --- a/src/acpi-tables/src/fadt.rs +++ b/src/acpi-tables/src/fadt.rs @@ -5,7 +5,7 @@ use vm_memory::{Bytes, GuestAddress, GuestMemory}; use zerocopy::little_endian::{U16, U32, U64}; -use zerocopy::AsBytes; +use zerocopy::{Immutable, IntoBytes}; use crate::{checksum, GenericAddressStructure, Result, Sdt, SdtHeader}; @@ -42,7 +42,7 @@ pub const FADT_F_HW_REDUCED_ACPI: u8 = 20; /// More information about this table can be found in the ACPI specification: /// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt #[repr(packed)] -#[derive(Debug, Copy, Clone, Default, AsBytes)] +#[derive(Debug, Copy, Clone, Default, IntoBytes, Immutable)] pub struct Fadt { header: SdtHeader, firmware_control: U32, diff --git a/src/acpi-tables/src/lib.rs b/src/acpi-tables/src/lib.rs index b815783ee14..301a2d1cc95 100644 --- a/src/acpi-tables/src/lib.rs +++ b/src/acpi-tables/src/lib.rs @@ -20,7 +20,7 @@ pub use madt::Madt; pub use rsdp::Rsdp; pub use xsdt::Xsdt; use zerocopy::little_endian::{U32, U64}; -use zerocopy::AsBytes; +use zerocopy::{Immutable, IntoBytes}; // This is the creator ID that we will embed in ACPI tables that are created using this crate. const FC_ACPI_CREATOR_ID: [u8; 4] = *b"FCAT"; @@ -50,7 +50,7 @@ pub type Result = std::result::Result; /// ACPI type representing memory addresses #[repr(packed)] -#[derive(AsBytes, Clone, Copy, Debug, Default)] +#[derive(IntoBytes, Immutable, Clone, Copy, Debug, Default)] pub struct GenericAddressStructure { pub address_space_id: u8, pub register_bit_width: u8, @@ -79,7 +79,7 @@ impl GenericAddressStructure { /// Header included in all System Descriptor Tables #[repr(packed)] -#[derive(Clone, Debug, Copy, Default, AsBytes)] +#[derive(Clone, Debug, Copy, Default, IntoBytes, Immutable)] pub struct SdtHeader { pub signature: [u8; 4], pub length: U32, diff --git a/src/acpi-tables/src/madt.rs b/src/acpi-tables/src/madt.rs index 1c3eb765701..28f5c108b40 100644 --- a/src/acpi-tables/src/madt.rs +++ b/src/acpi-tables/src/madt.rs @@ -7,7 +7,7 @@ use std::mem::size_of; use vm_memory::{Address, Bytes, GuestAddress, GuestMemory}; use zerocopy::little_endian::U32; -use zerocopy::AsBytes; +use zerocopy::{Immutable, IntoBytes}; use crate::{checksum, AcpiError, Result, Sdt, SdtHeader}; @@ -18,7 +18,7 @@ const MADT_CPU_ENABLE_FLAG: u32 = 0; // everything with an underscore prefix #[allow(dead_code)] #[repr(packed)] -#[derive(Copy, Clone, Debug, Default, AsBytes)] +#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)] pub struct LocalAPIC { r#type: u8, length: u8, @@ -44,7 +44,7 @@ impl LocalAPIC { // everything with an underscore prefix #[allow(dead_code)] #[repr(packed)] -#[derive(Copy, Clone, Debug, Default, AsBytes)] +#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)] pub struct IoAPIC { r#type: u8, length: u8, @@ -72,7 +72,7 @@ impl IoAPIC { // everything with an underscore prefix #[allow(dead_code)] #[repr(packed)] -#[derive(Debug, AsBytes)] +#[derive(Debug, IntoBytes, Immutable)] struct MadtHeader { sdt: SdtHeader, base_address: U32, diff --git a/src/acpi-tables/src/rsdp.rs b/src/acpi-tables/src/rsdp.rs index aaf6fa5c051..aa413b3cdfb 100644 --- a/src/acpi-tables/src/rsdp.rs +++ b/src/acpi-tables/src/rsdp.rs @@ -6,7 +6,7 @@ use vm_memory::{Bytes, GuestAddress, GuestMemory}; use zerocopy::little_endian::{U32, U64}; -use zerocopy::AsBytes; +use zerocopy::{Immutable, IntoBytes}; use crate::{checksum, Result, Sdt}; @@ -22,7 +22,7 @@ use crate::{checksum, Result, Sdt}; /// More information about this structure can be found in the ACPI specification: /// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#root-system-description-pointer-rsdp #[repr(packed)] -#[derive(Clone, Copy, Debug, Default, AsBytes)] +#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)] pub struct Rsdp { signature: [u8; 8], checksum: u8, diff --git a/src/acpi-tables/src/xsdt.rs b/src/acpi-tables/src/xsdt.rs index ff301fb9843..ed6798c1137 100644 --- a/src/acpi-tables/src/xsdt.rs +++ b/src/acpi-tables/src/xsdt.rs @@ -6,7 +6,7 @@ use std::mem::size_of; use vm_memory::{Address, Bytes, GuestAddress, GuestMemory}; -use zerocopy::AsBytes; +use zerocopy::IntoBytes; use crate::{checksum, AcpiError, Result, Sdt, SdtHeader}; diff --git a/src/vmm/src/acpi/x86_64.rs b/src/vmm/src/acpi/x86_64.rs index 0d64b6d5f26..2f06c35264f 100644 --- a/src/vmm/src/acpi/x86_64.rs +++ b/src/vmm/src/acpi/x86_64.rs @@ -10,7 +10,7 @@ use acpi_tables::fadt::{ use acpi_tables::madt::{IoAPIC, LocalAPIC}; use acpi_tables::Fadt; use vm_memory::GuestAddress; -use zerocopy::AsBytes; +use zerocopy::IntoBytes; use crate::arch::x86_64::layout; use crate::device_manager::legacy::PortIODeviceManager;