From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] qdev: hook up i440fx pcihost to system bus.
Date: Mon, 8 Jun 2009 14:33:48 +0200 [thread overview]
Message-ID: <1244464428-3795-1-git-send-email-kraxel@redhat.com> (raw)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pci_host.h | 1 +
hw/piix_pci.c | 22 ++++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/hw/pci_host.h b/hw/pci_host.h
index 757b0e2..bd7adcb 100644
--- a/hw/pci_host.h
+++ b/hw/pci_host.h
@@ -36,6 +36,7 @@ do { printf("pci_host_data: " fmt , ## __VA_ARGS__); } while (0)
#endif
typedef struct {
+ DeviceState qdev;
uint32_t config_reg;
PCIBus *bus;
} PCIHostState;
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 914a65a..8eed137 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -175,8 +175,8 @@ PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic)
PCIDevice *d;
I440FXState *s;
- s = qemu_mallocz(sizeof(I440FXState));
- b = pci_register_bus(NULL, "pci",
+ s = container_of(qdev_create(NULL, "i440FX-pcihost"), I440FXState, qdev);
+ b = pci_register_bus(&s->qdev, "pci",
piix3_set_irq, pci_slot_get_pirq, pic, 0, 4);
s->bus = b;
@@ -206,6 +206,24 @@ PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic)
return b;
}
+static void i440fx_initfn(DeviceState *qdev, DeviceInfo *base)
+{
+ /* dummy for now ... */
+}
+
+static struct DeviceInfo i440fx_pcihost_devinfo = {
+ .init = i440fx_initfn,
+ .bus_type = BUS_TYPE_SYSTEM,
+};
+
+static void i440fx_register(void)
+{
+ qdev_register("i440FX-pcihost", sizeof(I440FXState),
+ &i440fx_pcihost_devinfo);
+}
+
+device_init(i440fx_register);
+
/* PIIX3 PCI to ISA bridge */
static PCIDevice *piix3_dev;
--
1.6.2.2
next reply other threads:[~2009-06-08 12:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-08 12:33 Gerd Hoffmann [this message]
2009-06-08 13:04 ` [Qemu-devel] [PATCH] qdev: hook up i440fx pcihost to system bus Paul Brook
2009-06-08 14:04 ` Gerd Hoffmann
2009-06-08 14:53 ` Paul Brook
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=1244464428-3795-1-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).