From: Igor Mammedov <imammedo@redhat.com>
To: Robert Hoo <robert.hu@linux.intel.com>
Cc: mst@redhat.com, xiaoguangrong.eric@gmail.com, ani@anisinha.ca,
dan.j.williams@intel.com, jingqi.liu@intel.com,
qemu-devel@nongnu.org, robert.hu@intel.com
Subject: Re: [PATCH v3 4/5] acpi/nvdimm: Implement ACPI NVDIMM Label Methods
Date: Fri, 16 Sep 2022 09:37:57 +0200 [thread overview]
Message-ID: <20220916093757.689a939f@redhat.com> (raw)
In-Reply-To: <78f021195335f1cc9d01071db58a51539f29c597.camel@linux.intel.com>
On Fri, 16 Sep 2022 10:27:08 +0800
Robert Hoo <robert.hu@linux.intel.com> wrote:
> On Fri, 2022-09-09 at 15:39 +0200, Igor Mammedov wrote:
> ...
> > looks more or less fine except of excessive use of named variables
> > which creates global scope variables.
> >
> > I'd suggest to store temporary buffers/packages in LocalX variales,
> > you should be able to do that for everything modulo
> > aml_create_dword_field().
> >
> > see an example below
> >
> ...
> > >
> > > + /*
> > > + * ACPI v6.4: Section 6.5.10 NVDIMM Label Methods
> > > + */
> > > + /* _LSI */
> > > + method = aml_method("_LSI", 0, AML_SERIALIZED);
> > > + com_call = aml_call5(NVDIMM_COMMON_DSM,
> > > + aml_touuid(NVDIMM_DEVICE_DSM_UUID),
> > > + aml_int(1), aml_int(4), aml_int(0),
> > > + aml_int(handle));
> > > + aml_append(method, aml_store(com_call, aml_local(0)));
> > > +
> > > + aml_append(method, aml_create_dword_field(aml_local(0),
> > > + aml_int(0),
> > > "STTS"));
> > > + aml_append(method, aml_create_dword_field(aml_local(0),
> > > aml_int(4),
> > > + "SLSA"));
> > > + aml_append(method, aml_create_dword_field(aml_local(0),
> > > aml_int(8),
> > > + "MAXT"));
> > > +
> > > + pkg = aml_package(3);
> > > + aml_append(pkg, aml_name("STTS"));
> > > + aml_append(pkg, aml_name("SLSA"));
> > > + aml_append(pkg, aml_name("MAXT"));
> > > + aml_append(method, aml_name_decl("RET", pkg));
> >
> > ex: put it in local instead of named variable and return that
> > the same applies to other named temporary named variables.
> >
> Fine, get your point now.
> In ASL it will look like this:
> Local1 = Package (0x3) {STTS, SLSA, MAXT}
> Return (Local1)
>
> But as for
> CreateDWordField (Local0, Zero, STTS) // Status
> CreateDWordField (Local0, 0x04, SLSA) // SizeofLSA
> CreateDWordField (Local0, 0x08, MAXT) // Max Trans
>
> I cannot figure out how to substitute with LocalX. Can you shed more
> light?
Leave this as is, there is no way to make it anonymous/local with FooField.
(well one might try to use Index and copy field's bytes into a buffer and
then explicitly convert to Integer, but that's a rather convoluted way
around limitation so I'd not go this route)
>
> CreateQWordFieldTerm :=
> CreateQWordField (
> SourceBuffer, // TermArg => Buffer
> ByteIndex, // TermArg => Integer
> QWordFieldName // NameString
> )
> NameString :=
> <RootChar NamePath> | <ParentPrefixChar PrefixPath NamePath> |
> NonEmptyNamePath
>
> > > + aml_append(method, aml_return(aml_name("RET")));
> > > +
> ...
> > > + field = aml_create_dword_field(aml_local(3), aml_int(0),
> > > "STTS");
> > > + aml_append(method, field);
> > > + aml_append(method,
> > > aml_return(aml_to_integer(aml_name("STTS"))));
> >
> > why do you need explicitly convert DWORD field to integer?
> > it should be fine to return STTS directly (implicit conversion should
> > take care of the rest)
>
> Explicit convert eases my anxiety on uncertainty. ;)
>
> >
> > > + aml_append(nvdimm_dev, method);
> > > +
> ...
>
next prev parent reply other threads:[~2022-09-16 7:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 3:27 [PATCH v3 0/5] Support ACPI NVDIMM Label Methods Robert Hoo
2022-09-01 3:27 ` [PATCH v3 1/5] tests/acpi: allow SSDT changes Robert Hoo
2022-09-01 3:27 ` [PATCH v3 2/5] acpi/ssdt: Fix aml_or() and aml_and() in if clause Robert Hoo
2022-09-01 3:27 ` [PATCH v3 3/5] acpi/nvdimm: define macro for NVDIMM Device _DSM Robert Hoo
2022-09-07 9:15 ` Igor Mammedov
2022-09-01 3:27 ` [PATCH v3 4/5] acpi/nvdimm: Implement ACPI NVDIMM Label Methods Robert Hoo
2022-09-09 13:39 ` Igor Mammedov
2022-09-09 14:02 ` Robert Hoo
2022-09-12 8:48 ` Igor Mammedov
2022-09-16 2:27 ` Robert Hoo
2022-09-16 7:37 ` Igor Mammedov [this message]
2022-09-16 13:15 ` Robert Hoo
2022-09-20 9:13 ` Igor Mammedov
2022-09-20 12:28 ` Robert Hoo
2022-09-21 13:29 ` Igor Mammedov
2022-09-22 1:22 ` Robert Hoo
2022-09-01 3:27 ` [PATCH v3 5/5] test/acpi/bios-tables-test: SSDT: update golden master binaries Robert Hoo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220916093757.689a939f@redhat.com \
--to=imammedo@redhat.com \
--cc=ani@anisinha.ca \
--cc=dan.j.williams@intel.com \
--cc=jingqi.liu@intel.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=robert.hu@intel.com \
--cc=robert.hu@linux.intel.com \
--cc=xiaoguangrong.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).