From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgCcr-0006R9-P8 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 09:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgCco-0000Eq-FW for qemu-devel@nongnu.org; Thu, 09 Apr 2015 09:36:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgCco-0000Ef-8D for qemu-devel@nongnu.org; Thu, 09 Apr 2015 09:36:06 -0400 Date: Thu, 9 Apr 2015 15:35:54 +0200 From: Igor Mammedov Message-ID: <20150409153554.4b46b9ef@nial.brq.redhat.com> In-Reply-To: <1428055432-12120-15-git-send-email-zhaoshenglong@huawei.com> References: <1428055432-12120-1-git-send-email-zhaoshenglong@huawei.com> <1428055432-12120-15-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 14/20] hw/acpi/aml-build: Add aml_or() term List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, mst@redhat.com, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com, hanjun.guo@linaro.org, msalter@redhat.com, pbonzini@redhat.com, lersek@redhat.com, christoffer.dall@linaro.org, shannon.zhao@linaro.org On Fri, 3 Apr 2015 18:03:46 +0800 Shannon Zhao wrote: > From: Shannon Zhao > > Add aml_or() term and make aml_and can take three args. > Expose build_append_int_noprefix as it wiil be used by > creating a buffer. > > Signed-off-by: Shannon Zhao > Signed-off-by: Shannon Zhao > --- > hw/acpi/aml-build.c | 24 +++++++++++++++++++++--- > hw/i386/acpi-build.c | 2 +- > include/hw/acpi/aml-build.h | 4 +++- > 3 files changed, 25 insertions(+), 5 deletions(-) > > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c > index 5a94fc9..312afb6 100644 > --- a/hw/acpi/aml-build.c > +++ b/hw/acpi/aml-build.c > @@ -240,7 +240,7 @@ static void build_extop_package(GArray *package, uint8_t op) > build_prepend_byte(package, 0x5B); /* ExtOpPrefix */ > } > > -static void build_append_int_noprefix(GArray *table, uint64_t value, int size) > +void build_append_int_noprefix(GArray *table, uint64_t value, int size) > { > int i; > > @@ -445,12 +445,30 @@ Aml *aml_store(Aml *val, Aml *target) > } > > /* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefAnd */ > -Aml *aml_and(Aml *arg1, Aml *arg2) > +Aml *aml_and(Aml *arg1, Aml *arg2, Aml *arg3) I know that it's possible to Store inside of And(a, b, save_here) ASL op, but could you instead rewrite it to Store(And(a, b), save_here) so it wouldn't clatter trivial And(a,b) uses and drop this hunk. > { > Aml *var = aml_opcode(0x7B /* AndOp */); > aml_append(var, arg1); > aml_append(var, arg2); > - build_append_byte(var->buf, 0x00 /* NullNameOp */); > + if (arg3 == NULL) { > + build_append_byte(var->buf, 0x00 /* NullNameOp */); > + } else { > + aml_append(var, arg3); > + } > + return var; > +} > + > +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefOr */ > +Aml *aml_or(Aml *arg1, Aml *arg2, Aml *arg3) same here for arg3 > +{ > + Aml *var = aml_opcode(0x7D /* OrOp */); > + aml_append(var, arg1); > + aml_append(var, arg2); > + if (arg3 == NULL) { > + build_append_byte(var->buf, 0x00 /* NullNameOp */); > + } else { > + aml_append(var, arg3); > + } > return var; > } > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 7b5210e..133685e 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -452,7 +452,7 @@ static void build_append_pcihp_notify_entry(Aml *method, int slot) > Aml *if_ctx; > int32_t devfn = PCI_DEVFN(slot, 0); > > - if_ctx = aml_if(aml_and(aml_arg(0), aml_int(0x1U << slot))); > + if_ctx = aml_if(aml_and(aml_arg(0), aml_int(0x1U << slot), NULL)); > aml_append(if_ctx, aml_notify(aml_name("S%.02X", devfn), aml_arg(1))); > aml_append(method, if_ctx); > } > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h > index 942d986..3473d6e 100644 > --- a/include/hw/acpi/aml-build.h > +++ b/include/hw/acpi/aml-build.h > @@ -156,7 +156,8 @@ Aml *aml_return(Aml *val); > Aml *aml_int(const uint64_t val); > Aml *aml_arg(int pos); > Aml *aml_store(Aml *val, Aml *target); > -Aml *aml_and(Aml *arg1, Aml *arg2); > +Aml *aml_and(Aml *arg1, Aml *arg2, Aml *arg3); > +Aml *aml_or(Aml *arg1, Aml *arg2, Aml *arg3); > Aml *aml_notify(Aml *arg1, Aml *arg2); > Aml *aml_call1(const char *method, Aml *arg1); > Aml *aml_call2(const char *method, Aml *arg1, Aml *arg2); > @@ -211,6 +212,7 @@ Aml *aml_field(const char *name, AmlFieldFlags flags); > Aml *aml_varpackage(uint32_t num_elements); > Aml *aml_touuid(int32_t val1, int16_t val2, int16_t val3, > int16_t val4, int64_t val5); > +void build_append_int_noprefix(GArray *table, uint64_t value, int size); > > void > build_header(GArray *linker, GArray *table_data,