From nobody Sat Nov 2 12:20:07 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