Commit Graph

1813 Commits

Author SHA1 Message Date
Yonghong Zhu 7ccc9c954c BaseTools: Add PackageDocumentTools into Scripts folder
This tool is used to generate the document for edk2 packages. The
generated document will be in UDK release. For example, UDK2017
document can be found in:
https://github.com/tianocore/tianocore.github.io/wiki/UDK2017#documentation

Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2018-03-19 09:19:36 +08:00
Yonghong Zhu 316b43dee5 BaseTools: Fix bug for VOID* DynamicDefault Pcd use Flexible format
define a flexible pcd format in Dyanmic/DynamicExDefault section,
it cause build error.
[PcdsDynamicExDefault.common.DEFAULT]
  pcdToken.Name|{GUID("11111111-2222-42eb-b5eb-fef31d207cb4")}

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-18 15:01:07 +08:00
BobCF 34d808add3 BaseTools: Detect structure pcd header file change.
Detect structure pcd header file change

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-17 22:30:30 +08:00
Feng, YunhuaX 90456c3c06 BaseTools: --hash --binary-destination generate wrong binary path
Option --hash --binary-destination generate Binaries section in
the inf file, but the path of ASL file is begin with
Output directory,  so need replace Output directory with '',
will get the file name RamDisk.aml

Incorrect AML file path in inf file on linux:
[Binaries.X64]
  PE32|RamDiskDxe.efi

ASL|home/tiano/Desktop/hash/edk2/Build/OvmfX64/RELEASE_GCC5/X64
/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe/OUTPUT/RamDisk.aml
  DXE_DEPEX|RamDiskDxe.depex
  BIN|RamDiskDxeOffset.bin

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-17 16:03:34 +08:00
Carsey, Jaben b3fa393f47 BaseTools: UPT: remove unused variable and inaccessible code.
gINCLUDE_PATTERN is never used.
IncList is always empty.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-15 14:50:15 +08:00
Yonghong Zhu 87a1f65e80 BaseTools: Get Pcd DatumType from DEC file for --pcd
It is regression bug that missing the Pcd DatumType info from DEC file
for --pcd .

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-12 15:55:03 +08:00
Carsey, Jaben 7878f706e7 BaseTools: GlobalData remove unused variable
gWideStringPattern is not used.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-09 17:39:38 +08:00
Feng, YunhuaX b31501c90a BaseTools: Fix parse OFFSET_OF get wrong offset
Fix parse OFFSET_OF get wrong offset

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-09 17:34:10 +08:00
Yonghong Zhu 705ed563de BaseTools: Fix a bug for --pcd used in ConditionalStatement calculate
Move the GlobalData.BuildOptionPcd before FdfParser() function and add
type check for Pcd item.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-09 16:37:35 +08:00
Yonghong Zhu 8565b5829c BaseTools: Update --pcd parser to support flexible pcd format
This patch update --pcd parser to support flexible pcd format.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-09 16:34:37 +08:00
BobCF 0f228f19fb BaseTools: Fixed Pcd from command line issue.
Save the pcd command line value in Pcd object

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-09 16:33:29 +08:00
Laszlo Ersek 777f4aa083 BaseTools/header.makefile: revert gcc-8 "-Wno-xxx" options on OSX
I recently added the gcc-8 specific "-Wno-stringop-truncation" and
"-Wno-restrict" options to BUILD_CFLAGS, both for "Darwin" (XCODE5 /
clang, OSX) and otherwise (gcc, Linux / Cygwin).

I also regression-tested the change with gcc-4.8 on Linux -- gcc-4.8 does
not know either of the (gcc-8 specific) "-Wno-stringop-truncation" and
"-Wno-restrict" options, yet the build completed fine (by GCC design).

Regarding OSX, my expectation was that

- XCODE5 / clang would either recognize these warnings options (because
  clang does recognize most -W options of gcc),

- or, similarly to gcc, clang would simply ignore the "-Wno-xxx" flags
  that it didn't recognize.

Neither is the case; the new flags have broken the BaseTools build on OSX.
Revert them (for OSX only).

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reported-by: Liming Gao <liming.gao@intel.com>
Fixes: 1d212a83df
Fixes: 9222154ae7
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2018-03-07 22:42:55 +01:00
Laszlo Ersek 9de3067013 BaseTools/GenVtf: silence false "stringop-overflow" warning with memcpy()
gcc-8 (which is part of Fedora 28) enables the new warning
"-Wstringop-overflow" in "-Wall". This warning is documented in detail at
<https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>; the
introduction says

> Warn for calls to string manipulation functions such as memcpy and
> strcpy that are determined to overflow the destination buffer.

It breaks the BaseTools build with:

> GenVtf.c: In function 'ConvertVersionInfo':
> GenVtf.c:132:7: error: 'strncpy' specified bound depends on the length
> of the source argument [-Werror=stringop-overflow=]
>        strncpy (TemStr + 4 - Length, Str, Length);
>        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> GenVtf.c:130:14: note: length computed here
>      Length = strlen(Str);
>               ^~~~~~~~~~~

