From 16b29ae1807b024bd5052301550f5d47dae958a2 Mon Sep 17 00:00:00 2001 From: aliguori Date: Wed, 17 Dec 2008 23:28:44 +0000 Subject: Add HPET emulation to qemu (Beth Kon) This patch adds HPET emulation. It can be disabled with -disable-hpet. An hpet provides a more finely granular clocksource than otherwise available on PC. This means that latency-dependent applications (e.g. multimedia) will generally be smoother when using the HPET. Signed-off-by: Beth Kon Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6081 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/i8254.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'hw/i8254.c') diff --git a/hw/i8254.c b/hw/i8254.c index 4813b0374c..16257872d9 100644 --- a/hw/i8254.c +++ b/hw/i8254.c @@ -463,6 +463,27 @@ static void pit_reset(void *opaque) } } +/* When HPET is operating in legacy mode, i8254 timer0 is disabled */ +void hpet_pit_disable(void) { + PITChannelState *s; + s = &pit_state.channels[0]; + qemu_del_timer(s->irq_timer); +} + +/* When HPET is reset or leaving legacy mode, it must reenable i8254 + * timer 0 + */ + +void hpet_pit_enable(void) +{ + PITState *pit = &pit_state; + PITChannelState *s; + s = &pit->channels[0]; + s->mode = 3; + s->gate = 1; + pit_load_count(s, 0); +} + PITState *pit_init(int base, qemu_irq irq) { PITState *pit = &pit_state; -- cgit v1.2.3-70-g09d2