FdtManager

Struct FdtManager 

Source
pub struct FdtManager<'a> {
    fdt: Option<Fdt<'a>>,
    relocated: bool,
    original_addr: Option<usize>,
}

Fields§

§fdt: Option<Fdt<'a>>§relocated: bool§original_addr: Option<usize>

Implementations§

Source§

impl<'a> FdtManager<'a>

Source

const fn new() -> Self

Source

pub fn init(&mut self, ptr: *const u8) -> Result<(), FdtError>

Source

pub fn get_fdt(&self) -> Option<&Fdt<'a>>

Source

pub unsafe fn get_mut_manager() -> &'static mut FdtManager<'static>

Returns a mutable reference to the FdtManager for initialization.

§Safety

This function is only safe to call during single-threaded boot initialization. After SMP is enabled, this should not be called.

Source

pub fn get_manager() -> &'static FdtManager<'static>

Returns a reference to the FdtManager.

§Returns

A reference to the static FdtManager instance.

§Panics

Panics if called before FdtManager is initialized via init_fdt().

Source

unsafe fn relocate_fdt(&mut self, ptr: *mut u8)

Relocates the FDT to a new address.

§Safety

This function modifies the static FDT address and reinitializes the FdtManager. Ensure that the new address is valid and does not cause memory corruption.

§Parameters
  • ptr: The pointer to the new FDT address.
§Panics

This function will panic if the FDT has already been relocated.

Source

pub fn get_initramfs(&self) -> Option<MemoryArea>

Get the initramfs memory area from the device tree

This function searches for the initramfs memory region in the device tree. It looks for the initrd-start/end or linux,initrd-start/end properties in the /chosen node.

§Returns

Option: If the initramfs region is found, returns Some(MemoryArea), otherwise returns None.

Source

pub fn get_dram_memoryarea(&self) -> Option<MemoryArea>

Source

pub fn get_cpu_count(&self) -> Option<usize>

Auto Trait Implementations§

§

impl<'a> Freeze for FdtManager<'a>

§

impl<'a> RefUnwindSafe for FdtManager<'a>

§

impl<'a> Send for FdtManager<'a>

§

impl<'a> Sync for FdtManager<'a>

§

impl<'a> Unpin for FdtManager<'a>

§

impl<'a> UnwindSafe for FdtManager<'a>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.