mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-08-24 23:16:45 +00:00
kvm tools, rtc: Nonvolatile BIOS memory support
This adds a ->cmos_data array to 'struct rtc_device' that is used to emulate nonvolatile BIOS memory and the RTC registers. Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
committed by
Will Deacon
parent
c717392f5c
commit
d951bae032
@@ -26,6 +26,7 @@
|
||||
|
||||
struct rtc_device {
|
||||
u8 cmos_idx;
|
||||
u8 cmos_data[128];
|
||||
};
|
||||
|
||||
static struct rtc_device rtc;
|
||||
@@ -66,6 +67,9 @@ static bool cmos_ram_data_in(struct ioport *ioport, struct kvm *kvm, u16 port, v
|
||||
case RTC_YEAR:
|
||||
ioport__write8(data, bin2bcd(tm->tm_year));
|
||||
break;
|
||||
default:
|
||||
ioport__write8(data, rtc.cmos_data[rtc.cmos_idx]);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -73,6 +77,16 @@ static bool cmos_ram_data_in(struct ioport *ioport, struct kvm *kvm, u16 port, v
|
||||
|
||||
static bool cmos_ram_data_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size)
|
||||
{
|
||||
switch (rtc.cmos_idx) {
|
||||
case RTC_REG_C:
|
||||
case RTC_REG_D:
|
||||
/* Read-only */
|
||||
break;
|
||||
default:
|
||||
rtc.cmos_data[rtc.cmos_idx] = ioport__read8(data);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user