It is a false positive because, while the bound equals the length of the
source argument, the destination pointer is moved back towards the
beginning of the destination buffer by the same amount (and this amount is
range-checked first, so we can't precede the start of the dest buffer).

Replace both strncpy() calls with memcpy().

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Cole Robinson <crobinso@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reported-by: Cole Robinson <crobinso@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-05 22:38:35 +01:00
Laszlo Ersek 9222154ae7 BaseTools/header.makefile: add "-Wno-restrict"
gcc-8 (which is part of Fedora 28) enables the new warning
"-Wrestrict" in "-Wall". This warning is documented in detail
at <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>; the
introduction says

> Warn when an object referenced by a restrict-qualified parameter (or, in
> C++, a __restrict-qualified parameter) is aliased by another argument,
> or when copies between such objects overlap.

It breaks the BaseTools build (in the Brotli compression library) with:

> In function 'ProcessCommandsInternal',
>     inlined from 'ProcessCommands' at dec/decode.c:1828:10:
> dec/decode.c:1781:9: error: 'memcpy' accessing between 17 and 2147483631
> bytes at offsets 16 and 16 overlaps between 17 and 2147483631 bytes at
> offset 16 [-Werror=restrict]
>          memcpy(copy_dst + 16, copy_src + 16, (size_t)(i - 16));
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function 'ProcessCommandsInternal',
>     inlined from 'SafeProcessCommands' at dec/decode.c:1833:10:
> dec/decode.c:1781:9: error: 'memcpy' accessing between 17 and 2147483631
> bytes at offsets 16 and 16 overlaps between 17 and 2147483631 bytes at
> offset 16 [-Werror=restrict]
>          memcpy(copy_dst + 16, copy_src + 16, (size_t)(i - 16));
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Paolo Bonzini <pbonzini@redhat.com> analyzed the Brotli source in detail,
and concluded that the warning is a false positive:

> This seems safe to me, because it's preceded by:
>
>     uint8_t* copy_dst = &s->ringbuffer[pos];
>     uint8_t* copy_src = &s->ringbuffer[src_start];
>     int dst_end = pos + i;
>     int src_end = src_start + i;
>     if (src_end > pos && dst_end > src_start) {
>       /* Regions intersect. */
>       goto CommandPostWrapCopy;
>     }
>
> If [src_start, src_start + i) and [pos, pos + i) don't intersect, then
> neither do [src_start + 16, src_start + i) and [pos + 16, pos + i).
>
> The if seems okay:
>
>        (src_start + i > pos && pos + i > src_start)
>
> which can be rewritten to:
>
>        (pos < src_start + i && src_start < pos + i)
>
> Then the numbers are in one of these two orders:
>
>      pos <= src_start < pos + i <= src_start + i
>      src_start <= pos < src_start + i <= pos + i
>
> These two would be allowed by the "if", but they can only happen if pos
> == src_start so they degenerate to the same two orders above:
>
>      pos <= src_start < src_start + i <= pos + i
>      src_start <= pos < pos + i <= src_start + i
>
> So it is a false positive in GCC.

Disable the warning for now.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Cole Robinson <crobinso@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reported-by: Cole Robinson <crobinso@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-05 22:38:30 +01:00
Laszlo Ersek 1d212a83df BaseTools/header.makefile: add "-Wno-stringop-truncation"
gcc-8 (which is part of Fedora 28) enables the new warning
"-Wstringop-truncation" in "-Wall". This warning is documented in detail
at <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>; the
introduction says

> Warn for calls to bounded string manipulation functions such as strncat,
> strncpy, and stpncpy that may either truncate the copied string or leave
> the destination unchanged.

It breaks the BaseTools build with:

> EfiUtilityMsgs.c: In function 'PrintMessage':
> EfiUtilityMsgs.c:484:9: error: 'strncat' output may be truncated copying
> between 0 and 511 bytes from a string of length 511
> [-Werror=stringop-truncation]
>          strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> EfiUtilityMsgs.c:469:9: error: 'strncat' output may be truncated copying
> between 0 and 511 bytes from a string of length 511
> [-Werror=stringop-truncation]
>          strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> EfiUtilityMsgs.c:511:5: error: 'strncat' output may be truncated copying
> between 0 and 511 bytes from a string of length 511
> [-Werror=stringop-truncation]
>      strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The right way to fix the warning would be to implement string concat with
snprintf(). However, Microsoft does not appear to support snprintf()
before VS2015
<https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010>,
so we just have to shut up the warning. The strncat() calls flagged above
are valid BTW.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Cole Robinson <crobinso@redhat.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-05 22:38:09 +01:00
Yonghong Zhu 20203d3f98 BaseTools: update DNS_DEVICE_PATH/URI_DEVICE_PATH definition
Update this two definition to align with MdePkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-05 15:22:59 +08:00
Yonghong Zhu 27db236ac2 BaseTools: Fix byte orders when handling 8-byte array
Per UEFI spec, FibreEx.WWN, FibreEx.Lun, SasEx.Address, SasEx.Lun
and iSCSI.Lun are all 8-byte array with byte #0 in the left.
It means "0102030405060708" should be converted to:
    UINT8[8] = {01, 02, 03, 04, 05, 06, 07, 08}
or  UINT64 = {0807060504030201}

Today's implementation wrongly uses the reversed order.
The patch fixes this issue by using StrHexToBytes().
Copy this solution from MdePkg Hash version d0196be.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 15:41:16 +08:00
Yonghong Zhu c1d6749b0e BaseTools: Fix bug when converting iSCSI node
If protocol string is not specified, default TCP(0) should be used.
Today's implementation wrongly sets to 1 for this case.
Copy the fix solution from MdePkg Hash version e6c80aea.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 15:40:04 +08:00
Yonghong Zhu aebe5a36b6 BaseTools: Fix the bug to search Fv.txt file relative to workspace
when the SECTION FV_IMAGE = $(XX)/XX.Fv, the Fv file should relative to
WORKSPACE, so when we search the XX.Fv.txt file, we should search the
path relative to workspace first.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 12:40:51 +08:00
Yonghong Zhu 24326f381f BaseTools: Correct Structure Pcd value in the report
The patch "Fixed build failed issue" changed structure Pcd Object, so
we need update build report to correct structure Pcd Value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 12:40:48 +08:00
Feng, Bob C 1667eec699 BaseTools: Pcd Value override issue.
For the case that the structure PCD has no value assignment in DSC,
but has value assignment in command line.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 12:40:45 +08:00
Feng, Bob C f832bb3466 BaseTools: Fixed build failed issue.
Case 1. A Pcd has no default sku setting in DSC.
Case 2. Build as Single SKU.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 12:40:42 +08:00
BobCF b854e2bf75 BaseTools: Fixed Pcd value override issue.
1. Handle the Pcd maxsize issue for the case
that the length of Pcd value from CommandLine
bigger that its maxsize

2. The Pcd value override in commandline.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 12:40:39 +08:00
Yunhua Feng 0537f332c9 BaseTools: DSC Components section support flexible PCD
DSC Components section support flexible PCD, and for binary driver, we
need patch this value. Update the split char ',' not ', ' because some
value may have space, while others may not have this space.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-03 12:40:35 +08:00
Feng, YunhuaX 1fa7fdf6ea BaseTools: Dsc/Fdf conditional statement parse issue
Set PCD value with --pcd argument not replace DSC/Fdf PCD value.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-03 09:20:12 +08:00
Feng, YunhuaX 5ac0a5450b BaseTools: report error if flag in LABEL() invalid
Flag in LABEL() is not valid C variable name, will report error.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-02 10:18:50 +08:00
Yonghong Zhu 6ee9c68912 BaseTools: Fix the bug for display incorrect *M flag in report
The root cause is the byte array value in the driver Pcd, some bytes
have additional space character, while the value in DSC file doesn't
have this space, it cause the string compare return false, so we remove
the extra space.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-02 10:06:21 +08:00
Feng, YunhuaX 4faf13222e BaseTools: Fix eval parse string issue
eval argument start with " or ', but it is unicode string,
will encounter error:
    List = list(eval(Value)) # translate escape character
  File "<string>", line 1
    'j??=????????F??
             ^
SyntaxError: EOL while scanning string literal

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-02 10:05:03 +08:00
Feng, YunhuaX 541a3f5882 BaseTools: GlobalData.gConfDirectory is None when run GenFds
When run GenFds,  GlobalData.gConfDirectory is None, On Linux
self._ToolChainFamily default Value is "MSFT", and then
generate the wrong PcdValueInit Makefile

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-02 07:59:22 +08:00
Yonghong Zhu cd49821608 BaseTools: Fix the bug for single module build with GenC/GenMake
copy the same logic from _BuildPa() function.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-02 07:55:32 +08:00
Liming Gao a16f7f4794 BaseTools: Align WIN_CERTIFICATE_UEFI_GUID definition to MdePkg one.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-03-01 13:12:00 +08:00
Yonghong Zhu 2157bc9c8b BaseTools: Enhance FV info report file path to support absolute path
When generate build report, Tool will get the info like size, Fv Name,
etc from the xx.Fv.txt file and add these info into the build report.
This patch support the xx.Fv.txt to use absolute file path format since
user may provide specified FV path.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-01 10:13:13 +08:00
Feng, Bob C f3b314331c BaseTools: Improve build performance of structure PCD value generation
Optimized the PcdValueInit.c size by abstract the common logic in the funciton.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-28 16:47:43 +08:00
BobCF 79820e32ec BaseTool: GUID format PCD value assignment fail in Structure PCD field
If Structure PCD field is assigned as GUID format, its data type should be
the fixed GUID structure. No flexible check is required.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-28 16:47:27 +08:00
Feng, Bob C 0a57a9782b BaseTools: Improve build performance of structure PCD value generation
Add cache for building PcdValueInit.c. If PcdValueInit.c is not changed,
it will not be regenerated.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-28 16:45:55 +08:00
Feng, Bob C 06140766c1 BaseTools: Fixed the pcd value override issue.
1. the issue in the overriding value from command line.
2. dec fully value < dec field assign value <
   dsc fully value < dsc field assign value

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-28 16:45:31 +08:00
Ard Biesheuvel a68749f39a BaseTools/tools_def: use separate PP definition for DTC
Clang's preprocessor behaves differently from GCC's, and produces
intermediate device tree source that still contains #pragma pack()
and other directives that the device tree compiler chokes on.

For assembling device tree sources, it matters very little which
preprocessor is being used, so let's just use GNU CPP explicitly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-28 08:11:48 +00:00
Yonghong Zhu cdbf45ad85 BaseTools: Fix a bug override Pcd by DSC Components section
The case is: define a VOID* pcd in DEC file, eg: Value is {0x1}.
then override this PCD on DSC component section, eg: Value is
{0x1, 0x2, 0x3}, the max size of this PCD is calculate wrong
which cause build error.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-28 13:40:07 +08:00
Feng, YunhuaX 97e1ff1b91 BaseTools: Fix report not used --pcd value incorrectly
Argument --pcd gUefiOvmfPkgTokenSpaceGuid.test10=H"{1}",
If the PCD is not used, report value {0x01, 0x00}, is incorrect.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-28 08:49:51 +08:00
Feng, YunhuaX ea927d2f3f BaseTools: Fix flexible PCD single quote and double quote bugs
1.The " and ' inside the string, must use escape character format
  (\", \')
2.'string' and L'string' format in --pcd, it must be double quoted
  first.

  Some examples that to match --pcd format and DSC format
  --pcd                             DSC format
  L"ABC"                            L"ABC"
  "AB\\\"C"                         "AB\"C"
  "AB\\\'C"                         "AB\'C"
  L"\'AB\\\"C\'"                    L'AB\"C'
  "\'AB\\\'C\'"                     'AB\'C'
  H"{0, L\"AB\\\"B\", \'ab\\\"c\'}" {0, L"AB\"B", 'ab\"c'}

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-28 08:47:11 +08:00
Liming Gao 29c5075787 BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image
DebugEntry FileOffset is required to be updated to the virtual address if
the input image is converted to XIP image.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-27 18:43:30 +08:00
Liming Gao 0939fda93c BaseTools: Add more error message when PcdValue is wrong
For structure PCD, its field name is wrong and cause build failure. Its
build error message will output to let user aware what's wrong.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-27 18:42:34 +08:00
Liming Gao 006c2647dc BaseTools: Resolve BaseTools C tool build failure
New GUID definition is conflicted with GUID in Windows Kits guiddef.h.
GUID definition will be defined when it is undefined.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-27 18:34:03 +08:00
Yonghong Zhu 02a908fc6d BaseTools:Override the MAKE_FLAGS by BuildOptions in DSC
The issue that *_*_*_MAKE_FLAGS doesn't work in DSC [BuildOptions]
section. It means MAKE flags can't be set in platform DSC file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-27 15:41:02 +08:00
Liming Gao 3c3277f21e BaseTools GenFv: Update error message to describe PE image alignment
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-26 13:18:19 +08:00
Liming Gao 3e44e9f534 BaseTools: Add the missing basic definition in C BaseType.h
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-26 13:18:15 +08:00
Yonghong Zhu f440f7e3ca BaseTools: Add *B Flag for the field that from command line
For structure PCD, the field value may override in the command line,
so in the report when we print the field info we add *B Flag for those
field.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-25 16:05:20 +08:00
Feng, YunhuaX 3be421e987 BaseTools: Update ValueExpressionEx for flexible PCD
1. Byte  array number should less than 0xFF.
2. Add SplitPcdValueString for PCD split

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-25 16:04:23 +08:00
Kinney, Michael D 8bd72d7c05 BaseTools/Expression: Use 2nd passes on PCD values
Use 2 passes when evaluating PCD values to discover
all the LABEL() operators and compute the byte offset
of each LABEL().  The 2nd pass then has the information
to replace the OFFSET_OF() operator with the computed
byte offset.  The 2 passes allows OFFSET_OF() to be used
before a LABEL() is declared.

fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=880
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-25 16:03:14 +08:00
Yonghong Zhu 8aaa8f7bc0 BaseTools: Fix the bug to display the single SKUID info
when defined SKUID_IDENTIFIER = DEFAULT|TEST in DSC [Defines] section,
per spec it means current SKUID is single, the bug is build report print
both DEFAULT and TEST info, it should only print TEST.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-23 18:48:03 +08:00
Yonghong Zhu a87e79d9d6 BaseTools: Add check for INF statement must be a .inf file
Per FDF spec, INF statement must use a .inf file, we add this error
check.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-23 18:47:10 +08:00
Yonghong Zhu ffcec664ca BaseTools: Add WindowsLike path in front of PATH Env
Original BaseTools source build append WindowsLike path to PATH Env,
while WINDDK installation has a "build.exe", if user place WINDDK
folder to PATH either during WINDDK installation or manually, it will
block the BaseTools' build.bat.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-23 16:57:32 +08:00
Feng, YunhuaX a35918caae BaseTools: Fix VOID* type bug
Code miss UINT32 and UINT64 value type setting in
VOID*, like as {UINT32({TRUE})}

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-10 19:55:13 +08:00
Feng, YunhuaX ce2818e418 BaseTool: correct the generate compress section process
First generate a dummy file with section alignment,
then compress the dummy file to generate the compress file

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-09 17:07:55 +08:00
Yunhua Feng 9efe8d6040 BaseTools: Update Expression.py for string comparison and MACRO replace issue
1. Fix string comparison incorrect issue, we expected "ABC" is greater than
"AAD" since the second char 'B' is greater than 'A'.
2. fix MACRO not replace issue.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-09 08:34:36 +08:00
Yonghong Zhu 2052cb675f BaseTools: not specified value of MAX_CONCURRENT_THREAD_NUMBER
when MAX_CONCURRENT_THREAD_NUMBER is not specified, tool will
automatically detect number of processor threads.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=775
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-09 08:33:46 +08:00
Yonghong Zhu 70d0a7549e BaseTools: Enhance error handling for unsupported toolchain Flags/Path
Case1: Cover the Tool PATH is not exist, eg: build MdeModule under GCC5
toolchain and IPF arch.
Case2: Cover the Tool FLAGS is not exist, eg: build OvmfPkg under
CLANG35 toolchain and X64 arch.

fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=595
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-08 16:23:37 +08:00
Feng, Bob C 77204d608b BaseTools: Fixed incorrect Structure Pcd Value.
When structurePCD only has overall value assigned
in Dsc under different SKU, the value under default sku is used.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-08 11:09:49 +08:00
BobCF e1511113de BaseTools: Fixed Build failed issue.
If the PCD is not used in DSC file and user set
that PCD value from Command line, build will fail.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-08 11:09:45 +08:00
Feng, Bob C 8aa4db4b80 BaseTool: Fixed Pcd issues.
1. Check variable offset when merging Hii Pcds
2. Fixed the issue of Hii value inherit with default store.
3. Error handling for incorrect structure pcd declare.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-08 11:09:42 +08:00
Feng, YunhuaX 4f735fc8cd BaseTools: Fix COMPRESS alignment incorrect issue
Doesn't generate the correct alignment for the leaf section
in the compression section.
Below FFS rule doesn't work as the expectation.

[Rule.Common.PEIM.PE32]
  FILE PEIM = $(NAMED_GUID) {
    PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
    COMPRESS {
      PE32   PE32  Align=Auto    $(INF_OUTPUT)/$(MODULE_NAME).efi
      UI     STRING="$(MODULE_NAME)" Optional
      VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    }
  }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-07 14:48:04 +08:00
Pete Batard 0a4c903c5a BaseTools/Conf: Add VS2017/ARM support
We duplicate the Assembly-Code-File section from build_rule.template
because --convert-hex cannot be used with the MSFT ARM assembler.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-07 09:49:23 +08:00
Feng, YunhuaX 4344a788c4 BaseTools: Report error when GUID format is incorrect
Flexible GUID format of PCD value support following format, so tool should report
error when it is not correct.
1. { GUID("11E13869-1896-4A07-8B21-D8B23DD2A2B4") }
2. { GUID({ 0x11e13869, 0x1896, 0x4a07,{
    0x8b, 0x21, 0xd8, 0xb2, 0x3d, 0xd2, 0xa2, 0xb4 } }) }
3. { GUID(gEfiBlockIoProtocolGuid) }

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-07 09:29:08 +08:00
Feng, YunhuaX 8ad5f10a2b BaseTools: Fix flexible PCD DEVICE_PATH parse issue
When the format of DEVICE_PATH have string, like as:
{DEVICE_PATH("BBS(1,"AB",0)")} have string "AB", will
get the wrong value.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-07 09:28:44 +08:00
Feng, YunhuaX f9bba77495 BaseTools: Fix build argument --pcd for flexible format bugs
Build argument --pcd flexible format, like as:
1. VOID* type
gTokenSpaceGuid.Test=H"{flexible format}"
gTokenSpaceGuid.Test=L"string"
gTokenSpaceGuid.Test="string"
gTokenSpaceGuid.Test=L'string'
gTokenSpaceGuid.Test='string'
2. UINT8/UINT16/UINT32/UINT64 type
gTokenSpaceGuid.Test=H"{flexible format}"
gTokenSpaceGuid.Test=L"string"
gTokenSpaceGuid.Test="string"
gTokenSpaceGuid.Test=L'string'
gTokenSpaceGuid.Test='string'

In linux, single quotes need escape
gTokenSpaceGuid.Test=L\'string\'
gTokenSpaceGuid.Test=\'string\'

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-07 09:28:17 +08:00
Ard Biesheuvel 34a4ddda4d BaseTools/Conf: disable DTC legacy phandle format
By default, the device tree compiler emits phandle properties twice:
once called 'phandle' and again called 'linux,phandle'. Given that
Linux was updated in early 2010 [0] to accept the former (which is
what is specified in the ePAPR and device tree specifications), there
is no point in emitting both when compiling device trees for UEFI
platforms.

[0] 04b954a673dd02f585a2769c4945a43880faa989
"of/flattree: Make the kernel accept ePAPR style phandle information"

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-06 09:58:31 +00:00
Yonghong Zhu e0db09cd1c BaseTools: enhance error check for DatumType format
Add a check for DatumType format, eg: VOID *, original Tool will crash
but no detail error message which cause confusion to user.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-06 13:48:42 +08:00
Liming Gao d16e777ac5 BaseTools GNUmakefile: Remove HOST_ARCH in every tool Makefile
HOST_ARCH has been moved into the common header.makefile

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
2018-02-06 13:44:42 +08:00
Liming Gao 1eac82c878 BaseTools GNUmakefile: Move HOST_ARCH detection into common makefile
With this change, enter single tool directory, make can pass.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-06 13:44:39 +08:00
Feng, YunhuaX 0e6b86731e BaseTools: Update Expression.py for VOID* to support L'a' and 'a'
Original VOID* type support L"string" and "string" format, now we also
add support for single quote string that without null terminator.
Type VOID* support L'a' and 'a', the value transfer to c style value.
L'a' --> {0x61, 0x00}
L'ab' --> {0x61, 0x00, 0x62, 0x00}
'a'  --> {0x61}
'ab' --> {0x61, 0x62}

when the value is L'' or '' that not include any character, tool will
report error.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-04 11:19:39 +08:00
Feng, YunhuaX bee0f2f167 BaseTools: StructurePcd array Value support flexible format
if StructurePcd set item value is array, support flexible format
like as:
gEfiStructuredPcdPkgTokenSpaceGuid.Test.Array | {flexible format}
{flexible format} = {L"ABC"} | {L'ABC'} | {"ABC"} | {UINT8(0x10)}
                  | {UINT16(0x10)} | {UINT32(0x10)} | {UINT64(0x10)}
                  | {DEVICE_PATH("PciRoot(0)/Pci(0,0)")}
                  | {GUID(gPcdPkgTokenSpaceGuid)}
                  | {L"ABC", L'ABC', UINT8(0x10)....}

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-04 11:16:01 +08:00
Feng, YunhuaX 693877f8e5 BaseTools: Fix make PcdValueCommon.c failure on GCC
error message:
PcdValueCommon.c: In function '__PcdGetPtr':
PcdValueCommon.c:315:11: error: variable 'Byte'
set but not used [-Werror=unused-but-set-variable]
   UINT8   Byte;
           ^
cc1: all warnings being treated as errors

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-02 11:35:04 +08:00
Liming Gao 83ba30c5a3 BaseTools CommonLib: Remove the unnecessary print message in PcdValueCommon
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-02-01 10:09:49 +08:00
Feng, Bob C 6f49996ced BaseTools: Structure Pcd in CommandLine.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-01 09:21:47 +08:00
Feng, Bob C 81add864f4 BaseTools: Support multiple .h file
for structure Pcd declaration in DEC file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-01 09:21:45 +08:00
BobCF 5db9414cc1 BaseTool: Enhance error handling.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-01 09:21:42 +08:00
Feng, Bob C 75771aebd3 BaseTool: Add comments in PcdValueInit.c.
Add Comments for __FLEXIBLE_SIZE () statement.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-01 09:21:38 +08:00
Yonghong Zhu d5988a8ac9 BaseTools: Update BPDG to support L'' and '' format as VPD Pcd Value
Current Pcd value support flexible format, this patch add support for
BPDG Tool to support L'' and '' format.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-31 17:50:01 +08:00
Yonghong Zhu 86737681af BaseTools: Fix the bug to align VPD PCD based on value type
Spec required for VOID* VPD Pcd, Ascii string use byte alignment, byte
array use 8-byte alignment, unicode string use 2-byte alignment.
while when the VPD pcd offset use *, the offset generated in the .map
file not follow this rule.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-31 17:47:50 +08:00
Yunhua Feng 35f613d96c BaseTools: Enhance parse performance by optimize ValueExpressionEx
Optimize ValueExpressionEx function to enhance meta-data file parse
performance.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-30 22:44:59 +08:00
Gary Lin 877251b421 BaseTools: Fix indentation in CParser.py file
Mixing usage of spaces and tabs may confuse the python
compiler/interpreter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gary Lin <glin@suse.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-30 10:43:28 +08:00
BobCF e827d21da1 BaseTools: Fixed incorrect VPD size.
The VPD size is incorrect if that VPD is not used in Module.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-25 18:08:17 +08:00
Feng, Bob C 9904222db0 BaseTool: Fixed the StructurePcd incorrect value.
If user not set Structure overall value in Dsc,
Structure Pcd value would be incorrect.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-25 18:08:10 +08:00
Feng, Bob C 8e011d83bb BaseTools: Fixed some small issues
1. The structure pcd default value should use the default value under sku.
2. Incorrect VpdOffset value for those un-used in module Vpd
3. Add a checkpoint for Structure Pcd Name

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-25 18:08:07 +08:00
Feng, Bob C 841d86fe40 BaseTools: Fixed build failure for the PCD value initialization.
A pcd is initialized under one SKU but is uninitialized under another SKU.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-25 18:08:04 +08:00
Feng, Bob C 6a10344080 BaseTools: Add comments for the Structure Pcd definition in PcdValueInit.c file
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-25 18:07:59 +08:00
Feng, Bob C e6bf3cfd50 BaseTool: Combine the HiiPcd value if they link to same Variable
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-25 18:07:55 +08:00
Liming Gao 4faf534046 BaseTools: CommonLib Fix Crash to write the last byte
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-25 11:21:45 +08:00
Chema Gonzalez 9d5aab0554 BaseTools: Barf on unknown HOST_ARCH in C Makefile
I was getting `HOST_ARCH` set using the linux arch name ("x86_64"), which
is different from the MS one ("X64").

It is not clear anyway we can proceed without valid build variables
(`ARCH_INCLUDE`, `BIN_PATH`, `LIB_PATH`, `SYS_BIN_PATH`, and
`SYS_LIB_PATH`).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chema Gonzalez <chemag@gmail.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-24 11:47:32 +08:00
Yonghong Zhu 767ddbe874 BaseTools: Add DefaultStore section format Check
This patch add DefaultStore section format Check and it use same logic
with SKUID section.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-23 16:24:10 +08:00
Yonghong Zhu e6b10112b3 BaseTools: update SKUID value to support both integer and Hex number
This patch updated Skuid value to support both integer and hex value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-23 16:21:17 +08:00
Yonghong Zhu 5e2c0ecd0b BaseTools: Enhance binary file in [Binaries] section use relative path
Enhance the binary file in Asbuilt inf file [Binaries] section use
relative path.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-23 16:19:41 +08:00
Yonghong Zhu e74cea4c7b BaseTools: Add "processing meta-data" string back
Previous build tool will display "processing meta-data ..." to let user
know the progress. this Patch add this string back.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-23 16:18:19 +08:00
Ard Biesheuvel faf0475b13 BaseTools/tools_def CLANG3x: ignore unknown warning options
Ironically, disabling warnings in the OpensslLib library build is
causing breakage when using the CLANG35 toolchain to build for ARM:

error: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Werror,-Wunknown-warning-option]

So let's add -Wno-unknown-warning-option to the list of warnings to
ignore when using Clang 3.5, and move the same option from the x86
specific list to the shared list for Clang 3.8.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-22 11:17:04 +00:00
From: Yunhua Feng a676a24656 BaseTools: Optimizing DscDefaultValue process in BuildReport
DscDefaultValue from Dsc file has been parsed by ValueExpressionEx
when Dsc file parse, so only DscDefaultValue from FDF file need
ValueExpressionEx parse

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-21 16:28:45 +08:00
Yunhua Feng 6735645d9c BaseTools: Fix GenFds increment build bug that missing cover command option's change
Issue decription:
step 1, build platform X64
step 2, build platform IA32
step 3, build platform X64
step 4, check all ffs files for X64, the content still has IA32 in it

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-21 16:27:55 +08:00
Yonghong Zhu f21547ff64 BaseTools: enhance error handling for option --binary-source
Enhance error handling for option --binary-source to report invalid
option value. --binary-destination use same rule.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-19 10:52:29 +08:00
Liming Gao 2583352f24 BaseTools: Use nasm as the preferred assembly source files for XCODE5 tool
https://bugzilla.tianocore.org/show_bug.cgi?id=850

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-16 23:29:55 +08:00
Liming Gao db408fa3c1 BaseTools: Disable -Wno-unused-const-variable in XCODE5 RELEASE target
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-16 23:29:37 +08:00
Liming Gao 24a105a7d8 BaseTools: Disable warning varargs in XCODE5 align to CLANG38
https://bugzilla.tianocore.org/show_bug.cgi?id=741

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-16 23:29:29 +08:00
Yunhua Feng 29af38b0f8 BaseTools: Enable MAX_CONCURRENT_THREAD_NUMBER = 0 feature
when set 'MAX_CONCURRENT_THREAD_NUMBER=0',  will auto-detect number of
processor threads as MAX_CONCURRENT_THREAD_NUMBER.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=775
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-15 19:51:21 +08:00
Hao Wu e73fbac5d7 BaseTools/DevicePath: Fix potential null pointer dereference
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-15 10:42:17 +08:00
Hao Wu 66329d53bd BaseTools/C/Common: Fix potential null pointer dereference
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-15 10:42:17 +08:00
Hao Wu 46cced287e BaseTools/DevicePath: Fix potential memory leak
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-15 10:42:17 +08:00
Hao Wu 1f7e7e70d2 BaseTools/C/Common: Fix potential memory leak
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-15 10:42:17 +08:00
Hao Wu 3710ec21d5 BaseTools/C/Common: Fix code to be more readable
The change doesn't impact the functionality.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-15 10:42:16 +08:00
Yunhua Feng c7c5a6c4f7 BaseTools: Correct Target Path in CodaTargetList replace Path
Target Path in CodaTargetList is DebugDir path, correct replace
path with DebugDir

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-10 11:39:47 +08:00
Yonghong Zhu 643e8e4bd4 BaseTools: Add back the cc71d8 version's fix
The version cc71d8's fix was washed out by structure pcd report patch.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-09 14:45:11 +08:00
Yonghong Zhu 779ddcdf96 BaseTools: Not print SKUID info for PCD when it is only Single SKUID
when it is only single SKUID, we don't need to print the SKUID info for
every PCD since in the Global section there already have this info.
For DefaultStore, we use same rule.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-09 14:44:20 +08:00
BobCF 09c80b07b4 BaseTools: Fix Sku inherit issue.
The final Pcd value should only be override by its parents.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-08 11:32:04 +08:00
Feng, Bob C 4cc824283c BaseTools: Fix Pcd value override issue caused by SKU inherit
Pcd default value in DEC should only be assigned once.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
2018-01-08 11:31:48 +08:00
BobCF a3623244b9 BaseTools: Fix an issue in HiiPcd generation
DynamicHiiPcd may be used by PEIM or DXE driver.
All used DynamicHiiPcd value should be collected and placed into
the default setting PCD PcdNvStoreDefaultValueBuffer.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
2018-01-08 11:29:13 +08:00
Yonghong Zhu e4fb8f1d31 BaseTools: Fix compile error on VS2010
VS2010 also defined RSIZE_MAX, so we undef it first.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-03 16:35:19 +08:00
Laszlo Ersek 9a6b445bc2 BaseTools/DevicePath: fix GCC build error in print_mem(), and clean it up
Currently "BaseTools/Source/C/DevicePath/DevicePath.c" fails to build with
GCC48:

> DevicePath.c: In function 'print_mem':
> DevicePath.c:109:5: error: 'for' loop initial declarations are only
> allowed in C99 mode
>      for (size_t i=0; i<n; i++) {
>      ^
> DevicePath.c:109:5: note: use option -std=c99 or -std=gnu99 to compile
> your code

In addition, the print_mem() function does not conform to the edk2 coding
style:

- we use CamelCase and no underscores in identifiers,
- the types and type qualifiers should follow the edk2 style,
- initialization as part of definition is forbidden for local variables.

Clean these up.

While updating the print_mem()/PrintMem() call sites, also remove the
superfluous parentheses around the second argument.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Fixes: 7dbc50bd24
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-03 16:34:11 +08:00
Liming Gao beacbc7492 BaseTools CommonLib: Fix printf %llx issue on UINT64
UINT64 is defined as the different type for the different ARCHs. To
let it work for all archs and compilers, add (unsigned long long) for
the input value together with %llx.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2018-01-03 14:19:45 +08:00
Yonghong Zhu ff260aa7ab BaseTools: Fix the regression bug of a74398 for SubFv Image
in version a74398 we use guid value and Fv name as ffs dir for FILE
statement, this patch apply this rule on subFv image.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-03 10:48:26 +08:00
zenith432 5397bd425e BaseTools: resolve initialization order errors in VfrFormPkg.h
clang generates many warnings
warning: field 'XXX' is uninitialized when used here [-Wuninitialized]
for VfrFormPkg.h.

VfrFormPkg.h defines many classes derived from CIfrObj (along with other
base classes.)
Each of these derived classes defines a non-static member field that serves
as a duplicate pointer to an original pointer defined in the CIfrObj base
class, but cast to a different pointer type.
The derived class constructor passes the duplicate pointer to base class
constructors:
1) Once passes the address of the duplicate pointer to the CIfrObj
   constructor to have it initialized.
2) Then passes the duplicate pointer to one or more subsequent base class
   constructors to be used.
