From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuIMa-00044t-9b for qemu-devel@nongnu.org; Mon, 18 May 2015 06:33:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuIMW-0001qu-4M for qemu-devel@nongnu.org; Mon, 18 May 2015 06:33:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuIMW-0001qW-08 for qemu-devel@nongnu.org; Mon, 18 May 2015 06:33:32 -0400 Date: Mon, 18 May 2015 12:33:25 +0200 From: "Michael S. Tsirkin" Message-ID: <20150518123158-mutt-send-email-mst@redhat.com> References: <1430990964-10528-1-git-send-email-zhaoshenglong@huawei.com> <1430990964-10528-6-git-send-email-zhaoshenglong@huawei.com> <20150515141417.4b6d01ff@nial.brq.redhat.com> <5559651D.6030407@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5559651D.6030407@huawei.com> Subject: Re: [Qemu-devel] [PATCH v6 05/22] hw/acpi/aml-build: Add aml_interrupt() term List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao Cc: Peter Maydell , hangaohuai@huawei.com, Laszlo Ersek , Alexander Spyridakis , Claudio Fontana , QEMU Developers , "Huangpeng (Peter)" , Hanjun Guo , Paolo Bonzini , Igor Mammedov , Alex =?iso-8859-1?Q?Benn=E9e?= , Christoffer Dall , Shannon Zhao On Mon, May 18, 2015 at 12:05:49PM +0800, Shannon Zhao wrote: > On 2015/5/15 20:14, Igor Mammedov wrote: > > On Thu, 7 May 2015 16:51:31 +0100 > > Peter Maydell wrote: > > > >> > On 7 May 2015 at 10:29, Shannon Zhao wrote: > >>> > > From: Shannon Zhao > >>> > > > >>> > > Add aml_interrupt() for describing device interrupt in resource template. > >>> > > These can be used to generating DSDT table for ACPI on ARM. > >> > > >>> > > + /* Interrupt Number */ > >>> > > + build_append_byte(var->buf, extract32(irq, 0, 8)); /* bits[7:0] */ > >>> > > + build_append_byte(var->buf, extract32(irq, 8, 8)); /* bits[15:8] */ > >>> > > + build_append_byte(var->buf, extract32(irq, 16, 8)); /* bits[23:16] */ > >>> > > + build_append_byte(var->buf, extract32(irq, 24, 8)); /* bits[31:24] */ > >> > > >> > You used this twice in the previous patch and again here. Can > >> > we factor it out so we can > >> > build_append_uint32(var->buf, irq); > > I'd prefer to leave it as it is now, yes it's a bit of code duplication > > but when you compare to spec it's 1:1 match and easy to compare > > > > I think we could use build_append_uint32 because this really makes the > code cleaner and it also matches the spec. When comparing to the spec, > uint32 means 4 bytes, so it implies that it includes this byte and next > 3 bytes and it also says the 4 bytes are integral. To me it doesn't, build_append_uint32 suggests integer encoding is used which is not the case here. build_append_4byte? > -- > Shannon