From patchwork Tue Feb 12 01:17:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 219714 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 3B0CF2C02FC for ; Tue, 12 Feb 2013 12:18:31 +1100 (EST) Received: from localhost ([::1]:40926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U54Vx-00079R-Ak for incoming@patchwork.ozlabs.org; Mon, 11 Feb 2013 20:18:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U54Ve-0006kJ-Jd for qemu-devel@nongnu.org; Mon, 11 Feb 2013 20:18:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U54Vc-00085y-Ca for qemu-devel@nongnu.org; Mon, 11 Feb 2013 20:18:10 -0500 Received: from mail-ie0-x234.google.com ([2607:f8b0:4001:c03::234]:44252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U54Vc-00085g-8Q for qemu-devel@nongnu.org; Mon, 11 Feb 2013 20:18:08 -0500 Received: by mail-ie0-f180.google.com with SMTP id bn7so8371032ieb.39 for ; Mon, 11 Feb 2013 17:18:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:x-gm-message-state; bh=/zny7xWMDngeryMrQqVJ07+5xyXtvFw+3EC91BGpqos=; b=Bk6zY9h2rCPK1YBpKFYMROtOAy3ZlfClVN5X+qP631h8MjWxo9yy6mudnIirUhU5Cb 53TMndOV0TsCv0YFozQtqz5PZRhG3CjOaHpcHzw+3ux/19xiHjGPlfTDF0oCDhd07F3c BJeBREQ0bUtGiPam1GXp9uCXn987hyimN4iImTKEAcsKdyTX1cWoG1Qrtj45gicqQt26 7Z9KjT0EjtG6Oq8speXCY9rKHaHxb4SoFghG/e0GHsuF9jbylrRLLT5/OkvyBQL5ye7J /4FbWZsnuVWaD5JxUzMcWRTlhRsEkzh0cwcxleEAjzXRqrPCimRE7dfVs5fFs8sYYtZw JToA== X-Received: by 10.43.114.135 with SMTP id fa7mr20413545icc.21.1360631886537; Mon, 11 Feb 2013 17:18:06 -0800 (PST) Received: from localhost ([101.168.56.206]) by mx.google.com with ESMTPS id v5sm11560475igw.1.2013.02.11.17.18.02 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 11 Feb 2013 17:18:05 -0800 (PST) From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2013 11:17:10 +1000 Message-Id: <974711325dcf4c4ab25f051eede2d04adcfa5f34.1360631576.git.peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmcjNJDM/6Su2konKa88QG6+eD7j2Zr0bvdRh0vUniedAmzOP+EMHQi5JqJNIGbrjy4+Zs/ X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::234 Cc: Peter Crosthwaite , edgar.iglesias@gmail.com, aliguori@us.ibm.com, afaerber@suse.de Subject: [Qemu-devel] [RFC PATCH v1 1/4] xilinx.h: Dont qdev_create from ethernet_create() 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 Pulled the qdev_create functionality out of xilinx_axiethernet_create() and pushed it up to the petalogix_ml605_mmu machine model. This makes the ethernet create+init process consistent with the AXI DMA. Renamed function to xilinx_axiethernet_init accordingly. Signed-off-by: Peter Crosthwaite --- hw/petalogix_ml605_mmu.c | 6 ++++-- hw/xilinx.h | 13 +++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/petalogix_ml605_mmu.c b/hw/petalogix_ml605_mmu.c index bdfc6ce..8fd55a0 100644 --- a/hw/petalogix_ml605_mmu.c +++ b/hw/petalogix_ml605_mmu.c @@ -129,14 +129,16 @@ petalogix_ml605_init(QEMUMachineInitArgs *args) xilinx_timer_create(TIMER_BASEADDR, irq[2], 0, 100 * 1000000); /* axi ethernet and dma initialization. */ + qemu_check_nic_model(&nd_table[0], "xlnx.axi-ethernet"); + eth0 = qdev_create(NULL, "xlnx.axi-ethernet"); dma = qdev_create(NULL, "xlnx.axi-dma"); /* FIXME: attach to the sysbus instead */ object_property_add_child(container_get(qdev_get_machine(), "/unattached"), "xilinx-dma", OBJECT(dma), NULL); - eth0 = xilinx_axiethernet_create(&nd_table[0], STREAM_SLAVE(dma), - 0x82780000, irq[3], 0x1000, 0x1000); + xilinx_axiethernet_init(eth0, &nd_table[0], STREAM_SLAVE(dma), + 0x82780000, irq[3], 0x1000, 0x1000); xilinx_axiethernetdma_init(dma, STREAM_SLAVE(eth0), 0x84600000, irq[1], irq[0], 100 * 1000000); diff --git a/hw/xilinx.h b/hw/xilinx.h index 725f2f4..d255ca7 100644 --- a/hw/xilinx.h +++ b/hw/xilinx.h @@ -53,17 +53,12 @@ xilinx_ethlite_create(NICInfo *nd, hwaddr base, qemu_irq irq, return dev; } -static inline DeviceState * -xilinx_axiethernet_create(NICInfo *nd, StreamSlave *peer, - hwaddr base, qemu_irq irq, - int txmem, int rxmem) +static inline void +xilinx_axiethernet_init(DeviceState *dev, NICInfo *nd, StreamSlave *peer, + hwaddr base, qemu_irq irq, int txmem, int rxmem) { - DeviceState *dev; Error *errp = NULL; - qemu_check_nic_model(nd, "xlnx.axi-ethernet"); - - dev = qdev_create(NULL, "xlnx.axi-ethernet"); qdev_set_nic_properties(dev, nd); qdev_prop_set_uint32(dev, "rxmem", rxmem); qdev_prop_set_uint32(dev, "txmem", txmem); @@ -73,8 +68,6 @@ xilinx_axiethernet_create(NICInfo *nd, StreamSlave *peer, qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq); - - return dev; } static inline void