[edk2] [PATCH v2] MdePkg Base.h: Update field name in VERIFY_UINTXX_ENUM_SIZE to follow style

2016-11-13 Thread Liming Gao
In V2, add comments on why uses __ prefix in enum type name.

For field name in structure, its first character should be upper case.

Cc: Michael Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Include/Base.h | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 5e24b5d..ce6cb07 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -63,16 +63,21 @@ VERIFY_SIZE_OF (UINT64, 8);
 VERIFY_SIZE_OF (CHAR8, 1);
 VERIFY_SIZE_OF (CHAR16, 2);
 
+//
+// Those three enum types are only used to verify compiler config is right. 
+// They are not used by any source code. So, __ prefix is added for them to 
+// avoid their name conflict with other types. 
+//
 typedef enum {
-  __VerifyUint8EnumValue = 0xff
+  VerifyUint8EnumValue = 0xff
 } __VERIFY_UINT8_ENUM_SIZE;
 
 typedef enum {
-  __VerifyUint16EnumValue = 0x
+  VerifyUint16EnumValue = 0x
 } __VERIFY_UINT16_ENUM_SIZE;
 
 typedef enum {
-  __VerifyUint32EnumValue = 0x
+  VerifyUint32EnumValue = 0x
 } __VERIFY_UINT32_ENUM_SIZE;
 
 VERIFY_SIZE_OF (__VERIFY_UINT8_ENUM_SIZE, 4);
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdePkg IndustryStandard: Add DDR3, DDR4 and LPDDR definition per SPD spec

2016-11-11 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=201

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Include/IndustryStandard/SdramSpd.h | 1682 +++-
 1 file changed, 1670 insertions(+), 12 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/SdramSpd.h 
b/MdePkg/Include/IndustryStandard/SdramSpd.h
index 2b2012b..e3f6eea 100644
--- a/MdePkg/Include/IndustryStandard/SdramSpd.h
+++ b/MdePkg/Include/IndustryStandard/SdramSpd.h
@@ -1,14 +1,24 @@
 /** @file
   This file contains definitions for the SPD fields on an SDRAM.
-
-  Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
-  This program and the accompanying materials  
-  are licensed and made available under the terms and conditions of the BSD 
License 
-  which accompanies this distribution.  The full text of the license may be 
found at
-  http://opensource.org/licenses/bsd-license.php   
 
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED. 
+
+  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+  @par Revision Reference:
+- Serial Presence Detect (SPD) for DDR3 SDRAM Modules Document Release 6
+  http://www.jedec.org/sites/default/files/docs/4_01_02_11R21A.pdf
+
+- Serial Presence Detect (SPD) for DDR4 SDRAM Modules Document Release 4
+  http://www.jedec.org/standards-documents/docs/spd412l-4
+
+- Serial Presence Detect (SPD) for LPDDR3 and LPDDR4 SDRAM Modules 
Document Release 2
+  http://www.jedec.org/standards-documents/docs/spd412m-2
 **/
 
 #ifndef _SDRAM_SPD_H_
@@ -47,9 +57,14 @@
 //
 // Memory Type Definitions
 //
-#define SPD_VAL_SDR_TYPE  4 ///< SDR SDRAM memory
-#define SPD_VAL_DDR_TYPE  7 ///< DDR SDRAM memory
-#define SPD_VAL_DDR2_TYPE 8 ///< DDR2 SDRAM memory
+#define SPD_VAL_SDR_TYPE  4  ///< SDR SDRAM memory
+#define SPD_VAL_DDR_TYPE  7  ///< DDR SDRAM memory
+#define SPD_VAL_DDR2_TYPE 8  ///< DDR2 SDRAM memory
+#define SPD_VAL_DDR3_TYPE 11 ///< DDR3 SDRAM memory
+#define SPD_VAL_DDR4_TYPE 12 ///< DDR4 SDRAM memory
+#define SPD_VAL_LPDDR3_TYPE 15 ///< LPDDR3 SDRAM memory
+#define SPD_VAL_LPDDR4_TYPE 16 ///< LPDDR4 SDRAM memory
+
 //
 // ECC Type Definitions
 //
@@ -62,4 +77,1647 @@
 #define SPD_BUFFERED0x01
 #define SPD_REGISTERED  0x02
 
+#pragma pack (push, 1)
+
+typedef union {
+  struct {
+UINT8  BytesUsed   :  4; ///< Bits 3:0
+UINT8  BytesTotal  :  3; ///< Bits 6:4
+UINT8  CrcCoverage :  1; ///< Bits 7:7
+  } Bits;
+  UINT8  Data;
+} SPD_DEVICE_DESCRIPTION_STRUCT;
+
+typedef union {
+  struct {
+UINT8  Minor   :  4; ///< Bits 3:0
+UINT8  Major   :  4; ///< Bits 7:4
+  } Bits;
+  UINT8  Data;
+} SPD_REVISION_STRUCT;
+
+typedef union {
+  struct {
+UINT8  Type:  8; ///< Bits 7:0
+  } Bits;
+  UINT8  Data;
+} SPD_DRAM_DEVICE_TYPE_STRUCT;
+
+typedef union {
+  struct {
+UINT8  ModuleType  :  4; ///< Bits 3:0
+UINT8  Reserved:  4; ///< Bits 7:4
+  } Bits;
+  UINT8  Data;
+} SPD_MODULE_TYPE_STRUCT;
+
+typedef union {
+  struct {
+UINT8  Density :  4; ///< Bits 3:0
+UINT8  BankAddress :  3; ///< Bits 6:4
+UINT8  Reserved:  1; ///< Bits 7:7
+  } Bits;
+  UINT8  Data;
+} SPD_SDRAM_DENSITY_BANKS_STRUCT;
+
+typedef union {
+  struct {
+UINT8  ColumnAddress   :  3; ///< Bits 2:0
+UINT8  RowAddress  :  3; ///< Bits 5:3
+UINT8  Reserved:  2; ///< Bits 7:6
+  } Bits;
+  UINT8  Data;
+} SPD_SDRAM_ADDRESSING_STRUCT;
+
+typedef union {
+  struct {
+UINT8  OperationAt1_50 :  1; ///< Bits 0:0
+UINT8  OperationAt1_35 :  1; ///< Bits 1:1
+UINT8  OperationAt1_25 :  1; ///< Bits 2:2
+UINT8  Reserved:  5; ///< Bits 7:3
+  } Bits;
+  UINT8  Data;
+} SPD_MODULE_NOMINAL_VOLTAGE_S

[edk2] [Patch] MdePkg Base.h: Update field name in VERIFY_UINTXX_ENUM_SIZE to follow style

2016-11-10 Thread Liming Gao
For field name in structure, its first character should be upper case.

Cc: Michael Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Include/Base.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 5e24b5d..749c275 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -64,15 +64,15 @@ VERIFY_SIZE_OF (CHAR8, 1);
 VERIFY_SIZE_OF (CHAR16, 2);
 
 typedef enum {
-  __VerifyUint8EnumValue = 0xff
+  VerifyUint8EnumValue = 0xff
 } __VERIFY_UINT8_ENUM_SIZE;
 
 typedef enum {
-  __VerifyUint16EnumValue = 0x
+  VerifyUint16EnumValue = 0x
 } __VERIFY_UINT16_ENUM_SIZE;
 
 typedef enum {
-  __VerifyUint32EnumValue = 0x
+  VerifyUint32EnumValue = 0x
 } __VERIFY_UINT32_ENUM_SIZE;
 
 VERIFY_SIZE_OF (__VERIFY_UINT8_ENUM_SIZE, 4);
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] UefiCpuPkg PeiCpuExceptionHandlerLib: Add the missing nasm files in INF

2016-10-30 Thread Liming Gao
All CpuExceptionHandlerLib library instances use nasm source files.

Cc: Reviewed-by: Jeff Fan <jeff@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf| 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
index d8a2997..7c82219 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
@@ -29,13 +29,15 @@
 
 [Sources.Ia32]
   Ia32/ExceptionHandlerAsm.asm
-  Ia32/ExceptionHandlerAsm.S   |GCC
+  Ia32/ExceptionHandlerAsm.nasm
+  Ia32/ExceptionHandlerAsm.S
   Ia32/ArchExceptionHandler.c
   Ia32/ArchInterruptDefs.h
 
 [Sources.X64]
   X64/ExceptionHandlerAsm.asm
-  X64/ExceptionHandlerAsm.S   |GCC
+  X64/ExceptionHandlerAsm.nasm
+  X64/ExceptionHandlerAsm.S
   X64/ArchExceptionHandler.c
   X64/ArchInterruptDefs.h
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] IntelFrameworkModulePkg LzmaDecompressLib: Update LZMA to new 16.04 version

2016-10-27 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|   6 +-
 .../LzmaArchCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h| 260 +
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |  24 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra.h|   8 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |  99 ++--
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |  32 ++
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h| 206 ++-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c | 534 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |  40 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzHash.h |  47 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c| 290 ++
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|  12 +-
 .../LzmaCustomDecompressLib/Sdk/C/Precomp.h|  10 +
 .../Library/LzmaCustomDecompressLib/Sdk/C/Types.h  | 231 
 .../Sdk/DOC/lzma-history.txt   | 363 +
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   | 357 +
 .../LzmaCustomDecompressLib/Sdk/history.txt| 236 
 .../Library/LzmaCustomDecompressLib/Sdk/lzma.txt   | 594 -
 21 files changed, 1937 insertions(+), 1436 deletions(-)
 create mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
 create mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Compiler.h
 create mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Precomp.h
 delete mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Types.h
 create mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-history.txt
 create mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt
 delete mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/history.txt
 delete mode 100644 
IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/lzma.txt

diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
index e05b3bb..7a6a77f 100644
--- 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
+++ 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
@@ -1,4 +1,4 @@
-LzmaCustomDecompressLib is based on the LZMA SDK 4.65.
-LZMA SDK 4.65 was placed in the public domain on
-2009-02-03.  It was released on the
+LzmaCustomDecompressLib is based on the LZMA SDK 16.04.
+LZMA SDK 16.04 was placed in the public domain on
+2016-10-04.  It was released on the
 http://www.7-zip.org/sdk.html website.
\ No newline at end of file
diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
index ec7585d..ccd620b 100644
--- 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
+++ 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaArchCustomDecompressLib produces LZMA custom decompression algorithm 
with the converter for the different arch code.
 #
-#  It is based on the LZMA SDK 4.65.
-#  LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
+#  It is based on the LZMA SDK 16.04
+#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
-#  Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -43,7 +43,9 @@
   Sdk/C/LzFind.h
   Sdk/C/LzHash.h
   Sdk/C/LzmaDec.h
-  Sdk/C/Types.h  
+  Sdk/C/7zTypes.h
+  Sdk/C/Precomp.h
+  Sdk/C/Compiler.h
   UefiLzma.h
   LzmaDecompressLibInternal.h
 
diff --git 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
index f5624fd..127c7de 100644
--- 
a/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ 
b/IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaCustomDecompressLib produces LZMA custom decompression algorithm.
 #
-#  It is based on the LZMA SDK 4.65.
-#  LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
+#  It is based on the LZMA SDK

[edk2] [Patch 2/3] MdeModulePkg LzmaDecompressLib: Update LZMA to new 16.04 version

2016-10-27 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|   6 +-
 .../LzmaArchCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h| 260 +
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |  24 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra.h|   8 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |  99 ++--
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |  32 ++
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h| 206 ++-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c | 534 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |  40 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzHash.h |  47 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c| 290 ++
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|  12 +-
 .../LzmaCustomDecompressLib/Sdk/C/Precomp.h|  10 +
 .../Library/LzmaCustomDecompressLib/Sdk/C/Types.h  | 231 
 .../Sdk/DOC/lzma-history.txt   | 363 +
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   | 357 +
 .../LzmaCustomDecompressLib/Sdk/history.txt| 236 
 .../Library/LzmaCustomDecompressLib/Sdk/lzma.txt   | 594 -
 21 files changed, 1937 insertions(+), 1436 deletions(-)
 create mode 100644 MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/7zTypes.h
 create mode 100644 
MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Compiler.h
 create mode 100644 MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Precomp.h
 delete mode 100644 MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/Types.h
 create mode 100644 
MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-history.txt
 create mode 100644 
MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt
 delete mode 100644 MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/history.txt
 delete mode 100644 MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/lzma.txt

diff --git a/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
index e05b3bb..7a6a77f 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LZMA-SDK-README.txt
@@ -1,4 +1,4 @@
-LzmaCustomDecompressLib is based on the LZMA SDK 4.65.
-LZMA SDK 4.65 was placed in the public domain on
-2009-02-03.  It was released on the
+LzmaCustomDecompressLib is based on the LZMA SDK 16.04.
+LZMA SDK 16.04 was placed in the public domain on
+2016-10-04.  It was released on the
 http://www.7-zip.org/sdk.html website.
\ No newline at end of file
diff --git 
a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
index ec7585d..ccd620b 100644
--- 
a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
+++ 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaArchCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaArchCustomDecompressLib produces LZMA custom decompression algorithm 
with the converter for the different arch code.
 #
-#  It is based on the LZMA SDK 4.65.
-#  LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
+#  It is based on the LZMA SDK 16.04
+#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
-#  Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -43,7 +43,9 @@
   Sdk/C/LzFind.h
   Sdk/C/LzHash.h
   Sdk/C/LzmaDec.h
-  Sdk/C/Types.h  
+  Sdk/C/7zTypes.h
+  Sdk/C/Precomp.h
+  Sdk/C/Compiler.h
   UefiLzma.h
   LzmaDecompressLibInternal.h
 
diff --git 
a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf 
b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
index f5624fd..127c7de 100644
--- a/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+++ b/MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
@@ -1,11 +1,11 @@
 ## @file
 #  LzmaCustomDecompressLib produces LZMA custom decompression algorithm.
 #
-#  It is based on the LZMA SDK 4.65.
-#  LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
+#  It is based on the LZMA SDK 16.04.
+#  LZMA SDK 16.04 was placed in the public domain on 2016-10-04.
 #  It was released on the http://www.7-zip.org/sdk.html website.
 #
-#  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c

[edk2] [Patch 0/3] Update LZMA SDK to new 16.04 version

2016-10-27 Thread Liming Gao
New version LZMA improves the compression performance, and has no change on 
the compression algorithm. So, the decompression library can work with 
the old and new LZMA SDK. To be consistent, LZMA tool and library are both 
updated to new 16.04 version. 

Liming Gao (3):
  BaseTools LzmaCompress: Update LZMA to new 16.04 version
  MdeModulePkg LzmaDecompressLib: Update LZMA to new 16.04 version
  IntelFrameworkModulePkg LzmaDecompressLib: Update LZMA to new 16.04
version

 BaseTools/Source/C/LzmaCompress/GNUmakefile|   3 +-
 .../Source/C/LzmaCompress/LZMA-SDK-README.txt  |   4 +-
 BaseTools/Source/C/LzmaCompress/LzmaCompress.c |  12 +-
 BaseTools/Source/C/LzmaCompress/Makefile   |   6 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.c |  31 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zFile.h |  13 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zStream.c   |  12 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zTypes.h| 256 +
 BaseTools/Source/C/LzmaCompress/Sdk/C/7zVersion.h  |  24 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.c  |  15 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Alloc.h  |  13 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Bra.h|   8 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Bra86.c  |  99 ++--
 BaseTools/Source/C/LzmaCompress/Sdk/C/Compiler.h   |  32 ++
 BaseTools/Source/C/LzmaCompress/Sdk/C/CpuArch.h| 206 ++-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.c | 515 ++
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFind.h |  40 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.c   | 214 
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzFindMt.h   |  14 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzHash.h |  47 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c| 269 +++---
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.h|  12 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c| 512 ++
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.h|  14 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/Precomp.h|  10 +
 BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.c| 116 ++--
 BaseTools/Source/C/LzmaCompress/Sdk/C/Threads.h|  95 ++--
 BaseTools/Source/C/LzmaCompress/Sdk/C/Types.h  | 208 
 .../Source/C/LzmaCompress/Sdk/DOC/lzma-history.txt | 363 +
 .../Source/C/LzmaCompress/Sdk/DOC/lzma-sdk.txt | 357 +
 BaseTools/Source/C/LzmaCompress/Sdk/history.txt| 236 
 BaseTools/Source/C/LzmaCompress/Sdk/lzma.txt   | 594 -
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|   6 +-
 .../LzmaArchCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h| 260 +
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |  24 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra.h|   8 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |  99 ++--
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |  32 ++
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h| 206 ++-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c | 534 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |  40 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzHash.h |  47 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c| 290 ++
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|  12 +-
 .../LzmaCustomDecompressLib/Sdk/C/Precomp.h|  10 +
 .../Library/LzmaCustomDecompressLib/Sdk/C/Types.h  | 231 
 .../Sdk/DOC/lzma-history.txt   | 363 +
 .../LzmaCustomDecompressLib/Sdk/DOC/lzma-sdk.txt   | 357 +
 .../LzmaCustomDecompressLib/Sdk/history.txt| 236 
 .../Library/LzmaCustomDecompressLib/Sdk/lzma.txt   | 594 -
 .../LzmaCustomDecompressLib/LZMA-SDK-README.txt|   6 +-
 .../LzmaArchCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib.inf|  10 +-
 .../LzmaCustomDecompressLib/LzmaDecompress.c   |   4 +-
 .../LzmaCustomDecompressLib/Sdk/C/7zTypes.h| 260 +
 .../LzmaCustomDecompressLib/Sdk/C/7zVersion.h  |  24 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra.h|   8 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/Bra86.c  |  99 ++--
 .../LzmaCustomDecompressLib/Sdk/C/Compiler.h   |  32 ++
 .../LzmaCustomDecompressLib/Sdk/C/CpuArch.h| 206 ++-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.c | 534 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h |  40 +-
 .../Library/LzmaCustomDecompressLib/Sdk/C/LzHash.h |  47 +-
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.c| 290 ++
 .../LzmaCustomDecompressLib/Sdk/C/LzmaDec.h|  12 +-
 .../LzmaCustomDecompressLib/Sdk/C/Precomp.h|  10 +
 .../Library/LzmaCustomDecompressLib/Sdk/C/Types.h  | 231

[edk2] [Patch] edksetup.bat: make sure BASE_TOOLS_PATH be set correctly

2016-10-25 Thread Liming Gao
Move checkNt32Flag before set BASE_TOOLS_PATH env to make sure it be set

Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 edksetup.bat | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/edksetup.bat b/edksetup.bat
index 6c8c0aa..7aa1675 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -77,9 +77,10 @@ if not defined EDK_TOOLS_PATH (
 )
   )
 )
-if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
 
 :checkNt32Flag
