Patchwork [4/6] Make hpet_in_legacy_mode() return 0 for !TARGET_I386

login
register
mail settings
Submitter Juan Quintela
Date May 24, 2010, 3:18 p.m.
Message ID <e0ea28c8e1c33f5ccffdbe7b5301f149c5943c21.1274714215.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/53433/
State New
Headers show

Comments

Juan Quintela - May 24, 2010, 3:18 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/hpet_emul.h   |   12 ++++++++++--
 hw/mc146818rtc.c |    6 ------
 2 files changed, 10 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/hpet_emul.h b/hw/hpet_emul.h
index 7e9b610..b6fae0a 100644
--- a/hw/hpet_emul.h
+++ b/hw/hpet_emul.h
@@ -15,6 +15,15 @@ 

 extern int no_hpet;

+#if !defined(TARGET_I386)
+
+static inline uint32_t hpet_in_legacy_mode(void)
+{
+    return 0;
+}
+
+#else
+
 #define HPET_BASE               0xfed00000
 #define HPET_CLK_PERIOD         10000000ULL /* 10000000 femtoseconds == 10ns*/

@@ -76,9 +85,8 @@  typedef struct HPETState {
     uint64_t hpet_counter;      /* main counter */
 } HPETState;

-#if defined TARGET_I386
 extern uint32_t hpet_in_legacy_mode(void);
 extern void hpet_init(qemu_irq *irq);
-#endif
+#endif /* TARGET_I386 */

 #endif
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 571c593..b2af5de 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -101,9 +101,7 @@  static void rtc_irq_raise(qemu_irq irq)
      * mode is established while interrupt is raised. We want it to
      * be lowered in any case
      */
-#if defined TARGET_I386
     if (!hpet_in_legacy_mode())
-#endif
         qemu_irq_raise(irq);
 }

@@ -148,14 +146,10 @@  static void rtc_timer_update(RTCState *s, int64_t current_time)
     int enable_pie;

     period_code = s->cmos_data[RTC_REG_A] & 0x0f;
-#if defined TARGET_I386
     /* disable periodic timer if hpet is in legacy mode, since interrupts are
      * disabled anyway.
      */
     enable_pie = !hpet_in_legacy_mode();
-#else
-    enable_pie = 1;
-#endif
     if (period_code != 0
         && (((s->cmos_data[RTC_REG_B] & REG_B_PIE) && enable_pie)
             || ((s->cmos_data[RTC_REG_B] & REG_B_SQWE) && s->sqw_irq))) {