[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 for-2.3 05/25] acpi: add aml_index() term
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v4 for-2.3 05/25] acpi: add aml_index() term |
Date: |
Mon, 9 Mar 2015 12:00:20 +0100 |
On Mon, Mar 09, 2015 at 11:39:57AM +0100, Igor Mammedov wrote:
> On Sun, 8 Mar 2015 13:16:07 +0200
> Marcel Apfelbaum <address@hidden> wrote:
>
> > Add encoding for ACPI DefIndex Opcode.
> >
> > Signed-off-by: Marcel Apfelbaum <address@hidden>
> > ---
> > hw/acpi/aml-build.c | 13 +++++++++++++
> > include/hw/acpi/aml-build.h | 1 +
> > 2 files changed, 14 insertions(+)
> >
> > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> > index 49ba8c1..b3372df 100644
> > --- a/hw/acpi/aml-build.c
> > +++ b/hw/acpi/aml-build.c
> > @@ -477,6 +477,19 @@ Aml *aml_add(Aml *arg1, Aml *arg2)
> > return var;
> > }
> >
> > +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefIndex */
> > +Aml *aml_index(Aml *arg1, Aml *idx)
> > +{
> > + Aml *var = aml_opcode(0x88 /* IndexOp */);
> > +
> > + g_assert(arg1->block_flags & (AML_PACKAGE | AML_EXT_PACKAGE |
> > AML_BUFFER));
> it couldn't be AML_EXT_PACKAGE, it's either a plain DefPackage or DefBuffer
> i.e. I'd suggest to add to above check also checking for
> specific opcodes arg1->op = 0x11 /* buffer */ ...
>
> Also a newer spec (>1.0b) allows to use DefString as argument as well.
You really can have a lot of things there, e.g. a method call
will also work.
I think it's best to drop these asserts at this point,
and maybe blacklist specific bad configs down the road.
> > +
> > + aml_append(var, arg1);
> > + aml_append(var, idx);
> > + build_append_int(var->buf, 0x00 /* NullNameOp */);
> > + return var;
> > +}
> > +
> > /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefNotify */
> > Aml *aml_notify(Aml *arg1, Aml *arg2)
> > {
> > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> > index edc0520..b860732 100644
> > --- a/include/hw/acpi/aml-build.h
> > +++ b/include/hw/acpi/aml-build.h
> > @@ -140,6 +140,7 @@ Aml *aml_and(Aml *arg1, Aml *arg2);
> > Aml *aml_or(Aml *arg1, Aml *arg2);
> > Aml *aml_lless(Aml *arg1, Aml *arg2);
> > Aml *aml_add(Aml *arg1, Aml *arg2);
> > +Aml *aml_index(Aml *arg1, Aml *idx);
> > 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);
- Re: [Qemu-devel] [PATCH v4 for-2.3 01/25] acpi: fix aml_equal term implementation, (continued)
- [Qemu-devel] [PATCH v4 for-2.3 02/25] acpi: add aml_or() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 03/25] acpi: add aml_add() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 04/25] acpi: add aml_lless() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 06/25] acpi: add aml_shiftleft() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 05/25] acpi: add aml_index() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 07/25] acpi: add aml_shiftright() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 08/25] acpi: add aml_increment() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 09/25] acpi: add aml_while() term, Marcel Apfelbaum, 2015/03/08
- [Qemu-devel] [PATCH v4 for-2.3 10/25] hw/acpi: add support for multiple root busses, Marcel Apfelbaum, 2015/03/08