pub struct FdtManager<'a> {
fdt: Option<Fdt<'a>>,
relocated: bool,
}
Fields§
§fdt: Option<Fdt<'a>>
§relocated: bool
Implementations§
Source§impl<'a> FdtManager<'a>
impl<'a> FdtManager<'a>
const fn new() -> Self
pub fn init(&mut self, ptr: *const u8) -> Result<(), FdtError>
Sourcepub unsafe fn set_fdt_addr(addr: usize)
pub unsafe fn set_fdt_addr(addr: usize)
Sets the FDT address.
§Safety
This function modifies a static variable that holds the FDT address. Ensure that this function is called before any other FDT-related functions to avoid undefined behavior.
§Arguments
addr
: The address of the FDT.
§Notes
This function must be called before initializing the FDT manager. After once FdtManager is initialized, you cannot change the address.
pub fn get_fdt(&self) -> Option<&Fdt<'a>>
Sourcepub unsafe fn get_mut_manager() -> &'static mut FdtManager<'a>
pub unsafe fn get_mut_manager() -> &'static mut FdtManager<'a>
Returns a mutable reference to the FdtManager. This is unsafe because it allows mutable access to a static variable. It should be used with caution to avoid data races.
§Safety
This function provides mutable access to the static FdtManager instance. Ensure that no other references to the manager are active to prevent data races.
§Returns
A mutable reference to the static FdtManager instance.
Sourcepub fn get_manager() -> &'static FdtManager<'a>
pub fn get_manager() -> &'static FdtManager<'a>
Sourceunsafe fn relocate_fdt(&mut self, ptr: *mut u8)
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.
Sourcepub fn get_initramfs(&self) -> Option<MemoryArea>
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