qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 07/13] Create PIIX3State instead of using PCIDevice for PIIX3
Date: Mon, 24 Aug 2009 16:16:52 +0200	[thread overview]
Message-ID: <4bd6370f3ea0d567de1db07ff693ab4be9f2079a.1251122302.git.quintela@redhat.com> (raw)
In-Reply-To: <cover.1251122301.git.quintela@redhat.com>
In-Reply-To: <cover.1251122301.git.quintela@redhat.com>


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/piix_pci.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 4739604..29bd92c 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -33,6 +33,10 @@ typedef uint32_t pci_addr_t;

 typedef PCIHostState I440FXState;

+typedef struct PIIX3State {
+    PCIDevice dev;
+} PIIX3State;
+
 struct PCII440FXState {
     PCIDevice dev;
     target_phys_addr_t isa_page_descs[384 / 4];
@@ -229,7 +233,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)

 /* PIIX3 PCI to ISA bridge */

-static PCIDevice *piix3_dev;
+static PIIX3State *piix3_dev;

 static void piix3_set_irq(void *opaque, int irq_num, int level)
 {
@@ -240,13 +244,13 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)

     /* now we change the pic irq level according to the piix irq mappings */
     /* XXX: optimize */
-    pic_irq = piix3_dev->config[0x60 + irq_num];
+    pic_irq = piix3_dev->dev.config[0x60 + irq_num];
     if (pic_irq < 16) {
         /* The pic level is the logical OR of all the PCI irqs mapped
            to it */
         pic_level = 0;
         for (i = 0; i < 4; i++) {
-            if (pic_irq == piix3_dev->config[0x60 + i])
+            if (pic_irq == piix3_dev->dev.config[0x60 + i])
                 pic_level |= pci_irq_levels[i];
         }
         qemu_set_irq(pic[pic_irq], pic_level);
@@ -255,8 +259,8 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)

 static void piix3_reset(void *opaque)
 {
-    PCIDevice *d = opaque;
-    uint8_t *pci_conf = d->config;
+    PIIX3State *d = opaque;
+    uint8_t *pci_conf = d->dev.config;

     pci_conf[0x04] = 0x07; // master, memory and I/O
     pci_conf[0x05] = 0x00;
@@ -307,14 +311,15 @@ static int piix_load(QEMUFile* f, void *opaque, int version_id)
     return pci_device_load(d, f);
 }

-static void piix3_initfn(PCIDevice *d)
+static void piix3_initfn(PCIDevice *dev)
 {
+    PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
     uint8_t *pci_conf;

-    isa_bus_new(&d->qdev);
+    isa_bus_new(&d->dev.qdev);
     register_savevm("PIIX3", 0, 2, piix_save, piix_load, d);

-    pci_conf = d->config;
+    pci_conf = d->dev.config;
     pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
     pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371SB_0); // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
     pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
@@ -345,7 +350,7 @@ static PCIDeviceInfo i440fx_info[] = {
     },{
         .qdev.name    = "PIIX3",
         .qdev.desc    = "ISA bridge",
-        .qdev.size    = sizeof(PCIDevice),
+        .qdev.size    = sizeof(PIIX3State),
         .qdev.no_user = 1,
         .init         = piix3_initfn,
     },{
-- 
1.6.2.5

  parent reply	other threads:[~2009-08-24 14:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 14:16 [Qemu-devel] [PATCH v2 00/13] piix_pci cleanup Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 01/13] piix4 don't use pci_irq_levels at all Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 02/13] Split piix4 support from piix_pci.c Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 03/13] low_set_irq is not used anywhere Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 04/13] Use PCII440FXState instead of generic PCIDevice Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 05/13] Move smm_enabled and isa_memory_mappings to PCII440FXState Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 06/13] We want the argument pass to set_irq to be opaque Juan Quintela
2009-08-24 14:16 ` Juan Quintela [this message]
2009-08-24 14:16 ` [Qemu-devel] [PATCH 08/13] Introduce PIIX3IrqState for piix3 irq's state Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 09/13] Fold piix3_init() into i440fx_init Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 10/13] We can add piix3_dev now to PIIX3IrqState Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 11/13] Save irq_state into PCII440FXState Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 12/13] pci_irq_levels[] belong to PIIX3State Juan Quintela
2009-08-24 14:16 ` [Qemu-devel] [PATCH 13/13] Update SaveVM versions Juan Quintela
  -- strict thread matches above, loose matches on Subject: below --
2009-08-27 23:15 [Qemu-devel] [PATCH 00/13] piix_pci cleanup Juan Quintela
2009-08-27 23:15 ` [Qemu-devel] [PATCH 07/13] Create PIIX3State instead of using PCIDevice for PIIX3 Juan Quintela

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=4bd6370f3ea0d567de1db07ff693ab4be9f2079a.1251122302.git.quintela@redhat.com \
    --to=quintela@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).