From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDz4o-0002oD-Tf for qemu-devel@nongnu.org; Tue, 09 Jun 2009 07:01:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDz4k-0002gJ-S2 for qemu-devel@nongnu.org; Tue, 09 Jun 2009 07:01:10 -0400 Received: from [199.232.76.173] (port=41987 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDz4k-0002g7-N0 for qemu-devel@nongnu.org; Tue, 09 Jun 2009 07:01:06 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51415) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDz4j-0002v5-UJ for qemu-devel@nongnu.org; Tue, 09 Jun 2009 07:01:06 -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 n59B15cV007831 for ; Tue, 9 Jun 2009 07:01:05 -0400 From: Gerd Hoffmann Date: Tue, 9 Jun 2009 13:01:01 +0200 Message-Id: <1244545261-23679-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1244545261-23679-1-git-send-email-kraxel@redhat.com> References: <1244545261-23679-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] qdev: switch isa pic to generic irq allocation. 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/i8259.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/i8259.c b/hw/i8259.c index 6c8b5c5..4f73acc 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -59,7 +59,6 @@ struct PicState2 { /* 0 is master pic, 1 is slave pic */ /* XXX: better separation between the two pics */ PicState pics[2]; - qemu_irq parent_irq; void *irq_request_opaque; /* IOAPIC callback support */ SetIRQFunc *alt_irq_func; @@ -167,13 +166,13 @@ void pic_update_irq(PicState2 *s) } printf("pic: cpu_interrupt\n"); #endif - qemu_irq_raise(s->parent_irq); + qemu_irq_raise(s->busdev.qdev.gpio_out[0]); } /* all targets should do this rather than acking the IRQ in the cpu */ #if defined(TARGET_MIPS) || defined(TARGET_PPC) || defined(TARGET_ALPHA) else { - qemu_irq_lower(s->parent_irq); + qemu_irq_lower(s->busdev.qdev.gpio_out[0]); } #endif } @@ -299,7 +298,7 @@ static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val) /* init */ pic_reset(s); /* deassert a pending interrupt */ - qemu_irq_lower(s->pics_state->parent_irq); + qemu_irq_lower(s->pics_state->busdev.qdev.gpio_out[0]); s->init_state = 1; s->init4 = val & 1; s->single_mode = val & 2; @@ -560,13 +559,22 @@ static void i8259_initfn(SysBusDevice *sysdev) s->pics[1].elcr_mask = 0xde; s->pics[0].pics_state = s; s->pics[1].pics_state = s; - qdev_init_gpio_out(&sysdev->qdev, &s->parent_irq, 1); - qdev_init_gpio_in(&sysdev->qdev, i8259_set_irq, 16); } +static SysBusDeviceInfo i8259_info = { + .qdev.name = "i8259", + .qdev.size = sizeof(PicState2), + + .qdev.num_gpio_in = 16, + .qdev.num_gpio_out = 1, + .qdev.irq = i8259_set_irq, + + .init = i8259_initfn, +}; + static void i8259_register(void) { - sysbus_register_dev("i8259", sizeof(PicState2), i8259_initfn); + sysbus_register_withprop(&i8259_info); } device_init(i8259_register); -- 1.6.2.2