summary refs log tree commit diff stats
path: root/hw/i8254.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i8254.c')
-rw-r--r--hw/i8254.c21
1 files changed, 21 insertions, 0 deletions
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;