missing_dev_resources/
lib.rs#![forbid(unsafe_code)]
use mesh::MeshPayload;
use std::ops::RangeInclusive;
use vm_resource::ResourceId;
use vm_resource::kind::ChipsetDeviceHandleKind;
#[derive(MeshPayload, Default)]
pub struct MissingDevHandle {
pub pio: Vec<(String, u16, u16)>,
pub mmio: Vec<(String, u64, u64)>,
}
impl ResourceId<ChipsetDeviceHandleKind> for MissingDevHandle {
const ID: &'static str = "missing-dev";
}
impl MissingDevHandle {
pub fn new() -> Self {
Self::default()
}
pub fn claim_pio(mut self, region_name: impl Into<String>, range: RangeInclusive<u16>) -> Self {
self.pio
.push((region_name.into(), *range.start(), *range.end()));
self
}
pub fn claim_mmio(
mut self,
region_name: impl Into<String>,
range: RangeInclusive<u64>,
) -> Self {
self.mmio
.push((region_name.into(), *range.start(), *range.end()));
self
}
}