From 65730efa11b9bb5859f2e4fccdc8ba794ed111d2 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 21 Sep 2023 16:33:00 +0200 Subject: [PATCH 1/2] multiboot2: move EFIBootServicesNotExitedTag to efi module This change is not breaking as this path change is publicly not visible. --- multiboot2/src/efi.rs | 31 +++++++++++++++++++++++++++++++ multiboot2/src/lib.rs | 8 +++++--- multiboot2/src/memory_map.rs | 31 ------------------------------- 3 files changed, 36 insertions(+), 34 deletions(-) diff --git a/multiboot2/src/efi.rs b/multiboot2/src/efi.rs index c5f38b77..99972ff1 100644 --- a/multiboot2/src/efi.rs +++ b/multiboot2/src/efi.rs @@ -131,6 +131,37 @@ impl TagTrait for EFIImageHandle64Tag { fn dst_size(_base_tag: &Tag) {} } +/// EFI ExitBootServices was not called tag. +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[repr(C)] +pub struct EFIBootServicesNotExitedTag { + typ: TagTypeId, + size: u32, +} + +impl EFIBootServicesNotExitedTag { + #[cfg(feature = "builder")] + pub fn new() -> Self { + Self::default() + } +} + +#[cfg(feature = "builder")] +impl Default for EFIBootServicesNotExitedTag { + fn default() -> Self { + Self { + typ: TagType::EfiBs.into(), + size: core::mem::size_of::().try_into().unwrap(), + } + } +} + +impl TagTrait for EFIBootServicesNotExitedTag { + const ID: TagType = TagType::EfiBs; + + fn dst_size(_base_tag: &Tag) {} +} + #[cfg(all(test, feature = "builder"))] mod tests { use super::{EFIImageHandle32Tag, EFIImageHandle64Tag, EFISdt32Tag, EFISdt64Tag}; diff --git a/multiboot2/src/lib.rs b/multiboot2/src/lib.rs index 18c06879..c63c13f6 100644 --- a/multiboot2/src/lib.rs +++ b/multiboot2/src/lib.rs @@ -67,7 +67,9 @@ mod vbe_info; pub use boot_loader_name::BootLoaderNameTag; pub use command_line::CommandLineTag; -pub use efi::{EFIImageHandle32Tag, EFIImageHandle64Tag, EFISdt32Tag, EFISdt64Tag}; +pub use efi::{ + EFIBootServicesNotExitedTag, EFIImageHandle32Tag, EFIImageHandle64Tag, EFISdt32Tag, EFISdt64Tag, +}; pub use elf_sections::{ ElfSection, ElfSectionFlags, ElfSectionIter, ElfSectionType, ElfSectionsTag, }; @@ -75,8 +77,8 @@ pub use end::EndTag; pub use framebuffer::{FramebufferColor, FramebufferField, FramebufferTag, FramebufferType}; pub use image_load_addr::ImageLoadPhysAddrTag; pub use memory_map::{ - BasicMemoryInfoTag, EFIBootServicesNotExitedTag, EFIMemoryAreaType, EFIMemoryDesc, - EFIMemoryMapTag, MemoryArea, MemoryAreaType, MemoryAreaTypeId, MemoryMapTag, + BasicMemoryInfoTag, EFIMemoryAreaType, EFIMemoryDesc, EFIMemoryMapTag, MemoryArea, + MemoryAreaType, MemoryAreaTypeId, MemoryMapTag, }; pub use module::{ModuleIter, ModuleTag}; pub use ptr_meta::Pointee; diff --git a/multiboot2/src/memory_map.rs b/multiboot2/src/memory_map.rs index 147b7e7d..a94df130 100644 --- a/multiboot2/src/memory_map.rs +++ b/multiboot2/src/memory_map.rs @@ -334,37 +334,6 @@ impl TagTrait for EFIMemoryMapTag { } } -/// EFI ExitBootServices was not called tag. -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[repr(C)] -pub struct EFIBootServicesNotExitedTag { - typ: TagTypeId, - size: u32, -} - -impl EFIBootServicesNotExitedTag { - #[cfg(feature = "builder")] - pub fn new() -> Self { - Self::default() - } -} - -#[cfg(feature = "builder")] -impl Default for EFIBootServicesNotExitedTag { - fn default() -> Self { - Self { - typ: TagType::EfiBs.into(), - size: mem::size_of::().try_into().unwrap(), - } - } -} - -impl TagTrait for EFIBootServicesNotExitedTag { - const ID: TagType = TagType::EfiBs; - - fn dst_size(_base_tag: &Tag) {} -} - /// An iterator over ALL EFI memory areas. #[derive(Clone, Debug)] pub struct EFIMemoryAreaIter<'a> { From f67987f06256e093a6f17793fb0e2c18336085c4 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 21 Sep 2023 16:33:37 +0200 Subject: [PATCH 2/2] multiboot2: fill in missing module documentations --- multiboot2/src/boot_loader_name.rs | 2 ++ multiboot2/src/command_line.rs | 2 +- multiboot2/src/efi.rs | 8 +++++++- multiboot2/src/elf_sections.rs | 2 ++ multiboot2/src/framebuffer.rs | 2 ++ multiboot2/src/image_load_addr.rs | 2 ++ multiboot2/src/memory_map.rs | 3 +++ multiboot2/src/module.rs | 3 ++- multiboot2/src/rsdp.rs | 2 ++ multiboot2/src/smbios.rs | 2 ++ multiboot2/src/tag.rs | 2 +- multiboot2/src/vbe_info.rs | 3 ++- 12 files changed, 28 insertions(+), 5 deletions(-) diff --git a/multiboot2/src/boot_loader_name.rs b/multiboot2/src/boot_loader_name.rs index dcac5bc4..a7505c4c 100644 --- a/multiboot2/src/boot_loader_name.rs +++ b/multiboot2/src/boot_loader_name.rs @@ -1,3 +1,5 @@ +//! Module for [`BootLoaderNameTag`]. + use crate::{Tag, TagTrait, TagType, TagTypeId}; use core::fmt::{Debug, Formatter}; use core::mem::size_of; diff --git a/multiboot2/src/command_line.rs b/multiboot2/src/command_line.rs index 71b49a14..2f20227a 100644 --- a/multiboot2/src/command_line.rs +++ b/multiboot2/src/command_line.rs @@ -1,4 +1,4 @@ -//! Module for [CommandLineTag]. +//! Module for [`CommandLineTag`]. use crate::{Tag, TagTrait, TagType, TagTypeId}; diff --git a/multiboot2/src/efi.rs b/multiboot2/src/efi.rs index 99972ff1..a80325ca 100644 --- a/multiboot2/src/efi.rs +++ b/multiboot2/src/efi.rs @@ -1,4 +1,10 @@ -//! All MBI tags related to (U)EFI. +//! All tags related to (U)EFI with the exception of EFI memory tags: +//! +//! - [`EFISdt32Tag`] +//! - [`EFISdt64Tag`] +//! - [`EFIImageHandle32Tag`] +//! - [`EFIImageHandle64Tag`] +//! - [`EFIBootServicesNotExitedTag`] use crate::TagTypeId; use crate::{Tag, TagTrait, TagType}; diff --git a/multiboot2/src/elf_sections.rs b/multiboot2/src/elf_sections.rs index d41ab114..00579359 100644 --- a/multiboot2/src/elf_sections.rs +++ b/multiboot2/src/elf_sections.rs @@ -1,3 +1,5 @@ +//! Module for [`ElfSectionsTag`]. + #[cfg(feature = "builder")] use crate::builder::BoxedDst; use crate::{Tag, TagTrait, TagType, TagTypeId}; diff --git a/multiboot2/src/framebuffer.rs b/multiboot2/src/framebuffer.rs index 62acf067..bb80dc25 100644 --- a/multiboot2/src/framebuffer.rs +++ b/multiboot2/src/framebuffer.rs @@ -1,3 +1,5 @@ +//! Module for [`FramebufferTag`]. + use crate::{Tag, TagTrait, TagType, TagTypeId}; use core::fmt::Debug; use core::mem::size_of; diff --git a/multiboot2/src/image_load_addr.rs b/multiboot2/src/image_load_addr.rs index 306e5013..efb1b49e 100644 --- a/multiboot2/src/image_load_addr.rs +++ b/multiboot2/src/image_load_addr.rs @@ -1,3 +1,5 @@ +//! Module for [`ImageLoadPhysAddrTag`]. + use crate::{Tag, TagTrait, TagType, TagTypeId}; #[cfg(feature = "builder")] use {core::convert::TryInto, core::mem::size_of}; diff --git a/multiboot2/src/memory_map.rs b/multiboot2/src/memory_map.rs index a94df130..c502551e 100644 --- a/multiboot2/src/memory_map.rs +++ b/multiboot2/src/memory_map.rs @@ -1,3 +1,6 @@ +//! Module for [`MemoryMapTag`], [`EFIMemoryMapTag`] and [`BasicMemoryInfoTag`] +//! and corresponding helper types. + pub use uefi_raw::table::boot::MemoryDescriptor as EFIMemoryDesc; pub use uefi_raw::table::boot::MemoryType as EFIMemoryAreaType; diff --git a/multiboot2/src/module.rs b/multiboot2/src/module.rs index 5cc877e4..6392331e 100644 --- a/multiboot2/src/module.rs +++ b/multiboot2/src/module.rs @@ -1,5 +1,6 @@ -use crate::{Tag, TagIter, TagTrait, TagType, TagTypeId}; +//! Module for [`ModuleTag`]. +use crate::{Tag, TagIter, TagTrait, TagType, TagTypeId}; use core::fmt::{Debug, Formatter}; use core::mem::size_of; use core::str::Utf8Error; diff --git a/multiboot2/src/rsdp.rs b/multiboot2/src/rsdp.rs index ec5f9a62..12a5b723 100644 --- a/multiboot2/src/rsdp.rs +++ b/multiboot2/src/rsdp.rs @@ -1,3 +1,5 @@ +//! Module for [`RsdpV1Tag`] and [`RsdpV2Tag`]. + //! Module for RSDP/ACPI. RSDP (Root System Description Pointer) is a data structure used in the //! ACPI programming interface. //! diff --git a/multiboot2/src/smbios.rs b/multiboot2/src/smbios.rs index 56f9abe3..5c34c7d8 100644 --- a/multiboot2/src/smbios.rs +++ b/multiboot2/src/smbios.rs @@ -1,3 +1,5 @@ +//! Module for [`SmbiosTag`]. + #[cfg(feature = "builder")] use crate::builder::BoxedDst; use crate::{Tag, TagTrait, TagType, TagTypeId}; diff --git a/multiboot2/src/tag.rs b/multiboot2/src/tag.rs index 0469d720..c7860111 100644 --- a/multiboot2/src/tag.rs +++ b/multiboot2/src/tag.rs @@ -1,4 +1,4 @@ -//! Module for the base tag definition. +//! Module for the base tag definitions and helper types. //! //! The relevant exports of this module is [`Tag`]. diff --git a/multiboot2/src/vbe_info.rs b/multiboot2/src/vbe_info.rs index 7b7035a6..a5973f4c 100644 --- a/multiboot2/src/vbe_info.rs +++ b/multiboot2/src/vbe_info.rs @@ -1,3 +1,5 @@ +//! Module for [`VBEInfoTag`]. + use crate::{Tag, TagTrait, TagType, TagTypeId}; use core::fmt; @@ -319,7 +321,6 @@ bitflags! { } bitflags! { - /// The DirectColorModeInfo field describes important characteristics of direct color modes. /// /// Bit D0 specifies whether the color ramp of the DAC is fixed or