Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: documentation fixes and small module reorganization #176

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions multiboot2/src/boot_loader_name.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Module for [`BootLoaderNameTag`].

use crate::{Tag, TagTrait, TagType, TagTypeId};
use core::fmt::{Debug, Formatter};
use core::mem::size_of;
Expand Down
2 changes: 1 addition & 1 deletion multiboot2/src/command_line.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Module for [CommandLineTag].
//! Module for [`CommandLineTag`].

use crate::{Tag, TagTrait, TagType, TagTypeId};

Expand Down
39 changes: 38 additions & 1 deletion multiboot2/src/efi.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -131,6 +137,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::<Self>().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};
Expand Down
2 changes: 2 additions & 0 deletions multiboot2/src/elf_sections.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Module for [`ElfSectionsTag`].

#[cfg(feature = "builder")]
use crate::builder::BoxedDst;
use crate::{Tag, TagTrait, TagType, TagTypeId};
Expand Down
2 changes: 2 additions & 0 deletions multiboot2/src/framebuffer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Module for [`FramebufferTag`].

use crate::{Tag, TagTrait, TagType, TagTypeId};
use core::fmt::Debug;
use core::mem::size_of;
Expand Down
2 changes: 2 additions & 0 deletions multiboot2/src/image_load_addr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Module for [`ImageLoadPhysAddrTag`].

use crate::{Tag, TagTrait, TagType, TagTypeId};
#[cfg(feature = "builder")]
use {core::convert::TryInto, core::mem::size_of};
Expand Down
8 changes: 5 additions & 3 deletions multiboot2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ 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,
};
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;
Expand Down
34 changes: 3 additions & 31 deletions multiboot2/src/memory_map.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -334,37 +337,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::<Self>().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> {
Expand Down
3 changes: 2 additions & 1 deletion multiboot2/src/module.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions multiboot2/src/rsdp.rs
Original file line number Diff line number Diff line change
@@ -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.
//!
Expand Down
2 changes: 2 additions & 0 deletions multiboot2/src/smbios.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Module for [`SmbiosTag`].

#[cfg(feature = "builder")]
use crate::builder::BoxedDst;
use crate::{Tag, TagTrait, TagType, TagTypeId};
Expand Down
2 changes: 1 addition & 1 deletion multiboot2/src/tag.rs
Original file line number Diff line number Diff line change
@@ -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`].

Expand Down
3 changes: 2 additions & 1 deletion multiboot2/src/vbe_info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Module for [`VBEInfoTag`].

use crate::{Tag, TagTrait, TagType, TagTypeId};
use core::fmt;

Expand Down Expand Up @@ -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
Expand Down