From patchwork Tue Dec 4 13:05:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 203647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0571F2C0091 for ; Wed, 5 Dec 2012 01:04:26 +1100 (EST) Received: from localhost ([::1]:38069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tft6m-0007iN-4J for incoming@patchwork.ozlabs.org; Tue, 04 Dec 2012 09:04:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfsBn-00015r-C9 for qemu-devel@nongnu.org; Tue, 04 Dec 2012 08:06:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfsBd-0006B2-8P for qemu-devel@nongnu.org; Tue, 04 Dec 2012 08:05:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfsBc-0006AI-Vk for qemu-devel@nongnu.org; Tue, 04 Dec 2012 08:05:21 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qB4D5KTt019828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 Dec 2012 08:05:20 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qB4D5Iuo027042; Tue, 4 Dec 2012 08:05:19 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id B2D7940A3E; Tue, 4 Dec 2012 14:05:15 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 4 Dec 2012 14:05:14 +0100 Message-Id: <1354626315-31186-18-git-send-email-kraxel@redhat.com> In-Reply-To: <1354626315-31186-1-git-send-email-kraxel@redhat.com> References: <1354626315-31186-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 17/18] q35: update lpc pci config space according to configured devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- 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);