From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web09.71.1576691411350495693 for ; Wed, 18 Dec 2019 09:50:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=gtqKV24a; spf=pass (domain: linaro.org, ip: 209.85.128.66, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f66.google.com with SMTP id q9so2759650wmj.5 for ; Wed, 18 Dec 2019 09:50:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fK471Bg1B97IVqJe8zqP0leBZhL4xUeO7+QCDXJiKiY=; b=gtqKV24a+vLgy42c07Gns9LTuMJiPX/aga1L6zEION4EldAzcxm0gjDaQ232zicAVG 3YckDZlsUHD1runPyv6OmgJig68FMMlcf+c7Rd9OA9la8FgbvI6cZBiRCGLCkOC/QV8P RQXMZ6H9GqKR59anVuGqEtiSblwH7q6lYFGsMrJjz/ufuIH98jb80E/NHshfpJwQyF7M teumytM/DGh2zwCmN4OQ3OesEI/a71PViaedJS/tQyXTuSm25PiR5m/YBd3gKKmMUpTb ocU5bfshE1bPfNUfUgYzlK7W5OEwiZXxhhtQ2DxBafC1ZJ0pZV8TkKc+vqBeyLDh0c9H TKWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fK471Bg1B97IVqJe8zqP0leBZhL4xUeO7+QCDXJiKiY=; b=H7IKOMSh0+dvgZvFXHdbTRLilYtTo5u9nlk2KsE2NdZwKFmSR7Rf50eA3Tr/Ffr/AG k52hzzox/Oskmu6kA1QKv0cq+IM6ZbpJEujI3T6kIVvJMGAM7JRB9ulR99Q5zJd/AzJC KzBy1OzEQoJJkNLdZlSoKPtgOxsaghpMU2nOvWUfXzsFS0ft/PMx/AmbM1NRG4IGijrE 1A0gnjcxkS2KwZoT4mqJVBq1TEor3OGRA4FXizN148+FgpH1FDwpjxBFPDqpRewCj3UW zGBJkKYAa6zqUrkm+jfFcZD1+SnMJmIPA3XpJNby4u21bUEWDuFngsTLXmZFl893teU8 BhRg== X-Gm-Message-State: APjAAAWeLBWRgDhMOK08s2AFsbUB6OF5LK5ZQIsySfa0Y4kzpt588koN sGIujAf+FjRKR2PUPyTPMqq7sfnjMjDKgl+5/KoZpz/LLuJ5YA== X-Google-Smtp-Source: APXvYqzTqsLPJz1bZaRtJYDl2MMslbswP1s/+5MGcD1sDpgQ4YOMYxvHzjxUeI2lG4IZedYq6KfwJr/N/uqxSzE2hjY= X-Received: by 2002:a1c:7205:: with SMTP id n5mr4820824wmc.9.1576691409264; Wed, 18 Dec 2019 09:50:09 -0800 (PST) MIME-Version: 1.0 References: <20191030135036.118952-1-pierre.gondois@arm.com> In-Reply-To: <20191030135036.118952-1-pierre.gondois@arm.com> From: "Ard Biesheuvel" Date: Wed, 18 Dec 2019 17:50:02 +0000 Message-ID: Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files To: edk2-devel-groups-io , Pierre Gondois Cc: "Feng, Bob C" , "Gao, Liming" , Sami Mujawar , nd Content-Type: text/plain; charset="UTF-8" On Wed, 30 Oct 2019 at 15:50, PierreGondois wrote: > > From: Pierre Gondois > > 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 > --- > > 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..a59ed1d1952c23d0d3de83353a0566fb8a7dab77 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.
> +# Copyright (c) 2019, ARM Limited. All rights reserved.
> # 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)' > > > > >