From nobody Wed Apr 16 04:08:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504836827174831.4811028007456; Thu, 7 Sep 2017 19:13:47 -0700 (PDT) Received: from localhost ([::1]:42975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq8ni-0001ad-5d for importer@patchew.org; Thu, 07 Sep 2017 22:13:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dq8gD-0003Ci-GK for qemu-devel@nongnu.org; Thu, 07 Sep 2017 22:06:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dq8g8-00029m-L4 for qemu-devel@nongnu.org; Thu, 07 Sep 2017 22:06:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dq8g8-00027l-Cj for qemu-devel@nongnu.org; Thu, 07 Sep 2017 22:05:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E928356D4; Fri, 8 Sep 2017 02:05:55 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-98.pek2.redhat.com [10.72.12.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id B83A4600CA; Fri, 8 Sep 2017 02:05:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6E928356D4 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jasowang@redhat.com From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 8 Sep 2017 10:05:12 +0800 Message-Id: <1504836324-4871-7-git-send-email-jasowang@redhat.com> In-Reply-To: <1504836324-4871-1-git-send-email-jasowang@redhat.com> References: <1504836324-4871-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 08 Sep 2017 02:05:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/18] net: rtl8139: do not use old_mmio accesses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Parker , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matt Parker Both io and memory use the same mmio functions in the rtl8139 device. This patch removes the separate MemoryRegionOps and old_mmio accessors for memory, and replaces it with an alias to the io memory region. Signed-off-by: Matt Parker Signed-off-by: Jason Wang --- hw/net/rtl8139.c | 53 +++-------------------------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 671c7e4..3be24bb 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -3132,38 +3132,6 @@ static uint32_t rtl8139_io_readl(void *opaque, uint8= _t addr) =20 /* */ =20 -static void rtl8139_mmio_writeb(void *opaque, hwaddr addr, uint32_t val) -{ - rtl8139_io_writeb(opaque, addr & 0xFF, val); -} - -static void rtl8139_mmio_writew(void *opaque, hwaddr addr, uint32_t val) -{ - rtl8139_io_writew(opaque, addr & 0xFF, val); -} - -static void rtl8139_mmio_writel(void *opaque, hwaddr addr, uint32_t val) -{ - rtl8139_io_writel(opaque, addr & 0xFF, val); -} - -static uint32_t rtl8139_mmio_readb(void *opaque, hwaddr addr) -{ - return rtl8139_io_readb(opaque, addr & 0xFF); -} - -static uint32_t rtl8139_mmio_readw(void *opaque, hwaddr addr) -{ - uint32_t val =3D rtl8139_io_readw(opaque, addr & 0xFF); - return val; -} - -static uint32_t rtl8139_mmio_readl(void *opaque, hwaddr addr) -{ - uint32_t val =3D rtl8139_io_readl(opaque, addr & 0xFF); - return val; -} - static int rtl8139_post_load(void *opaque, int version_id) { RTL8139State* s =3D opaque; @@ -3344,22 +3312,6 @@ static const MemoryRegionOps rtl8139_io_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 -static const MemoryRegionOps rtl8139_mmio_ops =3D { - .old_mmio =3D { - .read =3D { - rtl8139_mmio_readb, - rtl8139_mmio_readw, - rtl8139_mmio_readl, - }, - .write =3D { - rtl8139_mmio_writeb, - rtl8139_mmio_writew, - rtl8139_mmio_writel, - }, - }, - .endianness =3D DEVICE_LITTLE_ENDIAN, -}; - static void rtl8139_timer(void *opaque) { RTL8139State *s =3D opaque; @@ -3422,8 +3374,9 @@ static void pci_rtl8139_realize(PCIDevice *dev, Error= **errp) =20 memory_region_init_io(&s->bar_io, OBJECT(s), &rtl8139_io_ops, s, "rtl8139", 0x100); - memory_region_init_io(&s->bar_mem, OBJECT(s), &rtl8139_mmio_ops, s, - "rtl8139", 0x100); + memory_region_init_alias(&s->bar_mem, OBJECT(s), "rtl8139-mem", &s->ba= r_io, + 0, 0x100); + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->bar_io); pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar_mem); =20 --=20 2.7.4