qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 20/20] q35: update lpc pci config space according to configured devices
Date: Fri, 23 Nov 2012 16:48:31 +0100	[thread overview]
Message-ID: <1353685711-24573-21-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1353685711-24573-1-git-send-email-kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/ich9.h       |    1 +
 hw/lpc_ich9.c   |   29 +++++++++++++++++++++++++++++
 hw/smbus_ich9.c |   12 ------------
 3 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/hw/ich9.h b/hw/ich9.h
index de49135..34e216f 100644
--- a/hw/ich9.h
+++ b/hw/ich9.h
@@ -51,6 +51,7 @@ typedef struct ICH9LPCState {
     /* isa bus */
     ISABus *isa_bus;
     MemoryRegion rbca_mem;
+    Notifier machine_ready;
 
     qemu_irq *pic;
     qemu_irq *ioapic;
diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c
index 2fc83a4..6585236 100644
--- a/hw/lpc_ich9.c
+++ b/hw/lpc_ich9.c
@@ -60,6 +60,7 @@
 #include "pam.h"
 #include "pci_internals.h"
 #include "exec-memory.h"
+#include "sysemu.h"
 
 static int ich9_lpc_sci_irq(ICH9LPCState *lpc);
 
@@ -456,6 +457,30 @@ static const MemoryRegionOps rbca_mmio_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
+static void ich9_lpc_machine_ready(Notifier *n, void *opaque)
+{
+    ICH9LPCState *s = container_of(n, ICH9LPCState, machine_ready);
+    uint8_t *pci_conf;
+
+    pci_conf = s->d.config;
+    if (isa_is_ioport_assigned(0x3f8)) {
+        /* com1 */
+        pci_conf[0x82] |= 0x01;
+    }
+    if (isa_is_ioport_assigned(0x2f8)) {
+        /* com2 */
+        pci_conf[0x82] |= 0x02;
+    }
+    if (isa_is_ioport_assigned(0x378)) {
+        /* lpt */
+        pci_conf[0x82] |= 0x04;
+    }
+    if (isa_is_ioport_assigned(0x3f0)) {
+        /* floppy */
+        pci_conf[0x82] |= 0x08;
+    }
+}
+
 static int ich9_lpc_initfn(PCIDevice *d)
 {
     ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
@@ -473,6 +498,10 @@ static int ich9_lpc_initfn(PCIDevice *d)
 
     ich9_cc_init(lpc);
     apm_init(&lpc->apm, ich9_apm_ctrl_changed, lpc);
+
+    lpc->machine_ready.notify = ich9_lpc_machine_ready;
+    qemu_add_machine_init_done_notifier(&lpc->machine_ready);
+
     return 0;
 }
 
diff --git a/hw/smbus_ich9.c b/hw/smbus_ich9.c
index 54e7e12..4194785 100644
--- a/hw/smbus_ich9.c
+++ b/hw/smbus_ich9.c
@@ -78,18 +78,6 @@ static int ich9_smbus_initfn(PCIDevice *d)
     pci_config_set_interrupt_pin(d->config, 0x01); /* interrupt pin 1 */
 
     pci_set_byte(d->config + ICH9_SMB_HOSTC, 0);
-
-    /*
-     * update parameters based on
-     * paralell_hds[0]
-     * serial_hds[0]
-     * serial_hds[0]
-     * fdc
-     *
-     * Is there any OS that depends on them?
-     */
-
-    pci_set_byte(d->config + ICH9_SMB_HOSTC, 0);
     /* TODO bar0, bar1: 64bit BAR support*/
 
     pm_smbus_init(&d->qdev, &s->smb);
-- 
1.7.1

      parent reply	other threads:[~2012-11-23 15:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 15:48 [Qemu-devel] [PATCH 00/20] acpi: switch to memory api Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 01/20] apci: switch piix4 " Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 02/20] apci: switch ich9 " Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 03/20] apci: switch vt82c686 " Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 04/20] apci: switch timer " Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 05/20] apci: switch timer to memory api [ich9] Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 06/20] apci: switch cnt to memory api Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 07/20] apci: switch cnt to memory api [ich9] Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 08/20] apci: switch evt to memory api Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 09/20] apci: switch evt to memory api [ich9] Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 10/20] acpi: cleanup piix4 memory region Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 11/20] acpi: cleanup vt82c686 " Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 12/20] apci: switch ich9 gpe to memory api Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 13/20] apci: switch ich9 smi " Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 14/20] acpi: cleanup ich9 memory region Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 15/20] acpi: switch smbus to memory api Gerd Hoffmann
2012-11-26 15:18   ` Andreas Färber
2012-11-27  8:47     ` Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 16/20] acpi: fix piix4 smbus mapping Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 17/20] apci: switch piix4 gpe to memory api Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 18/20] acpi: remove acpi_gpe_blk Gerd Hoffmann
2012-11-23 15:48 ` [Qemu-devel] [PATCH 19/20] apci: switch piix4 pci hotplug to memory api Gerd Hoffmann
2012-11-23 15:48 ` Gerd Hoffmann [this message]

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=1353685711-24573-21-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --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).