From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDe36-0007jn-Ez for qemu-devel@nongnu.org; Mon, 08 Jun 2009 08:34:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDe2z-0007fQ-MV for qemu-devel@nongnu.org; Mon, 08 Jun 2009 08:34:00 -0400 Received: from [199.232.76.173] (port=58055 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDe2z-0007fB-GR for qemu-devel@nongnu.org; Mon, 08 Jun 2009 08:33:53 -0400 Received: from mx2.redhat.com ([66.187.237.31]:35449) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDe2y-0002Uu-TZ for qemu-devel@nongnu.org; Mon, 08 Jun 2009 08:33:53 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n58CXp95032354 for ; Mon, 8 Jun 2009 08:33:51 -0400 From: Gerd Hoffmann Date: Mon, 8 Jun 2009 14:33:48 +0200 Message-Id: <1244464428-3795-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] qdev: hook up i440fx pcihost to system bus. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- 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