Patchwork [v3,1/7] i8254: Do not raise IRQ level on reset

login
register
mail settings
Submitter Jan Kiszka
Date Jan. 31, 2012, 5:41 p.m.
Message ID <2d77346cbd848bf82e639d80b26eb0e9506ace44.1328031687.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/138817/
State New
Headers show

Comments

Jan Kiszka - Jan. 31, 2012, 5:41 p.m.
Avoid changing the IRQ level to high on reset as it may trigger spurious
events. Instead, open-code the effects of pit_load_count(0) in the reset
handler.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/i8254.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/i8254.c b/hw/i8254.c
index add1fab..d4a08d7 100644
--- a/hw/i8254.c
+++ b/hw/i8254.c
@@ -481,7 +481,13 @@  static void pit_reset(DeviceState *dev)
         s = &pit->channels[i];
         s->mode = 3;
         s->gate = (i != 2);
-        pit_load_count(s, 0);
+        s->count_load_time = qemu_get_clock_ns(vm_clock);
+        s->count = 0x10000;
+        if (i == 0) {
+            s->next_transition_time =
+                pit_get_next_transition_time(s, s->count_load_time);
+            qemu_mod_timer(s->irq_timer, s->next_transition_time);
+        }
     }
 }