Both 1) and 2) constitute undefined behavior in C++.  C++ prescribes that
base classes are initialized before non-static members when initializing a
derived class.  So when base class constructors are executing, it is not
permitted to assume any non-static members of the derived class exist (even
to the stage of having their storage allocated.)

clang does not issue warnings for 1), but issues warnings -Wuninitialized
for 2).

This coding methodology is resolved as follows:
a) The CIfrObj object accessor method for retrieving the original pointer
   is revised to a template member function that returns the original
   pointer cast to a desired target type.
b) The call to CIfrObj constructor is no longer used to initialize the
   duplicate pointer in the derived class.
c) Any subsequent calls to a base class constructor that need to use the
   pointer, retrieve it from the CIfrObj base class using the template
   accessor method.
d) If the derived class makes no further use of the pointer, then the
   duplicate pointer defined in it is eliminated.
e) If the derived class needs the duplicate pointer for other use, the
   duplicate pointer remains in the derived class and is initialized in
   proper order from the original pointer in CIfrObj.
f) Existing source code that previously used the CIfrObj pointer accessor
   method is revised to use the template method.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-02 20:37:38 +08:00
zenith432 4e97974c1e BaseTools: silence parentheses-equality warning
Some code generated by antlr causes clang to emit warning
warning: equality comparison with extraneous parentheses
  [-Wparentheses-equality]
