@@ -165,6 +165,25 @@ DefinitionBlock (
,, , AddressRangeMemory, TypeStatic)
})
}
+
+ Device(HPET) {
+ Name(_HID, EISAID("PNP0103"))
+ Name(_UID, 0)
+ Method (_STA, 0, NotSerialized) {
+ Return(0x0F)
+ }
+ Name(_CRS, ResourceTemplate() {
+ DWordMemory(
+ ResourceConsumer, PosDecode, MinFixed, MaxFixed,
+ NonCacheable, ReadWrite,
+ 0x00000000,
+ 0xFED00000,
+ 0xFED003FF,
+ 0x00000000,
+ 0x00000400 /* 1K memory: FED00000 - FED003FF */
+ )
+ })
+ }
}
Scope(\_SB.PCI0) {
@@ -206,6 +206,30 @@ struct madt_intsrcovr {
u16 flags;
} PACKED;
+/*
+ * ACPI 2.0 Generic Address Space definition.
+ */
+struct acpi_20_generic_address {
+ u8 address_space_id;
+ u8 register_bit_width;
+ u8 register_bit_offset;
+ u8 reserved;
+ u64 address;
+} PACKED;
+
+/*
+ * HPET Description Table
+ */
+struct acpi_20_hpet {
+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */
+ u32 timer_block_id;
+ struct acpi_20_generic_address addr;
+ u8 hpet_number;
+ u16 min_tick;
+ u8 page_protect;
+} PACKED;
+#define ACPI_HPET_ADDRESS 0xFED00000UL
+
#include "acpi-dsdt.hex"
static inline u16 cpu_to_le16(u16 x)
@@ -402,6 +426,27 @@ build_ssdt(void)
return ssdt;
}
+#define HPET_SIGNATURE 0x54455048 //HPET
+static void*
+build_hpet(void)
+{
+ struct acpi_20_hpet *hpet = malloc_high(sizeof(*hpet));
+ if (!hpet) {
+ dprintf(1, "Not enough memory for hpet!\n");
+ return NULL;
+ }
+
+ memset(hpet, 0, sizeof(*hpet));
+ /* Note timer_block_id value must be kept in sync with value advertised by
+ * emulated hpet
+ */
+ hpet->timer_block_id = cpu_to_le32(0x8086a201);
+ hpet->addr.address = cpu_to_le32(ACPI_HPET_ADDRESS);
+ build_header((void*)hpet, HPET_SIGNATURE, sizeof(*hpet), 1);
+
+ return hpet;
+}
+
struct rsdp_descriptor *RsdpAddr;
#define MAX_ACPI_TABLES 20
@@ -440,6 +485,7 @@ acpi_bios_init(void)
ACPI_INIT_TABLE(build_fadt(bdf));
ACPI_INIT_TABLE(build_ssdt());
ACPI_INIT_TABLE(build_madt());
+ ACPI_INIT_TABLE(build_hpet());
u16 i, external_tables = qemu_cfg_acpi_additional_tables();
Part of qemu pcbios commit e04da91178f0e11febbbd61d9795e49cc27e9ad4 Signed-off-by: Gleb Natapov <gleb@redhat.com> --- src/acpi-dsdt.dsl | 19 +++++++++++++++++++ src/acpi.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 0 deletions(-)