From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: afaerber@suse.de, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH v2 16/18] apci: switch piix4 pci hotplug to memory api
Date: Tue, 27 Nov 2012 09:59:26 +0100 [thread overview]
Message-ID: <1354006768-13128-17-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1354006768-13128-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/acpi_piix4.c | 37 +++++++++++++++++++++++++++++--------
1 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index d2ba56e..263338a 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -42,6 +42,9 @@
#define GPE_BASE 0xafe0
#define GPE_LEN 4
+
+#define PCI_HOTPLUG_ADDR 0xae00
+#define PCI_HOTPLUG_SIZE 0x000f
#define PCI_UP_BASE 0xae00
#define PCI_DOWN_BASE 0xae04
#define PCI_EJ_BASE 0xae08
@@ -58,6 +61,7 @@ typedef struct PIIX4PMState {
PCIDevice dev;
MemoryRegion io;
MemoryRegion io_gpe;
+ MemoryRegion io_pci;
ACPIREGS ar;
APMState apm;
@@ -574,6 +578,27 @@ static uint32_t pcirmv_read(void *opaque, uint32_t addr)
return s->pci0_hotplug_enable;
}
+static const MemoryRegionOps piix4_pci_ops = {
+ .old_portio = (MemoryRegionPortio[]) {
+ {
+ .offset = PCI_UP_BASE - PCI_HOTPLUG_ADDR, .len = 4, .size = 4,
+ .read = pci_up_read,
+ },{
+ .offset = PCI_DOWN_BASE - PCI_HOTPLUG_ADDR, .len = 4, .size = 4,
+ .read = pci_down_read,
+ },{
+ .offset = PCI_EJ_BASE - PCI_HOTPLUG_ADDR, .len = 4, .size = 4,
+ .read = pci_features_read,
+ .write = pciej_write,
+ },{
+ .offset = PCI_RMV_BASE - PCI_HOTPLUG_ADDR, .len = 4, .size = 4,
+ .read = pcirmv_read,
+ },
+ PORTIO_END_OF_LIST()
+ },
+ .endianness = DEVICE_LITTLE_ENDIAN,
+};
+
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev,
PCIHotplugState state);
@@ -583,14 +608,10 @@ static void piix4_acpi_system_hot_add_init(PCIBus *bus, PIIX4PMState *s)
GPE_LEN);
memory_region_add_subregion(get_system_io(), GPE_BASE, &s->io_gpe);
- register_ioport_read(PCI_UP_BASE, 4, 4, pci_up_read, s);
- register_ioport_read(PCI_DOWN_BASE, 4, 4, pci_down_read, s);
-
- register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, s);
- register_ioport_read(PCI_EJ_BASE, 4, 4, pci_features_read, s);
-
- register_ioport_read(PCI_RMV_BASE, 4, 4, pcirmv_read, s);
-
+ memory_region_init_io(&s->io_pci, &piix4_pci_ops, s, "apci-pci-hotplug",
+ PCI_HOTPLUG_SIZE);
+ memory_region_add_subregion(get_system_io(), PCI_HOTPLUG_ADDR,
+ &s->io_pci);
pci_bus_hotplug(bus, piix4_device_hotplug, &s->dev.qdev);
}
--
1.7.1
next prev parent reply other threads:[~2012-11-27 8:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-27 8:59 [Qemu-devel] [PATCH v2 00/18] acpi: switch to memory api Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 01/18] apci: switch piix4 " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 02/18] apci: switch ich9 " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 03/18] apci: switch vt82c686 " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 04/18] apci: switch timer " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 05/18] apci: switch cnt " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 06/18] apci: switch evt " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 07/18] acpi: cleanup piix4 memory region Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 08/18] acpi: cleanup vt82c686 " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 09/18] apci: switch ich9 gpe to memory api Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 10/18] apci: switch ich9 smi " Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 11/18] acpi: cleanup ich9 memory region Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 12/18] acpi: switch smbus to memory api Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 13/18] acpi: fix piix4 smbus mapping Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 14/18] apci: switch piix4 gpe to memory api Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 15/18] acpi: remove acpi_gpe_blk Gerd Hoffmann
2012-11-27 8:59 ` Gerd Hoffmann [this message]
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 17/18] q35: update lpc pci config space according to configured devices Gerd Hoffmann
2012-11-27 8:59 ` [Qemu-devel] [PATCH v2 18/18] acpi: drop debug port Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354006768-13128-17-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=afaerber@suse.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).