summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBlue Swirl2011-02-05 15:35:00 +0100
committerBlue Swirl2011-02-12 10:45:06 +0100
commitdd703b991cce99271a032a975885dd37d8c07a94 (patch)
tree8dbb91856eb6ba1ffc18e5372320c0fb58ca351f
parentsysbus: add creation function that may fail (diff)
downloadqemu-dd703b991cce99271a032a975885dd37d8c07a94.tar.gz
qemu-dd703b991cce99271a032a975885dd37d8c07a94.tar.xz
qemu-dd703b991cce99271a032a975885dd37d8c07a94.zip
hpet: make optional
Ignore failure with hpet device creation. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--Makefile.objs1
-rw-r--r--Makefile.target2
-rw-r--r--default-configs/i386-softmmu.mak1
-rw-r--r--default-configs/x86_64-softmmu.mak1
-rw-r--r--hw/hpet.c2
-rw-r--r--hw/pc.c11
6 files changed, 11 insertions, 7 deletions
diff --git a/Makefile.objs b/Makefile.objs
index dee251a3d4..adb584234e 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -195,6 +195,7 @@ hw-obj-$(CONFIG_FDC) += fdc.o
hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o
hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o
hw-obj-$(CONFIG_DMA) += dma.o
+hw-obj-$(CONFIG_HPET) += hpet.o
# PPC devices
hw-obj-$(CONFIG_OPENPIC) += openpic.o
diff --git a/Makefile.target b/Makefile.target
index 3cf5ed9055..a6c30ddc23 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -215,7 +215,7 @@ obj-$(CONFIG_KVM) += ivshmem.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 += vmport.o hpet.o applesmc.o
+obj-i386-y += vmport.o applesmc.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/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index 924629354e..3e0eddfd02 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -19,3 +19,4 @@ CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
CONFIG_PIIX_PCI=y
CONFIG_SOUND=y
+CONFIG_HPET=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index daf8c48540..1cc1b61d54 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -19,3 +19,4 @@ CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
CONFIG_PIIX_PCI=y
CONFIG_SOUND=y
+CONFIG_HPET=y
diff --git a/hw/hpet.c b/hw/hpet.c
index 8fb6811a2c..82a9a21978 100644
--- a/hw/hpet.c
+++ b/hw/hpet.c
@@ -74,8 +74,6 @@ typedef struct HPETState {
uint8_t hpet_id; /* instance id */
} HPETState;
-struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
-
static uint32_t hpet_in_legacy_mode(HPETState *s)
{
return s->config & HPET_CFG_LEGACY;
diff --git a/hw/pc.c b/hw/pc.c
index 00fe04e9d7..56bf1d63f0 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -84,6 +84,7 @@ struct e820_table {
} __attribute((__packed__, __aligned__(4)));
static struct e820_table e820_table;
+struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
void isa_irq_handler(void *opaque, int n, int level)
{
@@ -1104,12 +1105,14 @@ void pc_basic_device_init(qemu_irq *isa_irq,
register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL);
if (!no_hpet) {
- DeviceState *hpet = sysbus_create_simple("hpet", HPET_BASE, NULL);
+ DeviceState *hpet = sysbus_try_create_simple("hpet", HPET_BASE, NULL);
- for (i = 0; i < 24; i++) {
- sysbus_connect_irq(sysbus_from_qdev(hpet), i, isa_irq[i]);
+ if (hpet) {
+ for (i = 0; i < 24; i++) {
+ sysbus_connect_irq(sysbus_from_qdev(hpet), i, isa_irq[i]);
+ }
+ rtc_irq = qdev_get_gpio_in(hpet, 0);
}
- rtc_irq = qdev_get_gpio_in(hpet, 0);
}
*rtc_state = rtc_init(2000, rtc_irq);