+if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
+
 @REM The Nt32 Emluation Platform requires Microsoft Libraries
 @REM and headers to interface with Windows.
 if /I "%1"=="--nt32" (
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdePkg ACPI60: Update MADT Revision per ACPI 6.0 Errata A

2016-10-25 Thread Liming Gao
Fix issue: https://bugzilla.tianocore.org/show_bug.cgi?id=94

Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Include/IndustryStandard/Acpi60.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Acpi60.h 
b/MdePkg/Include/IndustryStandard/Acpi60.h
index 01fda4b..ab798e9 100644
--- a/MdePkg/Include/IndustryStandard/Acpi60.h
+++ b/MdePkg/Include/IndustryStandard/Acpi60.h
@@ -1,5 +1,5 @@
 /** @file   
-  ACPI 6.0 definitions from the ACPI Specification Revision 6.0 April, 2015.
+  ACPI 6.0 definitions from the ACPI Specification Revision 6.0 Errata A 
January, 2016.
 
   Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
   (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
@@ -290,9 +290,9 @@ typedef struct {
 } EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
 
 ///
-/// MADT Revision (as defined in ACPI 6.0 spec.)
+/// MADT Revision (as defined in ACPI 6.0 Errata A spec.)
 ///
-#define EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x03
+#define EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x04
 
 ///
 /// Multiple APIC Flags
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools VS Makefile: Use /MT in replace of /MD to remove specific dll

2016-10-20 Thread Liming Gao
/MD option will introduce the specific version dll dependency. It will cause
the compiled C tools not work on some system.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/ms.common | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/ms.common 
b/BaseTools/Source/C/Makefiles/ms.common
index 5c3991d..69735e6 100644
--- a/BaseTools/Source/C/Makefiles/ms.common
+++ b/BaseTools/Source/C/Makefiles/ms.common
@@ -61,6 +61,6 @@ LINKER = $(LD)
 
 INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I 
$(SOURCE_PATH)\Common $(INC)
 
-CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MD /W4 /WX /D _CRT_SECURE_NO_DEPRECATE 
/D _CRT_NONSTDC_NO_DEPRECATE 
-CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MD /D 
_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
+CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MT /W4 /WX /D _CRT_SECURE_NO_DEPRECATE 
/D _CRT_NONSTDC_NO_DEPRECATE 
+CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MT /D 
_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdePkg BaseMemoryLibOptDxe: Add function comment for InternalMemCompareGuid

2016-10-19 Thread Liming Gao
Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c 
b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
index 8f1e50b..47386e9 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/MemLibGuid.c
@@ -15,6 +15,19 @@
 
 #include "MemLibInternals.h"
 
+/**
+  Internal function to compare two GUIDs.
+
+  This function compares Guid1 to Guid2.  If the GUIDs are identical then TRUE 
is returned.
+  If there are any bit differences in the two GUIDs, then FALSE is returned.
+
+  @param  Guid1   A pointer to a 128 bit GUID.
+  @param  Guid2   A pointer to a 128 bit GUID.
+
+  @retval TRUEGuid1 and Guid2 are identical.
+  @retval FALSE   Guid1 and Guid2 are not identical.
+
+**/
 BOOLEAN
 EFIAPI
 InternalMemCompareGuid (
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg LoadFileOnFv2: Correct the parameter name in function comment

2016-10-19 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c 
b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
index 18a07d8..bd86db5 100644
--- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
+++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
@@ -157,7 +157,7 @@ LOAD_FILE_ON_FV2_PRIVATE_DATA  
mLoadFileOnFv2PrivateDataTemplate = {
 /**
   Check if the FFS has been installed LoadFileProtocol for it.
 
-  @param EFI_GUID File GUID.
+  @param[in] NameGuid Point to FFS File GUID to be checked.
 
   @retval TRUEThe FFS's FileLoadProtocol is in list.
   @retval FALSE   The FFS's FileLoadProtocol is not in list.
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdePkg ACPI51: Update GIC version per ACPI 5.1 Errata B

2016-10-14 Thread Liming Gao
Fix issue: https://bugzilla.tianocore.org/show_bug.cgi?id=95

Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Include/IndustryStandard/Acpi51.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/Acpi51.h 
b/MdePkg/Include/IndustryStandard/Acpi51.h
index 034094e..f38aa46 100644
--- a/MdePkg/Include/IndustryStandard/Acpi51.h
+++ b/MdePkg/Include/IndustryStandard/Acpi51.h
@@ -1,8 +1,8 @@
 /** @file   
-  ACPI 5.1 definitions from the ACPI Specification Revision 5.1 July, 2014.
+  ACPI 5.1 definitions from the ACPI Specification Revision 5.1 Errata B 
January, 2016.
 
   Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
   (C) Copyright 2015 Hewlett Packard Enterprise Development LP
   This program and the accompanying materials  
   are licensed and made available under the terms and conditions of the BSD 
License 
@@ -537,8 +537,8 @@ typedef struct {
 ///
 /// GIC Version
 ///
-#define EFI_ACPI_5_1_GIC_V2   0x01
-#define EFI_ACPI_5_1_GIC_V2m  0x02
+#define EFI_ACPI_5_1_GIC_V1   0x01
+#define EFI_ACPI_5_1_GIC_V2   0x02
 #define EFI_ACPI_5_1_GIC_V3   0x03
 #define EFI_ACPI_5_1_GIC_V4   0x04
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdePkg BaseSynchronizationLib: Update InterlockedCompareExchange64.nasm

2016-10-14 Thread Liming Gao
Remove extra qword in nasm code to make it pass build.
This file is only built in INTEL ICC compiler. So, there is missing
build check for it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm 
b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm
index ee63ff7..206de40 100644
--- 
a/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm
+++ 
b/MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.nasm
@@ -41,7 +41,7 @@ ASM_PFX(InternalSyncCompareExchange64):
 mov edx, [esp + 20]
 mov ebx, [esp + 24]
 mov ecx, [esp + 28]
-lockcmpxchg8b   qword [esi]
+lockcmpxchg8b [esi]
 pop ebx
 pop esi
 ret
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] Nt32Pkg SecMain: Update SecMain.inf to support VS2015x86 X64 Mode

2016-10-12 Thread Liming Gao
From: chanuei <chenwe...@thtfpc.com>

Update SecMain.inf to support VS2015x86 X64 Mode Build.
After this change, X64 Native Tools Command Prompt is not
required to be trig. NT32 IA32 and X64 can be built in the same
environment. It simplifies NT32 X64 build. New build command:
edksetup.bat --nt32
build -p Nt32Pkg\Nt32Pkg.dsc -a X64  # for 64
build -p Nt32Pkg\Nt32Pkg.dsc -a IA32 # for 32

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Chan <chan...@sina.com>
Tested-by: Liming Gao <liming@intel.com>
---
 Nt32Pkg/Sec/SecMain.inf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Nt32Pkg/Sec/SecMain.inf b/Nt32Pkg/Sec/SecMain.inf
index 01bde2e..d6426c7 100644
--- a/Nt32Pkg/Sec/SecMain.inf
+++ b/Nt32Pkg/Sec/SecMain.inf
@@ -75,9 +75,9 @@
   MSFT:*_*_IA32_ASM_FLAGS == /nologo /W3 /WX /c /coff /Cx /Zd /W0 /Zi
   MSFT:*_*_IA32_ASMLINK_FLAGS   == /link /nologo /tiny
 
-  MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x1000 
/pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" 
/LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib\AMD64" /NOLOGO /SUBSYSTEM:CONSOLE 
/NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG 
Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
-  MSFT:*_VS2015_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" 
/base:0x1000 /pdb:"$(BIN_DIR)\SecMain.pdb" 
/LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" 
/LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib\AMD64" /NOLOGO /SUBSYSTEM:CONSOLE 
/NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG 
Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib 
Winmm.lib Advapi32.lib
-  MSFT:*_VS2015x86_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" 
/base:0x1000 /pdb:"$(BIN_DIR)\SecMain.pdb" 
/LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" 
/LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib\AMD64" /NOLOGO /SUBSYSTEM:CONSOLE 
/NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG 
Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib 
Winmm.lib Advapi32.lib
+  MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" /base:0x1000 
/pdb:"$(BIN_DIR)\SecMain.pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" 
/LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" 
/LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\um\x64" 
/LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO 
/SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG 
/MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib 
Advapi32.lib
+  MSFT:*_VS2015_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" 
/base:0x1000 /pdb:"$(BIN_DIR)\SecMain.pdb" 
/LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" 
/LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" 
/LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\um\x64" 
/LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO 
/SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG 
/MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib 
Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+  MSFT:*_VS2015x86_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\SecMain.exe" 
/base:0x1000 /pdb:"$(BIN_DIR)\SecMain.pdb" 
/LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" 
/LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" 
/LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\um\x64" 
/LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO 
/SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG 
/MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib 
Gdi32.lib User32.lib Winmm.lib Advapi32.lib
   MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h 
/EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D 
_CRT_SECURE_NO_DEPRECATE
   MSFT:*_*_X64_PP_FLAGS == /nologo /E /TC /FIAutoGen.h
   MSFT:*_*_X64_ASM_FLAGS == /nologo /W3 /WX /c /Cx /Zd /W0 /Zi
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] DuetPkg DxeIpl and EfiLdr: Add the missing EFIAPI for the function

2016-10-10 Thread Liming Gao
The function with the variable parameters should have EFIAPI.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 DuetPkg/DxeIpl/Debug.c | 1 +
 DuetPkg/DxeIpl/Debug.h | 1 +
 DuetPkg/EfiLdr/Debug.c | 1 +
 DuetPkg/EfiLdr/Debug.h | 1 +
 4 files changed, 4 insertions(+)

diff --git a/DuetPkg/DxeIpl/Debug.c b/DuetPkg/DxeIpl/Debug.c
index 1cb7e39..800f008 100644
--- a/DuetPkg/DxeIpl/Debug.c
+++ b/DuetPkg/DxeIpl/Debug.c
@@ -52,6 +52,7 @@ ClearScreen (
 }
 
 VOID
+EFIAPI
 PrintString (
   IN CONST CHAR8  *FormatString,
   ...
diff --git a/DuetPkg/DxeIpl/Debug.h b/DuetPkg/DxeIpl/Debug.h
index 7fcad26..81bb826 100644
--- a/DuetPkg/DxeIpl/Debug.h
+++ b/DuetPkg/DxeIpl/Debug.h
@@ -27,6 +27,7 @@ PrintHeader (
   );
 
 VOID
+EFIAPI
 PrintString (
   IN CONST CHAR8  *FormatString,
   ...
diff --git a/DuetPkg/EfiLdr/Debug.c b/DuetPkg/EfiLdr/Debug.c
index 84b2772..0727292 100644
--- a/DuetPkg/EfiLdr/Debug.c
+++ b/DuetPkg/EfiLdr/Debug.c
@@ -49,6 +49,7 @@ ClearScreen (
 }
 
 VOID
+EFIAPI
 PrintString (
   IN CONST CHAR8  *FormatString,
   ...
diff --git a/DuetPkg/EfiLdr/Debug.h b/DuetPkg/EfiLdr/Debug.h
index f6aa7a2..4252f31 100644
--- a/DuetPkg/EfiLdr/Debug.h
+++ b/DuetPkg/EfiLdr/Debug.h
@@ -27,6 +27,7 @@ PrintHeader (
   );
 
 VOID
+EFIAPI
 PrintString (
   IN CONST CHAR8  *FormatString,
   ...
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg RegularExpressionDxe: Add the missing EFIAPI for the function

2016-10-08 Thread Liming Gao
The function with the variable parameters should have EFIAPI.

Cc: Feng Tian <feng.t...@intel.com>
Cc: Cinnamon Shia <cinnamon.s...@hpe.com>
Cc: Cecil Sheng <cecil.sh...@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.c| 2 +-
 .../Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.h| 2 +-
 MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h   | 2 +-
 MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regerror.c| 2 ++
 MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h  | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.c
index aaa5d3d..b4a9adf 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.c
@@ -14,7 +14,7 @@
 **/
 #include "OnigurumaUefiPort.h"
 
-int sprintf_s(char *str, size_t sizeOfBuffer, char const *fmt, ...)
+int EFIAPI sprintf_s(char *str, size_t sizeOfBuffer, char const *fmt, ...)
 {
   VA_LIST Marker;
   int   NumberOfPrinted;
diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.h 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.h
index ca478de..d24ac1d 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/OnigurumaUefiPort.h
@@ -69,7 +69,7 @@ typedef UINTN size_t;
 
 int OnigStrCmp (char* Str1, char* Str2);
 
-int sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...);
+int EFIAPI sprintf_s (char *str, size_t sizeOfBuffer, char const *fmt, ...);
 
 #define exit(n) ASSERT(FALSE);
 
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h
index 034a2cc..462565a 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/oniguruma.h
@@ -719,7 +719,7 @@ typedef struct {
 ONIG_EXTERN
 int onig_init P_((void));
 ONIG_EXTERN
-int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
+int EFIAPI onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
 ONIG_EXTERN
 void onig_set_warn_func P_((OnigWarnFunc f));
 ONIG_EXTERN
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regerror.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regerror.c
index fbc764a..1544e23 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regerror.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regerror.c
@@ -252,6 +252,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
 #define MAX_ERROR_PAR_LEN   30
 
 extern int
+EFIAPI
 #ifdef HAVE_STDARG_PROTOTYPES
 onig_error_code_to_str(UChar* s, int code, ...)
 #else
@@ -324,6 +325,7 @@ onig_error_code_to_str(s, code, va_alist)
 
 
 void
+EFIAPI
 #ifdef HAVE_STDARG_PROTOTYPES
 onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
UChar* pat, UChar* pat_end, const UChar *fmt, ...)
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
index f48c557..d5b3089 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regint.h
@@ -781,7 +781,7 @@ extern void onig_print_statistics P_((FILE* f));
 #endif
 
 extern UChar* onig_error_code_to_format P_((int code));
-extern void  onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, 
OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
+extern void EFIAPI onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, 
OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
 extern int  onig_bbuf_init P_((BBuf* buf, int size));
 extern int  onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* 
pattern_end, OnigErrorInfo* einfo));
 extern void onig_chain_reduce P_((regex_t* reg));
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools Build: Fix build break for clean target in Linux

2016-09-29 Thread Liming Gao
From: Hao Wu <hao.a...@intel.com>

In Linux, Command needs to be String instead of list when Command run
as shell with True.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/Python/build/build.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index b003c67..f17b55c 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -265,10 +265,10 @@ def LaunchCommand(Command, WorkingDir):
 # It could be a string or sequence. We find that if command is a string in 
following Popen(),
 # ubuntu may fail with an error message that the command is not found.
 # So here we may need convert command from string to list instance.
-if not isinstance(Command, list):
-if platform.system() != 'Windows':
+if platform.system() != 'Windows':
+if not isinstance(Command, list):
 Command = Command.split()
-Command = ' '.join(Command)
+Command = ' '.join(Command)
 
 Proc = None
 EndOfProcedure = None
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/4] BaseTools GenVtf: Initialize the return point as NULL

2016-09-29 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/GenVtf/GenVtf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c 
b/BaseTools/Source/C/GenVtf/GenVtf.c
index 9a3f508..f6765dd 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -796,6 +796,7 @@ Returns:
 
   TmpFitPtr = (FIT_TABLE *) RelativeAddress;
   NumFitComponents  = TmpFitPtr->CompSize;
+  *FitPtr   = NULL;
 
   for (Index = 0; Index < NumFitComponents; Index++) {
 if ((TmpFitPtr->CvAndType & FIT_TYPE_MASK) == COMP_TYPE_FIT_UNUSED) {
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/4] BaseTools Makefile: Enable O2 option to replace Od for VS tool chain

2016-09-29 Thread Liming Gao
Enable O2 option to generate fast code for performance improvement.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/ms.app| 2 +-
 BaseTools/Source/C/Makefiles/ms.common | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/ms.app 
b/BaseTools/Source/C/Makefiles/ms.app
index 908ffe8..93d51f9 100644
--- a/BaseTools/Source/C/Makefiles/ms.app
+++ b/BaseTools/Source/C/Makefiles/ms.app
@@ -17,7 +17,7 @@ all: $(APPLICATION)
 
 $(APPLICATION) : $(OBJECTS) 
-@if not exist $(BIN_PATH) mkdir $(BIN_PATH)
-   $(LD) /nologo /debug /incremental:no /nodefaultlib:libc.lib /out:$@ 
$(LIBS) $**
+   $(LD) /nologo /debug /OPT:REF /OPT:ICF=10 /incremental:no 
/nodefaultlib:libc.lib /out:$@ $(LIBS) $**
 
 $(OBJECTS) : ..\Include\Common\BuildVersion.h
 
diff --git a/BaseTools/Source/C/Makefiles/ms.common 
b/BaseTools/Source/C/Makefiles/ms.common
index 9e50b21..5c3991d 100644
--- a/BaseTools/Source/C/Makefiles/ms.common
+++ b/BaseTools/Source/C/Makefiles/ms.common
@@ -61,6 +61,6 @@ LINKER = $(LD)
 
 INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I 
$(SOURCE_PATH)\Common $(INC)
 
-CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D 
_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
-CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D 
_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
+CFLAGS = $(CFLAGS) /nologo /Zi /c /O2 /MD /W4 /WX /D _CRT_SECURE_NO_DEPRECATE 
/D _CRT_NONSTDC_NO_DEPRECATE 
+CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /Zi /c /O2 /MD /D 
_CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE 
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/4] BaseTools Makefile: Enable Ofast option for GCC tool chain

2016-09-29 Thread Liming Gao
Enable Ofast option to generate fast code for performance improvement.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/header.makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
b/BaseTools/Source/C/Makefiles/header.makefile
index f2041f8..ca2dc2e 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -44,12 +44,12 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
 endif
 
 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I 
$(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I 
$(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 
-BUILD_CPPFLAGS = $(INCLUDE)
+BUILD_CPPFLAGS = $(INCLUDE) -Ofast
 ifeq ($(DARWIN),Darwin)
 # assume clang or clang compatible flags on OS X
-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-self-assign -nostdlib -c -g
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -c -g
 else
-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -nostdlib -c -g
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g
 endif
 BUILD_LFLAGS =
 BUILD_CXXFLAGS =
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/4] BaseTools EfiLdrImage: Remove unnecessary exit (0)

2016-09-29 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c 
b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
index 88cc345..a46ecf8 100644
--- a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
+++ b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
@@ -75,7 +75,6 @@ Returns:
 --*/
 {
   printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, 
UTILITY_MINOR_VERSION, __BUILD_VERSION);
-  exit (0);
 }
 
 VOID
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/4] BaseTools: Enable optimization to generate fast code in C tools

2016-09-29 Thread Liming Gao
After enable optimization, C tool build time is reduced by ~50%. Please see 
below example to use LzmaCompress to compress OVMF DXEFV.

Tool Compression time Decompression time
LzmaCompress (GCC O0)3.476s   0.204s
LzmaCompress (GCC Ofast) 1.655s   0.107s
LzmaCompress (VS Od) 3.047s   0.210s
LzmaCompress (VS O2) 1.551s   0.126s

Liming Gao (4):
  BaseTools EfiLdrImage: Remove unnecessary exit (0)
  BaseTools Makefile: Enable O2 option to replace Od for VS tool chain
  BaseTools GenVtf: Initialize the return point as NULL
  BaseTools Makefile: Enable Ofast option for GCC tool chain

 BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c | 1 -
 BaseTools/Source/C/GenVtf/GenVtf.c   | 1 +
 BaseTools/Source/C/Makefiles/header.makefile | 6 +++---
 BaseTools/Source/C/Makefiles/ms.app  | 2 +-
 BaseTools/Source/C/Makefiles/ms.common   | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools VS Makefile: Don't include ms.common in ms.app

2016-09-29 Thread Liming Gao
ms.common is included by every tool Makefile. it is not necessary to be placed
in ms.app again.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/ms.app | 2 --
 1 file changed, 2 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/ms.app 
b/BaseTools/Source/C/Makefiles/ms.app
index 3e04561..908ffe8 100644
--- a/BaseTools/Source/C/Makefiles/ms.app
+++ b/BaseTools/Source/C/Makefiles/ms.app
@@ -11,8 +11,6 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
-!INCLUDE ..\Makefiles\ms.common
-
 APPLICATION = $(BIN_PATH)\$(APPNAME).exe
 
 all: $(APPLICATION) 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools Makefile: Missing LFAGS in app.makefile

2016-09-29 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/app.makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/Makefiles/app.makefile 
b/BaseTools/Source/C/Makefiles/app.makefile
index b727a7e..e414551 100644
--- a/BaseTools/Source/C/Makefiles/app.makefile
+++ b/BaseTools/Source/C/Makefiles/app.makefile
@@ -21,7 +21,7 @@ APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
 all: $(MAKEROOT)/bin $(APPLICATION) 
 
 $(APPLICATION): $(OBJECTS) 
-   $(LINKER) -o $(APPLICATION) $(LFLAGS) $(OBJECTS) -L$(MAKEROOT)/libs 
$(LIBS)
+   $(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) 
-L$(MAKEROOT)/libs $(LIBS)
 
 $(OBJECTS): ../Include/Common/BuildVersion.h
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] MdeModulePkg FormBrowserEx: Change its structure name with EDKII_ prefix

2016-09-22 Thread Liming Gao
EDKII implementation protocol should be with EDKII_ prefix.

V2: add gEdkiiFormBrowserExProtocolGuid to align its structure name.

Cc: Eric Dong <eric.d...@intel.com>
Cc: Feng Tian <feng.t...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Include/Protocol/FormBrowserEx.h  | 12 +---
 MdeModulePkg/MdeModulePkg.dec  |  1 +
 MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c  |  4 ++--
 MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf |  2 +-
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c |  2 +-
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.h |  2 +-
 MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf |  2 +-
 7 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Include/Protocol/FormBrowserEx.h 
b/MdeModulePkg/Include/Protocol/FormBrowserEx.h
index ef3e8cb..512de44 100644
--- a/MdeModulePkg/Include/Protocol/FormBrowserEx.h
+++ b/MdeModulePkg/Include/Protocol/FormBrowserEx.h
@@ -2,7 +2,7 @@
   Extension Form Browser Protocol provides the services that can be used to 
   register the different hot keys for the standard Browser actions described 
in UEFI specification.
 
-Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -19,7 +19,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define FORM_BROWSER_EXTENSION_PROTOCOL_GUID  \
   { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 
0xa4 } }
 
-typedef struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL   
EFI_FORM_BROWSER_EXTENSION_PROTOCOL;
+typedef struct _EDKII_FORM_BROWSER_EXTENSION_PROTOCOL   
EDKII_FORM_BROWSER_EXTENSION_PROTOCOL;
+
+//
+// To be compatible, keep EFI_FORM_BROWSER_EXTENSION_PROTOCOL definition
+//
+typedef EDKII_FORM_BROWSER_EXTENSION_PROTOCOL   
EFI_FORM_BROWSER_EXTENSION_PROTOCOL;
 
 //
 // Return value of SAVE_REMINDER() that describes whether the changed data is 
saved or discarded.
@@ -137,7 +142,7 @@ UINT32
   VOID
   );
 
-struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL {
+struct _EDKII_FORM_BROWSER_EXTENSION_PROTOCOL {
   SET_SCOPE  SetScope;
   REGISTER_HOT_KEY   RegisterHotKey;
   REGISTER_EXIT_HANDLER  RegiserExitHandler;
@@ -145,6 +150,7 @@ struct _EFI_FORM_BROWSER_EXTENSION_PROTOCOL {
 };
 
 extern EFI_GUID gEfiFormBrowserExProtocolGuid;
+extern EFI_GUID gEdkiiFormBrowserExProtocolGuid;
 
 #endif
 
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 8d90f16..9c16222 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -459,6 +459,7 @@
 
   ## Include/Protocol/FormBrowserEx.h
   gEfiFormBrowserExProtocolGuid = { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 0xde, 
0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } }
+  gEdkiiFormBrowserExProtocolGuid = { 0x1f73b18d, 0x4630, 0x43c1, { 0xa1, 
0xde, 0x6f, 0x80, 0x85, 0x5d, 0x7d, 0xa4 } }
 
   ## Include/Protocol/EbcVmTest.h
   gEfiEbcVmTestProtocolGuid = { 0xAAEACCFD, 0xF27B, 0x4C17, { 0xB6, 0x10, 
0x75, 0xCA, 0x1F, 0x2D, 0xFB, 0x52 } }
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c 
b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index ea6b124..026e2c2 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -1952,7 +1952,7 @@ DriverSampleInit (
   EFI_STRING  NameRequestHdr;
   MY_EFI_VARSTORE_DATA*VarStoreConfig;
   EFI_INPUT_KEY   HotKey;
-  EFI_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
+  EDKII_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
 
   //
   // Initialize the local variables.
@@ -2244,7 +2244,7 @@ DriverSampleInit (
   //
   // Example of how to use BrowserEx protocol to register HotKey.
   // 
-  Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
   if (!EFI_ERROR (Status)) {
 //
 // First unregister the default hot key F9 and F10.
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf 
b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
index f5c0b46..4233e63 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
@@ -91,7 +91,7 @@
   gEfiFormBrowser2ProtocolGuid  ## CONSUMES
   gEfiHiiDatabaseProtocolGuid   ## CONSUMES
   gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES
-  gEfiFormBrowserExProtocolGuid ## CONSUMES
+  gEdkiiFormBrowserExProtocolGuid  

[edk2] [Patch 0/3] BaseTools: Add build support to generate HII image package

2016-09-20 Thread Liming Gao
HII image package is defined in UEFI spec. But, EDK2 BaseTools doesn't support
its generation. To fill this gap, new image description file (*.idf) is 
introduced to describe HII image resource. *.idf file syntax has been 
proposed into edk2 community. This patch updates BaseTools base on it to 
generate the binary HII image package.

Liming Gao (2):
  MdePkg UefiHii: Add IMAGE_TOKEN macro to access image resource in C
and VFR
  MdeModulePkg HiiDatabaseDxe: Ignore new EFI_HII_IIBT_IMAGE_PNG type
Image

Yonghong Zhu (1):
  BaseTools: support generating image package from BMP/JPEG/PNG files

 BaseTools/Conf/build_rule.template |  21 ++
 BaseTools/Source/Python/AutoGen/AutoGen.py |  31 ++-
 BaseTools/Source/Python/AutoGen/GenC.py| 245 -
 BaseTools/Source/Python/AutoGen/IdfClassObject.py  | 159 +
 BaseTools/Source/Python/AutoGen/StrGather.py   |   4 +-
 BaseTools/Source/Python/Common/DataType.py |   1 +
 MdeModulePkg/Universal/HiiDatabaseDxe/Image.c  |   6 +-
 .../Include/Uefi/UefiInternalFormRepresentation.h  |   8 +-
 8 files changed, 467 insertions(+), 8 deletions(-)
 create mode 100644 BaseTools/Source/Python/AutoGen/IdfClassObject.py

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] BaseTools: support generating image package from BMP/JPEG/PNG files

2016-09-20 Thread Liming Gao
From: Yonghong Zhu <yonghong@intel.com>

BaseTools add support to generating image package from BMP/JPEG/PNG
files.
1) New file type *.idf Image definition file to describe HII image
resource. It is the ASCII text file, and includes one or more "#image
IMAGE_ID [TRANSPARENT] ImageFileName".
2) New IMAGE_TOKEN macro is used to refer to IMAGE_ID.
3) New AutoGen header file $(MODULE_NAME)ImgDefs.h to include the
generated ImageId definition.
4) New $(MODULE_NAME)Idf.hpk or $(MODULE_NAME)Images are generated
as the output binary HII image package.

Cc: Liming Gao <liming@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong@intel.com>
---
 BaseTools/Conf/build_rule.template|  21 ++
 BaseTools/Source/Python/AutoGen/AutoGen.py|  31 ++-
 BaseTools/Source/Python/AutoGen/GenC.py   | 245 +-
 BaseTools/Source/Python/AutoGen/IdfClassObject.py | 159 ++
 BaseTools/Source/Python/AutoGen/StrGather.py  |   4 +-
 BaseTools/Source/Python/Common/DataType.py|   1 +
 6 files changed, 455 insertions(+), 6 deletions(-)
 create mode 100644 BaseTools/Source/Python/AutoGen/IdfClassObject.py

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 7e2c6a9..1db94b6 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -568,6 +568,17 @@
 
 
 
