mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices, vmm: Add legacy CMOS device
Based off of crosvm revision b5237bbcf074eb30cf368a138c0835081e747d71 add a CMOS device. This environments that can't use KVM clock to get the current time (e.g. Windows and EFI.) Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -370,7 +370,22 @@ impl DeviceManager {
|
||||
.io
|
||||
.insert(i8042.clone(), 0x61, 0x4)
|
||||
.map_err(DeviceManagerError::BusError)?;
|
||||
#[cfg(feature = "cmos")]
|
||||
{
|
||||
use vm_memory::GuestMemory;
|
||||
let mem_size = vm_info.memory.as_ref().read().unwrap().end_addr().0 + 1;
|
||||
let mem_below_4g = std::cmp::min(arch::layout::MEM_32BIT_RESERVED_START.0, mem_size);
|
||||
let mem_above_4g = mem_size.saturating_sub(arch::layout::RAM_64BIT_START.0);
|
||||
|
||||
let cmos = Arc::new(Mutex::new(devices::legacy::Cmos::new(
|
||||
mem_below_4g,
|
||||
mem_above_4g,
|
||||
)));
|
||||
buses
|
||||
.io
|
||||
.insert(cmos.clone(), 0x70, 0x2)
|
||||
.map_err(DeviceManagerError::BusError)?;
|
||||
}
|
||||
#[cfg(feature = "acpi")]
|
||||
{
|
||||
let acpi_device = Arc::new(Mutex::new(devices::AcpiShutdownDevice::new(
|
||||
|
||||
Reference in New Issue
Block a user