From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::241; helo=mail-wr0-x241.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2F2D22218E959 for ; Thu, 14 Dec 2017 03:59:19 -0800 (PST) Received: by mail-wr0-x241.google.com with SMTP id z18so4929999wrb.8 for ; Thu, 14 Dec 2017 04:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Uf85uix+HZOmbROTklqk3CsHlruBp755mYfBGYw0IiY=; b=kYYwA3pQB7v/gTmu6K/kKXYhEczxjUxRXWWpZD3W2ImC5wcDIcRMMdIBKLVaYjNXEa SIT78WWoOE0bgeRynK8eDdyfizJqs1/ZzGDKozt0AMlQXJm7MEMJihgYm66jWW+1OvA5 t6T5bxM0eJhta6sXcGbqCcSSi7jJ3S0yqahR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Uf85uix+HZOmbROTklqk3CsHlruBp755mYfBGYw0IiY=; b=CSIkFtwakVpL6QUamrlDB2DDkZ93z9GdoMn/PuDqaRW8h33pbFCtV+0SbpsVT3utpV +fpeh8KRtboIgriCq4WhLk1qGBcZ5uHS0nB4TOf0GHBRHU6Dfm87JXFC7C5Ff/6KyrOg HGluD1bN0sdGI4hCIgyui807ozS4seGlAB6gNeGsJ5/fasJXHn11gCOtRQz4fh00mTcE pe41Gf9LGQgzB53bFK+ZQmZBEoO8tOlmkTOtLnObM4vkJ2b/P+U2pKm9hE3IBhLmZ20N gyisDSMgEXP971CEuDgstuGlJJnlO+D1I5RHFvrDZm28WTHou7dXhnEZO4anI75kbuYd p2gg== X-Gm-Message-State: AKGB3mLhkT1tpjJ55fBo9ZFI93BPUJrKnhSxwzFhm8GvZMRoRIXltNX1 sxPORXaq8Dlxjf4t2US4NspkZg== X-Google-Smtp-Source: ACJfBou6cnMYys6/theUoKK8u4/+yM4h/idCWDXncDktKcuSo8tU2R8VATl5mzX4sOuSJnYp4JaHtA== X-Received: by 10.223.177.135 with SMTP id q7mr5313425wra.217.1513253039159; Thu, 14 Dec 2017 04:03:59 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id d9sm3961978wrf.45.2017.12.14.04.03.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 04:03:58 -0800 (PST) Date: Thu, 14 Dec 2017 12:03:56 +0000 From: Leif Lindholm To: "Ni, Ruiyu" Cc: edk2-devel@lists.01.org, Michael D Kinney , Eric Dong , Star Zeng , Liming Gao , Ard Biesheuvel Message-ID: <20171214120356.gmlqyz5qrhue7ww6@bivouac.eciton.net> References: <20171213122630.17023-1-leif.lindholm@linaro.org> <20171213122630.17023-2-leif.lindholm@linaro.org> <59f1f807-a54c-9f4f-ce9f-aa83409dea8c@Intel.com> MIME-Version: 1.0 In-Reply-To: <59f1f807-a54c-9f4f-ce9f-aa83409dea8c@Intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH 1/3] MdePkg: break #defines out of Uefi/UefiMultiPhase.h X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Dec 2017 11:59:20 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Dec 14, 2017 at 10:44:04AM +0800, Ni, Ruiyu wrote: > On 12/13/2017 8:26 PM, Leif Lindholm wrote: > > Turns out all .vfr files in the tree interacting with DynamicPcds > > manually copy the same set of EFI_VARIABLE_* definitions, since the rest > > of UefiMultiPhase.h is incompatible with VfrCompile. > > > > Split these out into a separate header file UefiMultiPhaseDefinitions.h > > in order to make it possible to include just that portion into .vfr > > files. Then include that from UefiMultiPhase.h. > > > > Cc: Michael D Kinney > > Cc: Liming Gao > > Cc: Ard Biesheuvel > > Cc: Star Zeng > > Cc: Eric Dong > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Leif Lindholm > > --- > > MdePkg/Include/Uefi/UefiMultiPhase.h | 23 +----------- > > MdePkg/Include/Uefi/UefiMultiPhaseDefinitions.h | 39 ++++++++++++++++++++ > > 2 files changed, 41 insertions(+), 21 deletions(-) > > > > diff --git a/MdePkg/Include/Uefi/UefiMultiPhase.h b/MdePkg/Include/Uefi/UefiMultiPhase.h > > index 0dcbb1b9ee..b360c9513b 100644 > > --- a/MdePkg/Include/Uefi/UefiMultiPhase.h > > +++ b/MdePkg/Include/Uefi/UefiMultiPhase.h > > @@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > > #ifndef __UEFI_MULTIPHASE_H__ > > #define __UEFI_MULTIPHASE_H__ > > +#include "UefiMultiPhaseDefinitions.h" > > + > > #include > > /// > > /// Enumeration of memory types introduced in UEFI. > > @@ -156,27 +158,6 @@ typedef struct { > > } EFI_TABLE_HEADER; > > /// > > -/// Attributes of variable. > > -/// > > -#define EFI_VARIABLE_NON_VOLATILE 0x00000001 > > -#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 > > -#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 > > -/// > > -/// This attribute is identified by the mnemonic 'HR' > > -/// elsewhere in this specification. > > -/// > > -#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 > > -/// > > -/// Attributes of Authenticated Variable > > -/// > > -#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 > > -#define EFI_VARIABLE_APPEND_WRITE 0x00000040 > > -/// > > -/// NOTE: EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered reserved. > > -/// > > -#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 > > - > > -/// > > /// AuthInfo is a WIN_CERTIFICATE using the wCertificateType > > /// WIN_CERTIFICATE_UEFI_GUID and the CertType > > /// EFI_CERT_TYPE_RSA2048_SHA256_GUID. If the attribute specifies > > diff --git a/MdePkg/Include/Uefi/UefiMultiPhaseDefinitions.h b/MdePkg/Include/Uefi/UefiMultiPhaseDefinitions.h > > new file mode 100644 > > index 0000000000..df55a92dfa > > --- /dev/null > > +++ b/MdePkg/Include/Uefi/UefiMultiPhaseDefinitions.h > > @@ -0,0 +1,39 @@ > > +/** @file > > + This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases. > > + > > +Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> > +This program and the accompanying materials are licensed and made available under > > +the terms and conditions of the BSD License that accompanies this distribution. > > +The full text of the license may be found at > > +http://opensource.org/licenses/bsd-license.php. > > + > > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > > + > > +**/ > > + > > +#ifndef __UEFI_MULTIPHASE_DEFS_H__ > > +#define __UEFI_MULTIPHASE_DEFS_H__ > > + > > +/// > > +/// Attributes of variable. > > +/// > > +#define EFI_VARIABLE_NON_VOLATILE 0x00000001 > > +#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 > > +#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 > > +/// > > +/// This attribute is identified by the mnemonic 'HR' > > +/// elsewhere in this specification. > > +/// > > +#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 > > +/// > > +/// Attributes of Authenticated Variable > > +/// > > +#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 > > +#define EFI_VARIABLE_APPEND_WRITE 0x00000040 > > +/// > > +/// NOTE: EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and should be considered reserved. > > +/// > > +#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 > > + > > +#endif > > > Can we just move the definitions to UefiBaseTypes.h? There is nothing in UefiBaseTypes.h that is fundamentally easier to deal with than what is in UefiMultiPhase.h to begin with. > Even vfrcompiler still complains, the syntax enhancement to > vfrcompiler should be simple. It's (probably) not VfrCompile that would need to change. The problem is that the build runs the C preprocessor on the .vfr source files before passing them to VfrCompile. #defines that just replace text work fine, but typedefs and struct definitions make no sense in vfr source. It runs the preprocessor in C mode (for gpp, -x c) which means we cannot use __ASSEMBLER__ to filter out typedefs and struct definitions. We could perhaps switch to -x assembler-with-cpp (and filter UefiMultiPhase.h on __ASSEMBLER__), like we do for DTC. It _seems_ to work in my test, but I do not know what a corresponding change for VS would be. > I personally do not like creating more and more files. I am sort of with you on that one. But I consider it a much lesser evil than duplicated definitions. / Leif