From c7725f921c899c40f500d5156b4c57a326913bfd Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Tue, 30 Nov 2021 16:36:25 +0100 Subject: [PATCH] devices: legacy: cmos: Fix register D emulation The register D has only one bit that is not reserved, and its purpose is to report if the RTC/CMOS device is powered or not. The OVMF firmware was failing to boot as it was getting the information that the device was powered off from the register D. The simple way to fix this issue is by always returning the bit 7 from register D as 1, indicating the device is always powered. Signed-off-by: Sebastien Boeuf --- devices/src/legacy/cmos.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devices/src/legacy/cmos.rs b/devices/src/legacy/cmos.rs index eeaf172c2..3d07eb84c 100644 --- a/devices/src/legacy/cmos.rs +++ b/devices/src/legacy/cmos.rs @@ -121,6 +121,9 @@ impl BusDevice for Cmos { 0x09 => to_bcd((year % 100) as u8), // Bit 5 for 32kHz clock. Bit 7 for Update in Progress 0x0a => 1 << 5 | (update_in_progress as u8) << 7, + // Bit 0-6 are reserved and must be 0. + // Bit 7 must be 1 (CMOS has power) + 0x0d => 1 << 7, 0x32 => to_bcd(((year + 1900) / 100) as u8), _ => { // self.index is always guaranteed to be in range via INDEX_MASK.