The warning is suppressed specifically for clang without affecting other
compilers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-02 20:37:32 +08:00
zenith432 a5b84d3480 BaseTools: eliminate unused expression result
Remove some code generated by antlr that causes clang to emit warning
warning: expression result unused [-Wunused-value]

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-02 20:37:26 +08:00
zenith432 8b13e18143 BaseTools: correct mal-typed CVfrDLGLexer::errstd
The member function CVfrDLGLexer::errstd is intended as an override virtual
function of DLGLexerBase::errstd, but due to mismatched prototype, it
didn't override, and never got called.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zenith432 <zenith432@users.sourceforge.net>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-01-02 20:37:20 +08:00
Yonghong Zhu 7dbc50bd24 BaseTools: Add DevicePath support for PCD values
Use C code parse device path to output hex string, and Python
run command when PCD Value need device path parse.

https://bugzilla.tianocore.org/show_bug.cgi?id=541

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-31 13:10:49 +08:00
Zhu, Yonghong f13f306b3b BaseTools: Fix the bug for QuarkPlatformPkg build failure
The issue is that the string 'LPC' starts with the 'L' character and
this is being confused with L" or L' for a Unicode string or Unicode
character.

Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=831
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-29 11:07:56 +08:00
Yonghong Zhu a743986df8 BaseTools: Fix a bug for different FV use same FILE statement Guid
We meet a case that different FV use same FILE statement Guid, but the
FILE content is different. current we use the Guid value as Ffs file
dir which cause the ffs file will be override. This patch use Guid
value and Fv name as ffs dir for FILE statement.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-29 11:07:50 +08:00
BobCF 98eb136437 BaseTools: Remove 'COMMON' in PCD SkuInfoList
'COMMON' is an alias of 'DEFAULT' for internal code,
it should be removed before generating Pcd DataBase.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-27 17:40:38 +08:00
Yonghong Zhu 726c501c2c BaseTools: Support PCD flexible values format
https://bugzilla.tianocore.org/show_bug.cgi?id=541

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-27 14:43:27 +08:00
Yonghong Zhu 68ba919f78 BaseTools: Add Platform Override Build Options for PcdValueInit
Add Platform's CC_FLAGS /D option for PcdValueInit generation.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-27 13:37:06 +08:00
Yonghong Zhu a9d9ce8ecc BaseTools: Update copyright year info of DSC/DEC/INF BuilData.py file
The DecBuildData.py, DscBuildData.py and InfBuildData.py were separated
from WorkspaceDatabase.py, so we updated to use same copyright year
info.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-27 13:19:10 +08:00
Liming Gao 02f6fd1d5f BaseTools: Update Python Makefile to include the new added python files
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2017-12-27 10:29:47 +08:00
Liming Gao e4ff28c3ac BaseTools: Update SkuId checker to make sure it be valid UINT64 value
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-12-27 10:29:46 +08:00
Feng, Bob C 5644e5cece BaseTools: Fix building FatPkg failed issue
Using property instead of vairable for DecPcds.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-26 11:41:34 +08:00
Liming Gao c05c2c0526 BaseTools: Fixed the issue of structure pcd filed sku inherit override
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:54 +08:00
Liming Gao 8ac167890f BaseTools: Fix VPD data optimization issue
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:54 +08:00
Liming Gao a09395932d BaseTools: Support nest field name in DSC/DEC
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:53 +08:00
BobCF 520365decb BaseTools: Check PCD DataType and the maxsize.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:53 +08:00
Liming Gao 67e63e9a7b BaseTools: Correct PCD generation logic to make sure DB is use
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:52 +08:00
Liming Gao 0b6c5954e1 BaseTools: Generate correct VPD PCD value to store the default setting
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:51 +08:00
Liming Gao b23957242c BaseTools: Add error message if Structure PCD value is wrong
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-12-25 11:05:51 +08:00
Liming Gao 65eff519e5 BaseTools: Fixed the issue of Multiple Skus are always disables
When multiple skus are enabled, PCD database should record the supported SKUs.
This patch fixes PCD database to add the missing supported SKUs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:50 +08:00
Liming Gao 626bece451 BaseTools: Optimize VPD PCD value for the different SKUs
If VPD PCD value is same in the different SKUs, the different SKUs will
save the same offset for this PCD in VPD region. That means there is only
one PCD value copy in VPD region to save VPD space.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:50 +08:00
Liming Gao 7e6e459a3d BaseTools: Update SkuId as SKU_ID type to follow current implementation
Update PCD DB and Default setting format as nature alignment.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-12-25 11:05:49 +08:00
Liming Gao 47854fd598 BaseTools: Update NV Default Header format to include the max size
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:48 +08:00
Liming Gao e651d06c5e BaseTools: Report Structure PCD value and SKU, DefaultStore info
https://bugzilla.tianocore.org/show_bug.cgi?id=706
Add Structure PCD support for Build report. Structure PCD field value described
in DEC/DSC will be display in build report. And, PCD value for each SKU and
Default store will also be shown in build report.

