From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgRqU-0002ds-7i for qemu-devel@nongnu.org; Fri, 10 Apr 2015 01:51:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgRqM-0000er-Je for qemu-devel@nongnu.org; Fri, 10 Apr 2015 01:51:14 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:8352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgRqL-0000cw-MR for qemu-devel@nongnu.org; Fri, 10 Apr 2015 01:51:06 -0400 Message-ID: <552764B2.5020502@huawei.com> Date: Fri, 10 Apr 2015 13:50:42 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> <1428055432-12120-6-git-send-email-zhaoshenglong@huawei.com> <87zj6i3by4.fsf@linaro.org> <55261793.9020702@huawei.com> <20150409115453.3eb3338d@nial.brq.redhat.com> In-Reply-To: <20150409115453.3eb3338d@nial.brq.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 05/20] hw/acpi/aml-build: Add aml_interrupt() term List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, mst@redhat.com, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, lersek@redhat.com, hanjun.guo@linaro.org, msalter@redhat.com, pbonzini@redhat.com, peter.huangpeng@huawei.com, =?UTF-8?B?QWxleCBCZW5uw6ll?= , christoffer.dall@linaro.org, shannon.zhao@linaro.org On 2015/4/9 17:54, Igor Mammedov wrote: > On Thu, 9 Apr 2015 14:09:23 +0800 > Shannon Zhao wrote: > >> > On 2015/4/8 22:57, Alex Bennée wrote: >>> > > >>> > > Shannon Zhao writes: >>> > > >>>> > >> 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. >>>> > >> >>>> > >> Signed-off-by: Shannon Zhao >>>> > >> Signed-off-by: Shannon Zhao >>>> > >> --- >>>> > >> hw/acpi/aml-build.c | 18 ++++++++++++++++++ >>>> > >> include/hw/acpi/aml-build.h | 1 + >>>> > >> 2 files changed, 19 insertions(+) >>>> > >> >>>> > >> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c >>>> > >> index fefe7c7..bd1713c 100644 >>>> > >> --- a/hw/acpi/aml-build.c >>>> > >> +++ b/hw/acpi/aml-build.c >>>> > >> @@ -527,6 +527,24 @@ Aml *aml_memory32_fixed(uint64_t addr, uint64_t size, uint8_t rw_flag) >>>> > >> return var; >>>> > >> } >>>> > >> >>>> > >> +/* >>>> > >> + * ACPI 1.0: 6.4.3.6 Interrupt (Interrupt Resource Descriptor Macro) >>>> > >> + */ >>>> > >> +Aml *aml_interrupt(uint8_t irq_flags, int irq) >>>> > >> +{ >>>> > >> + Aml *var = aml_alloc(); >>>> > >> + build_append_byte(var->buf, 0x89); /* Extended irq descriptor */ >>>> > >> + build_append_byte(var->buf, 6); /* Length, bits[7:0] minimum value = 6 */ >>>> > >> + build_append_byte(var->buf, 0); /* Length, bits[15:8] minimum value = 0 */ >>>> > >> + build_append_byte(var->buf, irq_flags); /* Interrupt Vector >>>> > >> Information. */ >>> > > >>> > > As the spec says [7:4] is RES0 we might want to assert this is the case. >>> > > >> > >> > Yes, we should check although the probability is very small. > It's revision specific and we don't have infrastructure to check/validate > per revision differences. > > I'd split irq_flags from bitmask to a several args, a enum for each implemented > bit to avoid user setting reserved bits. > > /* ACPI X.X: ... */ > AmlWakeCap { > aml_not_wake_capable = 0, > aml_wake_capable = 1 > } > > ... > Thanks, will try this way. -- Thanks, Shannon