aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi_ich9.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-11-22 13:51:35 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-12-04 13:52:43 +0100
commit10cc69b0de8e1756e6fbda4592c9d0ba3bce58fc (patch)
tree2cde697c9b87351342981061fac9d3d6e52fe1bf /hw/acpi_ich9.c
parent76a7daf97458c55b8d8e6d4eadc5c46b16c705ce (diff)
apci: switch ich9 smi to memory api
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/acpi_ich9.c')
-rw-r--r--hw/acpi_ich9.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/hw/acpi_ich9.c b/hw/acpi_ich9.c
index 5fc160a971..0ed17da1eb 100644
--- a/hw/acpi_ich9.c
+++ b/hw/acpi_ich9.c
@@ -119,12 +119,7 @@ static uint32_t pm_ioport_readw(void *opaque, uint32_t addr)
static void pm_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
{
- ICH9LPCPMRegs *pm = opaque;
-
switch (addr & ICH9_PMIO_MASK) {
- case ICH9_PMIO_SMI_EN:
- pm->smi_en = val;
- break;
default:
pm_ioport_write_fallback(opaque, addr, 4, val);
break;
@@ -134,14 +129,9 @@ static void pm_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
static uint32_t pm_ioport_readl(void *opaque, uint32_t addr)
{
- ICH9LPCPMRegs *pm = opaque;
uint32_t val;
switch (addr & ICH9_PMIO_MASK) {
- case ICH9_PMIO_SMI_EN:
- val = pm->smi_en;
- break;
-
default:
val = pm_ioport_read_fallback(opaque, addr, 4);
break;
@@ -223,6 +213,38 @@ static const MemoryRegionOps ich9_gpe_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
+static uint64_t ich9_smi_readl(void *opaque, hwaddr addr, unsigned width)
+{
+ ICH9LPCPMRegs *pm = opaque;
+ switch (addr) {
+ case 0:
+ return pm->smi_en;
+ case 4:
+ return pm->smi_sts;
+ default:
+ return 0;
+ }
+}
+
+static void ich9_smi_writel(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+ ICH9LPCPMRegs *pm = opaque;
+ switch (addr) {
+ case 0:
+ pm->smi_en = val;
+ break;
+ }
+}
+
+static const MemoryRegionOps ich9_smi_ops = {
+ .read = ich9_smi_readl,
+ .write = ich9_smi_writel,
+ .valid.min_access_size = 4,
+ .valid.max_access_size = 4,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base)
{
ICH9_DEBUG("to 0x%x\n", pm_io_base);
@@ -318,6 +340,10 @@ void ich9_pm_init(ICH9LPCPMRegs *pm, qemu_irq sci_irq, qemu_irq cmos_s3)
ICH9_PMIO_GPE0_LEN);
memory_region_add_subregion(&pm->io, ICH9_PMIO_GPE0_STS, &pm->io_gpe);
+ memory_region_init_io(&pm->io_smi, &ich9_smi_ops, pm, "apci-smi",
+ 8);
+ memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi);
+
pm->irq = sci_irq;
qemu_register_reset(pm_reset, pm);
pm->powerdown_notifier.notify = pm_powerdown_req;