openhcl_boot/host_params/
mod.rs1use crate::cmdline::BootCommandLineOptions;
8use crate::host_params::shim_params::IsolationType;
9use arrayvec::ArrayString;
10use arrayvec::ArrayVec;
11use host_fdt_parser::CpuEntry;
12use host_fdt_parser::GicInfo;
13use host_fdt_parser::MemoryAllocationMode;
14use host_fdt_parser::MemoryEntry;
15use host_fdt_parser::VmbusInfo;
16use memory_range::MemoryRange;
17use memory_range::subtract_ranges;
18
19mod dt;
20mod mmio;
21pub mod shim_params;
22
23pub const MAX_CPU_COUNT: usize = 2048;
25
26pub const MAX_NUMA_NODES: usize = 64;
29
30pub const COMMAND_LINE_SIZE: usize = 0x2000;
31
32const MAX_VTL2_RAM_RANGES: usize = 64;
37
38const MAX_PARTITION_RAM_RANGES: usize = 1024;
40
41pub const MAX_ENTROPY_SIZE: usize = 256;
43
44pub const MAX_VTL2_USED_RANGES: usize = 16;
46
47#[derive(Debug)]
49pub struct PartitionInfo {
50 pub vtl2_ram: ArrayVec<MemoryEntry, MAX_VTL2_RAM_RANGES>,
55 pub vtl2_full_config_region: MemoryRange,
57 pub vtl2_config_region_reclaim: MemoryRange,
60 pub vtl2_reserved_region: MemoryRange,
63 pub vtl2_pool_memory: MemoryRange,
65 pub vtl2_used_ranges: ArrayVec<MemoryRange, MAX_VTL2_USED_RANGES>,
71 pub partition_ram: ArrayVec<MemoryEntry, MAX_PARTITION_RAM_RANGES>,
73 pub isolation: IsolationType,
75 pub bsp_reg: u32,
78 pub cpus: ArrayVec<CpuEntry, MAX_CPU_COUNT>,
80 pub vmbus_vtl2: VmbusInfo,
82 pub vmbus_vtl0: VmbusInfo,
84 pub cmdline: ArrayString<COMMAND_LINE_SIZE>,
86 pub com3_serial_available: bool,
88 pub gic: Option<GicInfo>,
90 pub memory_allocation_mode: MemoryAllocationMode,
92 pub entropy: Option<ArrayVec<u8, MAX_ENTROPY_SIZE>>,
94 pub vtl0_alias_map: Option<u64>,
96 pub nvme_keepalive: bool,
98 pub boot_options: BootCommandLineOptions,
100}
101
102impl PartitionInfo {
103 pub const fn new() -> Self {
105 PartitionInfo {
106 vtl2_ram: ArrayVec::new_const(),
107 vtl2_full_config_region: MemoryRange::EMPTY,
108 vtl2_config_region_reclaim: MemoryRange::EMPTY,
109 vtl2_reserved_region: MemoryRange::EMPTY,
110 vtl2_pool_memory: MemoryRange::EMPTY,
111 vtl2_used_ranges: ArrayVec::new_const(),
112 partition_ram: ArrayVec::new_const(),
113 isolation: IsolationType::None,
114 bsp_reg: 0,
115 cpus: ArrayVec::new_const(),
116 vmbus_vtl2: VmbusInfo {
117 mmio: ArrayVec::new_const(),
118 connection_id: 0,
119 },
120 vmbus_vtl0: VmbusInfo {
121 mmio: ArrayVec::new_const(),
122 connection_id: 0,
123 },
124 cmdline: ArrayString::new_const(),
125 com3_serial_available: false,
126 gic: None,
127 memory_allocation_mode: MemoryAllocationMode::Host,
128 entropy: None,
129 vtl0_alias_map: None,
130 nvme_keepalive: false,
131 boot_options: BootCommandLineOptions::new(),
132 }
133 }
134
135 pub fn vtl2_config_regions(&self) -> impl Iterator<Item = MemoryRange> + use<> {
137 subtract_ranges(
138 [self.vtl2_full_config_region],
139 [self.vtl2_config_region_reclaim],
140 )
141 }
142}