Patchwork [6/6] Create CONFIG_HPET

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

Comments

Juan Quintela - May 24, 2010, 3:18 p.m.
Compile hpet.o depending of CONFIG_HPET.  Simplify testing for using
this functions once there.  Create inline stabs for the exported functions.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile.target                    |    3 ++-
 config.h                           |   10 ++++++++++
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/hpet_emul.h                     |    8 ++++++--
 monitor.c                          |    4 +++-
 6 files changed, 23 insertions(+), 4 deletions(-)

Patch

diff --git a/Makefile.target b/Makefile.target
index 3859dd5..533327e 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -194,7 +194,8 @@  obj-y += e1000.o
 obj-i386-y += vga.o
 obj-i386-y += mc146818rtc.o i8259.o pc.o
 obj-i386-y += cirrus_vga.o apic.o ioapic.o piix_pci.o
-obj-i386-y += vmmouse.o vmport.o hpet.o
+obj-i386-y += vmmouse.o vmport.o
+obj-i386-$(CONFIG_HPET) += hpet.o
 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
 obj-i386-y += debugcon.o multiboot.o
 obj-i386-y += pc_piix.o
diff --git a/config.h b/config.h
index e20f786..7d92cfc 100644
--- a/config.h
+++ b/config.h
@@ -1,2 +1,12 @@ 
 #include "config-host.h"
 #include "config-target.h"
+
+/* We want to include different config files for specific targets
+   And for the common library.  They need a different name because
+   we don't want to rely in paths */
+
+#if defined(NEED_CPU_H)
+#include "config-devices.h"
+#else
+#include "config-all-devices.h"
+#endif
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index ed00471..6341ede 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -23,3 +23,4 @@  CONFIG_NE2000_ISA=y
 CONFIG_PIIX_PCI=y
 CONFIG_SOUND=y
 CONFIG_VIRTIO_PCI=y
+CONFIG_HPET=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 5183203..e1ca587 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -23,3 +23,4 @@  CONFIG_NE2000_ISA=y
 CONFIG_PIIX_PCI=y
 CONFIG_SOUND=y
 CONFIG_VIRTIO_PCI=y
+CONFIG_HPET=y
diff --git a/hw/hpet_emul.h b/hw/hpet_emul.h
index 4f90faa..898364b 100644
--- a/hw/hpet_emul.h
+++ b/hw/hpet_emul.h
@@ -15,13 +15,17 @@ 

 extern int no_hpet;

-#if !defined(TARGET_I386)
+#if !defined(CONFIG_HPET)

 static inline bool hpet_in_legacy_mode(void)
 {
     return false;
 }

+static inline void hpet_init(qemu_irq *irq)
+{
+}
+
 #else

 #define HPET_BASE               0xfed00000
@@ -87,6 +91,6 @@  typedef struct HPETState {

 extern bool hpet_in_legacy_mode(void);
 extern void hpet_init(qemu_irq *irq);
-#endif /* TARGET_I386 */
+#endif /* CONFIG_HPET */

 #endif
diff --git a/monitor.c b/monitor.c
index 5975f40..a81de0c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -778,7 +778,7 @@  static void do_info_commands(Monitor *mon, QObject **ret_data)
     *ret_data = QOBJECT(cmd_list);
 }

-#if defined(TARGET_I386)
+#if defined(CONFIG_HPET)
 static void do_info_hpet_print(Monitor *mon, const QObject *data)
 {
     monitor_printf(mon, "HPET is %s by QEMU\n",
@@ -2610,6 +2610,8 @@  static const mon_cmd_t info_cmds[] = {
         .help       = "show the active virtual memory mappings",
         .mhandler.info = mem_info,
     },
+#endif
+#if defined(CONFIG_HPET)
     {
         .name       = "hpet",
         .args_type  = "",