Function select_vtl2_mmio_range

Source
pub fn select_vtl2_mmio_range(
    mmio: &[MemoryRange],
    vtl2_size: u64,
) -> Result<MemoryRange, DtError>
Expand description

Select the mmio range that VTL2 should use from looking at VTL0 mmio ranges.

VTL2 MMIO is partitioned such that:

  • All MMIO low range is assigned to VTL0.
  • VTL2_MMIO_HIGH_RANGE_SIZE bytes from the end of the high range is assigned to VTL2.
  • The remaining high range is assigned to VTL0.

Assumes input ranges are non-overlapping and in increasing address order.

On success, returns the mmio that VTL2 should use.

Returns an error if the input VTL0 MMIO range is invalid or if the VTL2 allocation amount was not satisfied due to a lack of high MMIO assigned to VTL0.