+[Image-Definition-File]
+
+*.idf, *.Idf, *.IDF
+
+
+$(DEBUG_DIR)(+)AutoGen.c
+$(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
+$(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk
+
+
+
 [Efi-Image.UEFI_OPTIONROM]
 
 ?.efi, ?.EFI, ?.Efi
@@ -588,6 +599,16 @@
 
 
 
+[Image-Definition-File.UEFI_HII]
+
+*.idf, *.Idf, *.IDF
+
+
+$(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
+$(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk
+
+
+
 [Visual-Form-Representation-File.UEFI_HII]
 
 ?.vfr
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 79bc7c6..f35ae25 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -72,7 +72,8 @@ gAutoGenHeaderFileName = "AutoGen.h"
 gAutoGenStringFileName = "%(module_name)sStrDefs.h"
 gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
 gAutoGenDepexFileName = "%(module_name)s.depex"
-
+gAutoGenImageDefFileName = "%(module_name)sImgDefs.h"
+gAutoGenIdfFileName = "%(module_name)sIdf.hpk"
 gInfSpecVersion = "0x00010017"
 
 #
@@ -2590,6 +2591,7 @@ class ModuleAutoGen(AutoGen):
 self._IncludePathLength = 0
 self._AutoGenFileList = None
 self._UnicodeFileList = None
+self._IdfFileList = None
 self._SourceFileList  = None
 self._ObjectFileList  = None
 self._BinaryFileList  = None
@@ -3114,6 +3116,15 @@ class ModuleAutoGen(AutoGen):
 self._UnicodeFileList = []
 return self._UnicodeFileList
 
+## Return the list of Image Definition files
+def _GetIdfFileList(self):
+if self._IdfFileList == None:
+if TAB_IMAGE_FILE in self.FileTypes:
+self._IdfFileList = self.FileTypes[TAB_IMAGE_FILE]
+else:
+self._IdfFileList = []
+return self._IdfFileList
+
 ## Return a list of files which can be built from binary
 #
 #  "Build" binary files are just to copy them to build directory.
@@ -3276,15 +3287,19 @@ class ModuleAutoGen(AutoGen):
 #
 def _GetAutoGenFileList(self):
 UniStringAutoGenC = True
+IdfStringAutoGenC = True
 UniStringBinBuffer = StringIO()
+IdfGenBinBuffer = StringIO()
 if self.BuildType == 'UEFI_HII':
 UniStringAutoGenC = False
+IdfStringAutoGenC = False
 if self._AutoGenFileList == None:
 self._AutoGenFileList = {}
 AutoGenC = TemplateString()
 AutoGenH = TemplateString()
 StringH = TemplateString()
-GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, 
UniStringAutoGenC, UniStringBinBuffer)
+StringIdf = TemplateString()
+GenC.CreateCode(self, AutoGenC, AutoGenH, StringH, 
UniStringAutoGenC, UniStringBinBuffer, StringIdf, IdfStringAutoGenC, 
IdfGenBinBuffer)
 #
 # AutoGen.c is generated if there are library classes in inf, or 
there are object files
 #
@@ -3308,6 +3323,17 @@ class ModuleAutoGen(AutoGen):
 self._ApplyBuildRule(AutoFile, TAB_UNKNOWN_FILE)
 if UniStringBinBuffer != None:
 UniStringBinBuffer.close()
+if str(StringIdf) != "":
+AutoFile = PathClass(gAutoGenImageDefFileName % 
{"module_name":self.Name}, self.DebugDir)
+ 

[edk2] [Patch 2/3] MdeModulePkg HiiDatabaseDxe: Ignore new EFI_HII_IIBT_IMAGE_PNG type Image

2016-09-20 Thread Liming Gao
HiiImage protocol implementation doesn't support EFI_HII_IIBT_IMAGE_PNG.

Cc: Eric Dong <eric.d...@intel.com>
Cc: Dandan Bi <dandan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Image.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index 612d57a..07b3ba0 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -142,8 +142,9 @@ GetImageIdOrAddress (
   break;
 
 case EFI_HII_IIBT_IMAGE_JPEG:
+case EFI_HII_IIBT_IMAGE_PNG:
   CopyMem (, ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK), sizeof 
(UINT32));
-  ImageBlock += Length32;
+  ImageBlock += OFFSET_OF (EFI_HII_IIBT_JPEG_BLOCK, Data) + Length32;
   ImageIdCurrent++;
   break;
 
@@ -895,6 +896,7 @@ HiiGetImage (
 
   switch (BlockType) {
   case EFI_HII_IIBT_IMAGE_JPEG:
+  case EFI_HII_IIBT_IMAGE_PNG:
 //
 // BUGBUG: need to be supported as soon as image tool is designed.
 //
@@ -1096,6 +1098,7 @@ HiiSetImage (
   //
   switch (BlockType) {
   case EFI_HII_IIBT_IMAGE_JPEG:
+  case EFI_HII_IIBT_IMAGE_PNG:
 //
 // BUGBUG: need to be supported as soon as image tool is designed.
 //
@@ -1497,6 +1500,7 @@ HiiDrawImageId (
   //
   // Get the specified Image.
   //
+  ZeroMem (, sizeof (Image));
   Status = HiiGetImage (This, PackageList, ImageId, );
   if (EFI_ERROR (Status)) {
 return Status;
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/3] MdePkg UefiHii: Add IMAGE_TOKEN macro to access image resource in C and VFR

2016-09-20 Thread Liming Gao
Cc: Eric Dong <eric.d...@intel.com>
Cc: Dandan Bi <dandan...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Include/Uefi/UefiInternalFormRepresentation.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h 
b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
index 4ac..ae5602f 100644
--- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
+++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h
@@ -3,7 +3,7 @@
   IFR is primarily consumed by the EFI presentation engine, and produced by EFI
   internal application and drivers as well as all add-in card option-ROM 
drivers
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials are licensed and made available 
under 
 the terms and conditions of the BSD License that accompanies this 
distribution.  
@@ -2126,4 +2126,10 @@ typedef struct _EFI_HII_AIBT_SKIP2_BLOCK {
 ///
 #define STRING_TOKEN(t) t
 
+///
+/// IMAGE_TOKEN is not defined in UEFI specification. But it is placed
+/// here for the easy access by C files and VFR source files.
+///
+#define IMAGE_TOKEN(t) t
+
 #endif
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/4] BaseTools: Update python tool to call external tools with shell true mode

2016-09-12 Thread Liming Gao
Python tool may run from source as the dos batch files. So, update python
code to call external tools with shell true mode.

Cc: Yonghong Zhu <yonghong@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Cc: Erik Bjorge <erik.c.bjo...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/Python/Common/VpdInfoFile.py | 7 ---
 BaseTools/Source/Python/build/build.py| 5 ++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py 
b/BaseTools/Source/Python/Common/VpdInfoFile.py
index cc79ee2..d45fb4c 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -233,14 +233,15 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
 OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
   
 try:
-PopenObject = subprocess.Popen([ToolPath,
+PopenObject = subprocess.Popen(' '.join([ToolPath,
 '-o', OutputBinFileName, 
 '-m', OutputMapFileName,
 '-q',
 '-f',
-VpdFileName],
+VpdFileName]),
 stdout=subprocess.PIPE, 
-stderr= subprocess.PIPE)
+stderr= subprocess.PIPE,
+shell=True)
 except Exception, X:
 EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" 
% (str(X)))
 (out, error) = PopenObject.communicate()
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index be02119..20f726f 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -266,14 +266,13 @@ def LaunchCommand(Command, WorkingDir):
 # ubuntu may fail with an error message that the command is not found.
 # So here we may need convert command from string to list instance.
 if not isinstance(Command, list):
-if platform.system() != 'Windows':
-Command = Command.split()
+Command = Command.split()
 
 Proc = None
 EndOfProcedure = None
 try:
 # launch the command
-Proc = Popen(Command, stdout=PIPE, stderr=PIPE, env=os.environ, 
cwd=WorkingDir, bufsize=-1)
+Proc = Popen(' '.join(Command), stdout=PIPE, stderr=PIPE, 
env=os.environ, cwd=WorkingDir, bufsize=-1, shell=True)
 
 # launch two threads to read the STDOUT and STDERR
 EndOfProcedure = Event()
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/4] BaseTools: Update toolsetup.bat to set PYTHONPATH env to run python source

2016-09-12 Thread Liming Gao
When python tool exe doesn't exist, toolsetup.bat will set up PYTHONPATH,
and set python tool dos script directory into system PATH.

Cc: Yonghong Zhu <yonghong@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Cc: Erik Bjorge <erik.c.bjo...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/toolsetup.bat | 101 +---
 1 file changed, 44 insertions(+), 57 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index a64938d..6d416d4 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -247,39 +247,38 @@ if defined FORCE_REBUILD goto check_build_environment
 if defined REBUILD goto check_build_environment
 if not exist "%EDK_TOOLS_PATH%" goto check_build_environment
 
-IF NOT EXIST "%EDK_TOOLS_BIN%\BootSectImage.exe" goto check_build_environment
+IF NOT EXIST "%EDK_TOOLS_BIN%\BootSectImage.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\EfiLdrImage.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenBootSector.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenPage.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenVtf.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_c_tools
+IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_c_tools
+
+goto check_python_tools
+
+:check_c_tools
+  echo.
+  echo Binary C tools are missing. They are requried to be built from 
BaseTools Source.
+  echo.
+
+:check_python_tools
 IF NOT EXIST "%EDK_TOOLS_BIN%\build.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\EfiLdrImage.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenBootSector.exe" goto check_build_environment
 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenPage.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenVtf.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_build_environment
 IF NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_build_environment
 IF NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_build_environment
-IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_build_environment
 
 goto end
 
 :check_build_environment
-
-  if not defined FORCE_REBUILD (
-echo.
-echo Rebuilding of tools is not required.  Binaries of the latest,
-echo tested versions of the tools have been tested and included in the
-echo EDK II repository.
-echo.
-echo If you really want to build the tools, use the ForceRebuild option.
-echo.
-goto end
-  )
+  if defined BASETOOLS_PYTHON_SOURCE goto VisualStudioAvailable
 
   if not defined BASE_TOOLS_PATH (
  if not exist "Source\C\Makefile" (
@@ -289,10 +288,6 @@ goto end
set BASE_TOOLS_PATH=%CD%
  )
   )
-  set PATH=%BASE_TOOLS_PATH%\Bin\Win32;%PATH%
-
-  set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
-  set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
 
   if not defined PYTHON_HOME (
 if defined PYTHONHOME (
@@ -307,36 +302,30 @@ goto end
 
   @REM We have Python, now test for FreezePython application
   if not defined PYTHON_FREEZER_PATH (
-@REM see if we can find FreezePython.ex
-if exist "%PYTHON_HOME%\Tools\cx_Freeze-3.0.3\FreezePython.exe" (
-  set PYTHON_FREEZER_PATH=%PYTHON_HOME%\Tools\cx_Freeze-3.0.3
-) 
-if exist "%PYTHON_HOME%\Tools\cx_Freeze\FreezePython.exe" (
-  set PYTHON_FREEZER_PATH=%PYTHON_HOME%\Tools\cx_Freeze
-) 
-if exist "C:\cx_Freeze\FreezePython.exe" (
-se

[edk2] [Patch 1/4] BaseTools: Add Windows batch files to run python tool from Source

2016-09-12 Thread Liming Gao
Add 13 windows batch files for every python tool.

Cc: Yonghong Zhu <yonghong@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Cc: Erik Bjorge <erik.c.bjo...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/BinWrappers/WindowsLike/BPDG.bat  | 3 +++
 BaseTools/BinWrappers/WindowsLike/Ecc.bat   | 3 +++
 BaseTools/BinWrappers/WindowsLike/GenDepex.bat  | 3 +++
 BaseTools/BinWrappers/WindowsLike/GenFds.bat| 3 +++
 BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat  | 3 +++
 BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat | 3 +++
 BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat | 3 +++
 BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat | 1 +
 BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat | 3 +++
 BaseTools/BinWrappers/WindowsLike/TargetTool.bat| 3 +++
 BaseTools/BinWrappers/WindowsLike/Trim.bat  | 3 +++
 BaseTools/BinWrappers/WindowsLike/UPT.bat   | 3 +++
 BaseTools/BinWrappers/WindowsLike/build.bat | 3 +++
 13 files changed, 37 insertions(+)
 create mode 100644 BaseTools/BinWrappers/WindowsLike/BPDG.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Ecc.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenDepex.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenFds.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
 create mode 100644 
BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/TargetTool.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Trim.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/UPT.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/build.bat

diff --git a/BaseTools/BinWrappers/WindowsLike/BPDG.bat 
b/BaseTools/BinWrappers/WindowsLike/BPDG.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/BPDG.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/Ecc.bat 
b/BaseTools/BinWrappers/WindowsLike/Ecc.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/Ecc.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/GenDepex.bat 
b/BaseTools/BinWrappers/WindowsLike/GenDepex.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/GenDepex.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/GenFds.bat 
b/BaseTools/BinWrappers/WindowsLike/GenFds.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/GenFds.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat 
b/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat 
b/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat 
b/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
new file mode 100644
index 000..9fbb704
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
@@ -0,0 +1,3 @@
+@setlocal
+@set ToolName=%~n0%
+@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
diff --git a/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat 
b/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
new file mode 100644
index 000..df93365
--- /dev/null
+++ b/BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
@@ -0,0 +1 @@
+@

[edk2] [Patch 3/4] BaseTools: Update Python Makefile not to depend on PYTHON_FREEZER_PATH

2016-09-12 Thread Liming Gao
If PYTHON_FREEZER_PATH is not set, Python tools will not be freeze.

Cc: Yonghong Zhu <yonghong@intel.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Cc: Erik Bjorge <erik.c.bjo...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/Python/Makefile | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile
index 28be671..e7755cd 100644
--- a/BaseTools/Source/Python/Makefile
+++ b/BaseTools/Source/Python/Makefile
@@ -11,16 +11,17 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
-!IFNDEF PYTHON_FREEZER_PATH
-!ERROR PYTHON_FREEZER_PATH must be defined!
+!IFNDEF PYTHON_HOME
+!ERROR PYTHON_HOME must be defined!
 !ENDIF
 
+!IFDEF PYTHON_FREEZER_PATH
 !IF EXIST ($(PYTHON_FREEZER_PATH)\cxfreeze)
 # Using cx_Freeze 4.2.3 with Python 2.7.2
 FREEZE=$(PYTHON_HOME)\python $(PYTHON_FREEZER_PATH)\cxfreeze
 !ELSE
-# Using cx_Freeze 3.0.3 with Python 2.5.4
-FREEZE=$(PYTHON_FREEZER_PATH)\FreezePython.exe
+!ERROR PYTHON_FREEZER_PATH does not exist!
+!ENDIF
 !ENDIF
 
 
MODULES=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_8,encodings.utf_16_le,encodings.latin_1,encodings.ascii
@@ -236,7 +237,14 @@ 
CMD_UPT=$(BASE_TOOLS_PATH)\Source\Python\UPT\Core\DependencyRules.py \
 $(BASE_TOOLS_PATH)\Source\Python\UPT\Xml\XmlParser.py \
 $(BASE_TOOLS_PATH)\Source\Python\UPT\Xml\XmlParserMisc.py
 
+!IFDEF PYTHON_FREEZER_PATH
 all: SetPythonPath $(APPLICATIONS)
+!ELSE
+all:
+  @echo.
+  @echo !!! WARNING !!! PYTHON_FREEZER_PATH is not set.
+  @echo Cannot make executable from Python code, executing python scripts 
instead !!!
+!ENDIF
 
 SetPythonPath:
   set PYTHONPATH=$(BASE_TOOLS_PATH)\Source\Python
@@ -310,5 +318,6 @@ $(BIN_DIR)\TestRoot.pub.pem: 
$(BASE_TOOLS_PATH)\Source\Python\Pkcs7Sign\TestRoot
 clean:
 cleanall:  
   @del /f /q $(BIN_DIR)\*.pyd $(BIN_DIR)\*.dll
+  @del /f /q $(BASE_TOOLS_PATH)\Source\Python\*.pyc
   @for %%i in ($(APPLICATIONS)) do @del /f /q %%i
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/4] Add support for running python tools from source on Windows

2016-09-12 Thread Liming Gao
When Python tool exe files don't exist, toolsetup.bat will configure 
PYTHONPATH to python source code, and set BaseTools\BinWrappers\WindowsLike
into system PATH directory. Then, windows batch files will be used to 
run python tools from source files. 

Liming Gao (4):
  BaseTools: Add Windows batch files to run python tool from Source
  BaseTools: Update python tool to call external tools with shell true
mode
  BaseTools: Update Python Makefile not to depend on PYTHON_FREEZER_PATH
  BaseTools: Update toolsetup.bat to set PYTHONPATH env to run python
source

 BaseTools/BinWrappers/WindowsLike/BPDG.bat |   3 +
 BaseTools/BinWrappers/WindowsLike/Ecc.bat  |   3 +
 BaseTools/BinWrappers/WindowsLike/GenDepex.bat |   3 +
 BaseTools/BinWrappers/WindowsLike/GenFds.bat   |   3 +
 .../BinWrappers/WindowsLike/GenPatchPcdTable.bat   |   3 +
 .../BinWrappers/WindowsLike/PatchPcdValue.bat  |   3 +
 BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat|   3 +
 .../WindowsLike/Rsa2048Sha256GenerateKeys.bat  |   1 +
 .../BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat  |   3 +
 BaseTools/BinWrappers/WindowsLike/TargetTool.bat   |   3 +
 BaseTools/BinWrappers/WindowsLike/Trim.bat |   3 +
 BaseTools/BinWrappers/WindowsLike/UPT.bat  |   3 +
 BaseTools/BinWrappers/WindowsLike/build.bat|   3 +
 BaseTools/Source/Python/Common/VpdInfoFile.py  |   7 +-
 BaseTools/Source/Python/Makefile   |  17 +++-
 BaseTools/Source/Python/build/build.py |   5 +-
 BaseTools/toolsetup.bat| 101 +
 17 files changed, 100 insertions(+), 67 deletions(-)
 create mode 100644 BaseTools/BinWrappers/WindowsLike/BPDG.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Ecc.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenDepex.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenFds.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
 create mode 100644 
BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/TargetTool.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/Trim.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/UPT.bat
 create mode 100644 BaseTools/BinWrappers/WindowsLike/build.bat

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/4] BaseTools VfrCompile Pccts: Update GCC Flags to the specific one with BUILD_ prefix

2016-09-05 Thread Liming Gao
This change is also applied to VfrCompile Pccts antlr and dlg tool.

In V2, add the missing C rules.

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 13 -
 BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 18 +++---
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile 
b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
index c49cfd8..8f2cc78 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile
@@ -157,20 +157,21 @@ PCCTS_H=../h
 #  $(DLG) -C2 parser.dlg scan.c
 #
 #set.$(OBJ_EXT): $(SET)/set.c
-#  $(CC) $(CFLAGS) -c $(OUT_OBJ)set.$(OBJ_EXT) $(SET)/set.c
+#  $(BUILD_CC) $(BUILD_CFLAGS) -c $(OUT_OBJ)set.$(OBJ_EXT) $(SET)/set.c
 
 
 
 #
 #   UNIX  (default)
 #
-CC?=gcc
+BUILD_CC?=gcc
 COPT=-O
 ANTLR=${BIN_DIR}/antlr
 DLG=${BIN_DIR}/dlg
 OBJ_EXT=o
 OUT_OBJ = -o
-CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) 
-DZZLEXBUFSIZE=65536
+BUILD_CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN $(COTHER) 
-DZZLEXBUFSIZE=65536
+BUILD_CPPFLAGS=
 #
 # SGI Users, use this CFLAGS
 #
@@ -179,7 +180,7 @@ OBJ=antlr.o scan.o err.o bits.o build.o fset2.o fset.o 
gen.o  \
 globals.o hash.o lex.o main.o misc.o set.o pred.o egman.o mrhoist.o 
fcache.o
 
 $(BIN_DIR)/antlr : $(OBJ) $(SRC)
-   $(CC) $(CFLAGS) -o $(BIN_DIR)/antlr $(OBJ)
+   $(BUILD_CC) $(BUILD_CFLAGS) -o $(BIN_DIR)/antlr $(OBJ)
 
 # what files does PCCTS generate (both ANTLR and DLG)
 PCCTS_GEN=antlr.c scan.c err.c tokens.h mode.h parser.dlg stdpccts.h remap.h
@@ -202,8 +203,10 @@ scan.o : scan.c mode.h tokens.h
 #  $(DLG) -C2 parser.dlg scan.c
 
 set.o : $(SET)/set.c
-   $(CC) $(CFLAGS) -c -o set.o $(SET)/set.c
+   $(BUILD_CC) $(BUILD_CFLAGS) -c -o set.o $(SET)/set.c
 
+%.o : %.c 
+   $(BUILD_CC) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
 
 #
 # ** These next targets are common to UNIX and PC world 
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile 
b/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile
index dfcf3ee..b3a34d3 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile
+++ b/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile
@@ -114,18 +114,19 @@ PCCTS_H=../h
 #
 #   UNIX
 #
-CC?=cc
+BUILD_CC?=cc
 COPT=-O
 ANTLR=${BIN_DIR}/antlr
 DLG=${BIN_DIR}/dlg
-CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN -DZZLEXBUFSIZE=65536
+BUILD_CFLAGS= $(COPT) -I. -I$(SET) -I$(PCCTS_H) -DUSER_ZZSYN 
-DZZLEXBUFSIZE=65536
+BUILD_CPPFLAGS=
 OBJ_EXT=o
 OUT_OBJ = -o
 OBJ = dlg_p.o dlg_a.o main.o err.o set.o support.o output.o \
 relabel.o automata.o
 
 $(BIN_DIR)/dlg : $(OBJ) $(SRC)
-   $(CC) $(CFLAGS) -o $(BIN_DIR)/dlg $(OBJ)
+   $(BUILD_CC) $(BUILD_CFLAGS) -o $(BIN_DIR)/dlg $(OBJ)
 
 SRC = dlg_p.c dlg_a.c main.c err.c $(SET)/set.c support.c output.c \
 relabel.c automata.c
@@ -137,16 +138,19 @@ SRC = dlg_p.c dlg_a.c main.c err.c $(SET)/set.c support.c 
output.c \
 #  $(DLG) -C2 parser.dlg dlg_a.c
 
 dlg_p.$(OBJ_EXT) : dlg_p.c dlg.h tokens.h mode.h
-   $(CC) $(CFLAGS) -c dlg_p.c
+   $(BUILD_CC) $(BUILD_CFLAGS) -c dlg_p.c
 
 dlg_a.$(OBJ_EXT) : dlg_a.c dlg.h tokens.h mode.h
-   $(CC) $(CFLAGS) -c dlg_a.c
+   $(BUILD_CC) $(BUILD_CFLAGS) -c dlg_a.c
 
 main.$(OBJ_EXT) : main.c dlg.h
-   $(CC) $(CFLAGS) -c main.c
+   $(BUILD_CC) $(BUILD_CFLAGS) -c main.c
 
 set.$(OBJ_EXT) : $(SET)/set.c
-   $(CC) -c $(CFLAGS) $(SET)/set.c
+   $(BUILD_CC) -c $(BUILD_CFLAGS) $(SET)/set.c
+
+%.o : %.c 
+   $(BUILD_CC) -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
 
 lint:
lint *.c
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/4] BaseTools VfrCompile GNU makefile: Replace CXX with BUILD_CXX

2016-09-05 Thread Liming Gao
The change is missing in VfrComile GNUmakefile.

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/VfrCompile/GNUmakefile | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile 
b/BaseTools/Source/C/VfrCompile/GNUmakefile
index e2d4321..2ebf3e0 100644
--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
@@ -26,7 +26,7 @@ OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o 
EfiVfrParser.o VfrLexer.o VfrSyn
 
 VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
 
-LINKER = $(CXX)
+LINKER = $(BUILD_CXX)
 
 EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg 
VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
 
@@ -59,16 +59,16 @@ Pccts/dlg/dlg:
BIN_DIR='.' $(MAKE) -C Pccts/dlg
 
 ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
-   $(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
+   $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
 
 DLexerBase.o: Pccts/h/DLexerBase.cpp
-   $(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
+   $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
 
 AParser.o: Pccts/h/AParser.cpp
-   $(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
+   $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
 
 VfrSyntax.o: VfrSyntax.cpp
-   $(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
+   $(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@

 clean: localClean
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/4] BaseTools GNU makefile: Add BUILD_CXXFLAGS to align make built-in rule

2016-09-05 Thread Liming Gao
GNU make built-in rule to Compiling C++ programs with
‘$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c’.
To align to it, add empty BUILD_CXXFLAGS in cpp rule.

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/footer.makefile | 2 +-
 BaseTools/Source/C/Makefiles/header.makefile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/Makefiles/footer.makefile 
b/BaseTools/Source/C/Makefiles/footer.makefile
index 216ae41..a58bff6 100644
--- a/BaseTools/Source/C/Makefiles/footer.makefile
+++ b/BaseTools/Source/C/Makefiles/footer.makefile
@@ -30,7 +30,7 @@ $(LIBRARY): $(OBJECTS)
$(BUILD_AS) -c $(BUILD_ASFLAGS) $< -o $@
 
 %.o : %.cpp
-   $(BUILD_CXX) -c $(BUILD_CPPFLAGS) $< -o $@
+   $(BUILD_CXX) -c $(BUILD_CPPFLAGS) $(BUILD_CXXFLAGS) $< -o $@
 
 .PHONY: clean
 clean:
diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
b/BaseTools/Source/C/Makefiles/header.makefile
index 5e79f31..f2041f8 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -52,6 +52,7 @@ else
 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -nostdlib -c -g
 endif
 BUILD_LFLAGS =
+BUILD_CXXFLAGS =
 
 ifeq ($(ARCH), IA32)
 #
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/4] BaseTools GNU makefile: Update GCC Flags to the specific one with BUILD_ prefix

2016-09-05 Thread Liming Gao
The following 4 patches clean up the remaining issues in GNU makefile. 
With those changes, all GNU makefiles have been updated. 

Liming Gao (4):
  BaseTools GNU makefile: Add BUILD_CXXFLAGS to align make built-in rule
  BaseTools GNU makefile: remove unused .S rule
  BaseTools VfrCompile GNU makefile: Replace CXX with BUILD_CXX
  BaseTools VfrCompile Pccts: Update GCC Flags to the specific one with
BUILD_ prefix

 BaseTools/Source/C/Makefiles/footer.makefile   |  5 +
 BaseTools/Source/C/Makefiles/header.makefile   |  1 +
 BaseTools/Source/C/VfrCompile/GNUmakefile  | 10 +-
 BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 13 -
 BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 18 +++---
 5 files changed, 26 insertions(+), 21 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] MdeModulePkg UefiBootManagerLib: Ignore BootManagerMenu from LoadFile

2016-09-01 Thread Liming Gao
BootManagerMenu boot option is handled by EfiBootManagerGetBootManagerMenu.
Don't need to handle it again when parse LoadFile protocol.

In V2, use "BootManagerMenu" instead of "BootMenuApp".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index fe09a04..6b84b85 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1940,7 +1940,6 @@ BmEnumerateBootOptions (
   UINTN Removable;
   UINTN Index;
   CHAR16*Description;
-  UINT32BootAttributes;
 
   ASSERT (BootOptionCount != NULL);
 
@@ -2070,6 +2069,12 @@ BmEnumerateBootOptions (
  
  );
   for (Index = 0; Index < HandleCount; Index++) {
+//
+// Ignore BootManagerMenu. its boot option will be created by 
EfiBootManagerGetBootManagerMenu().
+//
+if (BmIsBootManagerMenuFilePath (DevicePathFromHandle (Handles[Index]))) {
+  continue;
+}
 
 Description = BmGetBootDescription (Handles[Index]);
 BootOptions = ReallocatePool (
@@ -2079,19 +2084,11 @@ BmEnumerateBootOptions (
 );
 ASSERT (BootOptions != NULL);
 
-//
-// If LoadFile includes BootManagerMenu, its boot attribue will be set to 
APP and HIDDEN.
-//
-BootAttributes = LOAD_OPTION_ACTIVE;
-if (BmIsBootManagerMenuFilePath (DevicePathFromHandle (Handles[Index]))) {
-  BootAttributes = LOAD_OPTION_CATEGORY_APP | LOAD_OPTION_ACTIVE | 
LOAD_OPTION_HIDDEN;
-}
-
 Status = EfiBootManagerInitializeLoadOption (
[(*BootOptionCount)++],
LoadOptionNumberUnassigned,
LoadOptionTypeBoot,
-   BootAttributes,
+   LOAD_OPTION_ACTIVE,
Description,
DevicePathFromHandle (Handles[Index]),
NULL,
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2] MdeModulePkg UefiBootManagerLib: Rename BootMenuApp to BootManagerMenu

2016-09-01 Thread Liming Gao
Rename local function name BootMenuApp to BootManagerMenu to align to
other public function name.

In V2, use "BootManagerMenu" instead of "BootMenuApp".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index ecd0ae3..fe09a04 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1530,15 +1530,15 @@ EfiBootManagerGetLoadOptionBuffer (
 }
 
 /**
-  Check if it's a Device Path pointing to BootMenuApp.
+  Check if it's a Device Path pointing to BootManagerMenu.
 
   @param  DevicePath Input device path.
 
-  @retval TRUE   The device path is BootMenuApp File Device Path.
-  @retval FALSE  The device path is NOT BootMenuApp File Device Path.
+  @retval TRUE   The device path is BootManagerMenu File Device Path.
+  @retval FALSE  The device path is NOT BootManagerMenu File Device Path.
 **/
 BOOLEAN
-BmIsBootMenuAppFilePath (
+BmIsBootManagerMenuFilePath (
   EFI_DEVICE_PATH_PROTOCOL *DevicePath
 )
 {
@@ -1645,7 +1645,7 @@ EfiBootManagerBoot (
   // 3. Signal the EVT_SIGNAL_READY_TO_BOOT event when we are about to load 
and execute
   //the boot option.
   //
-  if (BmIsBootMenuAppFilePath (BootOption->FilePath)) {
+  if (BmIsBootManagerMenuFilePath (BootOption->FilePath)) {
 DEBUG ((EFI_D_INFO, "[Bds] Booting Boot Manager Menu.\n"));
 BmStopHotkeyService (NULL, NULL);
   } else {
@@ -2080,10 +2080,10 @@ BmEnumerateBootOptions (
 ASSERT (BootOptions != NULL);
 
 //
-// If LoadFile includes BootMenuApp, its boot attribue will be set to APP 
and HIDDEN.
+// If LoadFile includes BootManagerMenu, its boot attribue will be set to 
APP and HIDDEN.
 //
 BootAttributes = LOAD_OPTION_ACTIVE;
-if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+if (BmIsBootManagerMenuFilePath (DevicePathFromHandle (Handles[Index]))) {
   BootAttributes = LOAD_OPTION_CATEGORY_APP | LOAD_OPTION_ACTIVE | 
LOAD_OPTION_HIDDEN;
 }
 
@@ -2215,7 +2215,7 @@ BmRegisterBootManagerMenu (
   DevicePath = NULL;
   Description = NULL;
   //
-  // Try to find BootMenuApp from LoadFile protocol
+  // Try to find BootManagerMenu from LoadFile protocol
   //
   gBS->LocateHandleBuffer (
  ByProtocol,
@@ -2225,7 +2225,7 @@ BmRegisterBootManagerMenu (
  
  );
   for (Index = 0; Index < HandleCount; Index++) {
-if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+if (BmIsBootManagerMenuFilePath (DevicePathFromHandle (Handles[Index]))) {
   DevicePath  = DuplicateDevicePath (DevicePathFromHandle 
(Handles[Index]));
   Description = BmGetBootDescription (Handles[Index]);
   break;
@@ -2334,7 +2334,7 @@ EfiBootManagerGetBootManagerMenu (
   BootOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypeBoot);
 
   for (Index = 0; Index < BootOptionCount; Index++) {
-if (BmIsBootMenuAppFilePath (BootOptions[Index].FilePath)) {
+if (BmIsBootManagerMenuFilePath (BootOptions[Index].FilePath)) {
 Status = EfiBootManagerInitializeLoadOption (
BootOption,
BootOptions[Index].OptionNumber,
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg UefiBootManagerLib: Rename BootMenuApp to BootManagerMenuApp

2016-08-31 Thread Liming Gao
Rename local function name BootMenuApp to BootManagerMenuApp to align
to other public function name.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index f8a3988..88bb13b 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1530,15 +1530,15 @@ EfiBootManagerGetLoadOptionBuffer (
 }
 
 /**
-  Check if it's a Device Path pointing to BootMenuApp.
+  Check if it's a Device Path pointing to BootManagerMenuApp.
 
   @param  DevicePath Input device path.
 
-  @retval TRUE   The device path is BootMenuApp File Device Path.
-  @retval FALSE  The device path is NOT BootMenuApp File Device Path.
+  @retval TRUE   The device path is BootManagerMenuApp File Device Path.
+  @retval FALSE  The device path is NOT BootManagerMenuApp File Device Path.
 **/
 BOOLEAN
-BmIsBootMenuAppFilePath (
+BmIsBootManagerMenuAppFilePath (
   EFI_DEVICE_PATH_PROTOCOL *DevicePath
 )
 {
@@ -1645,7 +1645,7 @@ EfiBootManagerBoot (
   // 3. Signal the EVT_SIGNAL_READY_TO_BOOT event when we are about to load 
and execute
   //the boot option.
   //
-  if (BmIsBootMenuAppFilePath (BootOption->FilePath)) {
+  if (BmIsBootManagerMenuAppFilePath (BootOption->FilePath)) {
 DEBUG ((EFI_D_INFO, "[Bds] Booting Boot Manager Menu.\n"));
 BmStopHotkeyService (NULL, NULL);
   } else {
@@ -2070,9 +2070,9 @@ BmEnumerateBootOptions (
  );
   for (Index = 0; Index < HandleCount; Index++) {
 //
-// Ignore BootMenuApp. its boot option will be created by 
BmRegisterBootManagerMenu().
+// Ignore BootManagerMenuApp. its boot option will be created by 
BmRegisterBootManagerMenu().
 //
-if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+if (BmIsBootManagerMenuAppFilePath (DevicePathFromHandle 
(Handles[Index]))) {
   continue;
 }
 
@@ -2212,7 +2212,7 @@ BmRegisterBootManagerMenu (
   DevicePath = NULL;
   Description = NULL;
   //
-  // Try to find BootMenuApp from LoadFile protocol
+  // Try to find BootManagerMenuApp from LoadFile protocol
   //
   gBS->LocateHandleBuffer (
  ByProtocol,
@@ -,7 +,7 @@ BmRegisterBootManagerMenu (
  
  );
   for (Index = 0; Index < HandleCount; Index++) {
-if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+if (BmIsBootManagerMenuAppFilePath (DevicePathFromHandle 
(Handles[Index]))) {
   DevicePath  = DuplicateDevicePath (DevicePathFromHandle 
(Handles[Index]));
   Description = BmGetBootDescription (Handles[Index]);
   break;
@@ -2331,7 +2331,7 @@ EfiBootManagerGetBootManagerMenu (
   BootOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypeBoot);
 
   for (Index = 0; Index < BootOptionCount; Index++) {
-if (BmIsBootMenuAppFilePath (BootOptions[Index].FilePath)) {
+if (BmIsBootManagerMenuAppFilePath (BootOptions[Index].FilePath)) {
 Status = EfiBootManagerInitializeLoadOption (
BootOption,
BootOptions[Index].OptionNumber,
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg UefiBootManagerLib: Ignore BootManagerMenuApp from LoadFile

2016-08-31 Thread Liming Gao
BootManagerMenuApp boot option is handled by EfiBootManagerGetBootManagerMenu.
Don't need to handle it again when parse LoadFile protocol.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index ecd0ae3..f8a3988 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1940,7 +1940,6 @@ BmEnumerateBootOptions (
   UINTN Removable;
   UINTN Index;
   CHAR16*Description;
-  UINT32BootAttributes;
 
   ASSERT (BootOptionCount != NULL);
 
@@ -2070,6 +2069,12 @@ BmEnumerateBootOptions (
  
  );
   for (Index = 0; Index < HandleCount; Index++) {
+//
+// Ignore BootMenuApp. its boot option will be created by 
BmRegisterBootManagerMenu().
+//
+if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+  continue;
+}
 
 Description = BmGetBootDescription (Handles[Index]);
 BootOptions = ReallocatePool (
@@ -2079,19 +2084,11 @@ BmEnumerateBootOptions (
 );
 ASSERT (BootOptions != NULL);
 
-//
-// If LoadFile includes BootMenuApp, its boot attribue will be set to APP 
and HIDDEN.
-//
-BootAttributes = LOAD_OPTION_ACTIVE;
-if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
-  BootAttributes = LOAD_OPTION_CATEGORY_APP | LOAD_OPTION_ACTIVE | 
LOAD_OPTION_HIDDEN;
-}
-
 Status = EfiBootManagerInitializeLoadOption (
[(*BootOptionCount)++],
LoadOptionNumberUnassigned,
LoadOptionTypeBoot,
-   BootAttributes,
+   LOAD_OPTION_ACTIVE,
Description,
DevicePathFromHandle (Handles[Index]),
NULL,
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools GnuMakefile: Update GCC Flags to the specific one with BUILD_ prefix

2016-08-22 Thread Liming Gao
To avoid the conflict with the default GCC flag name, BUILD_ prefix is added.

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/footer.makefile |  8 
 BaseTools/Source/C/Makefiles/header.makefile | 28 ++--
 BaseTools/Source/C/VfrCompile/GNUmakefile|  4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/BaseTools/Source/C/Makefiles/footer.makefile 
b/BaseTools/Source/C/Makefiles/footer.makefile
index c3d8020..216ae41 100644
--- a/BaseTools/Source/C/Makefiles/footer.makefile
+++ b/BaseTools/Source/C/Makefiles/footer.makefile
@@ -21,16 +21,16 @@ install: $(MAKEROOT)/libs-$(ARCH) $(LIBRARY)
cp $(LIBRARY) $(MAKEROOT)/libs-$(ARCH)
 
 $(LIBRARY): $(OBJECTS) 
-   $(AR) crs $@ $^
+   $(BUILD_AR) crs $@ $^
 
 %.o : %.c 
-   $(CC)  -c $(CFLAGS) $(CPPFLAGS) $< -o $@
+   $(BUILD_CC)  -c $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< -o $@
 
 %.o : %.S
-   $(AS) -c $(ASFLAGS) $< -o $@
+   $(BUILD_AS) -c $(BUILD_ASFLAGS) $< -o $@
 
 %.o : %.cpp
-   $(CXX)  -c $(CPPFLAGS) $< -o $@
+   $(BUILD_CXX) -c $(BUILD_CPPFLAGS) $< -o $@
 
 .PHONY: clean
 clean:
diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
b/BaseTools/Source/C/Makefiles/header.makefile
index 09d2bff..5e79f31 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -6,7 +6,7 @@
 # ARCH = ia64 or IA64 for IA64 build
 # ARCH = Arm or ARM for ARM build
 #
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.The full text of the license may be 
found at
@@ -21,12 +21,12 @@ CYGWIN:=$(findstring CYGWIN, $(shell uname -s))
 LINUX:=$(findstring Linux, $(shell uname -s))
 DARWIN:=$(findstring Darwin, $(shell uname -s))
 
-CC ?= gcc
-CXX ?= g++
-AS ?= gcc
-AR ?= ar
-LD ?= ld
-LINKER ?= $(CC)
+BUILD_CC ?= gcc
+BUILD_CXX ?= g++
+BUILD_AS ?= gcc
+BUILD_AR ?= ar
+BUILD_LD ?= ld
+LINKER ?= $(BUILD_CC)
 ifeq ($(ARCH), IA32)
 ARCH_INCLUDE = -I $(MAKEROOT)/Include/Ia32/
 endif
@@ -44,14 +44,14 @@ ARCH_INCLUDE = -I $(MAKEROOT)/Include/AArch64/
 endif
 
 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I 
$(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I 
$(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 
-CPPFLAGS = $(INCLUDE)
+BUILD_CPPFLAGS = $(INCLUDE)
 ifeq ($(DARWIN),Darwin)
 # assume clang or clang compatible flags on OS X
-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-self-assign -nostdlib -c -g
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-self-assign -nostdlib -c -g
 else
-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -nostdlib -c -g
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -nostdlib -c -g
 endif
-LFLAGS =
+BUILD_LFLAGS =
 
 ifeq ($(ARCH), IA32)
 #
@@ -60,9 +60,9 @@ ifeq ($(ARCH), IA32)
 #  so only do this is uname -m returns i386.
 #
 ifeq ($(DARWIN),Darwin)
-  CFLAGS   += -arch i386
-  CPPFLAGS += -arch i386
-  LFLAGS   += -arch i386
+  BUILD_CFLAGS   += -arch i386
+  BUILD_CPPFLAGS += -arch i386
+  BUILD_LFLAGS   += -arch i386
 endif
 endif
 
diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile 
b/BaseTools/Source/C/VfrCompile/GNUmakefile
index e446d14..e2d4321 100644
--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
@@ -1,7 +1,7 @@
 ## @file
 # GNU/Linux makefile for 'VfrCompile' module build.
 #
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
@@ -24,7 +24,7 @@ TOOL_INCLUDE = -I Pccts/h
 OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o 
VfrSyntax.o \
   VfrFormPkg.o VfrError.o VfrUtilityLib.o VfrCompiler.o
 
-VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(CPPFLAGS)
+VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
 
 LINKER = $(CXX)
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools GNU Makefile: Add the missing rules for cpp source file

2016-08-22 Thread Liming Gao
Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Makefiles/footer.makefile | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/Makefiles/footer.makefile 
b/BaseTools/Source/C/Makefiles/footer.makefile
index 2dfc683..c3d8020 100644
--- a/BaseTools/Source/C/Makefiles/footer.makefile
+++ b/BaseTools/Source/C/Makefiles/footer.makefile
@@ -1,7 +1,7 @@
 ## @file
 # Makefile
 #
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.The full text of the license may be 
found at
@@ -29,6 +29,9 @@ $(LIBRARY): $(OBJECTS)
 %.o : %.S
$(AS) -c $(ASFLAGS) $< -o $@
 
+%.o : %.cpp
+   $(CXX)  -c $(CPPFLAGS) $< -o $@
+
 .PHONY: clean
 clean:
@rm -f $(OBJECTS) $(LIBRARY) $(DEPFILES)
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools PeCoffLib: Fix the issue to get RelocationsStripped from TE image

2016-08-21 Thread Liming Gao
If PE image has no relocation section, and has not set RELOCS_STRIPPED,
after it is converted to TE image, GenFw will set its relocation section
VirtualAddress to non-zero address, and keep Size value as Zero. MdePkg
BasePeCoffLib applied this rule to get RelocationsStripped attribute. But,
it is missing in BaseTools BasePeCoffLib.

Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/C/Common/BasePeCoff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/Common/BasePeCoff.c 
b/BaseTools/Source/C/Common/BasePeCoff.c
index 9652557..d0cc1af 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -2,7 +2,7 @@
 
   Functions to get info and load PE/COFF image.
 
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
 Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
 This program and the accompanying materials  
 are licensed and made available under the terms and conditions of the BSD 
License 
@@ -336,7 +336,7 @@ Returns:
   //
   if ((!(ImageContext->IsTeImage)) && ((PeHdr->Pe32.FileHeader.Characteristics 
& EFI_IMAGE_FILE_RELOCS_STRIPPED) != 0)) {
 ImageContext->RelocationsStripped = TRUE;
-  } else if ((ImageContext->IsTeImage) && (TeHdr->DataDirectory[0].Size == 0)) 
{
+  } else if ((ImageContext->IsTeImage) && (TeHdr->DataDirectory[0].Size == 0) 
&& (TeHdr->DataDirectory[0].VirtualAddress == 0)) {
 ImageContext->RelocationsStripped = TRUE;
   } else {
 ImageContext->RelocationsStripped = FALSE;
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] CryptoPkg IntrinsicLib: Add the missing nasm source file

2016-08-10 Thread Liming Gao
Add two name files IntrinsicLib Ia32 MathLShiftS64.nasm and MathRShiftU64.nasm

Cc: Qin Long <qin.l...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Library/IntrinsicLib/Ia32/MathLShiftS64.nasm   | 48 +
 .../Library/IntrinsicLib/Ia32/MathRShiftU64.nasm   | 49 ++
 CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf|  2 +
 3 files changed, 99 insertions(+)
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm
 create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm
new file mode 100644
index 000..a30edbf
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.nasm
@@ -0,0 +1,48 @@
+;--
+;
+; Copyright (c) 2016, Intel Corporation. All rights reserved.
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD 
License
+; which accompanies this distribution.  The full text of the license may be 
found at
+; http://opensource.org/licenses/bsd-license.php.
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+;   MathLShiftS64.nasm
+;
+; Abstract:
+;
+;   64-bit Math Worker Function.
+;   Shifts a 64-bit signed value left by a certain number of bits.
+;
+;--
+
+SECTION .text
+
+global ASM_PFX(__ashldi3)
+;--
+;
+; void __cdecl __ashldi3 (void)
+;
+;--
+ASM_PFX(__ashldi3):
+cmp cl,0x40
+jnc ReturnZero
+cmp cl,0x20
+jnc More32
+shld edx,eax,cl
+shl eax,cl
+ret
+More32:
+mov edx,eax
+xor eax,eax
+and cl,0x1f
+shl edx,cl
+ret
+ReturnZero:
+xor eax,eax
+xor edx,edx
+ret
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm
new file mode 100644
index 000..9bf1711
--- /dev/null
+++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.nasm
@@ -0,0 +1,49 @@
+;--
+;
+; Copyright (c) 2016, Intel Corporation. All rights reserved.
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD 
License
+; which accompanies this distribution.  The full text of the license may be 
found at
+; http://opensource.org/licenses/bsd-license.php.
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+;   MathRShiftU64.nasm
+;
+; Abstract:
+;
+;   64-bit Math Worker Function.
+;   Shifts a 64-bit unsigned value right by a certain number of bits.
+;
+;--
+
+SECTION .text
+
+;--
+;
+; void __cdecl __ashrdi3 (void)
+;
+;--
+global ASM_PFX(__ashrdi3)
+ASM_PFX(__ashrdi3):
+cmp cl,0x40
+jnc _Exit
+cmp cl,0x20
+jnc More32
+shrd eax,edx,cl
+shr edx,cl
+ret
+More32:
+mov eax,edx
+xor edx,edx
+and cl,0x1f
+shr eax,cl
+ret
+_Exit:
+xor eax,eax
+xor edx,edx
+ret
+
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index de61dc4..9495750 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -41,6 +41,8 @@
 
   Ia32/MathLShiftS64.S  | GCC
   Ia32/MathRShiftU64.S  | GCC
+  Ia32/MathLShiftS64.nasm   | GCC
+  Ia32/MathRShiftU64.nasm   | GCC
 
 [Sources.X64]
   CopyMem.c
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access

2016-08-01 Thread Liming Gao
Check NULL pointer before access it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c 
b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
index 9eea50d..18a07d8 100644
--- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
+++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
@@ -345,6 +345,9 @@ FvNotificationEvent (
   Index  = 0;
   BufferSize = sizeof (EFI_HANDLE);
   Handle = AllocateZeroPool (BufferSize);
+  if (Handle == NULL) {
+return;
+  }
   Status = gBS->LocateHandle (
 ByProtocol,
 ,
@@ -355,6 +358,9 @@ FvNotificationEvent (
   if (EFI_BUFFER_TOO_SMALL == Status) {
 FreePool (Handle);
 Handle = AllocateZeroPool (BufferSize);
+if (Handle == NULL) {
+  return;
+}
 Status = gBS->LocateHandle (
 ByProtocol,
 ,
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg LoadFileOnFv2: Correct copy right format

2016-08-01 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c 
b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
index 6ef9fac..9eea50d 100644
--- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
+++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
@@ -1,8 +1,8 @@
 /** @file
   Produce Load File Protocol for UEFI Applications in Firmware Volumes
 
-  Copyright (c) 2011 - 2013, Intel Corporation
-  All rights reserved. This program and the accompanying materials
+  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
+  This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/3] BaseTools: Correct ReadMe.txt file with CRLF line ending

2016-07-28 Thread Liming Gao
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/ReadMe.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/ReadMe.txt b/BaseTools/ReadMe.txt
index 6330b14..be9ff2a 100644
--- a/BaseTools/ReadMe.txt
+++ b/BaseTools/ReadMe.txt
@@ -7,9 +7,9 @@ directory contatins tools source.
 
 === Windows/Visual Studio Notes ===
 
-To build the BaseTools, you should run the standard vsvars32.bat script
-from your preferred Visual Studio installation or you can run get_vsvars.bat
-to use latest automatically detected version.
+To build the BaseTools, you should run the standard vsvars32.bat script
+from your preferred Visual Studio installation or you can run get_vsvars.bat
+to use latest automatically detected version.
 
 In addition to this, you should set the following environment variables:
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/3] Correct Source file with CRLF line ending

2016-07-28 Thread Liming Gao
edk2 project source files are CRLF line ending. BaseTools\Scripts\PatchCheck.py
script can detect Line ending issue in patch. 

Liming Gao (3):
  BaseTools: Correct ReadMe.txt file with CRLF line ending
  MdePkg PeiDxePostCodeLibReportStatusCode: Correct files with CRLF line
ending
  ShellPkg: Correct files with CRLF line ending

 BaseTools/ReadMe.txt   |  6 ++--
 .../PeiDxePostCodeLibReportStatusCode.inf  |  4 +--
 .../PeiDxePostCodeLibReportStatusCode.uni  |  4 +--
 .../UefiHandleParsingLib/UefiHandleParsingLib.h|  6 ++--
 .../UefiHandleParsingLib/UefiHandleParsingLib.uni  | 18 +-
 .../UefiShellCommandLib/UefiShellCommandLib.h  |  4 +--
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c  |  2 +-
 .../SmbiosView/QueryTable.c| 42 +++---
 8 files changed, 43 insertions(+), 43 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] ShellPkg: Correct files with CRLF line ending

2016-07-28 Thread Liming Gao
Cc: Ruiyu Ni <ruiyu...@intel.com>
Cc: Jaben Carsey <jaben.car...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../UefiHandleParsingLib/UefiHandleParsingLib.h|  6 ++--
 .../UefiHandleParsingLib/UefiHandleParsingLib.uni  | 18 +-
 .../UefiShellCommandLib/UefiShellCommandLib.h  |  4 +--
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c  |  2 +-
 .../SmbiosView/QueryTable.c| 42 +++---
 5 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
index f53cfb9..9a45076 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
@@ -2,8 +2,8 @@
   Provides interface to advanced shell functionality for parsing both handle 
and protocol database.
 
   Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
-  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
-  (C) Copyright 2013-2016 Hewlett-Packard Development Company, L.P.
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+  (C) Copyright 2013-2016 Hewlett-Packard Development Company, L.P.
   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
@@ -152,7 +152,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V1   1
 #define   EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION_V2   2
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni 
b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
index c5ea60d..aa6663d 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni
@@ -379,15 +379,15 @@
   " GreenMask...: 
%%H0x%08x%%N\r\n"
   " BlueMask: 
%%H0x%08x%%N\r\n"
 
-#string STR_GOP_RES_LIST_MAIN #language en-US " Supported Resolution 
List\r\n"
-#string STR_GOP_RES_LIST_ENTRY#language en-US "   
Resolution[%%H%d%%N]:\r\n"
-  " Res Hor.: 
%%H0x%08x%%N\r\n"
-  " Res Ver.: 
%%H0x%08x%%N\r\n"
-
-#string STR_EDID_DISCOVERED_MAIN  #language en-US " EDID Discovered Size : 
%%H0x%08x%%N\r\n"
-#string STR_EDID_DISCOVERED_DATA  #language en-US " EDID Discovered Data 
:\r\n"
-#string STR_EDID_ACTIVE_MAIN  #language en-US " EDID Active Size : 
%%H0x%08x%%N\r\n"
-#string STR_EDID_ACTIVE_DATA  #language en-US " EDID Active Data :\r\n"
+#string STR_GOP_RES_LIST_MAIN #language en-US " Supported Resolution 
List\r\n"
+#string STR_GOP_RES_LIST_ENTRY#language en-US "   
Resolution[%%H%d%%N]:\r\n"
+  " Res Hor.: 
%%H0x%08x%%N\r\n"
+  " Res Ver.: 
%%H0x%08x%%N\r\n"
+
+#string STR_EDID_DISCOVERED_MAIN  #language en-US " EDID Discovered Size : 
%%H0x%08x%%N\r\n"
+#string STR_EDID_DISCOVERED_DATA  #language en-US " EDID Discovered Data 
:\r\n"
+#string STR_EDID_ACTIVE_MAIN  #language en-US " EDID Active Size : 
%%H0x%08x%%N\r\n"
+#string STR_EDID_ACTIVE_DATA  #language en-US " EDID Active Data :\r\n"
 
 #string STR_GET_SUPP_TYPES_FAILED #language en-US "Unable to get 
supported types - %%H%r%%N\r\n"
 #string STR_SUPP_TYPE_HEADER  #language en-US "  Supported 
Information Types: \r\n"
diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h 
b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
index a096a12..faf2f51 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
@@ -2,7 +2,7 @@
   Provides interface to shell internal functions for shell commands.
 
   Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. 
-  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
   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
@@ -44,7 +44,7 @@
 #include 
 #i

[edk2] [Patch 2/3] MdePkg PeiDxePostCodeLibReportStatusCode: Correct files with CRLF line ending

2016-07-28 Thread Liming Gao
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../PeiDxePostCodeLibReportStatusCode.inf | 4 ++--
 .../PeiDxePostCodeLibReportStatusCode.uni | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
 
b/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
index 6189cf2..dc162c2 100644
--- 
a/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
+++ 
b/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.inf
@@ -1,7 +1,7 @@
 ## @file
-# Instance of Post Code Library based on Report Status Code Library.
+# Instance of Post Code Library based on Report Status Code Library.
 #
-# Post Code Library that layers on top of a Report Status Code Library 
instance.
+# Post Code Library that layers on top of a Report Status Code Library 
instance.
 #
 # Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
 #
diff --git 
a/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni
 
b/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni
index bc7387c..165f27f 100644
--- 
a/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni
+++ 
b/MdePkg/Library/PeiDxePostCodeLibReportStatusCode/PeiDxePostCodeLibReportStatusCode.uni
@@ -1,7 +1,7 @@
 // /** @file
-// Instance of Post Code Library based on Report Status Code Library.
+// Instance of Post Code Library based on Report Status Code Library.
 //
-// Post Code Library that layers on top of a Report Status Code Library 
instance.
+// Post Code Library that layers on top of a Report Status Code Library 
instance.
 //
 // Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
 //
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] EdkCompatibilityPkg: Fix GCC build failure

2016-07-28 Thread Liming Gao
Edk2 enables Os option and ms_va_list in GCC tool chain.
This change makes VA_LIST is not pointer, and cause GCC failure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c   | 2 +-
 .../EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c   | 2 +-
 .../Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c  | 2 +-
 EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
 
b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
index a1c232d..d872194 100644
--- 
a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
+++ 
b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
@@ -296,7 +296,7 @@ GlueReportStatusCodeExtractDebugInfo (
 
   *ErrorLevel = DebugInfo->ErrorLevel;
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__GNUC__)
   // This is non portable C code you can't assume VA_LIST is pointer
   return FALSE;
 #else
diff --git 
a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
 
b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
index 29207e0..248b781 100644
--- 
a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
+++ 
b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
@@ -248,7 +248,7 @@ GlueReportStatusCodeExtractDebugInfo (
   // The first 12 * UINTN bytes of the string are really an 
   // argument stack to support varargs on the Format string.
   //
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__GNUC__)
   // This is non portable C code you can't assume VA_LIST is pointer
   return FALSE;
 #else
diff --git 
a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
 
b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
index ef16d40..1b3d5cd 100644
--- 
a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
+++ 
b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
@@ -280,7 +280,7 @@ GlueReportStatusCodeExtractDebugInfo (
   // The first 12 * UINTN bytes of the string are really an
   // argument stack to support varargs on the Format string.
   //
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__GNUC__)
   // This is non portable C code you can't assume VA_LIST is pointer
   return FALSE;
 #else
diff --git 
a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c 
b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
index 58d97ac..47b65a8 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
+++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
@@ -332,7 +332,7 @@ Returns:
   // The first 12 * UINTN bytes of the string are really an 
   // arguement stack to support varargs on the Format string.
   //
-#if (defined (EFIARM) || defined (EFIAARCH64) || defined (__APPLE__))
+#if (defined (EFIARM) || defined (EFIAARCH64) || defined (__APPLE__) || 
defined (__GNUC__))
   // It is not legal C code to cast VA_LIST to a pointer. VA_LIST can 
   // be a structure. 
   return FALSE;
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/8] MdeModulePkg UefiBootManagerLib: Support LoadFile Protocol based on FV

2016-07-25 Thread Liming Gao
New LoadFileOnFv2 driver will install LoadFile protocol based on FV file.
Update UefiBootManagerLib to find BootMenuApp with LoadFile protocol.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 116 +++
 1 file changed, 76 insertions(+), 40 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 18259e9..d5818ca 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1940,6 +1940,7 @@ BmEnumerateBootOptions (
   UINTN Removable;
   UINTN Index;
   CHAR16*Description;
+  UINT32BootAttributes;
 
   ASSERT (BootOptionCount != NULL);
 
@@ -2059,7 +2060,7 @@ BmEnumerateBootOptions (
   }
 
   //
-  // Parse load file, assuming UEFI Network boot option
+  // Parse load file protocol
   //
   gBS->LocateHandleBuffer (
  ByProtocol,
@@ -2078,11 +2079,19 @@ BmEnumerateBootOptions (
 );
 ASSERT (BootOptions != NULL);
 
+//
+// If LoadFile includes BootMenuApp, its boot attribue will be set to APP 
and HIDDEN.
+//
+BootAttributes = LOAD_OPTION_ACTIVE;
+if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+  BootAttributes = LOAD_OPTION_CATEGORY_APP | LOAD_OPTION_ACTIVE | 
LOAD_OPTION_HIDDEN;
+}
+
 Status = EfiBootManagerInitializeLoadOption (
[(*BootOptionCount)++],
LoadOptionNumberUnassigned,
LoadOptionTypeBoot,
-   LOAD_OPTION_ACTIVE,
+   BootAttributes,
Description,
DevicePathFromHandle (Handles[Index]),
NULL,
@@ -2197,51 +2206,78 @@ BmRegisterBootManagerMenu (
   EFI_DEVICE_PATH_PROTOCOL   *DevicePath;
   EFI_LOADED_IMAGE_PROTOCOL  *LoadedImage;
   MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  FileNode;
+  UINTN  HandleCount;
+  EFI_HANDLE *Handles;
+  UINTN  Index;
   VOID   *Data;
   UINTN  DataSize;
 
-  Data = NULL;
-  Status = GetSectionFromFv (
- PcdGetPtr (PcdBootManagerMenuFile),
- EFI_SECTION_PE32,
- 0,
- (VOID **) ,
- 
- );
-  if (Data != NULL) {
-FreePool (Data);
-  }
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_WARN, "[Bds]BootManagerMenu FFS section can not be found, 
skip its boot option registration\n"));
-return EFI_NOT_FOUND;
-  }
-
+  DevicePath = NULL;
   //
-  // Get BootManagerMenu application's description from EFI User Interface 
Section.
+  // Try to find BootMenuApp from LoadFile protocol
   //
-  Status = GetSectionFromFv (
- PcdGetPtr (PcdBootManagerMenuFile),
- EFI_SECTION_USER_INTERFACE,
- 0,
- (VOID **) ,
- 
- );
-  if (EFI_ERROR (Status)) {
-Description = NULL;
+  gBS->LocateHandleBuffer (
+ ByProtocol,
+ ,
+ NULL,
+ ,
+ 
+ );
+  for (Index = 0; Index < HandleCount; Index++) {
+if (BmIsBootMenuAppFilePath (DevicePathFromHandle (Handles[Index]))) {
+  DevicePath  = DuplicateDevicePath (DevicePathFromHandle 
(Handles[Index]));
+  Description = BmGetBootDescription (Handles[Index]);
+  break;
+}
+  }
+  if (HandleCount != 0) {
+FreePool (Handles);
   }
 
-  EfiInitializeFwVolDevicepathNode (, PcdGetPtr 
(PcdBootManagerMenuFile));
-  Status = gBS->HandleProtocol (
-  gImageHandle,
-  ,
-  (VOID **) 
-  );
-  ASSERT_EFI_ERROR (Status);
-  DevicePath = AppendDevicePathNode (
- DevicePathFromHandle (LoadedImage->DeviceHandle),
- (EFI_DEVICE_PATH_PROTOCOL *) 
- );
-  ASSERT (DevicePath != NULL);
+  if (DevicePath == NULL) {
+Data = NULL;
+Status = GetSectionFromFv (
+   PcdGetPtr (PcdBootManagerMenuFile),
+   EFI_SECTION_PE32,
+   0,
+   (VOID **) ,
+   
+   );
+if (Data != NULL) {
+  FreePool (Data);
+}
+if (EFI_ERROR (Status)) {
+  DEBUG ((EFI_D_WARN, "[Bds]BootManagerMenu FFS section can not be found, 
skip its boot option registration\n"));
+  return EFI_NOT_FOUND;
+}
+
+//
+// Get BootManagerMenu application's description from EFI User Interface 
Section.
+//
+Status = GetSectionFromFv (
+   PcdGetPtr (PcdBootManagerMenuFile),
+   EFI_SECTION_USER_INTE

[edk2] [Patch 5/8] MdeModulePkg LoadFileOnFv2: Add new LoadFileOnFv2 driver

2016-07-25 Thread Liming Gao
This driver searches APPLICATION in FV and installs LoadFile protocol
for every found one. Then, BDS will add BootOption for LoadFile protocol.

It provides the generic way to expose boot option for the internal
application, such as Shell. With this driver, PlatformBds doesn’t need
to specially handle Shell application.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Universal/LoadFileOnFv2/LoadFileOnFv2.c| 421 +
 .../Universal/LoadFileOnFv2/LoadFileOnFv2.inf  |  68 
 .../Universal/LoadFileOnFv2/LoadFileOnFv2.uni  |  24 ++
 .../Universal/LoadFileOnFv2/LoadFileOnFv2Extra.uni |  18 +
 4 files changed, 531 insertions(+)
 create mode 100644 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
 create mode 100644 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf
 create mode 100644 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.uni
 create mode 100644 MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2Extra.uni

diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c 
b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
new file mode 100644
index 000..6ef9fac
--- /dev/null
+++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c
@@ -0,0 +1,421 @@
+/** @file
+  Produce Load File Protocol for UEFI Applications in Firmware Volumes
+
+  Copyright (c) 2011 - 2013, Intel Corporation
+  All rights reserved. This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('l', 'f', 'f', 
'v')
+
+typedef struct {
+  UINTN  Signature;
+  EFI_LOAD_FILE_PROTOCOL LoadFile;
+  EFI_DEVICE_PATH_PROTOCOL   *DevicePath;
+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;
+  EFI_GUID   NameGuid;
+  LIST_ENTRY Link;
+} LOAD_FILE_ON_FV2_PRIVATE_DATA;
+
+#define LOAD_FILE_ON_FV2_PRIVATE_DATA_FROM_THIS(a) CR (a, 
LOAD_FILE_ON_FV2_PRIVATE_DATA, LoadFile, 
LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE)
+#define LOAD_FILE_ON_FV2_PRIVATE_DATA_FROM_LINK(a) CR (a, 
LOAD_FILE_ON_FV2_PRIVATE_DATA, Link, LOAD_FILE_ON_FV2_PRIVATE_DATA_SIGNATURE)
+
+EFI_EVENT  mFvRegistration;
+LIST_ENTRY mPrivateDataList;
+
+/**
+  Causes the driver to load a specified file from firmware volume.
+
+  @param[in]  ThisProtocol instance pointer.
+  @param[in]  FilePathThe device specific path of the file to 
load.
+  @param[in]  BootPolicy  If TRUE, indicates that the request 
originates from the
+  boot manager is attempting to load 
FilePath as a boot
+  selection. If FALSE, then FilePath must 
match an exact file
+  to be loaded.
+  @param[in, out] BufferSize  On input the size of Buffer in bytes. On 
output with a return
+  code of EFI_SUCCESS, the amount of data 
transferred to
+  Buffer. On output with a return code of 
EFI_BUFFER_TOO_SMALL,
+  the size of Buffer required to retrieve 
the requested file.
+  @param[in]  Buffer  The memory buffer to transfer the file 
to. IF Buffer is NULL,
+  then no the size of the requested file 
is returned in
+  BufferSize.
+
+  @retval EFI_SUCCESS The file was loaded.
+  @retval EFI_UNSUPPORTED The device does not support the provided 
BootPolicy.
+  @retval EFI_INVALID_PARAMETER   FilePath is not a valid device path, or
+  BufferSize is NULL.
+  @retval EFI_DEVICE_ERRORThe file was not loaded due to a device 
error.
+  @retval EFI_NOT_FOUND   The file was not found.
+  @retval EFI_OUT_OF_RESOURCESAn allocation failure occurred.
+  @retval EFI_ACCESS_DENIED   The firmware volume is configured to
+  disallow reads.
+**/
+EFI_STATUS
+EFIAPI
+LoadFileOnFv2LoadFile (
+  IN EFI_LOAD_FILE_PROTOCOL*This,
+  IN EFI_DEVICE_PATH_PROTOCOL  *FilePath,
+  IN BOOLEAN   BootPolicy,
+  IN OUT UINTN *BufferSize,
+  IN VOID  *Buffer   OPTIONAL

[edk2] [Patch 3/8] MdeModulePkg UefiBootManagerLib: Update LoadFile boot description

2016-07-25 Thread Liming Gao
Update boot description to support LoadFile protocol based on FV file.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Library/UefiBootManagerLib/BmBootDescription.c | 47 ++
 1 file changed, 47 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
index 066ea80..f086764 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
@@ -455,6 +455,52 @@ BmGetNetworkDescription (
 }
 
 /**
+  Return the boot description for LoadFile
+
+  @param HandleController handle.
+
+  @return  The description string.
+**/
+CHAR16 *
+BmGetLoadFileDescription (
+  IN EFI_HANDLE  Handle
+  )
+{
+  EFI_STATUSStatus;
+  EFI_DEVICE_PATH_PROTOCOL  *FilePath;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePathNode;
+  CHAR16*Description;
+  EFI_LOAD_FILE_PROTOCOL*LoadFile;
+
+  Status = gBS->HandleProtocol (Handle, , (VOID 
**));
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
+
+  //
+  // Get the file name
+  //
+  Description = NULL;
+  Status = gBS->HandleProtocol (Handle, , (VOID 
**));
+  if (!EFI_ERROR (Status)) {
+DevicePathNode = FilePath;
+while (!IsDevicePathEnd (DevicePathNode)) {
+  if (DevicePathNode->Type == MEDIA_DEVICE_PATH && DevicePathNode->SubType 
== MEDIA_FILEPATH_DP) {
+Description = (CHAR16 *)(DevicePathNode + 1);
+break;
+  }
+  DevicePathNode = NextDevicePathNode (DevicePathNode);
+}
+  }
+
+  if (Description != NULL) {
+return AllocateCopyPool (StrSize (Description), Description);
+  }
+
+  return NULL;
+}
+
+/**
   Return the boot description for the controller based on the type.
 
   @param HandleController handle.
@@ -559,6 +605,7 @@ BM_GET_BOOT_DESCRIPTION mBmBootDescriptionHandlers[] = {
   BmGetUsbDescription,
   BmGetDescriptionFromDiskInfo,
   BmGetNetworkDescription,
+  BmGetLoadFileDescription,
   BmGetMiscDescription
 };
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 6/8] MdeModulePkg: Add new LoadFileOnFv2 in Package DSC for Build

2016-07-25 Thread Liming Gao
Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/MdeModulePkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 1e57389..8c0875b 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -405,6 +405,7 @@
   }
 
   MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+  MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf
 
 [Components.IA32, Components.X64, Components.IPF]  
   MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/8] MdeModulePkg UefiBootManagerLib: Enhance EfiBootManagerFindLoadOption

2016-07-25 Thread Liming Gao
The same boot file may have two different device paths. One is its FV
File device path, another is LoadFile FV device path. These two paths
includes the same NameGuid. So, EfiBootManagerFindLoadOption() is updated
to compare their NameGuid.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Library/UefiBootManagerLib/BmLoadOption.c  | 44 --
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 9af98de..f9650ff 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -506,6 +506,29 @@ EfiBootManagerInitializeLoadOption (
   return EFI_SUCCESS;
 }
 
+/**
+  Find NameGuid from the input device path.
+
+  @param  DevicePath Input device path.
+
+  @retval NULL  NameGuid can't be found in the input device path.
+  @retval NameGuid  Pointer to NameGuid found in the input device path.
+**/
+EFI_GUID *
+BmFileNameGuidFromFilePath (
+  EFI_DEVICE_PATH_PROTOCOL *DevicePath
+)
+{
+  EFI_HANDLE  FvHandle;
+  EFI_STATUS  Status;
+
+  Status = gBS->LocateDevicePath (, 
, );
+  if (!EFI_ERROR (Status)) {
+return EfiGetNameGuidFromFwVolDevicePathNode ((CONST 
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
+  }
+
+  return NULL;
+}
 
 /**
   Return the index of the load option in the load option array.
@@ -529,15 +552,30 @@ EfiBootManagerFindLoadOption (
   )
 {
   UINTN Index;
+  EFI_GUID  *KeyNameGuid;
+  EFI_GUID  *NameGuid;
+
+  KeyNameGuid = NULL;
+  if (Key->OptionType == LoadOptionTypeBoot) {
+KeyNameGuid = BmFileNameGuidFromFilePath (Key->FilePath);
+  }
 
   for (Index = 0; Index < Count; Index++) {
-if ((Key->OptionType == Array[Index].OptionType) &&
-(Key->Attributes == Array[Index].Attributes) &&
+if (Key->OptionType == Array[Index].OptionType) {
+  if ((Key->Attributes == Array[Index].Attributes) &&
 (StrCmp (Key->Description, Array[Index].Description) == 0) &&
 (CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSize 
(Key->FilePath)) == 0) &&
 (Key->OptionalDataSize == Array[Index].OptionalDataSize) &&
 (CompareMem (Key->OptionalData, Array[Index].OptionalData, 
Key->OptionalDataSize) == 0)) {
-  return (INTN) Index;
+return (INTN) Index;
+  }
+
+  if (KeyNameGuid != NULL) {
+NameGuid = BmFileNameGuidFromFilePath (Array[Index].FilePath);
+if ((NameGuid != NULL) && CompareGuid (KeyNameGuid, NameGuid)) {
+  return (INTN) Index;
+}
+  }
 }
   }
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/8] MdeModulePkg UefiBootManagerLib: Add BmIsBootMenuAppFilePath internal API

2016-07-25 Thread Liming Gao
This function abstracts the common logic to find BootMenuApp file.

Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 49 +++-
 1 file changed, 30 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index bb38f00..18259e9 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1530,6 +1530,34 @@ EfiBootManagerGetLoadOptionBuffer (
 }
 
 /**
+  Check if it's a Device Path pointing to BootMenuApp.
+
+  @param  DevicePath Input device path.
+
+  @retval TRUE   The device path is BootMenuApp File Device Path.
+  @retval FALSE  The device path is NOT BootMenuApp File Device Path.
+**/
+BOOLEAN
+BmIsBootMenuAppFilePath (
+  EFI_DEVICE_PATH_PROTOCOL *DevicePath
+)
+{
+  EFI_HANDLE  FvHandle;
+  VOID*NameGuid;
+  EFI_STATUS  Status;
+
+  Status = gBS->LocateDevicePath (, 
, );
+  if (!EFI_ERROR (Status)) {
+NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST 
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);
+if (NameGuid != NULL) {
+  return CompareGuid (NameGuid, PcdGetPtr (PcdBootManagerMenuFile));
+}
+  }
+
+  return FALSE;
+}
+
+/**
   Attempt to boot the EFI boot option. This routine sets L"BootCurent" and
   also signals the EFI ready to boot event. If the device path for the option
   starts with a BBS device path a legacy boot is attempted via the registered 
@@ -1562,9 +1590,7 @@ EfiBootManagerBoot (
   UINTN OptionNumber;
   UINTN OriginalOptionNumber;
   EFI_DEVICE_PATH_PROTOCOL  *FilePath;
-  EFI_DEVICE_PATH_PROTOCOL  *Node;
   EFI_DEVICE_PATH_PROTOCOL  *RamDiskDevicePath;
-  EFI_HANDLEFvHandle;
   VOID  *FileBuffer;
   UINTN FileSize;
   EFI_BOOT_LOGO_PROTOCOL*BootLogo;
@@ -1619,12 +1645,7 @@ EfiBootManagerBoot (
   // 3. Signal the EVT_SIGNAL_READY_TO_BOOT event when we are about to load 
and execute
   //the boot option.
   //
-  Node   = BootOption->FilePath;
-  Status = gBS->LocateDevicePath (, , 
);
-  if (!EFI_ERROR (Status) && CompareGuid (
-EfiGetNameGuidFromFwVolDevicePathNode ((CONST 
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) Node),
-PcdGetPtr (PcdBootManagerMenuFile)
-)) {
+  if (BmIsBootMenuAppFilePath (BootOption->FilePath)) {
 DEBUG ((EFI_D_INFO, "[Bds] Booting Boot Manager Menu.\n"));
 BmStopHotkeyService (NULL, NULL);
   } else {
@@ -2272,20 +2293,11 @@ EfiBootManagerGetBootManagerMenu (
   UINTNBootOptionCount;
   EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
   UINTNIndex;
-  EFI_DEVICE_PATH_PROTOCOL *Node;
-  EFI_HANDLE   FvHandle;
   
   BootOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypeBoot);
 
   for (Index = 0; Index < BootOptionCount; Index++) {
-Node   = BootOptions[Index].FilePath;
-Status = gBS->LocateDevicePath (, , 
);
-if (!EFI_ERROR (Status)) {
-  if (CompareGuid (
-EfiGetNameGuidFromFwVolDevicePathNode ((CONST 
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) Node),
-PcdGetPtr (PcdBootManagerMenuFile)
-)
-  ) {
+if (BmIsBootMenuAppFilePath (BootOptions[Index].FilePath)) {
 Status = EfiBootManagerInitializeLoadOption (
BootOption,
BootOptions[Index].OptionNumber,
@@ -2298,7 +2310,6 @@ EfiBootManagerGetBootManagerMenu (
);
 ASSERT_EFI_ERROR (Status);
 break;
-  }
 }
   }
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools PatchCheck.py: Add line number in the print error message

2016-07-21 Thread Liming Gao
PatchCheck script prints File and Line information in error message.
This patch adds line number in the error message to help detect the issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Scripts/PatchCheck.py | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 455c130..526ffe6 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -242,6 +242,8 @@ class GitDiffCheck:
 self.lines = diff.splitlines(True)
 self.count = len(self.lines)
 self.line_num = 0
+self.line_src = 0
+self.line_delta = 0
 self.state = START
 while self.line_num < self.count and self.format_ok:
 line_num = self.line_num
@@ -283,9 +285,11 @@ class GitDiffCheck:
 elif self.state == PRE_PATCH:
 if line.startswith('+++ b/'):
 self.set_filename(line[6:].rstrip())
+self.line_delta = 0
 if line.startswith('@@ '):
 self.state = PATCH
 self.binary = False
+self.line_src = int (line.split(',')[0][4:]) + self.line_delta
 elif line.startswith('GIT binary patch'):
 self.state = PATCH
 self.binary = True
@@ -301,13 +305,17 @@ class GitDiffCheck:
 if self.binary:
 pass
 if line.startswith('-'):
+self.line_src -= 1
+self.line_delta -= 1
 pass
 elif line.startswith('+'):
+self.line_delta += 1
 self.check_added_line(line[1:])
 elif line.startswith(r'\ No newline '):
 pass
 elif not line.startswith(' '):
 self.format_error("unexpected patch line")
+self.line_src += 1
 self.line_num += 1
 
 pre_patch_prefixes = (
@@ -335,8 +343,8 @@ class GitDiffCheck:
 def added_line_error(self, msg, line):
 lines = [ msg ]
 if self.hunk_filename is not None:
-lines.append('File: ' + self.hunk_filename)
-lines.append('Line: ' + line)
+lines.append('File : ' + self.hunk_filename)
+lines.append('Line %4d: %s' %(self.line_src, line))
 
 self.error(*lines)
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/3] IntelFsp2Pkg: Add missing modules in Package DSC

2016-07-14 Thread Liming Gao
Package DSC is used to verify the module source build.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 IntelFsp2Pkg/IntelFsp2Pkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
index 3b50bbf..61eb6f1 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
@@ -65,6 +65,8 @@
   IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
   IntelFsp2Pkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf
   IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
+  IntelFsp2Pkg/Library/BaseDebugDeviceLibNull/BaseDebugDeviceLibNull.inf
+  IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf
 
   IntelFsp2Pkg/FspSecCore/FspSecCoreT.inf
   IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/3] IntelFsp2WrapperPkg: Add missing modules in Package DSC

2016-07-14 Thread Liming Gao
Package DSC is used to verify the module source build.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc 
b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
index 70541c8..8292030 100644
--- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
+++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
@@ -75,10 +75,17 @@
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
 
 [Components.Ia32]
+  
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/BaseFspWrapperApiTestLibNull.inf
+  
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf
+  
IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/PeiFspWrapperHobProcessLibSample.inf
+  
IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/PeiFspWrapperApiTestLib.inf
+
   IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
   IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf
 
 [Components.IA32, Components.X64]
+  IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
+  
IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/BaseFspWrapperPlatformLibSample.inf
   IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf
 
 [PcdsFixedAtBuild.common]
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/3] IntelFsp2Pkg IntelFsp2WrapperPkg: Add the missing modules in DSC

2016-07-14 Thread Liming Gao
Package DSC is used to verify the module source build.

Liming Gao (3):
  IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample:Update code to
pass build
  IntelFsp2WrapperPkg: Add missing modules in Package DSC
  IntelFsp2Pkg: Add missing modules in Package DSC

 IntelFsp2Pkg/IntelFsp2Pkg.dsc   |  2 ++
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc |  7 +++
 .../FspWrapperPlatformSecLibSample.c|  2 ++
 .../SecFspWrapperPlatformSecLibSample.inf   |  4 +++-
 .../SecFspWrapperPlatformSecLibSample/SecTempRamDone.c  | 13 +
 5 files changed, 19 insertions(+), 9 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] (no subject)

2016-07-14 Thread Liming Gao
Package DSC is used to verify the module source build.

Liming Gao (3):
  IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample:Update code to
pass build
  IntelFsp2WrapperPkg: Add missing modules in Package DSC
  IntelFsp2Pkg: Add missing modules in Package DSC

 IntelFsp2Pkg/IntelFsp2Pkg.dsc   |  2 ++
 IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc |  7 +++
 .../FspWrapperPlatformSecLibSample.c|  2 ++
 .../SecFspWrapperPlatformSecLibSample.inf   |  4 +++-
 .../SecFspWrapperPlatformSecLibSample/SecTempRamDone.c  | 13 +
 5 files changed, 19 insertions(+), 9 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/3] IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample:Update code to pass build

2016-07-14 Thread Liming Gao
1. Update its library class to PlatformSecLib
2. Update source code to refer to the matched header file

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../FspWrapperPlatformSecLibSample.c|  2 ++
 .../SecFspWrapperPlatformSecLibSample.inf   |  4 +++-
 .../SecFspWrapperPlatformSecLibSample/SecTempRamDone.c  | 13 +
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c
index 19379c2..697381e 100644
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c
+++ 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c
@@ -18,6 +18,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 /**
   This interface conveys state information out of the Security (SEC) phase 
into PEI.
diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf
index bcb76b8..dfa5c15 100644
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf
+++ 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecFspWrapperPlatformSecLibSample.inf
@@ -23,7 +23,7 @@
   FILE_GUID  = 8F1AC44A-CE7E-4E29-95BB-92E321BB1573
   MODULE_TYPE= SEC
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = FspWrapperPlatformSecLib
+  LIBRARY_CLASS  = PlatformSecLib
 
 #
 # The following information is for reference only and not required by the 
build tools.
@@ -68,6 +68,8 @@
 [LibraryClasses]
   LocalApicLib
   SerialPortLib
+  DebugLib
+  BaseMemoryLib
 
 [Ppis]
   gEfiSecPlatformInformationPpiGuid   ## CONSUMES
diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c
index 76d2f42..b7a6227 100644
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c
+++ 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c
@@ -14,14 +14,11 @@
 
 #include 
 
-#include 
-
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 
 /**
 This interface disables temporary memory in SEC Phase.
@@ -43,8 +40,8 @@ SecPlatformDisableTemporaryMemory (
 
   DEBUG((DEBUG_INFO, "SecPlatformDisableTemporaryMemory enter\n"));
 
-  TempRamExitParam = GetTempRamExitParam ();
-  Status = CallTempRamExit (FspHeader, TempRamExitParam);
+  TempRamExitParam = UpdateTempRamExitParam ();
+  Status = CallTempRamExit (TempRamExitParam);
   DEBUG((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status));
   ASSERT_EFI_ERROR(Status);
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdePkg BaseLib: Add the missing nasm source file InternalSwitchStack.nasm

2016-07-14 Thread Liming Gao
BaseLib Ia32 InternalSwitchStack.S has no matched InternalSwitchStack.nasm.
Use ObjDump to verify the output object files be same.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 MdePkg/Library/BaseLib/BaseLib.inf |  3 +-
 .../Library/BaseLib/Ia32/InternalSwitchStack.nasm  | 47 ++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index 46a8c86..1ffe870 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Base Library implementation.
 #
-#  Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
 #  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
 #
@@ -410,6 +410,7 @@
   Ia32/InternalSwitchStack.c | MSFT
   Ia32/InternalSwitchStack.c | INTEL
   Ia32/InternalSwitchStack.S | GCC
+  Ia32/InternalSwitchStack.nasm | GCC
   Ia32/Non-existing.c
   Unaligned.c
   X86WriteIdtr.c
diff --git a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm 
b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm
new file mode 100644
index 000..3da341c
--- /dev/null
+++ b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.nasm
@@ -0,0 +1,47 @@
+;--
+;
+; Copyright (c) 2016, Intel Corporation. All rights reserved.
+; Portions copyright (c) 2011, Apple Inc. All rights reserved.
+; This program and the accompanying materials
+; are licensed and made available under the terms and conditions of the BSD 
License
+; which accompanies this distribution.  The full text of the license may be 
found at
+; http://opensource.org/licenses/bsd-license.php.
+;
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+;
+; Module Name:
+;
+;   InternalSwitchStack.nasm
+;
+; Abstract:
+;
+;   Implementation of a stack switch on IA-32.
+;
+;--
+
+SECTION .text
+
+;--
+; VOID
+; EFIAPI
+; InternalSwitchStack (
+;   IN  SWITCH_STACK_ENTRY_POINT  EntryPoint,
+;   IN  VOID  *Context1,   OPTIONAL
+;   IN  VOID  *Context2,   OPTIONAL
+;   IN  VOID  *NewStack
+;   );
+;--
+global ASM_PFX(InternalSwitchStack)
+ASM_PFX(InternalSwitchStack):
+  push  ebp
+  mov   ebp, esp
+
+  mov   esp, [ebp + 20]; switch stack
+  sub   esp, 8
+  mov   eax, [ebp + 16]
+  mov   [esp + 4], eax
+  mov   eax, [ebp + 12]
+  mov   [esp], eax
+  push  0  ; keeps gdb from unwinding stack
+  jmp   dword [ebp + 8]; call and never return
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] IntelFsp2WrapperPkg: Remove unused header files from Fspm and Fsps WrapperPeim

2016-07-13 Thread Liming Gao
PlatformSecLib.h is not used and removed.

Cc: Giri P Mudusuru <giri.p.mudus...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c | 1 -
 IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c 
b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index c98513e..0f6a7bd 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c 
b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
index c923690..1701b63 100644
--- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 1/5] SecurityPkg SecureBootConfigDxe: Add check for the external PE/COFF image.

2016-07-13 Thread Liming Gao
Use BasePeCoffLib PeCoffLoaderGetImageInfo() to check the PE/COFF image.

In V2, add specific ImageRead() to make sure the PE/COFF image content
read is within the image buffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Reviewed-by: Jiewen Yao <jiewen@intel.com>
Reviewed-by: Chao Zhang <chao.b.zh...@intel.com>
---
 SecurityPkg/SecurityPkg.dsc|  2 +
 .../SecureBootConfigDxe/SecureBootConfigDxe.inf|  1 +
 .../SecureBootConfigDxe/SecureBootConfigImpl.c | 70 ++
 .../SecureBootConfigDxe/SecureBootConfigImpl.h |  1 +
 4 files changed, 74 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 1960b52..21cac78 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -32,10 +32,12 @@
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
 
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
index 6b143f5..fa7c39d 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
@@ -56,10 +56,11 @@
   DebugLib
   HiiLib
   PlatformSecureLib
   DevicePathLib
   FileExplorerLib
+  PeCoffLib
 
 [Guids]
   ## SOMETIMES_CONSUMES  ## Variable:L"CustomMode"
   ## SOMETIMES_PRODUCES  ## Variable:L"CustomMode"
   gEfiCustomModeEnableGuid
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
index 3f80441..0d96185 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
@@ -1608,10 +1608,58 @@ ON_EXIT:
 
   return IsFound;
 }
 
 /**
+  Reads contents of a PE/COFF image in memory buffer.
+
+  Caution: This function may receive untrusted input.
+  PE/COFF image is external input, so this function will make sure the PE/COFF 
image content
+  read is within the image buffer.
+
+  @param  FileHandle  Pointer to the file handle to read the PE/COFF image.
+  @param  FileOffset  Offset into the PE/COFF image to begin the read 
operation.
+  @param  ReadSizeOn input, the size in bytes of the requested read 
operation.
+  On output, the number of bytes actually read.
+  @param  Buffer  Output buffer that contains the data read from the 
PE/COFF image.
+
+  @retval EFI_SUCCESS The specified portion of the PE/COFF image was read 
and the size
+**/
+EFI_STATUS
+EFIAPI
+SecureBootConfigImageRead (
+  IN VOID*FileHandle,
+  IN UINTN   FileOffset,
+  IN OUT UINTN   *ReadSize,
+  OUTVOID*Buffer
+  )
+{
+  UINTN   EndPosition;
+
+  if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  if (MAX_ADDRESS - FileOffset < *ReadSize) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  EndPosition = FileOffset + *ReadSize;
+  if (EndPosition > mImageSize) {
+*ReadSize = (UINT32)(mImageSize - FileOffset);
+  }
+
+  if (FileOffset >= mImageSize) {
+*ReadSize = 0;
+  }
+
+  CopyMem (Buffer, (UINT8 *)((UINTN) FileHandle + FileOffset), *ReadSize);
+
+  return EFI_SUCCESS;
+}
+
+/**
   Load PE/COFF image information into internal buffer and check its validity.
 
   @retval   EFI_SUCCESS Successful
   @retval   EFI_UNSUPPORTED Invalid PE/COFF file
   @retval   EFI_ABORTED Serious error occurs, like file I/O error etc.
@@ -1623,13 +1671,32 @@ LoadPeImage (
   )
 {
   EFI_IMAGE_DOS_HEADER  *DosHdr;
   EFI_IMAGE_NT_HEADERS32*NtHeader32;
   EFI_IMAGE_NT_HEADERS64*NtHeader64;
+  PE_COFF_LOADER_IMAGE_CONTEXT  ImageContext;
+  EFI_STATUSStatus;
 
   NtHeader32 = NULL;
   NtHeader64 = NULL;
+
+  ZeroMem (, sizeof (Im

[edk2] [PATCH v2 0/5] SecurityPkg: Add check for the external PE/COFF image

2016-07-13 Thread Liming Gao
External PE/COFF image may not be valid and cause memory corruption. 
These patches uses PeCoffLib PeCoffLoaderGetImageInfo() to check the PE format.
If this API has been used to check PE format, the addtional comments will 
be added to describe PE image has been checked. 

In V2, add specific ImageRead() to make sure the PE/COFF image content
read is within the image buffer.
Liming Gao (5):
  SecurityPkg SecureBootConfigDxe: Add check for the external PE/COFF
image.
  SecurityPkg TrEEDxe: Add check for the PE/COFF image.
  SecurityPkg Tcg2Dxe: Add check for the PE/COFF image
  SecurityPkg DxeImageVerificationLib: Add comments in HashPeImage()
  SecurityPkg DxeTpmMeasureBootLib: Add comments in TcgMeasurePeImage()

 .../DxeImageVerificationLib.c  |  5 +-
 .../DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c|  5 +-
 SecurityPkg/SecurityPkg.dsc|  2 +
 SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c| 72 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c  |  2 +
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf|  1 +
 SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c| 72 +-
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c  |  2 +
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf|  1 +
 .../SecureBootConfigDxe/SecureBootConfigDxe.inf|  1 +
 .../SecureBootConfigDxe/SecureBootConfigImpl.c | 70 +
 .../SecureBootConfigDxe/SecureBootConfigImpl.h |  1 +
 12 files changed, 230 insertions(+), 4 deletions(-)

-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 5/5] SecurityPkg DxeTpmMeasureBootLib: Add comments in TcgMeasurePeImage()

2016-07-13 Thread Liming Gao
The input PeImage in TcgMeasurePeImage() has been checked.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c 
b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
index 25788b8..8ab60d8 100644
--- a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
+++ b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
@@ -13,11 +13,11 @@
   data structure within this image buffer before use.
 
   TcgMeasureGptTable() function will receive untrusted GPT partition table, 
and parse
   partition data carefully.
 
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
 http://opensource.org/licenses/bsd-license.php
 
@@ -277,10 +277,13 @@ TcgMeasureGptTable (
 
   Caution: This function may receive untrusted input.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image has been checked by BasePeCoffLib 
PeCoffLoaderGetImageInfo() in 
+  its caller function DxeTpmMeasureBootHandler().
+
   @param[in] TcgProtocolPointer to the located TCG protocol instance.
   @param[in] ImageAddress   Start address of image buffer.
   @param[in] ImageSize  Image size
   @param[in] LinkTimeBase   Address that the image is loaded into memory.
   @param[in] ImageType  Image subsystem type.
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 2/5] SecurityPkg TrEEDxe: Add check for the PE/COFF image.

2016-07-13 Thread Liming Gao
Use BasePeCoffLib PeCoffLoaderGetImageInfo() to check the PE/COFF image.

In V2, add specific ImageRead() to make sure the PE/COFF image content
read is within the image buffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Reviewed-by: Jiewen Yao <jiewen@intel.com>
Reviewed-by: Chao Zhang <chao.b.zh...@intel.com>
---
 SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c | 72 -
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c   |  2 +
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf |  1 +
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c 
b/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
index e80e029..b20fc70 100644
--- a/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
+++ b/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
@@ -4,11 +4,11 @@
   Caution: This file requires additional review when modified.
   This driver will have external input - PE/COFF image.
   This external input must be validated carefully to avoid security issue like
   buffer overflow, integer overflow.
 
-Copyright (c) 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
 http://opensource.org/licenses/bsd-license.php
 
@@ -27,18 +27,70 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #include 
 
+UINTN  mTrEEDxeImageSize = 0;
+
+/**
+  Reads contents of a PE/COFF image in memory buffer.
+
+  Caution: This function may receive untrusted input.
+  PE/COFF image is external input, so this function will make sure the PE/COFF 
image content
+  read is within the image buffer.
+
+  @param  FileHandle  Pointer to the file handle to read the PE/COFF image.
+  @param  FileOffset  Offset into the PE/COFF image to begin the read 
operation.
+  @param  ReadSizeOn input, the size in bytes of the requested read 
operation.
+  On output, the number of bytes actually read.
+  @param  Buffer  Output buffer that contains the data read from the 
PE/COFF image.
+
+  @retval EFI_SUCCESS The specified portion of the PE/COFF image was read 
and the size
+**/
+EFI_STATUS
+EFIAPI
+TrEEDxeImageRead (
+  IN VOID*FileHandle,
+  IN UINTN   FileOffset,
+  IN OUT UINTN   *ReadSize,
+  OUTVOID*Buffer
+  )
+{
+  UINTN   EndPosition;
+
+  if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  if (MAX_ADDRESS - FileOffset < *ReadSize) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  EndPosition = FileOffset + *ReadSize;
+  if (EndPosition > mTrEEDxeImageSize) {
+*ReadSize = (UINT32)(mTrEEDxeImageSize - FileOffset);
+  }
+
+  if (FileOffset >= mTrEEDxeImageSize) {
+*ReadSize = 0;
+  }
+
+  CopyMem (Buffer, (UINT8 *)((UINTN) FileHandle + FileOffset), *ReadSize);
+
+  return EFI_SUCCESS;
+}
+
 /**
   Measure PE image into TPM log based on the authenticode image hashing in
   PE/COFF Specification 8.0 Appendix A.
 
   Caution: This function may receive untrusted input.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
+
   @param[in]  PCRIndex   TPM PCR index
   @param[in]  ImageAddress   Start address of image buffer.
   @param[in]  ImageSize  Image size
   @param[out] DigestList Digeest list of this image.
 
@@ -67,19 +119,37 @@ MeasurePeImageAndExtend (
   UINT16   Magic;
   EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;
   UINT32   NumberOfRvaAndSizes;
   UINT32   CertSize;
   HASH_HANDLE  HashHandle;
+  PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
 
   HashHandle = 0x; // Know bad value
 
   Status= EFI_UNSUPPORTED;
   SectionHeader = NULL;
 
   //
   // Check PE/COFF image
   //
+  ZeroMem (, sizeof (ImageContext));
+  ImageContext.Handle= (VOID *) (UINTN) ImageAddress;
+  mTrEEDxeImageSize  = ImageSize;
+  ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) TrEEDxeImageRead;
+
+  //
+  // Get information about the image being loaded
+  //
+  Status = PeCoffLoaderGetImageInfo ();
+  if (EFI_ERROR (Status)) {
+//
+// The information can't be got from the invalid PeImage
+//
+DEBUG ((DEBUG_INFO, "TreeDxe: PeImage invalid. Cannot retrieve image 
information.\n"));
+goto Finish;
+  }
+
   DosHdr = (EFI_IMAGE_DOS_HEADER *) (UINTN) ImageAddress;
   PeCoffHeaderOffset = 0;
   if (DosHdr->e_magic == EFI_IMAGE_

[edk2] [PATCH v2 4/5] SecurityPkg DxeImageVerificationLib: Add comments in HashPeImage()

2016-07-13 Thread Liming Gao
The input PeImage in HashPeImage() has been checked.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Reviewed-by: Jiewen Yao <jiewen@intel.com>
Reviewed-by: Chao Zhang <chao.b.zh...@intel.com>
---
 .../Library/DxeImageVerificationLib/DxeImageVerificationLib.c| 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c 
b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
index 3aef1af..7b7e6af 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
@@ -273,15 +273,18 @@ GetImageType (
 }
 
 /**
   Calculate hash of Pe/Coff image based on the authenticode image hashing in
   PE/COFF Specification 8.0 Appendix A
-
+  
   Caution: This function may receive untrusted input.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image has been checked by BasePeCoffLib 
PeCoffLoaderGetImageInfo() in 
+  its caller function DxeImageVerificationHandler().
+
   @param[in]HashAlg   Hash algorithm type.
 
   @retval TRUESuccessfully hash image.
   @retval FALSE   Fail in hash image.
 
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 3/5] SecurityPkg Tcg2Dxe: Add check for the PE/COFF image

2016-07-13 Thread Liming Gao
Use BasePeCoffLib PeCoffLoaderGetImageInfo() to check the PE/COFF image.

In V2, add specific ImageRead() to make sure the PE/COFF image content
read is within the image buffer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Reviewed-by: Jiewen Yao <jiewen@intel.com>
Reviewed-by: Chao Zhang <chao.b.zh...@intel.com>
---
 SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c | 72 -
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c   |  2 +
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf |  1 +
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c 
b/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c
index e2d763a..de55ed9 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c
@@ -4,11 +4,11 @@
   Caution: This file requires additional review when modified.
   This driver will have external input - PE/COFF image.
   This external input must be validated carefully to avoid security issue like
   buffer overflow, integer overflow.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
 http://opensource.org/licenses/bsd-license.php
 
@@ -27,18 +27,70 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #include 
 
+UINTN  mTcg2DxeImageSize = 0;
+
+/**
+  Reads contents of a PE/COFF image in memory buffer.
+
+  Caution: This function may receive untrusted input.
+  PE/COFF image is external input, so this function will make sure the PE/COFF 
image content
+  read is within the image buffer.
+
+  @param  FileHandle  Pointer to the file handle to read the PE/COFF image.
+  @param  FileOffset  Offset into the PE/COFF image to begin the read 
operation.
+  @param  ReadSizeOn input, the size in bytes of the requested read 
operation.
+  On output, the number of bytes actually read.
+  @param  Buffer  Output buffer that contains the data read from the 
PE/COFF image.
+
+  @retval EFI_SUCCESS The specified portion of the PE/COFF image was read 
and the size
+**/
+EFI_STATUS
+EFIAPI
+Tcg2DxeImageRead (
+  IN VOID*FileHandle,
+  IN UINTN   FileOffset,
+  IN OUT UINTN   *ReadSize,
+  OUTVOID*Buffer
+  )
+{
+  UINTN   EndPosition;
+
+  if (FileHandle == NULL || ReadSize == NULL || Buffer == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  if (MAX_ADDRESS - FileOffset < *ReadSize) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  EndPosition = FileOffset + *ReadSize;
+  if (EndPosition > mTcg2DxeImageSize) {
+*ReadSize = (UINT32)(mTcg2DxeImageSize - FileOffset);
+  }
+
+  if (FileOffset >= mTcg2DxeImageSize) {
+*ReadSize = 0;
+  }
+
+  CopyMem (Buffer, (UINT8 *)((UINTN) FileHandle + FileOffset), *ReadSize);
+
+  return EFI_SUCCESS;
+}
+
 /**
   Measure PE image into TPM log based on the authenticode image hashing in
   PE/COFF Specification 8.0 Appendix A.
 
   Caution: This function may receive untrusted input.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
+
   @param[in]  PCRIndex   TPM PCR index
   @param[in]  ImageAddress   Start address of image buffer.
   @param[in]  ImageSize  Image size
   @param[out] DigestList Digeest list of this image.
 
@@ -67,19 +119,37 @@ MeasurePeImageAndExtend (
   UINT16   Magic;
   EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;
   UINT32   NumberOfRvaAndSizes;
   UINT32   CertSize;
   HASH_HANDLE  HashHandle;
+  PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
 
   HashHandle = 0x; // Know bad value
 
   Status= EFI_UNSUPPORTED;
   SectionHeader = NULL;
 
   //
   // Check PE/COFF image
   //
+  ZeroMem (, sizeof (ImageContext));
+  ImageContext.Handle= (VOID *) (UINTN) ImageAddress;
+  mTcg2DxeImageSize  = ImageSize;
+  ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) Tcg2DxeImageRead;
+
+  //
+  // Get information about the image being loaded
+  //
+  Status = PeCoffLoaderGetImageInfo ();
+  if (EFI_ERROR (Status)) {
+//
+// The information can't be got from the invalid PeImage
+//
+DEBUG ((DEBUG_INFO, "Tcg2Dxe: PeImage invalid. Cannot retrieve image 
information.\n"));
+goto Finish;
+  }
+
   DosHdr = (EFI_IMAGE_DOS_HEADER *) (UINTN) ImageAddress;
   PeCoffHeaderOffset = 0;
   if (DosHdr->e_magic == EFI_IMAGE_

[edk2] [Patch] SecurityPkg DxeTpmMeasureBootLib: Add comments in TcgMeasurePeImage()

2016-07-12 Thread Liming Gao
The input PeImage in TcgMeasurePeImage() has been checked.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c 
b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
index 25788b8..8ab60d8 100644
--- a/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
+++ b/SecurityPkg/Library/DxeTpmMeasureBootLib/DxeTpmMeasureBootLib.c
@@ -13,11 +13,11 @@
   data structure within this image buffer before use.
 
   TcgMeasureGptTable() function will receive untrusted GPT partition table, 
and parse
   partition data carefully.
 
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
 http://opensource.org/licenses/bsd-license.php
 
@@ -277,10 +277,13 @@ TcgMeasureGptTable (
 
   Caution: This function may receive untrusted input.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image has been checked by BasePeCoffLib 
PeCoffLoaderGetImageInfo() in 
+  its caller function DxeTpmMeasureBootHandler().
+
   @param[in] TcgProtocolPointer to the located TCG protocol instance.
   @param[in] ImageAddress   Start address of image buffer.
   @param[in] ImageSize  Image size
   @param[in] LinkTimeBase   Address that the image is loaded into memory.
   @param[in] ImageType  Image subsystem type.
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/4] SecurityPkg: Add check for the external PE/COFF image

2016-07-12 Thread Liming Gao
External PE/COFF image may not be valid and cause memory corruption. 
These patches uses PeCoffLib PeCoffLoaderGetImageInfo() to check the PE format.
If this API has been used to check PE format, the addtional comments will 
be added to describe PE image has been checked. 

Liming Gao (4):
  SecurityPkg SecureBootConfigDxe: Add check for the external PE/COFF
image.
  SecurityPkg TrEEDxe: Add check for the PE/COFF image.
  SecurityPkg Tcg2Dxe: Add check for the PE/COFF image
  SecurityPkg DxeImageVerificationLib: Add comments in HashPeImage()

 .../DxeImageVerificationLib.c  |  5 -
 SecurityPkg/SecurityPkg.dsc|  2 ++
 SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c| 22 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c  |  2 ++
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf|  1 +
 SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c| 22 +-
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c  |  2 ++
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf|  1 +
 .../SecureBootConfigDxe/SecureBootConfigDxe.inf|  1 +
 .../SecureBootConfigDxe/SecureBootConfigImpl.c | 22 ++
 .../SecureBootConfigDxe/SecureBootConfigImpl.h |  1 +
 11 files changed, 78 insertions(+), 3 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 3/4] SecurityPkg Tcg2Dxe: Add check for the PE/COFF image

2016-07-12 Thread Liming Gao
Use BasePeCoffLib PeCoffLoaderGetImageInfo() to check the PE/COFF image.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c | 22 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c   |  2 ++
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c 
b/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c
index e2d763a..5cdb15e 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/MeasureBootPeCoff.c
@@ -6,7 +6,7 @@
   This external input must be validated carefully to avoid security issue like
   buffer overflow, integer overflow.
 
-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
@@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 
 /**
   Measure PE image into TPM log based on the authenticode image hashing in
@@ -37,6 +38,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
+
   @param[in]  PCRIndex   TPM PCR index
   @param[in]  ImageAddress   Start address of image buffer.
   @param[in]  ImageSize  Image size
@@ -69,6 +72,7 @@ MeasurePeImageAndExtend (
   UINT32   NumberOfRvaAndSizes;
   UINT32   CertSize;
   HASH_HANDLE  HashHandle;
+  PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
 
   HashHandle = 0x; // Know bad value
 
@@ -78,6 +82,22 @@ MeasurePeImageAndExtend (
   //
   // Check PE/COFF image
   //
+  ZeroMem (, sizeof (ImageContext));
+  ImageContext.Handle= (VOID *) (UINTN) ImageAddress;
+  ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) 
PeCoffLoaderImageReadFromMemory;
+
+  //
+  // Get information about the image being loaded
+  //
+  Status = PeCoffLoaderGetImageInfo ();
+  if (EFI_ERROR (Status)) {
+//
+// The information can't be got from the invalid PeImage
+//
+DEBUG ((DEBUG_INFO, "Tcg2Dxe: PeImage invalid. Cannot retrieve image 
information.\n"));
+goto Finish;
+  }
+
   DosHdr = (EFI_IMAGE_DOS_HEADER *) (UINTN) ImageAddress;
   PeCoffHeaderOffset = 0;
   if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c 
b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index 7720c27..95219c0 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -127,6 +127,8 @@ EFI_HANDLE mImageHandle;
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
+
   @param[in]  PCRIndex   TPM PCR index
   @param[in]  ImageAddress   Start address of image buffer.
   @param[in]  ImageSize  Image size
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf 
b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
index fd120e5..6b4c15f 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
@@ -59,6 +59,7 @@
   PerformanceLib
   ReportStatusCodeLib
   Tcg2PhysicalPresenceLib
+  PeCoffLib
 
 [Guids]
   ## SOMETIMES_CONSUMES ## Variable:L"SecureBoot"
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/4] SecurityPkg SecureBootConfigDxe: Add check for the external PE/COFF image.

2016-07-12 Thread Liming Gao
Use BasePeCoffLib PeCoffLoaderGetImageInfo() to check the PE/COFF image.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 SecurityPkg/SecurityPkg.dsc|  2 ++
 .../SecureBootConfigDxe/SecureBootConfigDxe.inf|  1 +
 .../SecureBootConfigDxe/SecureBootConfigImpl.c | 22 ++
 .../SecureBootConfigDxe/SecureBootConfigImpl.h |  1 +
 4 files changed, 26 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 1960b52..21cac78 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -34,6 +34,8 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
 
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
index 6b143f5..fa7c39d 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
@@ -58,6 +58,7 @@
   PlatformSecureLib
   DevicePathLib
   FileExplorerLib
+  PeCoffLib
 
 [Guids]
   ## SOMETIMES_CONSUMES  ## Variable:L"CustomMode"
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
index 3f80441..7eb050f 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
@@ -1625,9 +1625,28 @@ LoadPeImage (
   EFI_IMAGE_DOS_HEADER  *DosHdr;
   EFI_IMAGE_NT_HEADERS32*NtHeader32;
   EFI_IMAGE_NT_HEADERS64*NtHeader64;
+  PE_COFF_LOADER_IMAGE_CONTEXT  ImageContext;
+  EFI_STATUSStatus;
 
   NtHeader32 = NULL;
   NtHeader64 = NULL;
+
+  ZeroMem (, sizeof (ImageContext));
+  ImageContext.Handle= (VOID *) mImageBase;
+  ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) 
PeCoffLoaderImageReadFromMemory;
+
+  //
+  // Get information about the image being loaded
+  //
+  Status = PeCoffLoaderGetImageInfo ();
+  if (EFI_ERROR (Status)) {
+//
+// The information can't be got from the invalid PeImage
+//
+DEBUG ((DEBUG_INFO, "SecureBootConfigDxe: PeImage invalid. \n"));
+return Status;
+  }
+
   //
   // Read the Dos header
   //
@@ -1689,6 +1708,9 @@ LoadPeImage (
   Calculate hash of Pe/Coff image based on the authenticode image hashing in
   PE/COFF Specification 8.0 Appendix A
 
+  Notes: PE/COFF image has been checked by BasePeCoffLib 
PeCoffLoaderGetImageInfo() in 
+  the function LoadPeImage ().
+
   @param[in]HashAlg   Hash algorithm type.
 
   @retval TRUESuccessfully hash image.
diff --git 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
index 0a09ab4..5055a9e 100644
--- 
a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
+++ 
b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.h
@@ -40,6 +40,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/4] SecurityPkg DxeImageVerificationLib: Add comments in HashPeImage()

2016-07-12 Thread Liming Gao
The input PeImage in HashPeImage() has been checked.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Library/DxeImageVerificationLib/DxeImageVerificationLib.c| 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c 
b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
index 3aef1af..7b7e6af 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
@@ -275,11 +275,14 @@ GetImageType (
 /**
   Calculate hash of Pe/Coff image based on the authenticode image hashing in
   PE/COFF Specification 8.0 Appendix A
-
+  
   Caution: This function may receive untrusted input.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image has been checked by BasePeCoffLib 
PeCoffLoaderGetImageInfo() in 
+  its caller function DxeImageVerificationHandler().
+
   @param[in]HashAlg   Hash algorithm type.
 
   @retval TRUESuccessfully hash image.
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/4] SecurityPkg TrEEDxe: Add check for the PE/COFF image.

2016-07-12 Thread Liming Gao
Use BasePeCoffLib PeCoffLoaderGetImageInfo() to check the PE/COFF image.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Chao Zhang <chao.b.zh...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c | 22 +-
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c   |  2 ++
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c 
b/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
index e80e029..23d3f60 100644
--- a/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
+++ b/SecurityPkg/Tcg/TrEEDxe/MeasureBootPeCoff.c
@@ -6,7 +6,7 @@
   This external input must be validated carefully to avoid security issue like
   buffer overflow, integer overflow.
 
-Copyright (c) 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
@@ -28,6 +28,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 
 /**
   Measure PE image into TPM log based on the authenticode image hashing in
@@ -37,6 +38,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
+
   @param[in]  PCRIndex   TPM PCR index
   @param[in]  ImageAddress   Start address of image buffer.
   @param[in]  ImageSize  Image size
@@ -69,6 +72,7 @@ MeasurePeImageAndExtend (
   UINT32   NumberOfRvaAndSizes;
   UINT32   CertSize;
   HASH_HANDLE  HashHandle;
+  PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
 
   HashHandle = 0x; // Know bad value
 
@@ -78,6 +82,22 @@ MeasurePeImageAndExtend (
   //
   // Check PE/COFF image
   //
+  ZeroMem (, sizeof (ImageContext));
+  ImageContext.Handle= (VOID *) (UINTN) ImageAddress;
+  ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) 
PeCoffLoaderImageReadFromMemory;
+
+  //
+  // Get information about the image being loaded
+  //
+  Status = PeCoffLoaderGetImageInfo ();
+  if (EFI_ERROR (Status)) {
+//
+// The information can't be got from the invalid PeImage
+//
+DEBUG ((DEBUG_INFO, "TreeDxe: PeImage invalid. Cannot retrieve image 
information.\n"));
+goto Finish;
+  }
+
   DosHdr = (EFI_IMAGE_DOS_HEADER *) (UINTN) ImageAddress;
   PeCoffHeaderOffset = 0;
   if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
diff --git a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c 
b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
index a30cd51..ecafc12 100644
--- a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
+++ b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
@@ -179,6 +179,8 @@ EFI_HANDLE mImageHandle;
   PE/COFF image is external input, so this function will validate its data 
structure
   within this image buffer before use.
 
+  Notes: PE/COFF image is checked by BasePeCoffLib PeCoffLoaderGetImageInfo().
+
   @param[in]  PCRIndex   TPM PCR index
   @param[in]  ImageAddress   Start address of image buffer.
   @param[in]  ImageSize  Image size
diff --git a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf 
b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf
index c22e8f0..2dd038a 100644
--- a/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf
+++ b/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.inf
@@ -58,6 +58,7 @@
   HashLib
   PerformanceLib
   ReportStatusCodeLib
+  PeCoffLib
 
 [Guids]
   ## SOMETIMES_CONSUMES ## Variable:L"SecureBoot"
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] UefiCpuPkg CpuIo2Dxe: Update INF to refer to NASM source file

2016-07-10 Thread Liming Gao
Cc: Jeff Fan <jeff@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf 
b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
index 8af39ff..920ede7 100644
--- a/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
+++ b/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Produces the CPU I/O 2 Protocol by using the services of the I/O Library.
 #
-# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
@@ -33,14 +33,12 @@
   IoFifo.h
   
 [Sources.IA32]
-  Ia32/IoFifo.nasm | GCC
-  Ia32/IoFifo.asm  | MSFT
-  Ia32/IoFifo.asm  | INTEL
+  Ia32/IoFifo.nasm
+  Ia32/IoFifo.asm
 
 [Sources.X64]
-  X64/IoFifo.nasm  | GCC
-  X64/IoFifo.asm   | MSFT
-  X64/IoFifo.asm   | INTEL
+  X64/IoFifo.nasm
+  X64/IoFifo.asm
 
 [Packages]
   MdePkg/MdePkg.dec
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] UefiCpuPkg Update INF to refer to NASM source file

2016-07-10 Thread Liming Gao
NASM is used as the default assembly source file.

Liming Gao (2):
  UefiCpuPkg CpuIo2Dxe: Update INF to refer to NASM source file
  UefiCpuPkg CpuMpPei: Update INF to refer to NASM source file

 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf | 12 +---
 UefiCpuPkg/CpuMpPei/CpuMpPei.inf   | 10 --
 2 files changed, 9 insertions(+), 13 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] UefiCpuPkg CpuMpPei: Update INF to refer to NASM source file

2016-07-10 Thread Liming Gao
Cc: Jeff Fan <jeff@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
index 445caf9..5f45662 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
+++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
@@ -38,15 +38,13 @@
 
 [Sources.IA32]
   Ia32/MpEqu.inc
-  Ia32/MpFuncs.asm  | MSFT
-  Ia32/MpFuncs.asm  | INTEL
-  Ia32/MpFuncs.nasm | GCC
+  Ia32/MpFuncs.asm
+  Ia32/MpFuncs.nasm
 
 [Sources.X64]
   X64/MpEqu.inc
-  X64/MpFuncs.asm  | MSFT
-  X64/MpFuncs.asm  | INTEL
-  X64/MpFuncs.nasm | GCC
+  X64/MpFuncs.asm
+  X64/MpFuncs.nasm
 
 [Packages]
   MdePkg/MdePkg.dec
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] UefiCpuPkg SecCore: Update SecCore inf to refer to nasmb source

2016-07-10 Thread Liming Gao
Cc: Jeff Fan <jeff@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 UefiCpuPkg/SecCore/SecCore.inf | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/SecCore/SecCore.inf b/UefiCpuPkg/SecCore/SecCore.inf
index bf08a4c..4e598cb 100644
--- a/UefiCpuPkg/SecCore/SecCore.inf
+++ b/UefiCpuPkg/SecCore/SecCore.inf
@@ -7,7 +7,7 @@
 #  protected mode, setup flat memory model, enable temporary memory and
 #  call into SecStartup().
 #
-#  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -39,9 +39,7 @@
   FindPeiCore.c
 
 [Sources.IA32]
-  Ia32/ResetVec.asm16 | MSFT
-  Ia32/ResetVec.asm16 | INTEL
-  Ia32/ResetVec.nasmb | GCC
+  Ia32/ResetVec.nasmb
 
 [Packages]
   MdePkg/MdePkg.dec
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 4/5] IntelFsp2Pkg BaseFspSwitchStackLib: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../BaseFspSwitchStackLib.inf  |  2 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.asm   | 77 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.s | 78 --
 3 files changed, 157 deletions(-)
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s

diff --git 
a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf 
b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
index cef8d68..b3c673a 100644
--- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
+++ b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
@@ -22,12 +22,10 @@
 
 [Sources.IA32]
   FspSwitchStackLib.c
 
 [Sources.IA32]
-  Ia32/Stack.asm
-  Ia32/Stack.s
   Ia32/Stack.nasm
 
 [Packages]
   MdePkg/MdePkg.dec
   IntelFsp2Pkg/IntelFsp2Pkg.dec
diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm 
b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
deleted file mode 100644
index 1efab52..000
--- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-;--
-;
-; Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full text of the license may be 
found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Abstract:
-;
-;   Switch the stack from temporary memory to permenent memory.
-;
-;--
-
-.586p
-.model  flat,C
-.code
-
-;--
-; UINT32
-; EFIAPI
-; Pei2LoaderSwitchStack (
-;   VOID
-;   )
-;--
-EXTERNDEF  C   MeasurePoint:PROC
-Pei2LoaderSwitchStack   PROC C PUBLIC
-xor eax, eax
-jmp FspSwitchStack
-Pei2LoaderSwitchStack   ENDP
-
-;--
-; UINT32
-; EFIAPI
-; Loader2PeiSwitchStack (
-;   VOID
-;   )
-;--
-Loader2PeiSwitchStack   PROC C PUBLIC
-jmp FspSwitchStack
-Loader2PeiSwitchStack   ENDP
-
-;--
-; UINT32
-; EFIAPI
-; FspSwitchStack (
-;   VOID
-;   )
-;--
-EXTERNDEF  C   SwapStack:PROC
-FspSwitchStack   PROC C PUBLIC
-; Save current contexts
-pusheax
-pushfd
-cli
-pushad
-sub esp, 8
-sidtfword ptr [esp]
-
-; Load new stack
-pushesp
-callSwapStack
-mov esp, eax
-
-; Restore previous contexts
-lidtfword ptr [esp]
-add esp, 8
-popad
-popfd
-add esp, 4
-ret
-FspSwitchStack   ENDP
-
-END
diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s 
b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
deleted file mode 100644
index a21a5b6..000
--- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
+++ /dev/null
@@ -1,78 +0,0 @@
-#--
-#
-# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Abstract:
-#
-#   Switch the stack from temporary memory to permenent memory.
-#
-#--
-
-
-#--
-# UINT32
-# EFIAPI
-# Pei2LoaderSwitchStack (
-#   VOID
-#   )
-#--
-ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)
-ASM_PFX(Pei2LoaderSwitchStack):
-x

[edk2] [Patch 5/5] IntelFsp2Pkg SecFspSecPlatformLibNull: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../SecFspSecPlatformLibNull/Ia32/Flat32.asm   | 131 -
 .../Library/SecFspSecPlatformLibNull/Ia32/Flat32.s | 110 -
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.asm   |  51 
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.s |  37 --
 .../SecFspSecPlatformLibNull.inf   |   6 +-
 5 files changed, 1 insertion(+), 334 deletions(-)
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
 delete mode 100644 IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.asm
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.s

diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm 
b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
deleted file mode 100644
index 9f144fc..000
--- a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-;; @file
-;  This is the code that goes from real-mode to protected mode.
-;  It consumes the reset vector, configures the stack.
-;
-; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full text of the license may be 
found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;;
-
-;
-; Define assembler characteristics
-;
-.586p
-.xmm
-.model flat, c
-
-EXTRN   TempRamInitApi:NEAR
-
-.code 
-
-RET_ESI  MACRO
-
-  movdesi, mm7  ; restore ESP from MM7
-  jmp esi
-
-ENDM
-
-;
-; Perform early platform initialization
-;
-SecPlatformInitPROCNEARPUBLIC
-
-  RET_ESI
-
-SecPlatformInitENDP
-
-;
-; Protected mode portion initializes stack, configures cache, and calls C 
entry point
-;
-
-;
-;
-; Procedure:ProtectedModeEntryPoint
-;
-; Input:Executing in 32 Bit Protected (flat) mode
-;   cs: 0-4GB
-;   ds: 0-4GB
-;   es: 0-4GB
-;   fs: 0-4GB
-;   gs: 0-4GB
-;   ss: 0-4GB
-;
-; Output:   This function never returns
-;
-; Destroys:
-;   ecx
-;   edi
-;   esi
-;   esp
-;
-; Description:
-;   Perform any essential early platform initilaisation
-;   Setup a stack
-;
-;
-
-ProtectedModeEntryPoint PROC NEAR C PUBLIC
-  ;
-  ; Dummy function. Consume 2 API to make sure they can be linked.
-  ;
-  mov  eax, TempRamInitApi
-
-  ; Should never return
-  jmp  $
-
-ProtectedModeEntryPoint ENDP
-
-;
-; ROM-based Global-Descriptor Table for the PEI Phase
-;
-align 16
-PUBLIC  BootGdtTable
-
-;
-; GDT[0]: 0x00: Null entry, never used.
-;
-NULL_SELequ $ - GDT_BASE; Selector [0]
-GDT_BASE:
-BootGdtTableDD  0
-DD  0
-;
-; Linear code segment descriptor
-;
-LINEAR_CODE_SEL equ $ - GDT_BASE; Selector [0x8]
-DW  0h  ; limit 0x
-DW  0   ; base 0
-DB  0
-DB  09Bh; present, ring 0, data, 
expand-up, not-writable
-DB  0CFh; page-granular, 32-bit
-DB  0
-;
-; System data segment descriptor
-;
-SYS_DATA_SELequ $ - GDT_BASE; Selector [0x10]
-DW  0h  ; limit 0x
-DW  0   ; base 0
-DB  0
-DB  093h; present, ring 0, data, 
expand-up, not-writable
-DB  0CFh; page-granular, 32-bit
-DB  0
-
-GDT_SIZEEQU $ - BootGDTtable; Size, in bytes
-
-;
-; GDT Descriptor
-;
-GdtDesc:; GDT descriptor
-DW  GDT_SIZE - 1; GDT limit
-DD  OFFSET BootGdtTable ; GDT base address
-
-ProtectedModeEntryLinearAddress   LABEL   FWORD
-ProtectedModeEntryLinearOffsetLABEL   DWORD
-  DD  OFFSET ProtectedModeEntryPoint  ; Offset of our 32 bit code
-  DW  LINEAR_CODE_SEL
-  
-END
diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s 
b/IntelFsp2Pkg/Library/SecFspSecPlatformL

[edk2] [Patch 3/5] IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../BaseFspDebugLibSerialPort.inf  |  2 --
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.asm| 34 --
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.s  | 30 ---
 3 files changed, 66 deletions(-)
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s

diff --git 
a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
index 33e72a6..49adfd8 100644
--- 
a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
+++ 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
@@ -27,12 +27,10 @@
 [Sources]
   DebugLib.c
 
 [Sources.Ia32]
   Ia32/FspDebug.nasm
-  Ia32/FspDebug.asm
-  Ia32/FspDebug.s
 
 [Packages]
   MdePkg/MdePkg.dec
   IntelFsp2Pkg/IntelFsp2Pkg.dec
 
diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
deleted file mode 100644
index 8ac18ec..000
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-;--
-;
-; Copyright (c) 2014, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full text of the license may be 
found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Abstract:
-;
-;   FSP Debug functions
-;
-;--
-
-.386
-.model  flat,C
-.code
-
-;--
-; UINT32 *
-; EFIAPI
-; GetStackFramePointer (
-;   VOID
-;   );
-;--
-GetStackFramePointer  PROC  PUBLIC
-mov eax, ebp
-ret
-GetStackFramePointer  ENDP
-
-END
diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
deleted file mode 100644
index 0f8475f..000
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
+++ /dev/null
@@ -1,30 +0,0 @@
-#--
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Abstract:
-#
-#   FSP Debug functions
-#
-#--
-
-#--
-# UINT32 *
-# EFIAPI
-# GetStackFramePointer (
-#   VOID
-#   )
-#--
-ASM_GLOBAL ASM_PFX(GetStackFramePointer)
-ASM_PFX(GetStackFramePointer):
-mov%ebp, %eax
-ret
-
-
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/5] IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Ia32/PeiCoreEntry.S| 130 
 .../Ia32/PeiCoreEntry.asm  | 140 
 .../Ia32/SecEntry.S| 336 
 .../Ia32/SecEntry.asm  | 353 -
 .../SecFspWrapperPlatformSecLibSample/Ia32/Stack.S |  77 -
 .../Ia32/Stack.asm |  82 -
 .../SecFspWrapperPlatformSecLibSample.inf  |   6 -
 7 files changed, 1124 deletions(-)
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.asm

diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
deleted file mode 100644
index c35f02b..000
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
+++ /dev/null
@@ -1,130 +0,0 @@
-#--
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-#  PeiCoreEntry.S
-#
-# Abstract:
-#
-#   Find and call SecStartup
-#
-#--
-
-ASM_GLOBAL ASM_PFX(CallPeiCoreEntryPoint)
-ASM_PFX(CallPeiCoreEntryPoint):
-  #
-  # Obtain the hob list pointer
-  #
-  movl0x4(%esp), %eax
-  #
-  # Obtain the stack information
-  #   ECX: start of range
-  #   EDX: end of range
-  #
-  movl0x8(%esp), %ecx
-  movl0xC(%esp), %edx
-
-  #
-  # Platform init
-  #
-  pushal
-  pushl %edx
-  pushl %ecx
-  pushl %eax
-  call  ASM_PFX(PlatformInit)
-  popl  %eax
-  popl  %eax
-  popl  %eax
-  popal
-
-  #
-  # Set stack top pointer
-  #
-  movl%edx, %esp
-
-  #
-  # Push the hob list pointer
-  #
-  pushl   %eax
-
-  #
-  # Save the value
-  #   ECX: start of range
-  #   EDX: end of range
-  #
-  movl%esp, %ebp
-  pushl   %ecx
-  pushl   %edx
-
-  #
-  # Push processor count to stack first, then BIST status (AP then BSP)
-  #
-  movl$1, %eax
-  cpuid
-  shr $16, %ebx
-  andl$0x00FF, %ebx
-  cmp $1, %bl
-  jae PushProcessorCount
-
-  #
-  # Some processors report 0 logical processors.  Effectively 0 = 1.
-  # So we fix up the processor count
-  #
-  inc %ebx
-
-PushProcessorCount:
-  pushl   %ebx
-
-  #
-  # We need to implement a long-term solution for BIST capture.  For now, we 
just copy BSP BIST
-  # for all processor threads
-  #
-  xorl%ecx, %ecx
-  movb%bl, %cl
-PushBist:
-  movd%mm0, %eax
-  pushl   %eax
-  loopPushBist
-
-  # Save Time-Stamp Counter
-  movd  %mm5, %eax
-  pushl %eax
-
-  movd  %mm6, %eax
-  pushl %eax
-
-  #
-  # Pass entry point of the PEI core
-  #
-  movl$0xFFE0, %edi
-  pushl   %ds:(%edi)
-
-  #
-  # Pass BFV into the PEI Core
-  #
-  movl$0xFFFC, %edi
-  pushl   %ds:(%edi)
-
-  #
-  # Pass stack size into the PEI Core
-  #
-  movl-4(%ebp), %ecx
-  movl-8(%ebp), %edx
-  pushl   %ecx   # RamBase
-
-  subl%ecx, %edx
-  pushl   %edx   # RamSize
-
-  #
-  # Pass Control into the PEI Core
-  #
-  call ASM_PFX(SecStartup)
diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
deleted file mode 100644
index cd1c7b8..000
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
+++ /dev/null
@@ -1,140 +0,0 @@
-;--
-;
-; Copyright (c) 2014, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available un

[edk2] [Patch 0/5] Remove MASM/GAS from new IntelFsp2Pkg/IntelFps2WrapperPkg

2016-07-08 Thread Liming Gao
After NASM source files are added, MASM/GAS source files will not be kept for
new added modules and packages. IntelFsp2Pkg and IntelFps2WrapperPkg are added 
recently. They can be regarded as new packages. So, these changes remove 
MASM/GAS source files and keep NASM only for these two packages. 

Here, I would like to propose to add NASM only for IA32 and X64 assembly files 
in new modules and packages. If there is the real request for MASM or GAS, 
we can consider to add them later. 

Liming Gao (5):
  IntelFsp2WrapperPkg BaseFspWrapperApiLib: Remove MASM/GAS files
  IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample: Remove MASM/GAS
files
  IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove MASM/GAS files
  IntelFsp2Pkg BaseFspSwitchStackLib: Remove MASM/GAS files
  IntelFsp2Pkg SecFspSecPlatformLibNull: Remove MASM/GAS files

 .../BaseFspDebugLibSerialPort.inf  |   2 -
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.asm|  34 --
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.s  |  30 --
 .../BaseFspSwitchStackLib.inf  |   2 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.asm   |  77 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.s |  78 -
 .../SecFspSecPlatformLibNull/Ia32/Flat32.asm   | 131 
 .../Library/SecFspSecPlatformLibNull/Ia32/Flat32.s | 110 ---
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.asm   |  51 ---
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.s |  37 ---
 .../SecFspSecPlatformLibNull.inf   |   6 +-
 .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |   2 -
 .../Library/BaseFspWrapperApiLib/X64/Thunk64To32.S | 230 --
 .../BaseFspWrapperApiLib/X64/Thunk64To32.asm   | 230 --
 .../Ia32/PeiCoreEntry.S| 130 
 .../Ia32/PeiCoreEntry.asm  | 140 
 .../Ia32/SecEntry.S| 336 
 .../Ia32/SecEntry.asm  | 353 -
 .../SecFspWrapperPlatformSecLibSample/Ia32/Stack.S |  77 -
 .../Ia32/Stack.asm |  82 -
 .../SecFspWrapperPlatformSecLibSample.inf  |   6 -
 21 files changed, 1 insertion(+), 2143 deletions(-)
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
 delete mode 100644 IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.asm
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.s
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.asm

-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/5] IntelFsp2WrapperPkg BaseFspWrapperApiLib: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Giri Mudusuru <giri.p.mudus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |   2 -
 .../Library/BaseFspWrapperApiLib/X64/Thunk64To32.S | 230 -
 .../BaseFspWrapperApiLib/X64/Thunk64To32.asm   | 230 -
 3 files changed, 462 deletions(-)
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.asm

diff --git 
a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf 
b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
index f2cef05..b52cfeb 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
@@ -43,12 +43,10 @@
 [Sources.IA32]
   IA32/DispatchExecute.c
 
 [Sources.X64]
   X64/DispatchExecute.c
-  X64/Thunk64To32.asm
-  X64/Thunk64To32.S
   X64/Thunk64To32.nasm
 
 

 #
 # Package Dependency Section - list of Package files that are required for
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S 
b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
deleted file mode 100644
index b6b5c1a..000
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
+++ /dev/null
@@ -1,230 +0,0 @@
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-# Module Name:
-#
-#Thunk64To32.asm
-#
-# Abstract:
-#
-#   This is the assembly code to transition from long mode to compatibility 
mode to execute 32-bit code and then
-#   transit back to long mode.
-#
-#---
-
-#
-# Procedure:AsmExecute32BitCode
-#
-# Input:None
-#
-# Output:   None
-#
-# Prototype:UINT32
-#   AsmExecute32BitCode (
-# IN UINT64   Function,
-# IN UINT64   Param1,
-# IN UINT64   Param2,
-# IN IA32_DESCRIPTOR  *InternalGdtr
-# );
-#
-#
-# Description:  A thunk function to execute 32-bit code in long mode.
-#
-#
-
-ASM_GLOBAL ASM_PFX(AsmExecute32BitCode)
-ASM_PFX(AsmExecute32BitCode):
-#
-# save IFLAG and disable it
-#
-pushfq
-cli
-
-#
-# save orignal GDTR and CS
-#
-movl%ds, %eax
-push%rax
-movl%cs, %eax
-push%rax
-subq$0x10, %rsp
-sgdt(%rsp)
-#
-# load internal GDT
-#
-lgdt(%r9)
-#
-# Save general purpose register and rflag register
-#
-pushfq
-push%rdi
-push%rsi
-push%rbp
-push%rbx
-
-#
-# save CR3
-#
-movq%cr3, %rax
-movq%rax, %rbp
-
-#
-# Prepare the CS and return address for the transition from 32-bit to 
64-bit mode
-#
-movq$0x10, %rax  # load long mode selector
-shl $32, %rax
-lea ReloadCS(%rip), %r9   #Assume the ReloadCS is under 4G
-orq %r9, %rax
-push%rax
-#
-# Save parameters for 32-bit function call
-#
-movq%r8, %rax
-shl $32, %rax
-orq %rdx, %rax
-push%rax
-#
-# save the 32-bit function entry and the return address into stack which 
will be
-# retrieve in compatibility mode.
-#
-lea ReturnBack(%rip), %rax   #Assume the ReloadCS is under 4G
-shl $32, %rax
-orq %rcx, %rax
-push%rax
-
-#
-# let rax save DS
-#
-movq$0x18, %rax
-
-#
-# Change to Compatible Segment
-#
-movq$8, %rcx   # load compatible mode selector
-shl $32, %rcx
-lea Compatible(%rip), %rdx # assume address < 4G
-orq %rdx, %rcx
-push%rcx
-.byte   0xcb# retf
-
-Compatible:
-# reload DS/ES/SS to make sure they are correct referred to current GDT
-movw%ax, %ds
-movw%ax, %es
-movw%ax, %ss
-
-#
-# Disable paging
-#
-movq%c

[edk2] [Patch] IntelFrameworkModulePkg StatusCode RuntimeDxe: Remove duplicated structure.

2016-06-29 Thread Liming Gao
RUNTIME_MEMORY_STATUSCODE_HEADER has been moved into MdeModulePkg public header
file Include/Guid/MemoryStatusCodeRecord.h. It should be removed from the 
driver.

Cc: Cinnamon Shia <cinnamon.s...@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.h   | 9 -
 1 file changed, 9 deletions(-)

diff --git 
a/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.h
 
b/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.h
index 9d0ed19..ae20f5b 100644
--- 
a/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.h
+++ 
b/IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.h
@@ -53,15 +53,6 @@ typedef struct {
 } DATAHUB_STATUSCODE_RECORD;
 
 
-//
-// Runtime memory status code worker definition
-//
-typedef struct {
-  UINT32   RecordIndex;
-  UINT32   NumberOfRecords;
-  UINT32   MaxRecordsNumber;
-} RUNTIME_MEMORY_STATUSCODE_HEADER;
-
 extern RUNTIME_MEMORY_STATUSCODE_HEADER  *mRtMemoryStatusCodeTable;
 
 /**
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] PcAtChipsetPkg: Update ResetSystemLib with PCDs for Reset Control Register and Value

2016-06-23 Thread Liming Gao
Liming Gao (2):
  PcAtChipsetPkg: Add two PCDs for Reset Control Register and Value
  PcAtChipsetPkg: Update ResetSystemLib with PCDs

 PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c   |  6 +++---
 PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf |  6 +-
 PcAtChipsetPkg/PcAtChipsetPkg.dec|  8 
 PcAtChipsetPkg/PcAtChipsetPkg.uni| 15 +++
 4 files changed, 31 insertions(+), 4 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] PcAtChipsetPkg: Add two PCDs for Reset Control Register and Value

2016-06-23 Thread Liming Gao
PcdResetControlRegister for Reset Control Register address.
PcdResetControlValueColdReset for Reset Control Register code reset value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 PcAtChipsetPkg/PcAtChipsetPkg.dec |  8 
 PcAtChipsetPkg/PcAtChipsetPkg.uni | 15 +++
 2 files changed, 23 insertions(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec 
b/PcAtChipsetPkg/PcAtChipsetPkg.dec
index cbd5707..b0b2b62 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
@@ -173,5 +173,13 @@
   # @Prompt ACPI IO Port Base Address Mask
   gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoPortBaseAddressMask 
|0xFFFE|UINT16|0x0018
 
+  ## Reset Control Register address in I/O space.
+  # @Prompt Reset Control Register address
+  gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlRegister|0x64|UINT64|0x0019
+
+  ## 8bit Reset Control Register value for cold reset.
+  # @Prompt Reset Control Register value for cold reset
+  
gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlValueColdReset|0xFE|UINT8|0x001A
+
 [UserExtensions.TianoCore."ExtraFiles"]
   PcAtChipsetPkgExtra.uni
diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.uni 
b/PcAtChipsetPkg/PcAtChipsetPkg.uni
index 87f9396..530e9ae 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.uni
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.uni
@@ -141,3 +141,18 @@
 
 #string STR_gPcAtChipsetPkgTokenSpaceGuid_ERR_8001  #language en-US 
"Invalid value provided."
 
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdResetControlRegister_PROMPT
+#language en-US
+"Reset Control Register address"
+
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdResetControlRegister_HELP
+#language en-US
+"Reset Control Register address in I/O space."
+
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdResetControlValueColdReset_PROMPT
+#language en-US
+"Reset Control Register value for cold reset"
+
+#string STR_gPcAtChipsetPkgTokenSpaceGuid_PcdResetControlValueColdReset_HELP
+#language en-US
+"8bit Reset Control Register value for cold reset."
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] PcAtChipsetPkg: Update ResetSystemLib with PCDs

2016-06-23 Thread Liming Gao
Update ResetSystemLib with PCDs for Reset Control Register and Value
instead of hard code 0x64 and 0xFE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c   | 6 +++---
 PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf | 6 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
index 6a9dd71..b3b2efb 100644
--- a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -1,7 +1,7 @@
 /** @file
   Reset System Library functions for PCAT platforms
 
-  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -32,7 +32,7 @@ ResetCold (
   VOID
   )
 {
-  IoWrite8 (0x64, 0xfe);
+  IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 
(PcdResetControlValueColdReset));
 }
 
 /**
@@ -48,7 +48,7 @@ ResetWarm (
   VOID
   )
 {
-  IoWrite8 (0x64, 0xfe);
+  IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 
(PcdResetControlValueColdReset));
 }
 
 /**
diff --git a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf 
b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
index c994827..2384efa 100644
--- a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #   Library instance for ResetSystem library class for PCAT systems
 #
-#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
 #  which accompanies this distribution.  The full text of the license may be 
found at
@@ -32,8 +32,12 @@
 
 [Packages]
   MdePkg/MdePkg.dec
+  PcAtChipsetPkg/PcAtChipsetPkg.dec
 
 [LibraryClasses]
   DebugLib
   IoLib
 
+[Pcd]
+  gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlRegister## CONSUMES
+  gPcAtChipsetPkgTokenSpaceGuid.PcdResetControlValueColdReset  ## CONSUMES
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/2] SecurityPkg: Update PlatformSecureLibNull with PCD to get physical presence.

2016-06-23 Thread Liming Gao
This is an incompatible change. It uses PcdUserPhysicalPresence value instead
of hard code TRUE. Because PcdUserPhysicalPresence default value is FALSE,
this patch changes UserPhysicalPresent() return value from TRUE to FALSE.

>From Security point, it is not safe to always return TRUE. If user wants this
behavior, he can still configure PcdUserPhysicalPresence value to TRUE in
the platform DSC file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 .../PlatformSecureLibNull/PlatformSecureLibNull.c  | 29 --
 .../PlatformSecureLibNull.inf  |  9 +--
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c 
b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
index 1450ac4..8dc07ec 100644
--- a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
+++ b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.c
@@ -4,7 +4,7 @@
   related features during platform enabling and development. It should be 
replaced
   by a platform-specific method(e.g. Button pressed) in a real platform for 
product.
 
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
 This program and the accompanying materials 
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at 
@@ -15,6 +15,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 **/
 
+BOOLEAN   mUserPhysicalPresence  = FALSE;
+
 /**
 
   This function provides a platform-specific method to detect whether the 
platform
@@ -38,5 +40,28 @@ UserPhysicalPresent (
   VOID
   )
 {
-  return TRUE;
+  return mUserPhysicalPresence;  
+}
+
+
+/**
+  Save user physical presence state from a PCD to mUserPhysicalPresence.
+
+  @param  ImageHandle   ImageHandle of the loaded driver.
+  @param  SystemTable   Pointer to the EFI System Table.
+
+  @retval  EFI_SUCCESS  PcdUserPhysicalPresence is got successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformSecureLibNullConstructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+
+  mUserPhysicalPresence = PcdGetBool(PcdUserPhysicalPresence);
+
+  return EFI_SUCCESS;
 }
diff --git 
a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf 
b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
index 7a5229d..be415f4 100644
--- a/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
+++ b/SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
@@ -6,7 +6,7 @@
 #  related features during platform enabling and development. It should be 
replaced
 #  by a platform-specific method(e.g. Button pressed) in a real platform for 
product.
 #
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution. The full text of the license may be 
found at
@@ -24,7 +24,7 @@
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = PlatformSecureLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_DRIVER
-
+  CONSTRUCTOR= PlatformSecureLibNullConstructor
 
 #
 # The following information is for reference only and not required by the 
build tools.
@@ -37,3 +37,8 @@
 
 [Packages]
   MdePkg/MdePkg.dec
+  SecurityPkg/SecurityPkg.dec
+
+[Pcd]
+  gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence## CONSUMES
+
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/2] SecurityPkg: Add PcdUserPhysicalPresence to indicate use physical presence.

2016-06-23 Thread Liming Gao
This PCD supports all configuration type. Its default value is FALSE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 SecurityPkg/SecurityPkg.dec | 6 ++
 SecurityPkg/SecurityPkg.uni | 9 +
 2 files changed, 15 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.dec b/SecurityPkg/SecurityPkg.dec
index a9da5a6..f4f4d19 100644
--- a/SecurityPkg/SecurityPkg.dec
+++ b/SecurityPkg/SecurityPkg.dec
@@ -414,6 +414,12 @@
   # @Prompt Length(in bytes) of the TCG2 Final event log area.
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2FinalLogAreaLen|0x8000|UINT32|0x00010018
 
+  ## Indicate whether a physical presence user exist.
+  # When it is configured to Dynamic or DynamicEx, it can be set through 
detection using 
+  # a platform-specific method (e.g. Button pressed) in a actual platform in 
early boot phase.
+  # @Prompt A physical presence user status
+  
gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|FALSE|BOOLEAN|0x00010019
+
 [PcdsDynamic, PcdsDynamicEx]
 
   ## This PCD indicates Hash mask for TPM 2.0.
diff --git a/SecurityPkg/SecurityPkg.uni b/SecurityPkg/SecurityPkg.uni
index 432a77b..17a6842 100644
--- a/SecurityPkg/SecurityPkg.uni
+++ b/SecurityPkg/SecurityPkg.uni
@@ -205,3 +205,12 @@
 
 #string 
STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcgPhysicalPresenceInterfaceVer_HELP  
#language en-US "Null-terminated string of the Version of Physical Presence 
interface supported by platform."
 
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdUserPhysicalPresence_PROMPT
+#language en-US
+"A physical presence user status"
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdUserPhysicalPresence_HELP
+#language en-US
+"Indicate whether a physical presence user exist. "
+"When it is configured to Dynamic or DynamicEx, it can be set through 
detection using "
+"a platform-specific method (e.g. Button pressed) in a actual platform in 
early boot phase."
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 0/2] Update PlatformSecureLibNull with PCD to get user physical presence

2016-06-23 Thread Liming Gao
Liming Gao (2):
  SecurityPkg: Add PcdUserPhysicalPresence to indicate use physical
presence.
  SecurityPkg: Update PlatformSecureLibNull with PCD to get physical
presence.

 .../PlatformSecureLibNull/PlatformSecureLibNull.c  | 29 --
 .../PlatformSecureLibNull.inf  |  9 +--
 SecurityPkg/SecurityPkg.dec|  6 +
 SecurityPkg/SecurityPkg.uni|  9 +++
 4 files changed, 49 insertions(+), 4 deletions(-)

-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] MdeModulePkg: Remove NORETURN for PeiCore() and DxeMain() function

2016-06-22 Thread Liming Gao
PeiCore EntryPoint library _ModuleEntryPoint() will call PeiCore(), then call
CpuDeadLoop (). When NORETURN is added for PeiCore(), MSVC compiler will report
warning C4702: unreachable code for CpuDeadLoop (). And, the warning is treated
as error and cause build break. DxeMain() has the similar issue.

edk2 uses EntryPoint library to wrap every module entry point function except
for SEC. The module entry point is still called by _ModuleEntryPoint(). So,
there will be negative impact to add NORETURN for the module entry point.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Cc: Marvin Haeuser <marvin.haeu...@outlook.com>
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 1 -
 MdeModulePkg/Core/Pei/PeiMain.h | 1 -
 MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 1 -
 3 files changed, 3 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index 8380fd7..21cd61a 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -235,7 +235,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED 
EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLEgLoa
 
 **/
 VOID
-NORETURN
 EFIAPI
 DxeMain (
   IN  VOID *HobStart
diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h
index 54331da..2498320 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.h
+++ b/MdeModulePkg/Core/Pei/PeiMain.h
@@ -315,7 +315,6 @@ typedef struct {
 
 **/
 VOID
-NORETURN
 EFIAPI
 PeiCore (
   IN CONST EFI_SEC_PEI_HAND_OFF*SecCoreData,
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c 
b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index 59fdd26..956200f 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -136,7 +136,6 @@ ShadowPeiCore (
 
 **/
 VOID
-NORETURN
 EFIAPI
 PeiCore (
   IN CONST EFI_SEC_PEI_HAND_OFF*SecCoreDataPtr,
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 000/351] Convert EDK II core packages to NASM for IA32/X64

2016-06-15 Thread Liming Gao
These patches are available in https://github.com/lgao4/edk2.git nasm-v1. 
The nasm-v1 branch sha1 is 42bec457c575b6cb7c9fc1730cbea263ffce7b1c

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>

These patches base on previous patches in 
http://thread.gmane.org/gmane.comp.bios.tianocore.devel/10977. 
New changes in these patches includes: 
1. Keep ASM, GAS and NASM all. User can configure BUILDRULEORDER to specify 
   which one will be used. 
2. Add NASM in new modules from UefiCpuPkg, IntelFsp2Pkg and 
IntelFsp2WrapperPkg.
3. Use 16bit and 32bit assembly code to replace hard code db.

The done test includes:
1. Verify the output obj file from ASM and NASM to make sure the output obj
   have the same disassembly code. 
2. Verify OvmfIa32X64 boot to Shell on VS2015x86. 
3. Verify OVMF X64 when booting to arch linux, and with S3 suspend/resume.

These patches convert these package to use NASM for IA32 & X64
* MdePkg
* MdeModulePkg
* IntelFrameworkModulePkg
* UefiCpuPkg
* SourceLevelDebugPkg
* PcAtChipsetPkg
* IntelFsp2Pkg
* IntelFsp2WrapperPkg

Package maintainers: Could you help review and verify your package? If you find
any issues, please let us know. 

Notes: these patches will cause NASM compiler to be required for all IA32 and 
X64
toolchains with the default tool configuration. 
NASM compiler can be downloaded from http://www.nasm.us/
After download it, please configure NASM_PREFIX env to point to its directory.
For example, I place nasm.exe in C:\nasm directory, then set 
NASM_PREFIX=C:\nasm\

Jordan Justen and Liming Gao (351):
  MdePkg BaseLib: EXTERNDEF=>EXTERN in X64/SetJump
  MdePkg BaseLib Ia32 assembly: Specify DWORD sizes
  MdePkg BaseLib X64: Tag MSFT/INTEL for .asm routines in GccInline.c
  MdePkg BaseLib Ia32/DivU64x64Remainder: Make _@DivRemU64x64 private
  MdePkg BaseLib Thunk16: Add Thunk16 NASM versions for MSFT/INTEL
  MdePkg BaseLib: Remove unused GNU assembly files
  MdePkg BaseLib: Convert Ia32/DivU64x64Remainder.asm to NASM
  MdePkg BaseLib: Convert Ia32/EnablePaging64.asm to NASM
  MdePkg BaseLib: Convert Ia32/RdRand.asm to NASM
  MdePkg BaseLib: Convert Ia32/Wbinvd.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm7.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm6.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm5.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm4.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm3.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm2.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm1.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMm0.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteLdtr.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteIdtr.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteGdtr.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr7.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr6.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr5.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr4.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr3.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr2.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr1.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteDr0.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteCr4.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteCr3.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteCr2.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteCr0.asm to NASM
  MdePkg BaseLib: Convert Ia32/WriteMsr64.asm to NASM
  MdePkg BaseLib: Convert Ia32/SwapBytes64.asm to NASM
  MdePkg BaseLib: Convert Ia32/SetJump.asm to NASM
  MdePkg BaseLib: Convert Ia32/RRotU64.asm to NASM
  MdePkg BaseLib: Convert Ia32/RShiftU64.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadPmc.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadTsc.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadLdtr.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadIdtr.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadGdtr.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadTr.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadSs.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadGs.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadFs.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadEs.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadDs.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadCs.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMsr64.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm7.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm6.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm5.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm4.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm3.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm2.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm1.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadMm0.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadEflags.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadDr7.asm to NASM
  MdePkg BaseLib: Convert Ia32/ReadDr6.asm to NASM
  MdePkg BaseLib: Convert Ia32/

[edk2] [Patch] BaseTools: Fix GenFds issue to wrongly get file without postfix.

2016-05-20 Thread Liming Gao
GenFds GenSection will search the output file based on the file extension.
If the output file has no extension, it should be skip.

Cc: Andrew Fish <af...@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming@intel.com>
---
 BaseTools/Source/Python/GenFds/Section.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/Section.py 
b/BaseTools/Source/Python/GenFds/Section.py
index fc25447..942dd5c 100644
--- a/BaseTools/Source/Python/GenFds/Section.py
+++ b/BaseTools/Source/Python/GenFds/Section.py
@@ -154,7 +154,7 @@ class Section (SectionClassObject):
 Tuple = os.walk(FfsInf.EfiOutputPath)
 for Dirpath, Dirnames, Filenames in Tuple:
 for F in Filenames:
-if os.path.splitext(F)[1] in (Suffix):
+if os.path.splitext(F)[1] == Suffix:
 FullName = os.path.join(Dirpath, F)
 if os.path.getmtime(FullName) > 
os.path.getmtime(Makefile):
 FileList.append(FullName)
-- 
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


<    1   2   3   4   5   >