From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web12.532.1576774699642852664 for ; Thu, 19 Dec 2019 08:58:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=ZXtFf5Ky; spf=pass (domain: linaro.org, ip: 209.85.128.68, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f68.google.com with SMTP id u2so6382022wmc.3 for ; Thu, 19 Dec 2019 08:58:19 -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=L6M8nSy9MyusA3UpvMJOsx2oACVusmpuJ8fRlE/STLM=; b=ZXtFf5KyTYMVEusWHU5yb1+7BkIrvCWFrJFJ1pbbb4ZL/ZgnntnO3CRbP0NMku4j7h os7cQT1PWwWYNR86Ugf43DxK44xqYsvvZdNF09p5wMqXZ71FjX4F+jGLbm+jqgY3l9NT UZHGddK/bq74hFCIbsSZWqZTX6/lAERfwrxJDlJKjCal2oLx6p5KWbD2OcT1Qjg05Jpq KRuFTijBQs+cIQz4ynOW/mjcNF2HXSjE9JI518bmTia8DS2czPV5LYib1wrMp5rxFFpj 4JQmY56PFFLI9m0s6ZTY38HZZcvSJfCpXxS5e1fVtrWr35edk8+x6szd7moSH79fkByx 0jhg== 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=L6M8nSy9MyusA3UpvMJOsx2oACVusmpuJ8fRlE/STLM=; b=ikYkS0U0v06jUAXVZIu8xp0RhVEfdlm4ffmpZ9G6HC+Hghttcl4b+By9XQvLURFeKg uuq7D/Ak67Wfmtf6O9XP80/gn8ZuTZYdZfPOwGU6raTiOWrMT+wGStfJNuIKCASp7WAV nfBP5NQovnDHHmUB4w0arUwKvoJjLjKiNcjx8F0kmdpB880sS4YIfld9ZnNZCmGAs3zw huSjmGgEvTZnldD1HZ19eq0eNW16fm1BKlj8SOKzU0zWxkZxQFxEVjhGSFhLHnBbdjsg chhZeKIh1RiiOT1uVyVzOrgz+lC7VpmW9CI1zfLnAxjb5XnzpB3l2zN4hJlZNxBs5odU eAZw== X-Gm-Message-State: APjAAAXYyLPpGAYNz2dsVk1jpXNm+2XBX7qQxkSgHBn5P181eSNMkahb Tjm67q8Oahi23eM8pQzgr0YMxVfpcA65FZS0QveFVw== X-Google-Smtp-Source: APXvYqzdk8plJyl6sL4soitvIjUrAslBW0lKm9IpEI7f9fCwYWsu1d8jQeEHZR4fsK6HnNJ/B0XT63WyIBqCxF05rlc= X-Received: by 2002:a1c:7901:: with SMTP id l1mr10984982wme.67.1576774698008; Thu, 19 Dec 2019 08:58:18 -0800 (PST) MIME-Version: 1.0 References: <20191030135036.118952-1-pierre.gondois@arm.com> In-Reply-To: From: "Ard Biesheuvel" Date: Thu, 19 Dec 2019 16:58:12 +0000 Message-ID: Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files To: Pierre Gondois , Leif Lindholm Cc: edk2-devel-groups-io , "Feng, Bob C" , "Gao, Liming" , Sami Mujawar , nd Content-Type: text/plain; charset="UTF-8" (+ Leif) On Thu, 19 Dec 2019 at 13:19, Pierre Gondois 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 > Sent: 18 December 2019 17:50 > To: edk2-devel-groups-io ; Pierre Gondois > Cc: Feng, Bob C ; Gao, Liming ; Sami Mujawar ; nd > Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files > > 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..a59ed1d1952c23d0d3de83353a05 > > 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.
> > +# 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)' > > > > > > > > > >