From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdGpX-0002NJ-07 for qemu-devel@nongnu.org; Tue, 27 Nov 2012 03:47:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdGpS-0001P5-Fc for qemu-devel@nongnu.org; Tue, 27 Nov 2012 03:47:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdGpS-0001Oh-7N for qemu-devel@nongnu.org; Tue, 27 Nov 2012 03:47:42 -0500 Message-ID: <50B47E28.1050204@redhat.com> Date: Tue, 27 Nov 2012 09:47:36 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <1353685711-24573-1-git-send-email-kraxel@redhat.com> <1353685711-24573-16-git-send-email-kraxel@redhat.com> <50B3882D.7000700@suse.de> In-Reply-To: <50B3882D.7000700@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 15/20] acpi: switch smbus to memory api List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= Cc: Julien Grall , qemu-devel@nongnu.org On 11/26/12 16:18, Andreas F=E4rber wrote: > Am 23.11.2012 16:48, schrieb Gerd Hoffmann: >> diff --git a/hw/pm_smbus.c b/hw/pm_smbus.c >> index 5d6046d..ea1380c 100644 >> --- a/hw/pm_smbus.c >> +++ b/hw/pm_smbus.c > [...] >> @@ -170,7 +170,16 @@ uint32_t smb_ioport_readb(void *opaque, uint32_t = addr) >> return val; >> } >> =20 >> +static const MemoryRegionOps pm_smbus_ops =3D { >> + .read =3D smb_ioport_readb, >> + .write =3D smb_ioport_writeb, >> + .valid.min_access_size =3D 1, >> + .valid.max_access_size =3D 1, >> + .endianness =3D DEVICE_LITTLE_ENDIAN, >> +}; >=20 > I notice that in comparison to Julien's patch, you are setting .valid > here where he used .impl. Setting .valid matches previous behavior (only byte handlers registered). I'm not fully sure what the defaults for .valid are in case only .impl is specified. I usually either set .valid only or explicitly specify both if I want the memory api split dword writes into bytes for me. > Also a generic C question: When using C99-style struct initializers as > for the MemoryRegionOps, I understand that the fields not explicitly > assigned are zero-initialized. Does that also apply to .foo.bar =3D baz > notation or would it be advisable to use nested .foo =3D { .bar =3D baz= }? As far I know the whole (outer) struct is zero-initialized. cheers, Gerd