From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Pierre Gondois <Pierre.Gondois@arm.com>,
Leif Lindholm <leif.lindholm@linaro.org>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
"Feng, Bob C" <bob.c.feng@intel.com>,
"Gao, Liming" <liming.gao@intel.com>, nd <nd@arm.com>,
Matteo Carlini <Matteo.Carlini@arm.com>,
Laura Moretta <Laura.Moretta@arm.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files
Date: Thu, 19 Dec 2019 18:15:18 +0000 [thread overview]
Message-ID: <DB6PR0802MB2375333EC30BDE02342413CF84520@DB6PR0802MB2375.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <CAKv+Gu9GbYqJ-142_Jnc6aTYSEOy5UL3gc4dc1XYPX-cAWw2WQ@mail.gmail.com>
Hi Ard,
This is required for loading the AML blob in memory so that we can parse and fixup tables.
However, I understand your concern regarding dependency/relying on asl compilers for the .hex file.
The .hex file can be easily generated by a post-processing python script (20-30 lines of code) that reads the AML file and dumps the blob in a C array.
If preferred, we can post a patch that adds this support so that we don’t have to rely on intermediate outputs of asl compilers.
Alternatively, we would be grateful if you can any suggest another option.
Regards,
Sami Mujawar
-----Original Message-----
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Sent: 19 December 2019 04:58 PM
To: Pierre Gondois <Pierre.Gondois@arm.com>; Leif Lindholm <leif.lindholm@linaro.org>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Sami Mujawar <Sami.Mujawar@arm.com>; nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files
(+ Leif)
On Thu, 19 Dec 2019 at 13:19, Pierre Gondois <Pierre.Gondois@arm.com> wrote:
>
> Hello Ard,
> I cannot find any documentation more than what the iASL compiler does with the '-tc' argument:
> -tc Create hex AML table in C (*.hex)
>
> The '.hex' file looks like this:
>
> #ifndef __ASL_SOURCE_FILE_HEX__
> #define __ASL_SOURCE_FILE_HEX__
>
> unsigned char ASL_SOURCE_FILE[] =
> {
> 0x53,0x53,0x44,0x54,0xAD,0x00,0x00,0x00, /* 00000000 "SSDT...." */
> 0x01,0xF8,0x41,0x52,0x4D,0x4C,0x54,0x44, /* 00000008 "..ARMLTD" */
> ...
> }
>
> #endif __ASL_SOURCE_FILE_HEX__
>
> I can make a python script to create a similar '.hex' file in case the iASL compiler changes its ouput. However this script would have to be included in Conf/build_rule.txt.
>
I understand the appeal of using intermediate output of the iasl compiler, but I don't think we should rely on this unless it is a clear stable interface. Managing the complexity of all the various toolchains and build tools is already proving to be too difficult, and adding another degree of freedom is not a good idea.
Can you explain why exactly you need this?
> -----Original Message-----
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Sent: 18 December 2019 17:50
> To: edk2-devel-groups-io <devel@edk2.groups.io>; Pierre Gondois
> <Pierre.Gondois@arm.com>
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Sami Mujawar <Sami.Mujawar@arm.com>; nd
> <nd@arm.com>
> Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files
> before C files
>
> On Wed, 30 Oct 2019 at 15:50, PierreGondois <pierre.gondois@arm.com> wrote:
> >
> > From: Pierre Gondois <pierre.gondois@arm.com>
> >
> > The '-tc' option of the Intel iASL compiler facilitates generation
> > of AML code in a C array. This AML code is output to a .hex file.
> > The .hex file can be included from a C source file, thereby allowing
> > one to run a fix-up code in C.
> >
> > For example, this technique can be used to patch the resource data
> > elements that describe the base address or interrupt number for a
> > device, before installing the ACPI table.
> >
> > To implement this feature two conditions need to be
> > satisfied:
> > - The ASL and C files must be included in the sources
> > section of the same .inf file for the module.
> > - The ASL files are pre-processed and compiled before
> > the C files (so that the .hex file include dependency
> > is satisfied).
> >
> > This patch resolves the dependency by sorting the CODA_TARGET list
> > for the module being built and placing the .aml files at the very
> > beginning of the list.
> >
> > Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
> > ---
> >
> > The changes can be seen at
> > https://github.com/PierreARM/edk2/commits/676_build_asl_first_v1
> >
>
> Hello Pierre,
>
> I am not convinced it is a good idea to depend on what amounts to an implementation detail of the ASL compiler. Is the .hex format documented somewhere?
>
>
> > Notes:
> > v1:
> > - Sort .aml files first in the CODA_TARGET to build [Pierre]
> > them before other files.
> >
> > BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> > b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> > index
> > f0812b6887be6f9fbdb14003f2efff229633fb34..a59ed1d1952c23d0d3de83353a
> > 05
> > 66fb8a7dab77 100755
> > --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> > +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
> > @@ -2,6 +2,7 @@
> > # Create makefile for MS nmake and GNU make # # Copyright (c)
> > 2019, Intel Corporation. All rights reserved.<BR>
> > +# Copyright (c) 2019, ARM Limited. All rights reserved.<BR>
> > # SPDX-License-Identifier: BSD-2-Clause-Patent # from __future__
> > import absolute_import @@ -931,7 +932,14 @@ class
> > ModuleAutoGen(AutoGen):
> > @cached_property
> > def CodaTargetList(self):
> > self.Targets
> > - return self._FinalBuildTargetList
> > +
> > + # To resolve dependencies on compiled ASL files (.aml files) in modules,
> > + # build them first by putting them as the first targets in the
> > + # CodaTargetList.
> > + OrderedList = list(self._FinalBuildTargetList)
> > + OrderedList.sort(key=lambda T: (T.Target.Ext.lower() !=
> > + '.aml'))
> > +
> > + return OrderedList
> >
> > @cached_property
> > def FileTypes(self):
> > --
> > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> >
> >
> >
> >
> >
next prev parent reply other threads:[~2019-12-19 18:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 13:50 [PATCH v1 1/1] BaseTools: Build ASL files before C files PierreGondois
2019-10-30 13:52 ` [edk2-devel] " PierreGondois
2019-10-31 0:41 ` Liming Gao
2019-10-31 11:12 ` PierreGondois
2019-11-04 7:49 ` Bob Feng
2019-11-04 10:32 ` PierreGondois
2019-11-12 13:33 ` PierreGondois
2019-11-13 1:15 ` Liming Gao
2019-11-13 1:40 ` Bob Feng
2019-11-15 16:27 ` PierreGondois
2019-12-04 17:32 ` PierreGondois
2019-12-11 11:23 ` PierreGondois
2019-12-12 9:14 ` Bob Feng
2019-12-16 0:33 ` PierreGondois
2019-12-17 11:41 ` Bob Feng
2019-12-18 10:43 ` PierreGondois
2019-12-18 17:50 ` Ard Biesheuvel
2019-12-19 11:18 ` PierreGondois
2019-12-19 16:58 ` Ard Biesheuvel
2019-12-19 18:15 ` Sami Mujawar [this message]
2019-12-23 16:09 ` Ard Biesheuvel
2019-12-24 16:47 ` PierreGondois
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-list 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=DB6PR0802MB2375333EC30BDE02342413CF84520@DB6PR0802MB2375.eurprd08.prod.outlook.com \
--to=devel@edk2.groups.io \
/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