Contributed-under: TianoCore Contribution Agreement 1.1
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:48 +08:00
Liming Gao 2b8a6c44e0 BaseTools: PcdDataBase Optimization for multiple SkuIds
https://bugzilla.tianocore.org/show_bug.cgi?id=546
BaseTools will generate the optimized PCD database to save the image size
at build time for multiple SKUs. The optimized PCD database layout will be like
below, the PCD database will be composed of the full default SKU data
(PCD_DATABASE_INIT) and the non-default SKU delta data(PCD_DATABASE_SKU_DELTA).
PCD driver will build HOB to store the full default SKU data, and patch HOB
data based on non-default SKU delta data for the SKU set by SetSku(),
it can save memory resource at boot time.

//
// PCD database layout:
// +---------------------------------+
// | PCD_DATABASE_INIT (DEFAULT SKU) |
// +---------------------------------+
// | PCD_DATABASE_SKU_DELTA (SKU A)  |
// +---------------------------------+
// | PCD_DATABASE_SKU_DELTA (SKU B)  |
// +---------------------------------+
// | ......                          |
// +---------------------------------+
//

BaseTools, PCD database and driver updates are needed for this proposal.
For single SKU (default) case, this proposal is expected to have no impact.
For multi-SKU case, PCD database format will be changed.
So, PcdDataBase Version is also updated from 6 to 7.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:47 +08:00
Liming Gao 8518bf0b92 BaseTools: Support Structure PCD value inherit between the different SKUs
https://bugzilla.tianocore.org/show_bug.cgi?id=543
Structure PCD field value can inherit between the different SKUIds.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:47 +08:00
Liming Gao 34952f493c BaseTools: Collect DynamicHii PCD values and assign it to VPD PCD Value
https://bugzilla.tianocore.org/show_bug.cgi?id=661
Collect all DynamicHii and DynamicExHii PCD value into PCD
PcdNvStoreDefaultValueBuffer, then firmware can access this PCD value
to get the variable default setting.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 11:05:46 +08:00
Liming Gao ae7b6df816 BaseTools: Support Structure PCD value assignment in DEC/DSC
https://bugzilla.tianocore.org/show_bug.cgi?id=542
This is pure BaseTools enhancement to support PCD with one structure.
User can specify PCD value based on its structure field.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-12-25 11:05:45 +08:00
Liming Gao 309e37a229 BaseTools: Add PcdValueCommon logic into C source CommonLib
PcdValueCommon is used to calculate structure pcd value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-12-25 11:05:45 +08:00
Liming Gao 84e076c861 BaseTools: Update Makefile to work at absolute path
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-12-25 11:05:44 +08:00
Hao Wu c40dbe5e7b BaseTools/GenSec: Fix potential null pointer dereference
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 09:54:56 +08:00
Hao Wu ae0fbb7f5a BaseTools/GenSec: Fix potential memory leak
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-25 09:54:48 +08:00