Skip to contentSkip to conversation

x86: use device info for hpet

RFC PATCH In review Blue Swirl 1 participant 1 message Aug 29, 2009

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

RFC PATCH 4/5 x86: use device info for hpet

---
 hw/pc.c         |    7 +++++++
 monitor.c       |   10 ----------
 qemu-monitor.hx |    2 --
 3 files changed, 7 insertions(+), 12 deletions(-)
hw/pc.c +7 -0
index 32713b4..cbb9542 100644
@@ -1108,6 +1108,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)
     return env;
 }
 
+static void info_hpet(Monitor *mon, void *opaque)
+{
+    monitor_printf(mon, "HPET is %s by QEMU\n",
+                   (no_hpet) ? "disabled" : "enabled");
+}
+
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size,
                      const char *boot_device,
@@ -1328,6 +1334,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (!no_hpet) {
         hpet_init(isa_irq);
     }
+    monitor_register_device_info("hpet", info_hpet, NULL);
 
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         if (serial_hds[i]) {
monitor.c +0 -10
index 4f507f2..9a55e1c 100644
@@ -304,14 +304,6 @@ static void do_info_name(Monitor *mon)
         monitor_printf(mon, "%s\n", qemu_name);
 }
 
-#if defined(TARGET_I386)
-static void do_info_hpet(Monitor *mon)
-{
-    monitor_printf(mon, "HPET is %s by QEMU\n",
-                   (no_hpet) ? "disabled" : "enabled");
-}
-#endif
-
 static void do_info_uuid(Monitor *mon)
 {
     monitor_printf(mon, UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1],
@@ -1806,8 +1798,6 @@ static const mon_cmd_t info_cmds[] = {
 #if defined(TARGET_I386)
     { "mem", "", mem_info,
       "", "show the active virtual memory mappings", },
-    { "hpet", "", do_info_hpet,
-      "", "show state of HPET", },
 #endif
     { "jit", "", do_info_jit,
       "", "show dynamic compiler info", },
qemu-monitor.hx +0 -2
index 6ad960e..946ba34 100644
@@ -49,8 +49,6 @@ show the command line history
 show virtual to physical memory mappings (i386 only)
 @item info mem
 show the active virtual memory mappings (i386 only)
-@item info hpet
-show state of HPET (i386 only)
 @item info kvm
 show KVM information
 @item info usb
Signature · 1 line
1.6.2.4

From 1f9d63dc2f80fb03cb6fb77c7767b110b96e10f3 Mon Sep 17 00:00:00 2001
From: Blue Swirl <[email protected]>
Date: Sat, 29 Aug 2009 14:02:06 +0000
Subject: [PATCH] x86: use device info for hpet

---
 hw/pc.c         |    7 +++++++
 monitor.c       |   10 ----------
 qemu-monitor.hx |    2 --
 3 files changed, 7 insertions(+), 12 deletions(-)
hw/pc.c +7 -0
index 32713b4..cbb9542 100644
@@ -1108,6 +1108,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)
     return env;
 }
 
+static void info_hpet(Monitor *mon, void *opaque)
+{
+    monitor_printf(mon, "HPET is %s by QEMU\n",
+                   (no_hpet) ? "disabled" : "enabled");
+}
+
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size,
                      const char *boot_device,
@@ -1328,6 +1334,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (!no_hpet) {
         hpet_init(isa_irq);
     }
+    monitor_register_device_info("hpet", info_hpet, NULL);
 
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         if (serial_hds[i]) {
monitor.c +0 -10
index 4f507f2..9a55e1c 100644
@@ -304,14 +304,6 @@ static void do_info_name(Monitor *mon)
         monitor_printf(mon, "%s\n", qemu_name);
 }
 
-#if defined(TARGET_I386)
-static void do_info_hpet(Monitor *mon)
-{
-    monitor_printf(mon, "HPET is %s by QEMU\n",
-                   (no_hpet) ? "disabled" : "enabled");
-}
-#endif
-
 static void do_info_uuid(Monitor *mon)
 {
     monitor_printf(mon, UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1],
@@ -1806,8 +1798,6 @@ static const mon_cmd_t info_cmds[] = {
 #if defined(TARGET_I386)
     { "mem", "", mem_info,
       "", "show the active virtual memory mappings", },
-    { "hpet", "", do_info_hpet,
-      "", "show state of HPET", },
 #endif
     { "jit", "", do_info_jit,
       "", "show dynamic compiler info", },
qemu-monitor.hx +0 -2
index 6ad960e..946ba34 100644
@@ -49,8 +49,6 @@ show the command line history
 show virtual to physical memory mappings (i386 only)
 @item info mem
 show the active virtual memory mappings (i386 only)
-@item info hpet
-show state of HPET (i386 only)
 @item info kvm
 show KVM information
 @item info usb
Signature · 1 line
1.5.6.5