From nobody Sat May 4 18:41:37 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1491923838613567.9680753619749; Tue, 11 Apr 2017 08:17:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B35C020D7648E; Tue, 11 Apr 2017 08:17:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BB96521A04823 for ; Tue, 11 Apr 2017 08:17:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 11 Apr 2017 08:17:08 -0700 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by orsmga002.jf.intel.com with ESMTP; 11 Apr 2017 08:17:07 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,186,1488873600"; d="scan'208";a="72592956" From: Liming Gao To: edk2-devel@lists.01.org Date: Tue, 11 Apr 2017 23:16:41 +0800 Message-Id: <1491923803-12124-2-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 In-Reply-To: <1491923803-12124-1-git-send-email-liming.gao@intel.com> References: <1491923803-12124-1-git-send-email-liming.gao@intel.com> Subject: [edk2] [RFC 1/3] BaseTools: Update Makefile to work at absolute path 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- BaseTools/Source/C/Makefiles/app.makefile | 2 +- BaseTools/Source/C/Makefiles/ms.app | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/C/Makefiles/app.makefile b/BaseTools/Source/C= /Makefiles/app.makefile index e414551..6017b2d 100644 --- a/BaseTools/Source/C/Makefiles/app.makefile +++ b/BaseTools/Source/C/Makefiles/app.makefile @@ -23,6 +23,6 @@ all: $(MAKEROOT)/bin $(APPLICATION) $(APPLICATION): $(OBJECTS)=20 $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs= $(LIBS) =20 -$(OBJECTS): ../Include/Common/BuildVersion.h +$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h =20 include $(MAKEROOT)/Makefiles/footer.makefile diff --git a/BaseTools/Source/C/Makefiles/ms.app b/BaseTools/Source/C/Makef= iles/ms.app index 93d51f9..37b7446 100644 --- a/BaseTools/Source/C/Makefiles/ms.app +++ b/BaseTools/Source/C/Makefiles/ms.app @@ -19,7 +19,7 @@ $(APPLICATION) : $(OBJECTS) -@if not exist $(BIN_PATH) mkdir $(BIN_PATH) $(LD) /nologo /debug /OPT:REF /OPT:ICF=3D10 /incremental:no /nodefaultlib= :libc.lib /out:$@ $(LIBS) $** =20 -$(OBJECTS) : ..\Include\Common\BuildVersion.h +$(OBJECTS) : $(SOURCE_PATH)\Include\Common\BuildVersion.h =20 .PHONY:clean .PHONY:cleanall @@ -30,5 +30,5 @@ clean: cleanall: del /f /q $(OBJECTS) $(APPLICATION) *.pdb $(BIN_PATH)\$(APPNAME).pdb > nul =20 -!INCLUDE ..\Makefiles\ms.rule +!INCLUDE $(SOURCE_PATH)\Makefiles\ms.rule =20 --=20 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat May 4 18:41:37 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1491923840846210.9998474727821; Tue, 11 Apr 2017 08:17:20 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E3E2E2095C3C2; Tue, 11 Apr 2017 08:17:14 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CD24B2194235A for ; Tue, 11 Apr 2017 08:17:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 11 Apr 2017 08:17:10 -0700 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by orsmga002.jf.intel.com with ESMTP; 11 Apr 2017 08:17:08 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,186,1488873600"; d="scan'208";a="72592972" From: Liming Gao To: edk2-devel@lists.01.org Date: Tue, 11 Apr 2017 23:16:42 +0800 Message-Id: <1491923803-12124-3-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 In-Reply-To: <1491923803-12124-1-git-send-email-liming.gao@intel.com> References: <1491923803-12124-1-git-send-email-liming.gao@intel.com> Subject: [edk2] [RFC 2/3] BaseTools: Add PcdValueCommon logic into CommonLib 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- BaseTools/Source/C/Common/GNUmakefile | 3 +- BaseTools/Source/C/Common/Makefile | 3 +- BaseTools/Source/C/Common/PcdValueCommon.c | 601 +++++++++++++++++++++++++= ++++ BaseTools/Source/C/Common/PcdValueCommon.h | 78 ++++ BaseTools/Source/C/Makefiles/lib.makefile | 2 + 5 files changed, 685 insertions(+), 2 deletions(-) create mode 100644 BaseTools/Source/C/Common/PcdValueCommon.c create mode 100644 BaseTools/Source/C/Common/PcdValueCommon.h diff --git a/BaseTools/Source/C/Common/GNUmakefile b/BaseTools/Source/C/Com= mon/GNUmakefile index a193557..574d556 100644 --- a/BaseTools/Source/C/Common/GNUmakefile +++ b/BaseTools/Source/C/Common/GNUmakefile @@ -35,6 +35,7 @@ OBJECTS =3D \ PeCoffLoaderEx.o \ SimpleFileParsing.o \ StringFuncs.o \ - TianoCompress.o + TianoCompress.o \ + PcdValueCommon.o =20 include $(MAKEROOT)/Makefiles/lib.makefile diff --git a/BaseTools/Source/C/Common/Makefile b/BaseTools/Source/C/Common= /Makefile index 41119b1..beb94c7 100644 --- a/BaseTools/Source/C/Common/Makefile +++ b/BaseTools/Source/C/Common/Makefile @@ -34,7 +34,8 @@ OBJECTS =3D \ PeCoffLoaderEx.obj \ SimpleFileParsing.obj \ StringFuncs.obj \ - TianoCompress.obj + TianoCompress.obj \ + PcdValueCommon.obj =20 !INCLUDE ..\Makefiles\ms.lib =20 diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/= C/Common/PcdValueCommon.c new file mode 100644 index 0000000..05b1328 --- /dev/null +++ b/BaseTools/Source/C/Common/PcdValueCommon.c @@ -0,0 +1,601 @@ +/** @file +This file contains the PcdValue structure definition. + +Copyright (c) 2013-2015 Intel Corporation. + +This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD = License +which 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 IMPLI= ED. + +**/ + +#include +#include +#include +#include "CommonLib.h" +#include "PcdValueCommon.h" + +typedef enum { + PcdDataTypeBoolean, + PcdDataTypeUint8, + PcdDataTypeUint16, + PcdDataTypeUint32, + PcdDataTypeUint64, + PcdDataTypePointer +} PCD_DATA_TYPE; + +typedef struct { + CHAR8 *SkuName; + CHAR8 *DefaultValueName; + CHAR8 *TokenSpaceGuidName; + CHAR8 *TokenName; + CHAR8 *DataType; + CHAR8 *Value; + PCD_DATA_TYPE PcdDataType; +} PCD_ENTRY; + +PCD_ENTRY *PcdList; +UINT32 PcdListLength; + +VOID +STATIC +RecordToken ( + UINT8 *FileBuffer, + UINT32 PcdIndex, + UINT32 TokenIndex, + UINT32 TokenStart, + UINT32 TokenEnd + ) +{ + UINT8 *Token; + =20 + Token =3D malloc (TokenEnd - TokenStart + 1); + memcpy (Token, &FileBuffer[TokenStart], TokenEnd - TokenStart); + Token[TokenEnd - TokenStart] =3D 0; + switch (TokenIndex) { + case 0: + PcdList[PcdIndex].SkuName =3D Token; + break; + case 1: + PcdList[PcdIndex].DefaultValueName =3D Token; + break; + case 2: + PcdList[PcdIndex].TokenSpaceGuidName =3D Token; + break; + case 3: + PcdList[PcdIndex].TokenName =3D Token; + break; + case 4: + PcdList[PcdIndex].DataType =3D Token; + if (strcmp (Token, "BOOLEAN") =3D=3D 0) { + PcdList[PcdIndex].PcdDataType =3D PcdDataTypeBoolean; + } else if (strcmp (Token, "UINT8") =3D=3D 0) { + PcdList[PcdIndex].PcdDataType =3D PcdDataTypeUint8; + } else if (strcmp (Token, "UINT16") =3D=3D 0) { + PcdList[PcdIndex].PcdDataType =3D PcdDataTypeUint16; + } else if (strcmp (Token, "UINT32") =3D=3D 0) { + PcdList[PcdIndex].PcdDataType =3D PcdDataTypeUint32; + } else if (strcmp (Token, "UINT64") =3D=3D 0) { + PcdList[PcdIndex].PcdDataType =3D PcdDataTypeUint64; + } else { + PcdList[PcdIndex].PcdDataType =3D PcdDataTypePointer; + } + break; + case 5: + PcdList[PcdIndex].Value =3D Token; + break; + } +} + +int +STATIC +LookupPcdIndex ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName + ) +{ + UINT32 Index; + =20 + if (SkuName =3D=3D NULL) { + SkuName =3D "DEFAULT"; + } + if (DefaultValueName =3D=3D NULL) { + DefaultValueName =3D "DEFAULT"; + } + for (Index =3D 0; Index < PcdListLength; Index++) { + if (strcmp(PcdList[Index].TokenSpaceGuidName, TokenSpaceGuidName) !=3D= 0) { + continue; + } + if (strcmp(PcdList[Index].TokenName, TokenName) !=3D 0) { + continue; + } + if (strcmp(PcdList[Index].SkuName, SkuName) !=3D 0) { + continue; + } + if (strcmp(PcdList[Index].DefaultValueName, DefaultValueName) !=3D 0) { + continue; + } + return Index; + } + return -1; +} + +UINT64 +__PcdGet ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName + ) +{ + int Index; + UINT8 *End; + =20 + Index =3D LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName,= TokenName); + if (Index < 0) { + fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, Defa= ultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + } + switch (PcdList[Index].PcdDataType) { + case PcdDataTypeBoolean: + case PcdDataTypeUint8: + case PcdDataTypeUint16: + case PcdDataTypeUint32: + return (UINT64)strtoul(PcdList[Index].Value, &End, 16); + break; + case PcdDataTypeUint64: + return (UINT64)strtoull(PcdList[Index].Value, &End, 16); + break; + case PcdDataTypePointer: + fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use PcdGetPtr()\n", S= kuName, DefaultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + break; + } + return 0; +} + +VOID +__PcdSet ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT64 Value + ) +{ + int Index; + =20 + Index =3D LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName,= TokenName); + if (Index < 0) { + fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, Defa= ultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + } + free(PcdList[Index].Value); + PcdList[Index].Value =3D malloc(20); + switch (PcdList[Index].PcdDataType) { + case PcdDataTypeBoolean: + if (Value =3D=3D 0) { + strcpy (PcdList[Index].Value, "0x00"); + } else { + strcpy (PcdList[Index].Value, "0x01"); + } + break; + case PcdDataTypeUint8: + sprintf(PcdList[Index].Value, "0x%02x", (UINT8)(Value & 0xff)); + break; + case PcdDataTypeUint16: + sprintf(PcdList[Index].Value, "0x%04x", (UINT16)(Value & 0xffff)); + break; + case PcdDataTypeUint32: + sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff)); + break; + case PcdDataTypeUint64: + sprintf(PcdList[Index].Value, "0x%016llx", Value); + break; + case PcdDataTypePointer: + fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use PcdSetPtr()\n", S= kuName, DefaultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + break; + } +} + +VOID * +__PcdGetPtr ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT32 *Size + ) +{ + int Index; + UINT8 *Value; + UINT8 *Buffer; + UINT8 *End; + UINT8 Byte; + =20 + Index =3D LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName,= TokenName); + if (Index < 0) { + fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, Defa= ultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + } + switch (PcdList[Index].PcdDataType) { + case PcdDataTypeBoolean: + case PcdDataTypeUint8: + case PcdDataTypeUint16: + case PcdDataTypeUint32: + case PcdDataTypeUint64: + fprintf (stderr, "PCD %s.%s.%s.%s is a value. Use PcdGet()\n", SkuNam= e, DefaultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + break; + case PcdDataTypePointer: + Value =3D &PcdList[Index].Value[1]; + printf ("Value =3D %s\n", PcdList[Index].Value); + for (*Size =3D 0, Byte =3D (UINT8) strtoul(Value, &End, 16); Value != =3D End; Byte =3D (UINT8) strtoul(Value, &End, 16), *Size =3D *Size + 1) { + printf("%x\n", Byte);=20 + Value =3D End + 1; + } + Buffer =3D malloc(*Size); + Value =3D &PcdList[Index].Value[1]; + for (*Size =3D 0, Buffer[*Size] =3D (UINT8) strtoul(Value, &End, 16); = Value !=3D End; Buffer[*Size] =3D (UINT8) strtoul(Value, &End, 16), *Size = =3D *Size + 1) { + Value =3D End + 1; + } + return Buffer; + } + *Size =3D 0; + return 0; +} + +VOID +__PcdSetPtr ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT32 Size, + UINT8 *Value + ) +{ + int Index; + UINT32 ValueIndex; + =20 + Index =3D LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName,= TokenName); + if (Index < 0) { + fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, Defa= ultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + } + switch (PcdList[Index].PcdDataType) { + case PcdDataTypeBoolean: + case PcdDataTypeUint8: + case PcdDataTypeUint16: + case PcdDataTypeUint32: + case PcdDataTypeUint64: + fprintf (stderr, "PCD %s.%s.%s.%s is a value. Use PcdGet()\n", SkuNam= e, DefaultValueName, TokenSpaceGuidName, TokenName); + exit (EXIT_FAILURE); + break; + case PcdDataTypePointer: + free(PcdList[Index].Value); + PcdList[Index].Value =3D malloc(Size * 5 + 3); + PcdList[Index].Value[0] =3D '{'; + for (ValueIndex =3D 0; ValueIndex < Size; ValueIndex++) { + printf("Value[%d] =3D %02x\n", ValueIndex, Value[ValueIndex]); + sprintf(&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[= ValueIndex]); + } + PcdList[Index].Value[1 + Size * 5 - 1] =3D '}'; + PcdList[Index].Value[1 + Size * 5 ] =3D 0; + break; + } +} + +VOID +STATIC +ReadInputFile ( + CHAR8 *InputFileName, + UINT8 **FileBuffer, + UINT32 *FileSize + ) +{ + FILE *InputFile; + UINT32 BytesRead; + =20 + // + // Open Input file and read file data. + // + InputFile =3D fopen (InputFileName, "rb"); + if (InputFile =3D=3D NULL) { + fprintf (stderr, "Error opening file %s\n", InputFileName); + exit (EXIT_FAILURE); + } + =20 + // + // Go to the end so that we can determine the file size + // + if (fseek (InputFile, 0, SEEK_END)) { + fprintf (stderr, "Error reading input file %s\n", InputFileName); + fclose (InputFile); + exit (EXIT_FAILURE); + } + =20 + // + // Get the file size + // + *FileSize =3D ftell (InputFile); + if (*FileSize =3D=3D -1) { + fprintf (stderr, "Error parsing the input file %s\n", InputFileName); + fclose (InputFile); + exit (EXIT_FAILURE); + } + =20 + // + // Allocate a buffer + // + *FileBuffer =3D malloc (*FileSize); + if (*FileBuffer =3D=3D NULL) { + fprintf (stderr, "Can not allocate buffer for input input file %s\n", = InputFileName); + fclose (InputFile); + exit (EXIT_FAILURE); + } + =20 + // + // Reset to the beginning of the file + // + if (fseek (InputFile, 0, SEEK_SET)) { + fprintf (stderr, "Error reading the input file %s\n", InputFileName); + fclose (InputFile); + free (*FileBuffer); + exit (EXIT_FAILURE); + } + + // + // Read all of the file contents. + // + BytesRead =3D fread (*FileBuffer, sizeof (UINT8), *FileSize, InputFile); + if (BytesRead !=3D *FileSize * sizeof (UINT8)) { + fprintf (stderr, "Error reading the input file %s\n", InputFileName); + fclose (InputFile); + free (*FileBuffer); + exit (EXIT_FAILURE); + } + + // + // Close the file + // + fclose (InputFile); +} + +VOID +STATIC +ParseFile ( + UINT8 *FileBuffer, + UINT32 FileSize + ) +{ + UINT32 Index; + UINT32 NumLines; + UINT32 TokenIndex; + UINT32 TokenStart; + + for (Index =3D 0, NumLines =3D 0; Index < FileSize; Index++) { + if (FileBuffer[Index] =3D=3D '\n') { + NumLines++; + } + } + PcdList =3D malloc((NumLines + 1) * sizeof(PcdList[0])); + =20 + for (Index =3D 0, TokenIndex =3D 0, PcdListLength =3D 0, TokenStart =3D = 0; Index < FileSize; Index++) { + if (FileBuffer[Index] =3D=3D ' ') { + continue; + } + if (FileBuffer[Index] =3D=3D '|' || FileBuffer[Index] =3D=3D '.' || Fi= leBuffer[Index] =3D=3D '\n' || FileBuffer[Index] =3D=3D '\r') { + RecordToken (FileBuffer, PcdListLength, TokenIndex, TokenStart, Inde= x); + if (FileBuffer[Index] =3D=3D '\n' || FileBuffer[Index] =3D=3D '\r') { + if (TokenIndex !=3D 0) { + PcdListLength++; + TokenIndex =3D 0; + } + } else { + TokenIndex++; + } + TokenStart =3D Index + 1; + continue; + } + } + if (Index > TokenStart) { + RecordToken (FileBuffer, PcdListLength, TokenIndex, TokenStart, Index); + if (TokenIndex !=3D 0) { + PcdListLength++; + } + } +} + +VOID +STATIC +WriteOutputFile ( + CHAR8 *OutputFileName + ) +{ + FILE *OutputFile; + UINT32 Index; + =20 + // + // Open output file + // + OutputFile =3D fopen (OutputFileName, "wb"); + if (OutputFile =3D=3D NULL) { + fprintf (stderr, "Error opening file %s\n", OutputFileName); + exit (EXIT_FAILURE); + } + + for (Index =3D 0; Index < PcdListLength; Index++) { + fprintf ( + OutputFile,=20 + "%s.%s.%s.%s|%s|%s\n",=20 + PcdList[Index].SkuName, + PcdList[Index].DefaultValueName, + PcdList[Index].TokenSpaceGuidName, + PcdList[Index].TokenName, + PcdList[Index].DataType, + PcdList[Index].Value + ); + } + + // + // Done, write output file. + // + if (OutputFile !=3D NULL) { + fclose (OutputFile); + } +} + +VOID +STATIC +Usage ( + VOID + ) +/*++ + +Routine Description: + + Displays the utility usage syntax to STDOUT + +Arguments: + + None + +Returns: + + None + +--*/ +{ + fprintf (stdout, "Usage: -i -o \n\n"); + fprintf (stdout, "optional arguments:\n"); + fprintf (stdout, " -h, --help Show this help message and exi= t\n"); + fprintf (stdout, " -i INPUT_FILENAME, --input INPUT_FILENAME\n\ + PCD Database Input file name\n"); + fprintf (stdout, " -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\ + PCD Database Output file name\n"); +} + +VOID +STATIC +ParseArguments ( + int argc, + char *argv[], + CHAR8 **InputFileName, + CHAR8 **OutputFileName + ) +{ + if (argc =3D=3D 1) { + fprintf (stderr, "Missing options\n"); + exit (EXIT_FAILURE); + } + + // + // Parse command line + // + argc--; + argv++; + + if ((stricmp (argv[0], "-h") =3D=3D 0) || (stricmp (argv[0], "--help") = =3D=3D 0)) { + Usage (); + exit (EXIT_SUCCESS); + } + + while (argc > 0) { + if ((stricmp (argv[0], "-i") =3D=3D 0) || (stricmp (argv[0], "--input"= ) =3D=3D 0)) { + if (argv[1] =3D=3D NULL || argv[1][0] =3D=3D '-') { + fprintf (stderr, "Invalid option value. Input File name is missin= g for -i option\n"); + exit (EXIT_FAILURE); + } + *InputFileName =3D argv[1]; + argc -=3D 2; + argv +=3D 2; + continue;=20 + } + =20 + if ((stricmp (argv[0], "-o") =3D=3D 0) || (stricmp (argv[0], "--output= ") =3D=3D 0)) { + if (argv[1] =3D=3D NULL || argv[1][0] =3D=3D '-') { + fprintf (stderr, "Invalid option value. Output File name is missi= ng for -i option\n"); + exit (EXIT_FAILURE); + } + *OutputFileName =3D argv[1]; + argc -=3D 2; + argv +=3D 2; + continue;=20 + } + =20 + if (argv[0][0] =3D=3D '-') { + fprintf (stderr, "Unknown option %s\n", argv[0]); + exit (EXIT_FAILURE); + } + argc --; + argv ++; + } + =20 + // + // Check Input paramters + // + if (*InputFileName =3D=3D NULL) { + fprintf (stderr, "Missing option. Input files is not specified\n"); + exit (EXIT_FAILURE); + } else { + printf ("Input file name is %s\n", *InputFileName); + } + + if (*OutputFileName =3D=3D NULL) { + fprintf (stderr, "Missing option. Output file is not specified\n"); + exit (EXIT_FAILURE); + } else { + printf ("Output file name is %s\n", *OutputFileName); + } +} + +int +PcdValueMain ( + int argc, + char *argv[] + ) +{ + CHAR8 *InputFileName; + CHAR8 *OutputFileName; + UINT8 *FileBuffer; + UINT32 FileSize; + =20 + printf ("PCD tool start.\n"); + =20 + // + // + // + ParseArguments (argc, argv, &InputFileName, &OutputFileName); + + // + // Open Input file and read file data. + // + ReadInputFile (InputFileName, &FileBuffer, &FileSize); + =20 + // + // + // + ParseFile (FileBuffer, FileSize); + =20 + // + // Customize PCD values in the PCD Database + // + PcdEntryPoint (); + + // + // + // + WriteOutputFile (OutputFileName); + =20 + printf ("PCD tool done.\n"); + =20 + exit (EXIT_SUCCESS); +} diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/= C/Common/PcdValueCommon.h new file mode 100644 index 0000000..768d7a9 --- /dev/null +++ b/BaseTools/Source/C/Common/PcdValueCommon.h @@ -0,0 +1,78 @@ +/** @file +Header file for CalcuateCrc32 routine + +Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+This program and the accompanying materials =20 +are licensed and made available under the terms and conditions of the BSD = License =20 +which accompanies this distribution. The full text of the license may be = found at =20 +http://opensource.org/licenses/bsd-license.php = =20 + = =20 +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, = =20 +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. =20 + +**/ + +#ifndef _PCD_VALUE_COMMON_H +#define _PCD_VALUE_COMMON_H + +#include + +#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field) +#define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0]) +#define __OFFSET_OF(TYPE, Field) ((UINT32) &(((TYPE *)0)->Field)) +#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex) if (__FIELD_SIZE(TY= PE, Field) =3D=3D 0) Size =3D (__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_S= IZE(TYPE, Field) * (MaxIndex)) + +VOID +PcdEntryPoint ( + VOID + ); + +int +PcdValueMain ( + int argc, + char *argv[] + ); + +VOID +__PcdSet ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT64 Value + ); + +VOID +__PcdSet ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT64 Value + ); + +VOID * +__PcdGetPtr ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT32 *Size + ); + +VOID +__PcdSetPtr ( + CHAR8 *SkuName OPTIONAL, + CHAR8 *DefaultValueName OPTIONAL, + CHAR8 *TokenSpaceGuidName, + CHAR8 *TokenName, + UINT32 Size, + UINT8 *Value + ); + +#define PcdGet(A, B, C, D) __PcdGet(#A, #B, #C, #D) +#define PcdSet(A, B, C, D, Value) __PcdSet(#A, #B, #C, #D, Value) +#define PcdGetPtr(A, B, C, D, Size) __PcdGetPtr(#A, #B, #C, #D, Size) +#define PcdSetPtr(A, B, C, D, Size, Value) __PcdSetPtr(#A, #B, #C, #D, Si= ze, Value) + +#endif diff --git a/BaseTools/Source/C/Makefiles/lib.makefile b/BaseTools/Source/C= /Makefiles/lib.makefile index bba76be..c592806 100644 --- a/BaseTools/Source/C/Makefiles/lib.makefile +++ b/BaseTools/Source/C/Makefiles/lib.makefile @@ -13,6 +13,8 @@ =20 include $(MAKEROOT)/Makefiles/header.makefile =20 +BUILD_CFLAGS +=3D -Wno-error + LIBRARY =3D $(MAKEROOT)/libs/lib$(LIBNAME).a =20 all: $(MAKEROOT)/libs $(LIBRARY)=20 --=20 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat May 4 18:41:37 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1491923843455280.88017326350246; Tue, 11 Apr 2017 08:17:23 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2223F2095C3CF; Tue, 11 Apr 2017 08:17:15 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F257121939304 for ; Tue, 11 Apr 2017 08:17:12 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 11 Apr 2017 08:17:11 -0700 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by orsmga002.jf.intel.com with ESMTP; 11 Apr 2017 08:17:10 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,186,1488873600"; d="scan'208";a="72592980" From: Liming Gao To: edk2-devel@lists.01.org Date: Tue, 11 Apr 2017 23:16:43 +0800 Message-Id: <1491923803-12124-4-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 In-Reply-To: <1491923803-12124-1-git-send-email-liming.gao@intel.com> References: <1491923803-12124-1-git-send-email-liming.gao@intel.com> Subject: [edk2] [RFC 3/3] TestPkg: Show Structure PCD value assignment 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- TestPkg/Include/Guid/Test.h | 31 ++ TestPkg/StructuredPcdValueGenerator.py | 702 +++++++++++++++++++++++++++++= ++++ TestPkg/TestPkg.dec | 44 +++ TestPkg/TestPkg.dsc | 69 ++++ 4 files changed, 846 insertions(+) create mode 100644 TestPkg/Include/Guid/Test.h create mode 100644 TestPkg/StructuredPcdValueGenerator.py create mode 100644 TestPkg/TestPkg.dec create mode 100644 TestPkg/TestPkg.dsc diff --git a/TestPkg/Include/Guid/Test.h b/TestPkg/Include/Guid/Test.h new file mode 100644 index 0000000..e988954 --- /dev/null +++ b/TestPkg/Include/Guid/Test.h @@ -0,0 +1,31 @@ +//#pragma pack(1) + +#define MacroTest2 10 + +typedef struct { + BOOLEAN Bool; =20 + UINT8 A:4;=20 + UINT8 B:4; + UINT32 Unaligned32; + UINT16 C; + UINT16 D; + UINT32 E; + UINT32 F; + UINT64 G; + UINT64 H; + UINT8 Reserved; + UINT8 Hidden; =20 + UINT8 OneLine8; =20 + UINT16 OneLine16; =20 + UINT32 OneLine32; =20 + UINT64 OneLine64; =20 + BOOLEAN OneLineBoolA; =20 + BOOLEAN OneLineBoolB; =20 + BOOLEAN OneLineBoolC; =20 + BOOLEAN OneLineBoolD; =20 + UINT32 Array[10]; + UINT8 Array2[2]; + UINT8 FlexibleArray[0]; +} TEST; + +//#pragma pack() diff --git a/TestPkg/StructuredPcdValueGenerator.py b/TestPkg/StructuredPcd= ValueGenerator.py new file mode 100644 index 0000000..a24ccf3 --- /dev/null +++ b/TestPkg/StructuredPcdValueGenerator.py @@ -0,0 +1,702 @@ +# +# Generate C program to convert structure PCD value to byte array. +# + +import os +import sys +import argparse +import subprocess +from collections import OrderedDict +import uuid + +# +# Globals for help information +# +__prog__ =3D 'StructuredPcdValueGenerator' +__version__ =3D '%s Version %s' % (__prog__, '0.1 ') +__copyright__ =3D 'Copyright (c) 2017, Intel Corporation. All rights reser= ved.' +__usage__ =3D '%s [options]' % (__prog__) + +# +# Treat CHAR16 as a synonym for UINT16. CHAR16 support is required for VF= R C structs +# +PcdValueInitName =3D 'PcdValueInit' +PcdSupportedBaseTypes =3D ['BOOLEAN', 'UINT8', 'UINT16', 'UINT32', 'UINT= 64', 'CHAR16'] +PcdSupportedBaseTypeWidth =3D {'BOOLEAN':8, 'UINT8':8, 'UINT16':16, 'UINT3= 2':32, 'UINT64':64} +PcdUnsupportedBaseTypes =3D ['INT8', 'INT16', 'INT32', 'INT64', 'CHAR8', '= UINTN', 'INTN', 'VOID'] + +PcdMainCHeader =3D ''' +/** + DO NOT EDIT + FILE auto-generated +**/ + +#include +#include +#include +''' + +PcdMainCEntry =3D ''' +int +main ( + int argc, + char *argv[] + ) +{ + return PcdValueMain (argc, argv); +} +''' + +PcdMakefileHeader =3D ''' +# +# DO NOT EDIT +# This file is auto-generated by build utility +# + +''' + +PcdMakefileEnd =3D ''' +!INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common + +CFLAGS =3D $(CFLAGS) /wd4200 /wd4034 + +LIBS =3D $(LIB_PATH)\Common.lib + +!INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app +''' + +PcdGccMakefile =3D ''' +ARCH ?=3D IA32 +MAKEROOT ?=3D $(EDK_TOOLS_PATH)/Source/C +LIBS =3D -lCommon +''' + +def GetBitField(Value, Start, Width): + Mask =3D (1 << Width) - 1 + return (Value >> Start) & Mask + +def SetBitField(Value, Start, Width, BitFieldValue): + Mask =3D (1 << Width) - 1 + if BitFieldValue & (~Mask) <> 0: + raise ValueError + BitFieldValue =3D BitFieldValue & Mask + Value =3D (Value & (~(Mask << Start))) | (BitFieldValue << Start) + return Value + +def IntToArray(Value, Size, Stride =3D 1, ValuesPerLine =3D 16, AsciiComme= nt =3D False): + if Stride not in [1,2,4,8]: + return '' + PostFix =3D '' + if Stride =3D=3D 8: + PostFix =3D 'ULL' + Value =3D Value & ((1 << Size * 8) - 1) + Output =3D '{\n' + Shift =3D Stride * 8 + Mask =3D (1 << Shift) - 1 + NumValues =3D 0 + Ascii =3D '' + for Index in range (0, Size, Stride): + Output =3D Output + '0x%0*X%s' % (Stride * 2, Value & Mask, PostFix) + if Index + Stride < Size: + Output =3D Output + ', ' + else: =20 + Output =3D Output + ' ' + for CharIndex in range (0, Stride): + Char =3D Value & 0xff + if Char in range(0x20, 0x7F): + Ascii =3D Ascii + chr(Value & 0xff) + else: + Ascii =3D Ascii + '.' + Value =3D Value >> 8 + if (NumValues % ValuesPerLine) =3D=3D (ValuesPerLine - 1): + if AsciiComment: + Output =3D Output + ' // %s' % (Ascii) + Output =3D Output + '\n' + Ascii =3D '' + NumValues =3D NumValues + 1 + if AsciiComment and (NumValues % ValuesPerLine) <> 0: + for Index in range((NumValues % ValuesPerLine), ValuesPerLine): + Output =3D Output + ' %*s%*s ' % (Stride * 2, '', len(PostFix), '') + Output =3D Output + ' // %s\n' % (Ascii) + Output =3D Output + '}' + return Output + +def IntToCString(Value, ValueSize): + Result =3D '"' + if not isinstance (Value, str): + for Index in range(0, ValueSize): + Result =3D Result + '\\x%02x' % (Value & 0xff) + Value =3D Value >> 8 + Result =3D Result + '"' + return Result =20 + =20 +def ParseFieldValue (Value): + if type(Value) =3D=3D type(0): + return Value, (Value.bit_length() + 7) / 8 + if type(Value) <> type(''): + raise ValueError + Value =3D Value.strip() + if Value.startswith('UINT8') and Value.endswith(')'): + Value, Size =3D ParseFieldValue(Value.split('(',1)[1][:-1]) + if Size > 1: + raise ValueError + return Value, 1 =20 + if Value.startswith('UINT16') and Value.endswith(')'): + Value, Size =3D ParseFieldValue(Value.split('(',1)[1][:-1]) + if Size > 2: + raise ValueError + return Value, 2 =20 + if Value.startswith('UINT32') and Value.endswith(')'): + Value, Size =3D ParseFieldValue(Value.split('(',1)[1][:-1]) + if Size > 4: + raise ValueError + return Value, 4 =20 + if Value.startswith('UINT64') and Value.endswith(')'): + Value, Size =3D ParseFieldValue(Value.split('(',1)[1][:-1]) + if Size > 8: + raise ValueError + return Value, 8 =20 + if Value.startswith('GUID') and Value.endswith(')'): + Value =3D Value.split('(',1)[1][:-1].strip() + if Value[0] =3D=3D '{' and Value[-1] =3D=3D '}': + Value =3D Value[1:-1].strip() + Value =3D Value.split('{',1) + Value =3D [Item.strip()[2:] for Item in (Value[0] + Value[1][:-1]).s= plit(',')] + Value =3D '-'.join(Value[0:3]) + '-' + ''.join(Value[3:5]) + '-' + '= '.join(Value[5:11]) + if Value[0] =3D=3D '"' and Value[-1] =3D=3D '"': + Value =3D Value[1:-1] + Value =3D "'" + uuid.UUID(Value).get_bytes_le() + "'" + Value, Size =3D ParseFieldValue(Value) + return Value, 16 =20 + if Value.startswith('L"') and Value.endswith('"'): + # Unicode String + List =3D list(Value[2:-1]) + List.reverse() + Value =3D 0 + for Char in List: + Value =3D (Value << 16) | ord(Char) + return Value, (len(List) + 1) * 2 + if Value.startswith('"') and Value.endswith('"'): + # ASCII String + List =3D list(Value[1:-1]) + List.reverse() + Value =3D 0 + for Char in List: + Value =3D (Value << 8) | ord(Char) + return Value, len(List) + 1 =20 + if Value.startswith("L'") and Value.endswith("'"): + # Unicode Character Constant + List =3D list(Value[2:-1]) + List.reverse() + Value =3D 0 + for Char in List: + Value =3D (Value << 16) | ord(Char) + return Value, len(List) * 2 + if Value.startswith("'") and Value.endswith("'"): + # Character constant + List =3D list(Value[1:-1]) + List.reverse() + Value =3D 0 + for Char in List: + Value =3D (Value << 8) | ord(Char) + return Value, len(List) =20 + if Value.startswith('{') and Value.endswith('}'): + # Byte array + Value =3D Value[1:-1] + List =3D [Item.strip() for Item in Value.split(',')] + List.reverse() + Value =3D 0 + for Item in List: + ItemValue, Size =3D ParseFieldValue(Item) + if Size > 1: + raise ValueError + Value =3D (Value << 8) | ItemValue + return Value, len(List) =20 + if Value.lower().startswith('0x'): + Value =3D int(Value, 16) + return Value, (Value.bit_length() + 7) / 8=20 + if Value[0].isdigit(): + Value =3D int(Value, 10) + return Value, (Value.bit_length() + 7) / 8=20 + if Value.lower() =3D=3D 'true': + return 1, 1 + if Value.lower() =3D=3D 'false': + return 0, 1 + return Value, 1 + +def IsFieldValueAnArray (Value): + Value =3D Value.strip() + if Value.startswith('GUID') and Value.endswith(')'): + return True + if Value.startswith('L"') and Value.endswith('"'): + return True + if Value[0] =3D=3D '"' and Value[-1] =3D=3D '"': + return True + if Value[0] =3D=3D '{' and Value[-1] =3D=3D '}': + return True + if Value.startswith("L'") and Value.endswith("'") and len(list(Value[2:-= 1])) > 1: + print 'foo =3D ', list(Value[2:-1]) + return True + if Value[0] =3D=3D "'" and Value[-1] =3D=3D "'" and len(list(Value[1:-1]= )) > 1: + print 'bar =3D ', list(Value[1:-1]) + return True + return False =20 + +def ConvertValueToString (Value): + Result =3D '' + if Value.startswith('L"') and Value.endswith('"'): + for Char in Value[2:-1]: + Result =3D Result + '\\x%02x\\x00' % (ord(Char)) + Result =3D Result + '\\x00\\x00' + if Value[0] =3D=3D '"' and Value[-1] =3D=3D '"': + for Char in Value[1:-1]: + Result =3D Result + '\\x%02x' % (ord(Char)) + Result =3D Result + '\\x00' + if Value[0] =3D=3D '{' and Value[-1] =3D=3D '}': + Value =3D [int(Item.strip(),16) for Item in Value[1:-1].split(',')] + for Item in Value: + Result =3D Result + '\\x%02x' % (Item) + return Result + =20 +def ExecuteCommand (Command): + try: + Process =3D subprocess.Popen(Command, stdout=3Dsubprocess.PIPE, st= derr=3Dsubprocess.PIPE, shell=3DTrue) + except: =20 + print 'ERROR: Can not execute command:', Command + sys.exit(1) + Result =3D Process.communicate() + if Process.returncode <> 0: + print 'ERROR: Can not collect output from command:', Command + return Result[0], Result[1] + =20 +class StructuredPcdField: + def __init__(self, FieldName, DefaultValue): + self.FieldName =3D FieldName + self.DefaultValue =3D DefaultValue + + def __repr__(self): + return self.FieldName + =20 +class StructuredPcd: + def __init__(self, StructuredPcdIncludeFile, Packages, TokenSpaceGuidNam= e, TokenName, TypeName): + self.StructuredPcdIncludeFile =3D StructuredPcdIncludeFile + self.PackageDecs =3D Packages + self.SkuName =3D 'DEFAULT' + self.DefaultStoreName =3D 'DEFAULT' + self.TokenSpaceGuidName =3D TokenSpaceGuidName + self.TokenName =3D TokenName + self.TypeName =3D TypeName + self.DefaultValues =3D OrderedDict({}) + self.PcdMode =3D None + self.OverrideValues =3D OrderedDict({}) + self.FlexibleFieldName =3D None + + def __repr__(self): + return self.TypeName + + def AddDefaultValue (self, FieldName, Value, FileName=3D"", LineNo=3D0): + self.DefaultValues[FieldName] =3D [Value.strip(), FileName, LineNo] + return self.DefaultValues[FieldName] + + def AddOverrideValue (self, FieldName, Value, FileName=3D"", LineNo=3D0): + self.OverrideValues[FieldName] =3D [Value.strip(), FileName, LineNo] + return self.OverrideValues[FieldName] + + def SetPcdMode (self, PcdMode): + self.PcdMode =3D PcdMode + + def SetFlexibleFieldName (self, FlexibleFieldName): + self.FlexibleFieldName =3D FlexibleFieldName + =20 +class Build: + def __init__(self, args): + self.args =3D args + self.DecFile =3D args.DecFile + self.DscFile =3D args.DscFile + self.Quiet =3D args.Quiet + self.StructuredPcds =3D [] + self.PackagePath =3D os.path.dirname(self.DecFile) + if os.getenv("WORKSPACE"): + self.OutputPath =3D os.path.join(os.getenv("WORKSPACE"), 'Buil= d', PcdValueInitName) + else: + self.OutputPath =3D os.path.dirname(self.DscFile) + + def __repr__(self): + return self.DscFile + + def AddStructuredPcd (self, Include, Packages, TokenSpaceGuidName, Token= Name, Type): + Pcd =3D StructuredPcd(Include, Packages, TokenSpaceGuidName, TokenName= , Type) + self.StructuredPcds.append(Pcd) + return Pcd + + def LookupPcd(self, TokenSpaceGuidName, TokenName): + for Pcd in self.StructuredPcds: + if Pcd.TokenSpaceGuidName =3D=3D TokenSpaceGuidName and Pcd.TokenNam= e =3D=3D TokenName: + return Pcd + return None + + def LookupPcdByTypeName(self, TypeName): + for Pcd in self.StructuredPcds: + if Pcd.TypeName =3D=3D TypeName: + return Pcd + return None + =20 + def ParseDecFile (self): + print 'Parse DEC File', self.DecFile + File =3D open (self.DecFile, mode=3D'r') + DecFileBuffer =3D File.readlines() + File.close() + DecLineNumber =3D 0 + Include =3D None + PcdObject =3D None + while (DecLineNumber < len (DecFileBuffer)): + Line =3D DecFileBuffer[DecLineNumber] + DecLineNumber =3D DecLineNumber + 1 + Line =3D Line.strip() + if Line.startswith('#'): + continue + if len(Line.split('|')) =3D=3D 4: + Line =3D Line [:(len(Line)-1)] + Line =3D [Item.strip() for Item in Line.strip().split('|')] + Pcd =3D [Item.strip() for Item in Line[0].split('.',2)] + if len(Pcd) < 2: + print 'Error: PCD field sytnax error', DecLineNumber, Line + sys.exit() + elif len(Pcd) =3D=3D 2: + TokenSpaceGuidName =3D Pcd[0] + TokenName =3D Pcd[1] + Type =3D Line[2] + Packages =3D [] + NextLine =3D DecFileBuffer[DecLineNumber].strip() + DecLineNumber =3D DecLineNumber + 1 + while (NextLine[0] !=3D "}"): + if NextLine =3D=3D "": + Include =3D DecFileBuffer[DecLineNumber].strip() + DecLineNumber =3D DecLineNumber + 1 + NextLine =3D DecFileBuffer[DecLineNumber].strip() + if NextLine =3D=3D "": + DecLineNumber =3D DecLineNumber + 1 + NextLine =3D DecFileBuffer[DecLineNumber].strip() + while (NextLine[0] !=3D "}" and NextLine[0] !=3D "= <"): + Packages.append (NextLine.strip().replace ('\\= ', '/')) + DecLineNumber =3D DecLineNumber + 1 + NextLine =3D DecFileBuffer[DecLineNumber].stri= p() + DecLineNumber =3D DecLineNumber + 1 + PcdObject =3D self.AddStructuredPcd (Include, Packages, To= kenSpaceGuidName, TokenName, Type) + PcdObject.AddDefaultValue(Line[2], Line[1], self.DecFile, = DecLineNumber) + elif PcdObject <> None: + Line =3D [Item.strip() for Item in Line.strip().split('|')] + Pcd =3D [Item.strip() for Item in Line[0].split('.',2)] + if len (Line) =3D=3D 2 and len (Pcd) > 2: + if Pcd[0] <> PcdObject.TokenSpaceGuidName or Pcd[1] <> PcdOb= ject.TokenName: + print 'Error: PCD does not match parent Structured PCD', P= cd[0], Pcd[1], TokenSpaceGuidName, TokenName + sys.exit() + PcdObject.AddDefaultValue('.' + Pcd[2], Line[1], self.DecFil= e, DecLineNumber) + if not self.args.Quiet: + for Pcd in self.StructuredPcds: + print 'Include : ', Pcd.StructuredPcdIncludeFile + print 'Type : ', Pcd.TypeName + print 'SkuName : ', Pcd.SkuName + print 'DefaultStoreName : ', Pcd.DefaultStoreName + print 'TokenSpaceGuid : ', Pcd.TokenSpaceGuidName + print 'TokenName : ', Pcd.TokenName + for Field in Pcd.DefaultValues: + print ' %40s : %s' % (Field, Pcd.DefaultValues[Field][0]) + print '' + =20 + def ParseDscFile (self): + print 'Parse DSC File', self.DscFile + File =3D open (self.DscFile, mode=3D'r') + DscFileBuffer =3D File.readlines() + File.close() + PcdMode =3D None + PcdFieldSettings =3D OrderedDict({}) + DscLineNumber =3D 0 + for Line in DscFileBuffer: + DscLineNumber =3D DscLineNumber + 1 + if Line.startswith('#'): + continue + if Line.startswith('['): + Mode =3D Line[1:].split('.',1)[0].split(']',1)[0] + continue + Line =3D [Item.strip() for Item in Line.split('|')] + Pcd =3D [Item.strip() for Item in Line[0].split('.',2)] + if len(Pcd) >=3D 2 and len(Line) > 1: + PcdObject =3D self.LookupPcd (Pcd[0], Pcd[1]) + if not PcdObject: + print 'ERROR: DSC file references structured PCD that is not dec= lared in DEC file', Pcd[0], Pcd[1] + sys.exit() + if len (Pcd) =3D=3D 2: + PcdObject.AddDefaultValue (PcdObject.TypeName, Line[1], self.D= scFile, DscLineNumber) + else: + PcdObject.AddOverrideValue ('.' + Pcd[2], Line[1], self.DscFil= e, DscLineNumber) + if PcdMode and PcdMode <> Mode: + print '%d: %s: ERROR: PCD %s.%s has more than one mode %s %s.' %= (DscLineNumber, self.DscFile, Pcd[0], Pcd[1], PcdMode, Mode) + sys.exit() + PcdMode =3D Mode + PcdObject.SetPcdMode(Mode) + if not self.args.Quiet: + for Pcd in self.StructuredPcds: + print 'Include : ', Pcd.StructuredPcdIncludeFile + print 'Type : ', Pcd.TypeName + print 'SkuName : ', Pcd.SkuName + print 'DefaultStoreName : ', Pcd.DefaultStoreName + print 'TokenSpaceGuid : ', Pcd.TokenSpaceGuidName + print 'TokenName : ', Pcd.TokenName + print 'PcdMode : ', Pcd.PcdMode + for Field in Pcd.DefaultValues: + print ' D %40s : %s' % (Field, Pcd.DefaultValues[Field][0]) + for Field in Pcd.OverrideValues: + print ' O %40s : %s' % (Field, Pcd.OverrideValues[Field][0]) + print '' =20 + + def GenerateByteArrayValue (self): + # + # Generate/Compile/Run C application to determine if there are any fle= xible array members + # + InitByteValue =3D "" + CApp =3D PcdMainCHeader + =20 + Includes =3D {} + for Pcd in self.StructuredPcds: + IncludeFile =3D Pcd.StructuredPcdIncludeFile + if IncludeFile not in Includes: + Includes[IncludeFile] =3D True + CApp =3D CApp + '#include <%s>\n' % (IncludeFile) + CApp =3D CApp + '\n' + =20 + FieldNames =3D {} + for Pcd in self.StructuredPcds: + CApp =3D CApp + 'void\n' + CApp =3D CApp + 'Initialize_%s_%s_%s_%s(\n' % (Pcd.SkuName, Pcd.Defa= ultStoreName, Pcd.TokenSpaceGuidName, Pcd.TokenName) + CApp =3D CApp + ' void\n' + CApp =3D CApp + ' )\n' + CApp =3D CApp + '{\n' + CApp =3D CApp + ' UINT32 Size;\n' + CApp =3D CApp + ' UINT32 FieldSize;\n' + CApp =3D CApp + ' UINT8 *Value;\n' + CApp =3D CApp + ' %s *Pcd;\n' % (Pcd.TypeName) + CApp =3D CApp + ' UINT32 OriginalSize;\n' + CApp =3D CApp + ' VOID *OriginalPcd;\n' + CApp =3D CApp + '\n' + InitByteValue =3D '%s.%s.%s.%s|%s|' %(Pcd.SkuName, Pcd.DefaultStoreN= ame, Pcd.TokenSpaceGuidName, Pcd.TokenName, Pcd.TypeName) + + # + # Get current PCD value and size + # + CApp =3D CApp + ' OriginalPcd =3D PcdGetPtr (%s, %s, %s, %s, &Origi= nalSize);\n' % (Pcd.SkuName, Pcd.DefaultStoreName, Pcd.TokenSpaceGuidName, = Pcd.TokenName) + CApp =3D CApp + ' printf("OriginalSize =3D %d\\n", OriginalSize);\n' + =20 + =20 + # + # Determine the size of the PCD. For simple structures, sizeof(TYPE= ) provides + # the correct value. For structures with a flexible array member, t= he flexible + # array member is detected, and the size is based on the highest ind= ex used with + # the flexible array member. The flexible array member must be the = last field + # in a structure. The size formula for this case is:=20 + # OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0]) * (Highest= Index + 1) + # + CApp =3D CApp + ' Size =3D sizeof(%s);\n' % (Pcd.TypeName) + CApp =3D CApp + ' printf("Size =3D %d\\n", Size);\n' + for FieldList in [Pcd.DefaultValues, Pcd.OverrideValues]: + for FieldName in FieldList: + if not FieldName.startswith('.'): + continue + IsArray =3D IsFieldValueAnArray(FieldList[FieldName][0]) + if IsArray: + Value, ValueSize =3D ParseFieldValue (FieldList[FieldName][0]) + CApp =3D CApp + ' __FLEXIBLE_SIZE(Size, %s, %s, %d / __ARRAY_= ELEMENT_SIZE(%s, %s));\n' % (Pcd.TypeName, FieldName[1:], ValueSize, Pcd.Ty= peName, FieldName[1:]); + CApp =3D CApp + ' printf("Size =3D %d\\n", Size);\n' + else: =20 + NewFieldName =3D '' + while '[' in FieldName: + NewFieldName =3D NewFieldName + FieldName.split('[',1)[0] + = '[0]' + ArrayIndex =3D int(FieldName.split('[',1)[1].split(']',1)[= 0]) + FieldName =3D FieldName.split(']',1)[1] + FieldName =3D NewFieldName + FieldName + while '[' in FieldName: + FieldName =3D FieldName.rsplit('[',1)[0] + #if not self.args.Quiet: + # print 'PCD Field: %40s' % (FieldName) + if Pcd.TypeName + FieldName not in FieldNames: + FieldNames[Pcd.TypeName + FieldName] =3D True + CApp =3D CApp + ' __FLEXIBLE_SIZE(Size, %s, %s, %d);\n' %= (Pcd.TypeName, FieldName[1:], ArrayIndex + 1) + CApp =3D CApp + ' printf("Size =3D %d\\n", Size);\n' + CApp =3D CApp + ' printf("Size =3D %d\\n", Size);\n' + + # + # Allocate and zero buffer for the PCD + # Must handle cases where current value is smaller, larger, or same = size + # Always keep that larger one as the current size + # + CApp =3D CApp + ' Size =3D (OriginalSize > Size ? OriginalSize : Si= ze);\n' + CApp =3D CApp + ' printf("Size =3D %d\\n", Size);\n' + CApp =3D CApp + ' Pcd =3D (%s *)malloc (Size);\n' % (Pcd.TypeNa= me) + CApp =3D CApp + ' memset (Pcd, 0, Size);\n' + + # + # Copy current PCD value into allocated buffer. + # + CApp =3D CApp + ' memcpy (Pcd, OriginalPcd, OriginalSize);\n' + + # + # Assign field values in PCD + # + for FieldList in [Pcd.DefaultValues, Pcd.OverrideValues]: + for FieldName in FieldList: + if not FieldName.startswith('.'): + InitByteValue =3D InitByteValue + '%s\n'%(FieldList[FieldName= ][0]) + continue + IsArray =3D IsFieldValueAnArray(FieldList[FieldName][0]) + Value, ValueSize =3D ParseFieldValue (FieldList[FieldName][0]) + #print FieldName, Value, ValueSize, IntToCString(Value, ValueSiz= e) + if isinstance(Value, str): + CApp =3D CApp + ' Pcd->%s =3D %s; // From %s Line %d Value = %s\n' % (FieldName[1:], Value, FieldList[FieldName][1], FieldList[FieldName= ][2], FieldList[FieldName][0]) + elif IsArray: + # + # Use memcpy() to copy value into field + # + CApp =3D CApp + ' FieldSize =3D __FIELD_SIZE(%s, %s);\n' % (P= cd.TypeName, FieldName[1:]) + CApp =3D CApp + ' printf("FieldSize =3D %d\\n", FieldSize);\n' + CApp =3D CApp + ' Value =3D %s; // From %s Line %d Value = %s\n' % (IntToCString(Value, ValueSize), FieldList[FieldName][1], FieldList= [FieldName][2], FieldList[FieldName][0]) + CApp =3D CApp + ' memcpy (&Pcd->%s[0], Value, (FieldSize > 0 = && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName[1:], ValueSize, Value= Size) + else: + if ValueSize > 4: + CApp =3D CApp + ' Pcd->%s =3D %dULL; // From %s Line %d Val= ue %s\n' % (FieldName[1:], Value, FieldList[FieldName][1], FieldList[FieldN= ame][2], FieldList[FieldName][0]) + else: + CApp =3D CApp + ' Pcd->%s =3D %d; // From %s Line %d Value = %s\n' % (FieldName[1:], Value, FieldList[FieldName][1], FieldList[FieldName= ][2], FieldList[FieldName][0]) + + # + # Set new PCD value and size + # + CApp =3D CApp + ' PcdSetPtr (%s, %s, %s, %s, Size, (UINT8 *)Pcd);\n= ' % (Pcd.SkuName, Pcd.DefaultStoreName, Pcd.TokenSpaceGuidName, Pcd.TokenNa= me) + + # + # Free PCD + # + CApp =3D CApp + ' free (Pcd);\n' + =20 + CApp =3D CApp + '}\n' + CApp =3D CApp + '\n' + + CApp =3D CApp + 'VOID\n' + CApp =3D CApp + 'PcdEntryPoint(\n' + CApp =3D CApp + ' VOID\n' + CApp =3D CApp + ' )\n' + CApp =3D CApp + '{\n' + for Pcd in self.StructuredPcds: + CApp =3D CApp + ' Initialize_%s_%s_%s_%s();\n' % (Pcd.SkuName, Pcd.= DefaultStoreName, Pcd.TokenSpaceGuidName, Pcd.TokenName) + CApp =3D CApp + '}\n' + =20 + CApp =3D CApp + PcdMainCEntry + '\n' + =20 + if not os.path.exists(self.OutputPath): + os.makedirs(self.OutputPath) + CAppBaseFileName =3D os.path.join(self.OutputPath, PcdValueInitName) + File =3D open (CAppBaseFileName + '.c', mode=3D'w') + File.write(CApp) + File.close() + =20 + MakeApp =3D PcdMakefileHeader + if sys.platform =3D=3D "win32": + MakeApp =3D MakeApp + 'APPNAME =3D %s\n' %(PcdValueInitName) + 'OB= JECTS =3D %s\%s.obj\n' %(self.OutputPath, PcdValueInitName) + 'INC =3D $(IN= C)' + else: + MakeApp =3D MakeApp + PcdGccMakefile + MakeApp =3D MakeApp + 'APPNAME =3D %s\n' %(PcdValueInitName) + 'OB= JECTS =3D %s/%s.o\n' %(self.OutputPath, PcdValueInitName) + \ + 'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'BUILD_= CFLAGS +=3D -Wno-error\n' + 'INCLUDE +=3D' + Packages =3D {} + for Pcd in self.StructuredPcds: + for PackageDec in Pcd.PackageDecs: + Package =3D PackageDec.split('/')[0] + if Package not in Packages: + Packages[Package] =3D True + MakeApp =3D MakeApp + ' -I $(WORKSPACE)/%s/Include' %(Pack= age) + if Package =3D=3D 'MdePkg': + MakeApp =3D MakeApp + ' -I $(WORKSPACE)/%s/Include/Ia3= 2' %(Package) + MakeApp =3D MakeApp + '\n'=20 + if sys.platform =3D=3D "win32": + MakeApp =3D MakeApp + PcdMakefileEnd + MakeFileName =3D os.path.join(self.OutputPath, 'Makefile') + File =3D open (MakeFileName, mode=3D'w') + File.write(MakeApp) + File.close() + + InputValueFile =3D os.path.join(self.OutputPath, 'Input.txt') + OutputValueFile =3D os.path.join(self.OutputPath, 'Output.txt') + File =3D open (InputValueFile, mode=3D'w') + File.write(InitByteValue) + File.close() + + if sys.platform =3D=3D "win32": + StdOut, StdErr =3D ExecuteCommand ('nmake -f %s' % (MakeFileName)) + else: + StdOut, StdErr =3D ExecuteCommand ('make -f %s' % (MakeFileName)) + Messages =3D StdOut.split('\r') + for Message in Messages: + if " error " in Message: + FileInfo =3D Message.strip().split('(') + if len (FileInfo) > 0: + FileName =3D FileInfo [0] + FileLine =3D FileInfo [1].split (')')[0] + else: + FileInfo =3D Message.strip().split(':') + FileName =3D FileInfo [0] + FileLine =3D FileInfo [1] + =20 + File =3D open (FileName, mode=3D'r') + FileData =3D File.readlines() + File.close() + print Message + print FileData[int (FileLine) - 1] + return + =20 + PcdValueInitExe =3D PcdValueInitName + if not sys.platform =3D=3D "win32": + PcdValueInitExe =3D os.path.join(os.getenv("EDK_TOOLS_PATH"), 'Sou= rce', 'C', 'bin', PcdValueInitName)=20 + =20 + StdOut, StdErr =3D ExecuteCommand (PcdValueInitExe + ' -i %s -o %s' % = (InputValueFile, OutputValueFile)) + File =3D open (OutputValueFile, mode=3D'r') + FileBuffer =3D File.readlines() + File.close() + =20 + print 'Final Value Output:' + for Pcd in FileBuffer: + PcdValue =3D Pcd.split ('|') + PcdInfo =3D PcdValue[0].split ('.') + print 'SkuName : ', PcdInfo[0] + print 'TokenSpaceGuid : ', PcdInfo[2] + print 'TokenName : ', PcdInfo[3] + print 'Value : ', PcdValue[2] + +def main(): + # + # Create command line argument parser object + # + parser =3D argparse.ArgumentParser(prog=3D__prog__, version=3D__versio= n__, usage=3D__usage__, description=3D__copyright__, conflict_handler=3D're= solve') + parser.add_argument("-p", "--dec-file", dest=3D'DecFile', help=3D"DEC = File", required =3D True) + parser.add_argument("-d", "--dsc-file", dest=3D'DscFile', help=3D"DSC = File", required =3D True) + parser.add_argument("-v", "--verbose", dest=3D'Verbose', action=3D"sto= re_true", help=3D"increase output messages") + parser.add_argument("-q", "--quiet", dest=3D'Quiet', action=3D"store_t= rue", help=3D"reduce output messages") + parser.add_argument("--debug", dest=3D'Debug', type=3Dint, metavar=3D'= [0-9]', choices=3Drange(0,10), default=3D0, help=3D"set debug level") + =20 + # + # Parse command line arguments + # + args =3D parser.parse_args() + =20 + # + # Get absolute paths + # + args.DecFile =3D os.path.abspath(args.DecFile) + args.DscFile =3D os.path.abspath(args.DscFile) + =20 + # + # + # + BuildObject =3D Build(args) + BuildObject.ParseDecFile() + BuildObject.ParseDscFile() + BuildObject.GenerateByteArrayValue() + +if __name__ =3D=3D '__main__': + main() diff --git a/TestPkg/TestPkg.dec b/TestPkg/TestPkg.dec new file mode 100644 index 0000000..622678e --- /dev/null +++ b/TestPkg/TestPkg.dec @@ -0,0 +1,44 @@ +## @file TestPkg.dec +# +# Copyright (c) 2016, Intel Corporation. All rights reserved.
+# This program and the accompanying materials are licensed and made availa= ble under +# the terms and conditions of the BSD License that accompanies this distri= bution. +# 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 IMP= LIED. +# +## + + +[Defines] + DEC_SPECIFICATION =3D 0x00010005 + PACKAGE_NAME =3D TestPkg + PACKAGE_GUID =3D F05BB314-CD00-4705-BD04-59B1CD9630E1 + PACKAGE_VERSION =3D 0.1 + +[Includes] + Include + +[LibraryClasses] + +[Guids] + ## MdeModule package token space guid + # Include/Guid/MdeModulePkgTokenSpace.h + gEfiStructuredPcdPkgTokenSpaceGuid =3D { 0x11a81069, 0xa6a2, 0x420= a, { 0xa0, 0xe, 0x30, 0xc5, 0xb, 0xfb, 0xe8, 0x13 } } + +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] + # @Prompt Test Strucutre + gEfiStructuredPcdPkgTokenSpaceGuid.Test|{0xFF, 0xFF}|TEST|0x00010071 { + + Guid/Test.h + + MdePkg/MdePkg.dec + TestPkg/TestPkg.dec + } + gEfiStructuredPcdPkgTokenSpaceGuid.Test.A|2 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.C|20 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array[4]|1 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array2[0]|2 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray[7]|5 diff --git a/TestPkg/TestPkg.dsc b/TestPkg/TestPkg.dsc new file mode 100644 index 0000000..fc61979 --- /dev/null +++ b/TestPkg/TestPkg.dsc @@ -0,0 +1,69 @@ +## @file +# EFI/PI Reference Module Package for All Architectures +# +# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
+# Copyright (c) 2007 - 2016, 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 +# which 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. +# +## + +[Defines] + PLATFORM_NAME =3D StructuredPcdPkg + PLATFORM_GUID =3D 35B4419B-4CF6-46FA-9A5D-741D0D29CD61 + PLATFORM_VERSION =3D 0.1 + DSC_SPECIFICATION =3D 0x00010005 + OUTPUT_DIRECTORY =3D Build/StructuredPcdPkg + SUPPORTED_ARCHITECTURES =3D IA32|IPF|X64|EBC|ARM|AARCH64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER =3D DEFAULT + +[LibraryClasses] + +##########################################################################= ######################### +# +# Components Section - list of the modules and components that will be pro= cessed by compilation +# tools and the EDK II tools to generate PE32/PE32+/C= off image files. +# +# Note: The EDK II DSC file is not used to specify how compiled binary ima= ges get placed +# into firmware volume images. This section is just a list of module= s to compile from +# source into UEFI-compliant binaries. +# It is the FDF file that contains information on combining binary f= iles into firmware +# volume images, whose concept is beyond UEFI and is described in PI= specification. +# Binary modules do not need to be listed in this section, as they s= hould be +# specified in the FDF file. For example: Shell binary (Shell_Full.e= fi), FAT binary (Fat.efi), +# Logo (Logo.bmp), and etc. +# There may also be modules listed in this section that are not requ= ired in the FDF file, +# When a module listed here is excluded from FDF file, then UEFI-com= pliant binary will be +# generated for it, but the binary will not be put into any firmware= volume. +# +##########################################################################= ######################### + +[PcdsFixedAtBuild] + gEfiStructuredPcdPkgTokenSpaceGuid.Test|{0xFF, 0xFF} + gEfiStructuredPcdPkgTokenSpaceGuid.Test.A|MacroTest2 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.C|'a' + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array[4]|1 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array2[0]|2 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray[7]|5 + gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray[4]|L'C' + gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray[3]|'b' + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|"Hello" + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|L"Hello" + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|'Hello' + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|L'Hello' + gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|GUID("6F08F62E-5C19-498E-9= 157-B59CE6F362F1") +# gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|GUID({ 0x827495c7, 0x636f= , 0x4e0c, { 0x9c, 0xcc, 0x93, 0x5e, 0xfb, 0x67, 0xf2, 0x7c } }) +# gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array|{1,2,3} + gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray|"World" + gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray|L"World" +# gEfiStructuredPcdPkgTokenSpaceGuid.Test.FlexibleArray|{4, 5, 6} + + +[Components] --=20 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel