From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEeNz-0000uP-UR for qemu-devel@nongnu.org; Fri, 23 Jan 2015 08:34:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEeNt-0003qP-NJ for qemu-devel@nongnu.org; Fri, 23 Jan 2015 08:34:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEeNt-0003qG-Gb for qemu-devel@nongnu.org; Fri, 23 Jan 2015 08:34:49 -0500 Date: Fri, 23 Jan 2015 14:34:39 +0100 From: Igor Mammedov Message-ID: <20150123143439.7b2370a2@nial.brq.redhat.com> In-Reply-To: <54C20739.6000407@redhat.com> References: <1421938231-25698-1-git-send-email-imammedo@redhat.com> <1421938231-25698-12-git-send-email-imammedo@redhat.com> <54C20739.6000407@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 11/47] acpi: add acpi_arg0(), acpi_arg1(), acpi_arg2(), acpi_arg3() terms List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: drjones@redhat.com, marcel.a@redhat.com, mst@redhat.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, pbonzini@redhat.com On Fri, 23 Jan 2015 10:32:57 +0200 Marcel Apfelbaum wrote: > On 01/22/2015 04:49 PM, Igor Mammedov wrote: > > Signed-off-by: Igor Mammedov > > --- > > hw/acpi/acpi-build-utils.c | 32 ++++++++++++++++++++++++++++++++ > > include/hw/acpi/acpi-build-utils.h | 5 +++++ > > 2 files changed, 37 insertions(+) > > > > diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c > > index df5880f..6e10712 100644 > > --- a/hw/acpi/acpi-build-utils.c > > +++ b/hw/acpi/acpi-build-utils.c > > @@ -348,6 +348,38 @@ AcpiAml acpi_name_decl(const char *name, AcpiAml val) > > return var; > > } > Hi Igor, > Very nice series!!! > > > > > +/* ACPI 5.0: 20.2.6.1 Arg Objects Encoding: Arg0Op */ > > +AcpiAml acpi_arg0(void) > > +{ > > + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > > + build_append_byte(var.buf, 0x68); /* ARG0 op */ > > + return var; > > +} > Maybe we can have a little code reuse and use something like: > > static AcpiAml acpi_arg(int idx) > { > AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > build_append_byte(var.buf, 0x68 + idx); /* ARG op */ > return var; > } > > and then: > > AcpiAml acpi_arg0(void) > { > return acpi_arg(0); > } > ... > > I did the same with the local vars. > What do you think? sure lets use it, and take Michael's suggest dropping wrappers and just use plain acpi_arg(X) > Thanks, > Marcel > > > + > > +/* ACPI 5.0: 20.2.6.1 Arg Objects Encoding: Arg1Op */ > > +AcpiAml acpi_arg1(void) > > +{ > > + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > > + build_append_byte(var.buf, 0x69); /* ARG1 op */ > > + return var; > > +} > > + > > +/* ACPI 5.0: 20.2.6.1 Arg Objects Encoding: Arg2Op */ > > +AcpiAml acpi_arg2(void) > > +{ > > + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > > + build_append_byte(var.buf, 0x6A); /* ARG2 op */ > > + return var; > > +} > > + > > +/* ACPI 5.0: 20.2.6.1 Arg Objects Encoding: Arg3Op */ > > +AcpiAml acpi_arg3(void) > > +{ > > + AcpiAml var = aml_allocate_internal(0, NON_BLOCK); > > + build_append_byte(var.buf, 0x6B); /* ARG3 op */ > > + return var; > > +} > > + > > /* ACPI 5.0: 20.2.5.3 Type 1 Opcodes Encoding: DefIfElse */ > > AcpiAml acpi_if(AcpiAml predicate) > > { > > diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h > > index 9e9ef1a..18d9efa 100644 > > --- a/include/hw/acpi/acpi-build-utils.h > > +++ b/include/hw/acpi/acpi-build-utils.h > > @@ -26,6 +26,11 @@ AcpiAml acpi_return(AcpiAml val); > > AcpiAml acpi_int(const uint64_t val); > > AcpiAml GCC_FMT_ATTR(1, 2) acpi_name(const char *name_format, ...); > > AcpiAml acpi_name_decl(const char *name, AcpiAml val); > > +AcpiAml acpi_arg0(void); > > +AcpiAml acpi_arg1(void); > > +AcpiAml acpi_arg2(void); > > +AcpiAml acpi_arg3(void); > > + > > /* Block ASL object primitives */ > > AcpiAml acpi_if(AcpiAml predicate); > > AcpiAml acpi_method(const char *name, int arg_count); > > >