From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYFCk-0001Ss-D9 for qemu-devel@nongnu.org; Wed, 07 Dec 2011 05:58:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYFCf-0007WD-Up for qemu-devel@nongnu.org; Wed, 07 Dec 2011 05:58:26 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:24949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYFCf-0007Vu-P6 for qemu-devel@nongnu.org; Wed, 07 Dec 2011 05:58:21 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=UTF-8; format=flowed Received: from euspt2 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0LVT0026FYH5KL40@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 07 Dec 2011 10:58:17 +0000 (GMT) Received: from [106.109.8.48] by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LVT007VYYH59X@spt2.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 07 Dec 2011 10:58:17 +0000 (GMT) Date: Wed, 07 Dec 2011 14:58:13 +0400 From: Evgeny Voevodin In-reply-to: Message-id: <4EDF46C5.8060300@samsung.com> References: <1323251225-1072-1-git-send-email-e.voevodin@samsung.com> <1323251225-1072-10-git-send-email-e.voevodin@samsung.com> Subject: Re: [Qemu-devel] [PATCH 09/14] hw/lan9118.c: Basic byte/word/long access support. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org, d.solodkiy@samsung.com On 12/07/2011 02:09 PM, Peter Maydell wrote: > On 7 December 2011 09:47, Evgeny Voevodin wrote: >> We included this chip into s5pc210 platform because SMDK board holds >> lan9215 chip. Difference is that 9215 access is 16-bit wide and some >> registers differ. By addition basic 16-bit access to 9118 emulation we >> achieved ethernet controller support by Linux lernel on SMDK boards. > > If it differs then shouldn't we add a new qdev device for 9215 ? > (sharing most of the implementation code, obviously) > This patch could be interpreted as lan9118 emulation expansion since this chip supports 16-bit access too. These changes don't cover all the difference between 9118 and 9215, but it's enough to provide network support to Samsung boards. When 9215 support will be added we can easily switch to this chip. >> static const MemoryRegionOps lan9118_mem_ops = { >> - .read = lan9118_readl, >> - .write = lan9118_writel, >> + .old_mmio = { >> + .read = { lan9118_readb, lan9118_readw, lan9118_readl, }, >> + .write = { lan9118_writeb, lan9118_writew, lan9118_writel, }, >> + }, >> .endianness = DEVICE_NATIVE_ENDIAN, >> }; > > This is going backwards -- the .old_mmio hooks are for backwards > compatibility when converting old devices to MemoryRegions -- they > shouldn't be added in new code. > > You need to make the lan9118_read/write functions look at their > 'size' argument instead. > > -- PMM > >