From patchwork Mon Feb 25 17:09:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15074 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 066BE23E24 for ; Mon, 25 Feb 2013 17:09:11 +0000 (UTC) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by fiordland.canonical.com (Postfix) with ESMTP id B4FACA18AB8 for ; Mon, 25 Feb 2013 17:09:10 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id 15so2390330vea.28 for ; Mon, 25 Feb 2013 09:09:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=2fMaEXwKdQHao6Jtgd6TNAvXRi+zDk4BMxiA2jrYWbY=; b=CdPtgD9EerEkUm/yoY4loTDbLHTleSTeOS15cRJAOkYSAQ1kGJdjLy5PVq7LET65oV xIsE4R4Fjgt7Ni/qtLNEmn6/In96WMPoHyWGGNLZO6cu/TxOR0pvzsj2+MOJNSOoBCuy e/Zw31Ib5YXWFnPGthWHBnHnj9uqVuVJL3F03P5fdhHb21cBB+1OTM6FJ594GRr0qcmG NvEBxb0CPlGmlBIz8lDXjxv3ywdrWLt5hL1jYXybq6nHfsvuCndsiGTByXO6ttQZeVCd j9mnoiNF0TUJ/LKeF5yNwgm4dGlMHCLY4jZYdHDIb5Oiuyf9QaannbQVySksIhHItcsA 51xg== X-Received: by 10.52.93.235 with SMTP id cx11mr8689704vdb.51.1361812150237; Mon, 25 Feb 2013 09:09:10 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp68600veb; Mon, 25 Feb 2013 09:09:09 -0800 (PST) X-Received: by 10.180.74.228 with SMTP id x4mr13886773wiv.0.1361812145998; Mon, 25 Feb 2013 09:09:05 -0800 (PST) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id w6si22147397eeo.202.2013.02.25.09.09.05 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Feb 2013 09:09:05 -0800 (PST) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UA1Xy-0006wD-G1; Mon, 25 Feb 2013 17:09:02 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Michael Walle , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini Subject: [PATCH v2 3/5] milkymist-minimac2: Just expose buffers as a sysbus mmio region Date: Mon, 25 Feb 2013 17:09:00 +0000 Message-Id: <1361812142-26640-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1361812142-26640-1-git-send-email-peter.maydell@linaro.org> References: <1361812142-26640-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmHWb774zDd9QL6HPvTFrLRH/mMMZ/p9RIGMi0ahE1uqOhOw5MQnih3X0sbcsF3qKt8RQD+ Just expose the register buffers memory as a standard sysbus mmio region which the creator of the device can map, rather than providing a qdev property which the creator has to set to the base address and then doing the mapping in the device's own init function. Signed-off-by: Peter Maydell Reviewed-by: Andreas Färber Acked-by: Michael Walle --- hw/milkymist-hw.h | 2 +- hw/milkymist-minimac2.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/milkymist-hw.h b/hw/milkymist-hw.h index c8bd7e9..21e202b 100644 --- a/hw/milkymist-hw.h +++ b/hw/milkymist-hw.h @@ -193,10 +193,10 @@ static inline DeviceState *milkymist_minimac2_create(hwaddr base, qemu_check_nic_model(&nd_table[0], "minimac2"); dev = qdev_create(NULL, "milkymist-minimac2"); - qdev_prop_set_taddr(dev, "buffers_base", buffers_base); qdev_set_nic_properties(dev, &nd_table[0]); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, buffers_base); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, rx_irq); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, tx_irq); diff --git a/hw/milkymist-minimac2.c b/hw/milkymist-minimac2.c index 9992dcc..b462e90 100644 --- a/hw/milkymist-minimac2.c +++ b/hw/milkymist-minimac2.c @@ -96,7 +96,6 @@ struct MilkymistMinimac2State { NICState *nic; NICConf conf; char *phy_model; - hwaddr buffers_base; MemoryRegion buffers; MemoryRegion regs_region; @@ -475,7 +474,7 @@ static int milkymist_minimac2_init(SysBusDevice *dev) s->rx1_buf = s->rx0_buf + MINIMAC2_BUFFER_SIZE; s->tx_buf = s->rx1_buf + MINIMAC2_BUFFER_SIZE; - sysbus_add_memory(dev, s->buffers_base, &s->buffers); + sysbus_init_mmio(dev, &s->buffers); qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_milkymist_minimac2_info, &s->conf, @@ -517,8 +516,6 @@ static const VMStateDescription vmstate_milkymist_minimac2 = { }; static Property milkymist_minimac2_properties[] = { - DEFINE_PROP_TADDR("buffers_base", MilkymistMinimac2State, - buffers_base, 0), DEFINE_NIC_PROPERTIES(MilkymistMinimac2State, conf), DEFINE_PROP_STRING("phy_model", MilkymistMinimac2State, phy_model), DEFINE_PROP_END_OF_LIST(),