#[repr(C, align(64))]pub struct BootHandoff {Show 46 fields
pub magic: u64,
pub version: u32,
pub size: u32,
pub nic_mmio_base: u64,
pub nic_pci_bus: u8,
pub nic_pci_device: u8,
pub nic_pci_function: u8,
pub nic_type: u8,
pub mac_address: [u8; 6],
pub _nic_pad: [u8; 2],
pub blk_mmio_base: u64,
pub blk_pci_bus: u8,
pub blk_pci_device: u8,
pub blk_pci_function: u8,
pub blk_type: u8,
pub blk_sector_size: u32,
pub blk_total_sectors: u64,
pub dma_cpu_ptr: u64,
pub dma_bus_addr: u64,
pub dma_size: u64,
pub tsc_freq: u64,
pub stack_top: u64,
pub stack_size: u64,
pub framebuffer_base: u64,
pub framebuffer_width: u32,
pub framebuffer_height: u32,
pub framebuffer_stride: u32,
pub framebuffer_format: u32,
pub memory_map_ptr: u64,
pub memory_map_size: u32,
pub memory_map_desc_size: u32,
pub nic_transport_type: u8,
pub _transport_pad: [u8; 3],
pub nic_notify_off_multiplier: u32,
pub nic_common_cfg: u64,
pub nic_notify_cfg: u64,
pub nic_isr_cfg: u64,
pub nic_device_cfg: u64,
pub blk_transport_type: u8,
pub _blk_transport_pad: [u8; 3],
pub blk_notify_off_multiplier: u32,
pub blk_common_cfg: u64,
pub blk_notify_cfg: u64,
pub blk_isr_cfg: u64,
pub blk_device_cfg: u64,
pub _reserved: [u8; 8],
}Expand description
Data passed from UEFI boot phase to bare-metal phase.
This structure is populated before ExitBootServices and consumed after. All pointers must remain valid post-EBS.
§Safety
- All pointers must point to memory that survives ExitBootServices
- DMA region must be allocated via PCI I/O Protocol for IOMMU compatibility
- Structure must be placed in EfiLoaderData or EfiBootServicesData memory
Fields§
§magic: u64Magic number for validation: “MORPHEUS” = 0x5355_4548_5052_4F4D
version: u32Structure version (currently 1)
size: u32Structure size in bytes (for forward compatibility)
nic_mmio_base: u64VirtIO/NIC MMIO base address (from PCI BAR)
nic_pci_bus: u8PCI bus number
nic_pci_device: u8PCI device number
nic_pci_function: u8PCI function number
nic_type: u8NIC type: 0=None, 1=VirtIO, 2=Intel, 3=Realtek, 4=Broadcom
mac_address: [u8; 6]MAC address (6 bytes, may be zeros if not yet read)
_nic_pad: [u8; 2]Padding for alignment
blk_mmio_base: u64Block device MMIO base address (legacy) or common_cfg (PCI Modern)
blk_pci_bus: u8Block device PCI bus number
blk_pci_device: u8Block device PCI device number
blk_pci_function: u8Block device PCI function number
blk_type: u8Block device type: 0=None, 1=VirtIO-blk, 2=NVMe, 3=AHCI
blk_sector_size: u32Block device sector size (typically 512)
blk_total_sectors: u64Block device total sectors
dma_cpu_ptr: u64CPU pointer for software access
dma_bus_addr: u64Bus address for device DMA (may differ from CPU addr with IOMMU)
dma_size: u64Region size in bytes (minimum 2MB)
tsc_freq: u64Calibrated TSC frequency (ticks per second) MUST be calibrated at boot using UEFI Stall(). NO HARDCODED VALUES.
stack_top: u64Top of stack (highest address, stack grows down)
stack_size: u64Stack size in bytes (minimum 64KB)
framebuffer_base: u64Framebuffer base address for debug output (0 if unavailable)
framebuffer_width: u32Framebuffer width in pixels
framebuffer_height: u32Framebuffer height in pixels
framebuffer_stride: u32Framebuffer stride (bytes per row)
framebuffer_format: u32Framebuffer pixel format: 0=BGR, 1=RGB
memory_map_ptr: u64Pointer to UEFI memory map (copied before EBS)
memory_map_size: u32Memory map size in bytes
memory_map_desc_size: u32Memory map descriptor size
nic_transport_type: u8Transport type: 0=MMIO, 1=PCI Modern, 2=PCI Legacy
_transport_pad: [u8; 3]Padding
nic_notify_off_multiplier: u32Notify offset multiplier (from VIRTIO_PCI_CAP_NOTIFY)
nic_common_cfg: u64Common cfg address (BAR base + cap offset)
nic_notify_cfg: u64Notify cfg address (BAR base + cap offset)
nic_isr_cfg: u64ISR cfg address (BAR base + cap offset)
nic_device_cfg: u64Device cfg address (BAR base + cap offset)
blk_transport_type: u8Transport type: 0=MMIO, 1=PCI Modern, 2=PCI Legacy
_blk_transport_pad: [u8; 3]Padding
blk_notify_off_multiplier: u32Notify offset multiplier (from VIRTIO_PCI_CAP_NOTIFY)
blk_common_cfg: u64Common cfg address (BAR base + cap offset) - same as blk_mmio_base for PCI Modern
blk_notify_cfg: u64Notify cfg address (BAR base + cap offset)
blk_isr_cfg: u64ISR cfg address (BAR base + cap offset)
blk_device_cfg: u64Device cfg address (BAR base + cap offset)
_reserved: [u8; 8]Implementations§
Source§impl BootHandoff
impl BootHandoff
Sourcepub fn validate(&self) -> Result<(), HandoffError>
pub fn validate(&self) -> Result<(), HandoffError>
Validate the handoff structure.
§Returns
Ok(())if validErr(HandoffError)describing the first validation failure
Sourcepub fn validate_network_only(&self) -> Result<(), HandoffError>
pub fn validate_network_only(&self) -> Result<(), HandoffError>
Validate for network-only operation (block device optional).
Sourcepub fn has_block_device(&self) -> bool
pub fn has_block_device(&self) -> bool
Check if block device is configured.
Sourcepub fn has_framebuffer(&self) -> bool
pub fn has_framebuffer(&self) -> bool
Check if framebuffer is available.
Sourcepub unsafe fn dma_region(&self) -> (*mut u8, u64, u64)
pub unsafe fn dma_region(&self) -> (*mut u8, u64, u64)
Get DMA region as raw pointer and size.
§Safety
The returned pointer is only valid if the handoff has been validated.
Sourcepub fn ms_to_ticks(&self, ms: u64) -> u64
pub fn ms_to_ticks(&self, ms: u64) -> u64
Convert milliseconds to TSC ticks.
Sourcepub fn ticks_to_ms(&self, ticks: u64) -> u64
pub fn ticks_to_ms(&self, ticks: u64) -> u64
Convert TSC ticks to milliseconds.
Sourcepub fn us_to_ticks(&self, us: u64) -> u64
pub fn us_to_ticks(&self, us: u64) -> u64
Convert microseconds to TSC ticks.
Sourcepub fn ticks_to_us(&self, ticks: u64) -> u64
pub fn ticks_to_us(&self, ticks: u64) -> u64
Convert TSC ticks to microseconds.
Trait Implementations§
Source§impl Clone for BootHandoff
impl Clone for BootHandoff
Source§fn clone(&self) -> BootHandoff
fn clone(&self) -> BootHandoff
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more