[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] hw/acpi/piix4: Fix offset of GPE0 registers
From: |
Bernhard Beschow |
Subject: |
[PATCH 5/7] hw/acpi/piix4: Fix offset of GPE0 registers |
Date: |
Sun, 22 Jan 2023 18:07:22 +0100 |
The PIIX4 datasheet defines the GPSTS register to be at offset 0x0c of the
power management I/O register block. This register block is represented
in the device model by the io attribute. So make io_gpe a child memory
region of io at offset 0x0c.
Note that SeaBIOS sets the base address of the register block to 0x600,
resulting in the io_gpe block to start at 0x60c. GPE_BASE is defined as
0xafe0 which is 0xa9d4 bytes off. In order to preserve compatibilty,
create an io_gpe_qemu memory region alias at GPE_BASE.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
include/hw/acpi/piix4.h | 1 +
hw/acpi/piix4.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h
index 62e1925a1f..4e6cad9e8c 100644
--- a/include/hw/acpi/piix4.h
+++ b/include/hw/acpi/piix4.h
@@ -40,6 +40,7 @@ struct PIIX4PMState {
MemoryRegion io;
MemoryRegion io_gpe;
+ MemoryRegion io_gpe_qemu;
ACPIREGS ar;
APMState apm;
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 2e9bc63fca..836f9026b1 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -49,6 +49,7 @@
#include "qom/object.h"
#define GPE_BASE 0xafe0
+#define GPE_OFS 0xc
#define GPE_LEN 4
#define ACPI_PCIHP_ADDR_PIIX4 0xae00
@@ -429,7 +430,7 @@ static void piix4_pm_add_properties(PIIX4PMState *s)
object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_DISABLE_CMD,
&acpi_disable_cmd, OBJ_PROP_FLAG_READ);
object_property_add_uint64_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK,
- &s->io_gpe.addr, OBJ_PROP_FLAG_READ);
+ &s->io_gpe_qemu.addr, OBJ_PROP_FLAG_READ);
object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN,
&s->ar.gpe.len, OBJ_PROP_FLAG_READ);
object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT,
@@ -558,7 +559,11 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion
*parent,
{
memory_region_init_io(&s->io_gpe, OBJECT(s), &piix4_gpe_ops, s,
"acpi-gpe0", GPE_LEN);
- memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe);
+ memory_region_add_subregion(&s->io, GPE_OFS, &s->io_gpe);
+
+ memory_region_init_alias(&s->io_gpe_qemu, OBJECT(s), "acpi-gpe0-qemu",
+ &s->io_gpe, 0, memory_region_size(&s->io_gpe));
+ memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe_qemu);
if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) {
acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent,
--
2.39.1
- Re: [PATCH 1/7] hw/acpi/{ich9,piix4}: Reuse existing attributes for QOM properties, (continued)
- [PATCH 4/7] hw/acpi/ich9: Use ICH9_PMIO_GPE0_STS just once, Bernhard Beschow, 2023/01/22
- [PATCH 5/7] hw/acpi/piix4: Fix offset of GPE0 registers,
Bernhard Beschow <=
- [PATCH 6/7] hw/acpi: Trace GPE access in all device models, not just PIIX4, Bernhard Beschow, 2023/01/22
- [PATCH 7/7] hw/acpi/core: Trace enable and status registers of GPE separately, Bernhard Beschow, 2023/01/22
- Re: [PATCH 0/7] ACPI controller cleanup, Igor Mammedov, 2023/01/25