[edk2] reg: Clarification required on ISCSI Initiator Implementation

2018-08-29 Thread Sivaraman Nainar
Hello All,

As per the current ISCSI implementation there is only one Initiator name 
maintained even when there are multiple MAC and attempts are made from an UEFI 
system.

Is there history behind not allowing to change the Initiator Name specific to 
MAC ?

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


[edk2] [Patch] BaseTools: Involve Dec default value to calculate Maxsize

2018-08-29 Thread BobCF
Involve Dec default value to calculate Maxsize for structure PCD

Cc: Bob Feng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 9 +
 1 file changed, 9 insertions(+)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 88465c59ea..32d202de5e 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -91,10 +91,19 @@ class PcdClassObject(object):
 return max([len(self.PcdValueFromComm)-2+1, MaxSize])
 elif self.PcdValueFromComm.startswith("L\""):
 return max([2*(len(self.PcdValueFromComm)-3+1), MaxSize])
 else:
 return max([len(self.PcdValueFromComm), MaxSize])
+if hasattr(self, "DefaultValueFromDec"):
+if self.DefaultValueFromDec.startswith("{") and 
self.DefaultValueFromDec.endswith("}"):
+return max([len(self.DefaultValueFromDec.split(",")), MaxSize])
+elif self.DefaultValueFromDec.startswith("\"") or 
self.DefaultValueFromDec.startswith("\'"):
+return max([len(self.DefaultValueFromDec)-2+1, MaxSize])
+elif self.DefaultValueFromDec.startswith("L\""):
+return max([2*(len(self.DefaultValueFromDec)-3+1), MaxSize])
+else:
+return max([len(self.DefaultValueFromDec), MaxSize])
 return MaxSize
 
 ## Get the number of bytes
 def GetPcdSize(self):
 if self.DatumType in TAB_PCD_NUMERIC_TYPES:
-- 
2.16.2.windows.1

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


Re: [edk2] [PATCH v2 0/9] Quality improvement for EmulatorPkg Win Host

2018-08-29 Thread Wu, Hao A
The series is good to me.
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu
> Ni
> Sent: Thursday, August 30, 2018 10:02 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2 0/9] Quality improvement for EmulatorPkg Win Host
> 
> The patch sets make Win Host boot in 64 bit, fix all SCT issues
> regarding to console input/output, switch to use MdeModulePkg/Bds.
> 
> v2: 1. Pass PatchChecker.py (VS project files don't pass. I don't want
> to change the default file content because next time when VS
> opens the project again the file content will be restored back)
> 2. Skip the V1 5/10 "Do not zero out file content" because the
> current behavior is already to not zero out file content.
> 3. Always report 57 as CPU address size through CPU HOB.
> 
> Ruiyu Ni (9):
>   EmulatorPkg/EmuGopDxe: Fix TxtInEx.SetState SCT conformance failure
>   EmulatorPkg/EmuGopDxe: Clear screen to black in GOP.SetMode
>   EmulatorPkg/Win: Use FrameBufferBltLib for BLT operation
>   EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState
>   EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 64bit)
>   EmulatorPkg/AutoScanPei: Report the correct CPU address size
>   EmulatorPkg/Win: Add VS2017 project file
>   EmulatorPkg: Use MdeModulePkg/Bds module
>   EmulatorPkg: IoThunk->Close() is called too early, may causing hang
> 
>  EmulatorPkg/AutoScanPei/AutoScanPei.c  |   6 +-
>  EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c |  14 +-
>  EmulatorPkg/EmuGopDxe/GopInput.c   |  11 +-
>  EmulatorPkg/EmuGopDxe/GopScreen.c  |   8 +-
>  .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |  10 +-
>  EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c  |  32 +-
>  EmulatorPkg/EmulatorPkg.dsc|  38 +-
>  EmulatorPkg/EmulatorPkg.fdf|  21 +-
>  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c| 559 
> -
>  EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 435
> 
>  .../BdsPlatform.h => PlatformBmLib/PlatformBm.h}   |  63 ++-
>  .../PlatformBmData.c}  |  13 +-
>  .../PlatformBmLib.inf} |  28 +-
>  .../Library/PlatformBmLib/PlatformBmMemoryTest.c   | 133 +
>  EmulatorPkg/Win/Host/WinBlockIo.c  |   2 +-
>  EmulatorPkg/Win/Host/WinGop.h  |   4 +-
>  EmulatorPkg/Win/Host/WinGopInput.c |  17 +
>  EmulatorPkg/Win/Host/WinGopScreen.c| 218 +++-
>  EmulatorPkg/Win/Host/WinHost.c |   2 +-
>  EmulatorPkg/Win/Host/WinHost.inf   |   1 +
>  EmulatorPkg/Win/VS2017/BuildVS.bat |   3 +
>  EmulatorPkg/Win/VS2017/Win.sln |  25 +
>  EmulatorPkg/Win/VS2017/Win.vcxproj | 120 +
>  EmulatorPkg/Win/VS2017/Win.vcxproj.filters |  50 ++
>  EmulatorPkg/Win/VS2017/Win.vcxproj.user|  13 +
>  25 files changed, 1008 insertions(+), 818 deletions(-)
>  delete mode 100644 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
>  create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
>  rename EmulatorPkg/Library/{EmuBdsLib/BdsPlatform.h =>
> PlatformBmLib/PlatformBm.h} (60%)
>  rename EmulatorPkg/Library/{EmuBdsLib/PlatformData.c =>
> PlatformBmLib/PlatformBmData.c} (77%)
>  rename EmulatorPkg/Library/{EmuBdsLib/EmuBdsLib.inf =>
> PlatformBmLib/PlatformBmLib.inf} (71%)
>  create mode 100644
> EmulatorPkg/Library/PlatformBmLib/PlatformBmMemoryTest.c
>  create mode 100644 EmulatorPkg/Win/VS2017/BuildVS.bat
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.sln
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.filters
>  create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.user
> 
> --
> 2.16.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 2/9] EmulatorPkg/EmuGopDxe: Clear screen to black in GOP.SetMode

2018-08-29 Thread Ruiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1118

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/EmuGopDxe/GopScreen.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/EmulatorPkg/EmuGopDxe/GopScreen.c 
b/EmulatorPkg/EmuGopDxe/GopScreen.c
index 761d945c15..b6d1b6c6c8 100644
--- a/EmulatorPkg/EmuGopDxe/GopScreen.c
+++ b/EmulatorPkg/EmuGopDxe/GopScreen.c
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Portions copyright (c) 2010 - 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
@@ -146,9 +146,9 @@ EmuGopSetMode (
 );
 
 
-  Fill.Red  = 0x7f;
-  Fill.Green= 0x7F;
-  Fill.Blue = 0x7f;
+  Fill.Red   = 0;
+  Fill.Green = 0;
+  Fill.Blue  = 0;
   This->Blt (
   This,
   ,
-- 
2.16.1.windows.1

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


[edk2] [PATCH v2 1/9] EmulatorPkg/EmuGopDxe: Fix TxtInEx.SetState SCT conformance failure

2018-08-29 Thread Ruiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1118

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/EmuGopDxe/GopInput.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/EmulatorPkg/EmuGopDxe/GopInput.c b/EmulatorPkg/EmuGopDxe/GopInput.c
index 1d40b1d7d6..97a5fbc1ad 100644
--- a/EmulatorPkg/EmuGopDxe/GopInput.c
+++ b/EmulatorPkg/EmuGopDxe/GopInput.c
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Portions copyright (c) 2010 0 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
@@ -442,11 +442,20 @@ EmuGopSimpleTextInExSetState (
   EFI_STATUSStatus;
   EFI_TPL   OldTpl;
 
+  if (KeyToggleState == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);
   if (Private->EmuGraphicsWindow == NULL) {
 return EFI_NOT_READY;
   }
 
+  if (((Private->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != 
EFI_TOGGLE_STATE_VALID) ||
+  ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) {
+return EFI_UNSUPPORTED;
+  }
+
   //
   // Enter critical section
   //
-- 
2.16.1.windows.1

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


[edk2] [PATCH v2 5/9] EmulatorPkg/Win: Enable 64bit (SEC, PEI, DXE all run at 64bit)

2018-08-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc   | 6 +-
 EmulatorPkg/Win/Host/WinBlockIo.c | 2 +-
 EmulatorPkg/Win/Host/WinHost.c| 2 +-
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index ee85c9ef64..72e8aa1788 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -22,11 +22,7 @@ [Defines]
   PLATFORM_GUID  = 05FD064D-1073-E844-936C-A0E16317107D
   PLATFORM_VERSION   = 0.3
   DSC_SPECIFICATION  = 0x00010005
-!if $(BUILD_32)
-  OUTPUT_DIRECTORY   = Build/Emulator32
-!else
-  OUTPUT_DIRECTORY   = Build/Emulator
-!endif
+  OUTPUT_DIRECTORY   = Build/Emulator$(ARCH)
 
   SUPPORTED_ARCHITECTURES= X64|IA32
   BUILD_TARGETS  = DEBUG|RELEASE
diff --git a/EmulatorPkg/Win/Host/WinBlockIo.c 
b/EmulatorPkg/Win/Host/WinBlockIo.c
index d5944c4227..bae907c705 100644
--- a/EmulatorPkg/Win/Host/WinBlockIo.c
+++ b/EmulatorPkg/Win/Host/WinBlockIo.c
@@ -24,7 +24,7 @@ typedef struct {
   BOOLEAN Readonly;
 
   HANDLE  NtHandle;
-  UINTN   BlockSize;
+  UINT32  BlockSize;
 
   EFI_BLOCK_IO_MEDIA  *Media;
   EMU_BLOCK_IO_PROTOCOL   EmuBlockIo;
diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c
index 0cf02044c2..9b98d5330f 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -466,7 +466,7 @@ Returns:
 SecPrint ("ERROR : Can not allocate enough space for SecStack\n");
 exit (1);
   }
-  SetMemN (TemporaryRam, TemporaryRamSize, PcdGet32 (PcdInitValueInTempStack));
+  SetMem32 (TemporaryRam, TemporaryRamSize, PcdGet32 
(PcdInitValueInTempStack));
 
   SecPrint ("  OS Emulator passing in %u KB of temp RAM at 0x%08lx to SEC\n",
 TemporaryRamSize / SIZE_1KB,
-- 
2.16.1.windows.1

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


[edk2] [PATCH v2 4/9] EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState

2018-08-29 Thread Ruiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1118

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/Win/Host/WinGopInput.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/EmulatorPkg/Win/Host/WinGopInput.c 
b/EmulatorPkg/Win/Host/WinGopInput.c
index 6c218ab98a..17d35bb52c 100644
--- a/EmulatorPkg/Win/Host/WinGopInput.c
+++ b/EmulatorPkg/Win/Host/WinGopInput.c
@@ -363,6 +363,23 @@ WinNtWndKeySetState (
   GRAPHICS_PRIVATE_DATA   *Private;
 
   Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
+  Private->ScrollLock = FALSE;
+  Private->NumLock = FALSE;
+  Private->CapsLock = FALSE;
+  Private->IsPartialKeySupport = FALSE;
+
+  if ((*KeyToggleState & EFI_SCROLL_LOCK_ACTIVE) == EFI_SCROLL_LOCK_ACTIVE) {
+Private->ScrollLock = TRUE;
+  }
+  if ((*KeyToggleState & EFI_NUM_LOCK_ACTIVE) == EFI_NUM_LOCK_ACTIVE) {
+Private->NumLock = TRUE;
+  }
+  if ((*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == EFI_CAPS_LOCK_ACTIVE) {
+Private->CapsLock = TRUE;
+  }
+  if ((*KeyToggleState & EFI_KEY_STATE_EXPOSED) == EFI_KEY_STATE_EXPOSED) {
+Private->IsPartialKeySupport = TRUE;
+  }
   Private->KeyState.KeyToggleState = *KeyToggleState;
   return EFI_SUCCESS;
 }
-- 
2.16.1.windows.1

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


[edk2] [PATCH v2 8/9] EmulatorPkg: Use MdeModulePkg/Bds module

2018-08-29 Thread Ruiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1120

Logo is enabled by adding a separate core driver LogoDxe.
UiApp and BootManagerMenuApp are added to provide two UIs.

LoadFileOnFv2 is added to auto-install LoadFile protocol for
applications in FV so the boot options for applications can be
auto-created from LoadFile.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc|  31 +-
 EmulatorPkg/EmulatorPkg.fdf|  21 +-
 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c| 559 -
 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 435 
 .../BdsPlatform.h => PlatformBmLib/PlatformBm.h}   |  63 ++-
 .../PlatformBmData.c}  |  13 +-
 .../PlatformBmLib.inf} |  28 +-
 .../Library/PlatformBmLib/PlatformBmMemoryTest.c   | 133 +
 8 files changed, 649 insertions(+), 634 deletions(-)
 delete mode 100644 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
 create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
 rename EmulatorPkg/Library/{EmuBdsLib/BdsPlatform.h => 
PlatformBmLib/PlatformBm.h} (60%)
 rename EmulatorPkg/Library/{EmuBdsLib/PlatformData.c => 
PlatformBmLib/PlatformBmData.c} (77%)
 rename EmulatorPkg/Library/{EmuBdsLib/EmuBdsLib.inf => 
PlatformBmLib/PlatformBmLib.inf} (71%)
 create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBmMemoryTest.c

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 72e8aa1788..78e9a3f1cc 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -79,7 +79,9 @@ [LibraryClasses]
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
-  GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
@@ -90,7 +92,7 @@ [LibraryClasses]
   #
   # Platform
   #
-  PlatformBdsLib|EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf
+  PlatformBootManagerLib|EmulatorPkg/Library/PlatformBmLib/PlatformBmLib.inf
   KeyMapLib|EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf
 
   #
@@ -107,7 +109,6 @@ [LibraryClasses]
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
-  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
@@ -171,13 +172,6 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER, 
LibraryClasses.common.UEFI_DRIVER, Li
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
   TimerLib|EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf
 
-[LibraryClasses.common.UEFI_DRIVER]
-  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-
-[LibraryClasses.common.UEFI_APPLICATION]
-  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
-
-
 [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
@@ -198,6 +192,9 @@ [PcdsFixedAtBuild]
 
   gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize|L"64!64"
 
+  # Change PcdBootManagerMenuFile to UiApp
+  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
+
 !ifndef $(USE_OLD_SHELL)
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 
0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
 !endif
@@ -238,7 +235,7 @@ [PcdsDynamicDefault.common.DEFAULT]
 [PcdsDynamicHii.common.DEFAULT]
   
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Setup"|gEmuSystemConfigGuid|0x0|80
   
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Setup"|gEmuSystemConfigGuid|0x4|25
-
+  
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
 
 [Components]
 !ifdef $(UNIX_SEC_BUILD)
@@ -337,7 +334,17 @@ [Components]
   }
 
   MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
-  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  MdeModulePkg/Logo/LogoDxe.inf
+  

[edk2] [PATCH v2 7/9] EmulatorPkg/Win: Add VS2017 project file

2018-08-29 Thread Ruiyu Ni
Developer can build the Win Host in VS2017 and launch to debug it.
Platform 'x64' is to build 64bit EmulatorWin.
Platform 'Win32' is to build 32bit EmulatorWin.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/Win/VS2017/BuildVS.bat |   3 +
 EmulatorPkg/Win/VS2017/Win.sln |  25 ++
 EmulatorPkg/Win/VS2017/Win.vcxproj | 120 +
 EmulatorPkg/Win/VS2017/Win.vcxproj.filters |  50 
 EmulatorPkg/Win/VS2017/Win.vcxproj.user|  13 
 5 files changed, 211 insertions(+)
 create mode 100644 EmulatorPkg/Win/VS2017/BuildVS.bat
 create mode 100644 EmulatorPkg/Win/VS2017/Win.sln
 create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj
 create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.filters
 create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.user

diff --git a/EmulatorPkg/Win/VS2017/BuildVS.bat 
b/EmulatorPkg/Win/VS2017/BuildVS.bat
new file mode 100644
index 00..83aebc77dc
--- /dev/null
+++ b/EmulatorPkg/Win/VS2017/BuildVS.bat
@@ -0,0 +1,3 @@
+cd ../../../
+@call edksetup.bat
+build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -D WIN_SEC_BUILD %*
diff --git a/EmulatorPkg/Win/VS2017/Win.sln b/EmulatorPkg/Win/VS2017/Win.sln
new file mode 100644
index 00..397c5d9b8b
--- /dev/null
+++ b/EmulatorPkg/Win/VS2017/Win.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2003
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Win", "Win.vcxproj", 
"{B4E1783F-FD72-4214-B0F7-69271BAD5DDF}"
+EndProject
+Global
+   GlobalSection(SolutionConfigurationPlatforms) = preSolution
+   Debug|x64 = Debug|x64
+   Debug|x86 = Debug|x86
+   Release|x64 = Release|x64
+   Release|x86 = Release|x86
+   EndGlobalSection
+   GlobalSection(ProjectConfigurationPlatforms) = postSolution
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Debug|x64.ActiveCfg = 
Debug|x64
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Debug|x64.Build.0 = 
Debug|x64
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Debug|x86.ActiveCfg = 
Debug|Win32
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Debug|x86.Build.0 = 
Debug|Win32
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Release|x64.ActiveCfg = 
Release|x64
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Release|x64.Build.0 = 
Release|x64
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Release|x86.ActiveCfg = 
Release|Win32
+   {B4E1783F-FD72-4214-B0F7-69271BAD5DDF}.Release|x86.Build.0 = 
Release|Win32
+   EndGlobalSection
+EndGlobal
diff --git a/EmulatorPkg/Win/VS2017/Win.vcxproj 
b/EmulatorPkg/Win/VS2017/Win.vcxproj
new file mode 100644
index 00..0f574a8e7f
--- /dev/null
+++ b/EmulatorPkg/Win/VS2017/Win.vcxproj
@@ -0,0 +1,120 @@
+
+http://schemas.microsoft.com/developer/msbuild/2003;>
+  
+
+  Debug
+  Win32
+
+
+  Release
+  Win32
+
+
+  Debug
+  x64
+
+
+  Release
+  x64
+
+  
+  
+15.0
+{B4E1783F-FD72-4214-B0F7-69271BAD5DDF}
+MakeFileProj
+8.1
+  
+  
+  
+Makefile
+true
+v141
+  
+  
+Makefile
+false
+v141
+  
+  
+Makefile
+true
+v141
+  
+  
+Makefile
+true
+v141
+  
+  
+  
+  
+  
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+  
+  
+BuildVS.bat -a IA32
+BuildVS.bat -a IA32 all
+BuildVS.bat -a IA32 clean
+..\..\..\Build\EmulatorIA32\DEBUG_VS2017\
+..\..\..\Build\EmulatorIA32\DEBUG_VS2017\
+
..\..\..\MdePkg\Include;..\..\..\MdePkg\Include\Ia32;..\..\..\MdeModulePkg\Include;..\..\..\EmulatorPkg\Include;$(IncludePath)
+  
+  
+BuildVS.bat -a IA32 -b 
RELEASE
+
+
+BuildVS.bat -a IA32 -b RELEASE 
all
+BuildVS.bat -a IA32 -b RELEASE 
clean
+..\..\..\Build\EmulatorIA32\DEBUG_VS2017\
+..\..\..\Build\EmulatorIA32\DEBUG_VS2017\
+
..\..\..\MdePkg\Include;..\..\..\MdePkg\Include\Ia32;..\..\..\MdeModulePkg\Include;..\..\..\EmulatorPkg\Include;$(IncludePath)
+  
+  
+BuildVS.bat -a X64
+BuildVS.bat -a X64 all
+BuildVS.bat -a X64 clean
+..\..\..\Build\EmulatorX64\DEBUG_VS2017\
+..\..\..\Build\EmulatorX64\DEBUG_VS2017\
+
..\..\..\MdePkg\Include;..\..\..\MdePkg\Include\X64;..\..\..\MdeModulePkg\Include;..\..\..\EmulatorPkg\Include;$(IncludePath)
+  
+  
+BuildVS.bat -a X64 -b 
RELEASE
+BuildVS.bat -a X64 -b RELEASE 
all
+BuildVS.bat -a X64 -b RELEASE 
clean
+..\..\Build\EmulatorX64\DEBUG_VS2017\
+..\..\Build\EmulatorX64\DEBUG_VS2017\
+
..\..\..\MdePkg\Include;..\..\..\MdePkg\Include\X64;..\..\..\MdeModulePkg\Include;..\..\..\EmulatorPkg\Include;$(IncludePath)
+  
+  
+
+
+
+
+
+
+
+  
+  
+
+
+
+  
+  
+
+  
+  
+  

[edk2] [PATCH v2 9/9] EmulatorPkg: IoThunk->Close() is called too early, may causing hang

2018-08-29 Thread Ruiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1121

To produce a EFI_BLOCK_IO_PROTOCOL instance in Emulator platform,
EmulatorPkg defines the EMU_IO_THUNK_PROTOCOL. OS dependent layer
needs to produce this protocol implementation and a generic OS
independent layer consumes this protocol to produce
EFI_BLOCK_IO_PROTOCOL.

EMU_IO_THUNK_PROTOCOL can also be used to abstract the OS dependent
IO operation for other UEFI protocols, e.g.: GOP, SimpleFileSystem
and etc.

It contains two interfaces Open() and Close(). Open() creates the
specific IO instances, e.g. for Block IO access, File System access,
Screen access, etc. Close() destroys the specific IO instances.

Later on the Emulator generic module (e.g.: EmuBlockIoDxe) calls
Open() to create the IO instance in DriverBindingStart() and calls
Close() in DriverBindingStop().
But today's implementation of DriverBindingStop() contains a bug
that it calls Close() before uninstalling the EFI_BLOCK_IO_PROTOCOL.

It's a mistake in code. Take EFI_BLOCK_IO for example,
the uninstallation may cause the upper layer driver that consumes
EFI_BLOCK_IO call BlockIo.Reset(), which consequently calls
EmuBlockIo.Reset(). But the EmuBlockIo instance is already destroyed
by Close() that happens before uninstallation.

So a proper implementation is to call Close() after uninstallation
succeeds.

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Andrew Fish 
Cc: Hao Wu 
---
 EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c | 14 ++
 .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   | 10 ---
 EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c  | 32 --
 3 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c 
b/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c
index b9ac6ce080..47b50a8e05 100644
--- a/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c
+++ b/EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c
@@ -1,6 +1,6 @@
 /**@file
 
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, 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
@@ -662,7 +662,6 @@ EmuBlockIoDriverBindingStop (
   }
 
   Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
-  Status = Private->IoThunk->Close (Private->IoThunk);
 
   Status = gBS->UninstallMultipleProtocolInterfaces (
   Private->EfiHandle,
@@ -677,14 +676,17 @@ EmuBlockIoDriverBindingStop (
 This->DriverBindingHandle,
 Handle
 );
-  }
-
-  if (!EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+//
+// Destroy the IO interface.
+//
+Status = Private->IoThunk->Close (Private->IoThunk);
+ASSERT_EFI_ERROR (Status);
 //
 // Free our instance data
 //
 FreeUnicodeStringTable (Private->ControllerNameTable);
-gBS->FreePool (Private);
+FreePool (Private);
   }
 
   return Status;
diff --git a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c 
b/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c
index b5e19bb840..28abfd6bef 100644
--- a/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c
+++ b/EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c
@@ -866,7 +866,6 @@ EmuSimpleFileSystemDriverBindingStop (
   }
 
   Private = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
-  Status = Private->IoThunk->Close (Private->IoThunk);
 
   //
   // Uninstall the Simple File System Protocol from ControllerHandle
@@ -883,9 +882,12 @@ EmuSimpleFileSystemDriverBindingStop (
 This->DriverBindingHandle,
 ControllerHandle
 );
-  }
-
-  if (!EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+//
+// Destroy the IO interface.
+//
+Status = Private->IoThunk->Close (Private->IoThunk);
+ASSERT_EFI_ERROR (Status);
 //
 // Free our instance data
 //
diff --git a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c 
b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c
index 0031baea52..967da9900a 100644
--- a/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c
+++ b/EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c
@@ -870,6 +870,7 @@ EmuSnpDriverBindingStop (
   EFI_STATUS  Status;
   EMU_SNP_PRIVATE_DATA*Private = NULL;
   EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
+  VOID*EmuIoThunk;
 
   //
   // Complete all outstanding transactions to Controller.
@@ -914,27 +915,42 @@ EmuSnpDriverBindingStop (
   }
 
   Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (Snp);
-  Status = Private->IoThunk->Close (Private->IoThunk);
+  ASSERT (Private->DeviceHandle == ChildHandleBuffer[0]);
+  ASSERT (Private->EfiHandle== ControllerHandle);
 
   Status = gBS->CloseProtocol(
-

[edk2] [PATCH v2 6/9] EmulatorPkg/AutoScanPei: Report the correct CPU address size

2018-08-29 Thread Ruiyu Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1119

Today's implementation reports CPU address size as 36 through CPU
HOB. But when WinHost is running at 64bit, the system memory might
be allocated above 2^36.

It causes system asserts when DxeCore code tries to find the
corresponding GCD entry for a given valid address.

The patch uses 57 as the CPU address size which is maximum linear
address size when 5-level paging is enabled in host OS.

Using 64 seems more proper and a one-time change even 6-level
paging might be invented. But it causes CoreInitializeGcdServices()
assertion on following code:
  Entry->EndAddress = LShiftU64 (1, SizeOfMemorySpace) - 1;
Because LShiftU64 expects SizeOfMemorySpace < 64.

So to be practical, I didn't report 64 and change
CoreInitializeGcdServices().

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/AutoScanPei/AutoScanPei.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/EmulatorPkg/AutoScanPei/AutoScanPei.c 
b/EmulatorPkg/AutoScanPei/AutoScanPei.c
index 78a40db3a2..9316ea549b 100644
--- a/EmulatorPkg/AutoScanPei/AutoScanPei.c
+++ b/EmulatorPkg/AutoScanPei/AutoScanPei.c
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, 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
@@ -101,9 +101,9 @@ Returns:
   } while (!EFI_ERROR (Status));
 
   //
-  // Build the CPU hob with 36-bit addressing and 16-bits of IO space.
+  // Build the CPU hob with 57-bit addressing and 16-bits of IO space.
   //
-  BuildCpuHob (36, 16);
+  BuildCpuHob (57, 16);
 
   return Status;
 }
-- 
2.16.1.windows.1

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


[edk2] [PATCH v2 3/9] EmulatorPkg/Win: Use FrameBufferBltLib for BLT operation

2018-08-29 Thread Ruiyu Ni
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Hao Wu 
Cc: Andrew Fish 
---
 EmulatorPkg/EmulatorPkg.dsc |   1 +
 EmulatorPkg/Win/Host/WinGop.h   |   4 +-
 EmulatorPkg/Win/Host/WinGopScreen.c | 218 
 EmulatorPkg/Win/Host/WinHost.inf|   1 +
 4 files changed, 73 insertions(+), 151 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 9f9f7d318d..ee85c9ef64 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -55,6 +55,7 @@ [LibraryClasses]
   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
   
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
 
   #
   # UEFI & PI
diff --git a/EmulatorPkg/Win/Host/WinGop.h b/EmulatorPkg/Win/Host/WinGop.h
index de27238342..7843b60b91 100644
--- a/EmulatorPkg/Win/Host/WinGop.h
+++ b/EmulatorPkg/Win/Host/WinGop.h
@@ -31,6 +31,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 
 
 //
 // WM_SYSKEYDOWN/WM_SYSKEYUP Notification
@@ -86,9 +87,8 @@ typedef struct {
   // updated in the main thread and displayed in the windows thread.
   //
   BITMAPV4HEADER*VirtualScreenInfo;
-  RGBQUAD   *VirtualScreen;
 
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
+  FRAME_BUFFER_CONFIGURE*FrameBufferConfigure;
 
   //
   // Keyboard Queue used by Simple Text In.
diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c 
b/EmulatorPkg/Win/Host/WinGopScreen.c
index 2ca51d23d0..0e1f1ff205 100644
--- a/EmulatorPkg/Win/Host/WinGopScreen.c
+++ b/EmulatorPkg/Win/Host/WinGopScreen.c
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, 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
@@ -193,64 +193,85 @@ WinNtWndSize (
   IN  UINT32Height
 )
 {
-  UINT32Size;
-  GRAPHICS_PRIVATE_DATA *Private;
-  RECT  Rect;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewFillLine;
+  RETURN_STATUSRStatus;
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION Info;
+  GRAPHICS_PRIVATE_DATA*Private;
+  RECT Rect;
+  BITMAPV4HEADER   *VirtualScreenInfo;
+  FRAME_BUFFER_CONFIGURE   *FrameBufferConfigure;
+  UINTNFrameBufferConfigureSize;
 
   Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
-  Private->Width  = Width;
-  Private->Height = Height;
-
-
-  //
-  // Free the old buffer. We do not save the content of the old buffer since 
the
-  // screen is to be cleared anyway. Clearing the screen is required by the 
EFI spec.
-  // See UEFI spec -EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode()
-  //
-  if (Private->VirtualScreenInfo != NULL) {
-HeapFree (GetProcessHeap (), 0, Private->VirtualScreenInfo);
-  }
 
   //
   // Allocate DIB frame buffer directly from NT for performance enhancement
-  // This buffer is the virtual screen/frame buffer. This buffer is not the
-  // same a a frame buffer. The first row of this buffer will be the bottom
-  // line of the image. This is an artifact of the way we draw to the screen.
+  // This buffer is the virtual screen/frame buffer.
   //
-  Size = Private->Width * Private->Height * sizeof (RGBQUAD) + sizeof 
(BITMAPV4HEADER);
-  Private->VirtualScreenInfo = HeapAlloc (
+  VirtualScreenInfo = HeapAlloc (
 GetProcessHeap (),
 HEAP_ZERO_MEMORY,
-Size
+Width * Height * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER)
   );
+  if (VirtualScreenInfo == NULL) {
+return EFI_OUT_OF_RESOURCES;
+  }
 
   //
   // Update the virtual screen info data structure
+  // Use negative Height to make sure screen/buffer are using the same 
coordinate.
   //
-  Private->VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
-  Private->VirtualScreenInfo->bV4Width = Private->Width;
-  Private->VirtualScreenInfo->bV4Height = Private->Height;
-  Private->VirtualScreenInfo->bV4Planes = 1;
-  Private->VirtualScreenInfo->bV4BitCount = 32;
+  VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
+  VirtualScreenInfo->bV4Width = Width;
+  VirtualScreenInfo->bV4Height = -(LONG)Height;
+  VirtualScreenInfo->bV4Planes = 1;
+  VirtualScreenInfo->bV4BitCount = 32;
   //
   // uncompressed
   //
-  Private->VirtualScreenInfo->bV4V4Compression = BI_RGB;
+  VirtualScreenInfo->bV4V4Compression = BI_RGB;
+
+  Info.HorizontalResolution = Width;
+  Info.VerticalResolution   = Height;
+  Info.PixelFormat  = 

[edk2] [PATCH v2 0/9] Quality improvement for EmulatorPkg Win Host

2018-08-29 Thread Ruiyu Ni
The patch sets make Win Host boot in 64 bit, fix all SCT issues
regarding to console input/output, switch to use MdeModulePkg/Bds.

v2: 1. Pass PatchChecker.py (VS project files don't pass. I don't want
to change the default file content because next time when VS
opens the project again the file content will be restored back)
2. Skip the V1 5/10 "Do not zero out file content" because the
current behavior is already to not zero out file content.
3. Always report 57 as CPU address size through CPU HOB.

Ruiyu Ni (9):
  EmulatorPkg/EmuGopDxe: Fix TxtInEx.SetState SCT conformance failure
  EmulatorPkg/EmuGopDxe: Clear screen to black in GOP.SetMode
  EmulatorPkg/Win: Use FrameBufferBltLib for BLT operation
  EmulatorPkg/Win: ReadKeyStrokeEx() always returns correct KeyState
  EmulatorPkg/Win: Enable 64bit (SEC,PEI,DXE all run at 64bit)
  EmulatorPkg/AutoScanPei: Report the correct CPU address size
  EmulatorPkg/Win: Add VS2017 project file
  EmulatorPkg: Use MdeModulePkg/Bds module
  EmulatorPkg: IoThunk->Close() is called too early, may causing hang

 EmulatorPkg/AutoScanPei/AutoScanPei.c  |   6 +-
 EmulatorPkg/EmuBlockIoDxe/EmuBlockIo.c |  14 +-
 EmulatorPkg/EmuGopDxe/GopInput.c   |  11 +-
 EmulatorPkg/EmuGopDxe/GopScreen.c  |   8 +-
 .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |  10 +-
 EmulatorPkg/EmuSnpDxe/EmuSnpDxe.c  |  32 +-
 EmulatorPkg/EmulatorPkg.dsc|  38 +-
 EmulatorPkg/EmulatorPkg.fdf|  21 +-
 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c| 559 -
 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 435 
 .../BdsPlatform.h => PlatformBmLib/PlatformBm.h}   |  63 ++-
 .../PlatformBmData.c}  |  13 +-
 .../PlatformBmLib.inf} |  28 +-
 .../Library/PlatformBmLib/PlatformBmMemoryTest.c   | 133 +
 EmulatorPkg/Win/Host/WinBlockIo.c  |   2 +-
 EmulatorPkg/Win/Host/WinGop.h  |   4 +-
 EmulatorPkg/Win/Host/WinGopInput.c |  17 +
 EmulatorPkg/Win/Host/WinGopScreen.c| 218 +++-
 EmulatorPkg/Win/Host/WinHost.c |   2 +-
 EmulatorPkg/Win/Host/WinHost.inf   |   1 +
 EmulatorPkg/Win/VS2017/BuildVS.bat |   3 +
 EmulatorPkg/Win/VS2017/Win.sln |  25 +
 EmulatorPkg/Win/VS2017/Win.vcxproj | 120 +
 EmulatorPkg/Win/VS2017/Win.vcxproj.filters |  50 ++
 EmulatorPkg/Win/VS2017/Win.vcxproj.user|  13 +
 25 files changed, 1008 insertions(+), 818 deletions(-)
 delete mode 100644 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c
 create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBm.c
 rename EmulatorPkg/Library/{EmuBdsLib/BdsPlatform.h => 
PlatformBmLib/PlatformBm.h} (60%)
 rename EmulatorPkg/Library/{EmuBdsLib/PlatformData.c => 
PlatformBmLib/PlatformBmData.c} (77%)
 rename EmulatorPkg/Library/{EmuBdsLib/EmuBdsLib.inf => 
PlatformBmLib/PlatformBmLib.inf} (71%)
 create mode 100644 EmulatorPkg/Library/PlatformBmLib/PlatformBmMemoryTest.c
 create mode 100644 EmulatorPkg/Win/VS2017/BuildVS.bat
 create mode 100644 EmulatorPkg/Win/VS2017/Win.sln
 create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj
 create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.filters
 create mode 100644 EmulatorPkg/Win/VS2017/Win.vcxproj.user

-- 
2.16.1.windows.1

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


Re: [edk2] [PATCH v2 00/12] Add WinHost support in EmulatorPkg

2018-08-29 Thread Shia, Cinnamon
Hi Ray,

Does this change mean that Nt32Pkg is going to be retired?

Thanks
Cinnamon Shia

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ruiyu Ni
Sent: Thursday, August 23, 2018 5:56 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2 00/12] Add WinHost support in EmulatorPkg

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

The patch sets add WinHost support (Nt32) in EmulatorPkg.
3 EmulatorPkg common issues were found and fixed.
Other 9 patches are to step-by-step enable the WinHost.

v2 sends to correct mail address.

Ruiyu Ni (12):
  EmulatorPkg/ThunkProtocolList: Fix VS build failure
  EmulatorPkg/Win: Add Windows host support
  EmulatorPkg/Win: Enable source level debugging
  EmulatorPkg/Win: Enable native OS console as firmware console
  EmulatorPkg/Win: Add input/output support
  EmulatorPkg/Win: Add timer and interrupt support
  EmulatorPkg/Win: Add RTC support
  EmulatorPkg/Win: Add SimpleFileSystem support
  EmulatorPkg/Win: Add BlockIo support
  EmulatorPkg/PlatformBds: Signal EndOfDxe in platform BDS
  EmulatorPkg/EmuFileSystem: Fix a bug that causes Close() assertion
  EmulatorPkg/DSC: Remove FS mapping to EDK Shell bin directory

 .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |   33 +-
 EmulatorPkg/EmulatorPkg.dsc|   17 +-
 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c|4 +-
 EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h|4 +-
 EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf|5 +-
 .../Library/ThunkProtocolList/ThunkProtocolList.c  |4 +-
 EmulatorPkg/Win/Host/WinBlockIo.c  |  563 +
 EmulatorPkg/Win/Host/WinFileSystem.c   | 2409 
 EmulatorPkg/Win/Host/WinGop.h  |  204 ++
 EmulatorPkg/Win/Host/WinGopInput.c |  417 
 EmulatorPkg/Win/Host/WinGopScreen.c|  872 +++
 EmulatorPkg/Win/Host/WinHost.c |  947 
 EmulatorPkg/Win/Host/WinHost.h |  209 ++
 EmulatorPkg/Win/Host/WinHost.inf   |  107 +
 EmulatorPkg/Win/Host/WinInclude.h  |   75 +
 EmulatorPkg/Win/Host/WinMemoryAllocationLib.c  |  178 ++
 EmulatorPkg/Win/Host/WinThunk.c|  577 +
 17 files changed, 6614 insertions(+), 11 deletions(-)  create mode 100644 
EmulatorPkg/Win/Host/WinBlockIo.c  create mode 100644 
EmulatorPkg/Win/Host/WinFileSystem.c
 create mode 100644 EmulatorPkg/Win/Host/WinGop.h  create mode 100644 
EmulatorPkg/Win/Host/WinGopInput.c
 create mode 100644 EmulatorPkg/Win/Host/WinGopScreen.c
 create mode 100644 EmulatorPkg/Win/Host/WinHost.c  create mode 100644 
EmulatorPkg/Win/Host/WinHost.h  create mode 100644 
EmulatorPkg/Win/Host/WinHost.inf  create mode 100644 
EmulatorPkg/Win/Host/WinInclude.h  create mode 100644 
EmulatorPkg/Win/Host/WinMemoryAllocationLib.c
 create mode 100644 EmulatorPkg/Win/Host/WinThunk.c

--
2.16.1.windows.1

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


[edk2] Remove EDK package from edk2 master

2018-08-29 Thread Gao, Liming
EDK2 plans to retire EDK style packages. Below BZ requests to remove FatBinPkg, 
EdkShellPkg, EdkShellBinPkg and EdkCompatiblityPkg from edk2 master. They can 
be replaced by Edk2 FatPkg, ShellBinPkg and ShellPkg. UnixPkg is an empty 
package. So, it is also suggested to be removed. But, they are all kept in edk2 
existing branches for reference. Once they are removed, edk2 platform dsc/fdf 
will be updated to use edk2 FatPkg/ShellBinPkg/ShellPkg. If you have any 
comments on this change, please reply to this mail.

1106

EDK2

Code

Remove UnixPkg from 
edk2/master

1105

EDK2

Code

Remove FatBinPkg from 
edk2/master

1107

EDK2

Code

Remove EdkShellPkg from 
edk2/master

1108

EDK2

Code

Remove EdkShellBinPkg from 
edk2/master

1103

EDK2

Code

delete EdkCompatibilityPkg from 
edk2/master


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


Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: change level of DEBUG message

2018-08-29 Thread Wang, Jian J
Laszlo,

Thanks for the comment. I’ll add the info.

Regards,
Jian

From: Laszlo Ersek [mailto:ler...@redhat.com]
Sent: Wednesday, August 29, 2018 9:54 PM
To: Wang, Jian J ; edk2-devel@lists.01.org
Cc: Dong, Eric 
Subject: Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: change level of DEBUG message

On 08/29/18 05:21, Jian J Wang wrote:
> It's reported the debug message in CpuDxe driver is quite annoying in
> boot and shell, and slow down the boot process. To solve this issue,
> this patch changes the DEBUG_INFO to DEBUG_VERBOSE. On a typical Intel
> real platform, at least 16s boot time can be saved.
>
> Cc: Eric Dong mailto:eric.d...@intel.com>>
> Cc: Laszlo Ersek mailto:ler...@redhat.com>>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang 
> mailto:jian.j.w...@intel.com>>
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c   | 2 +-
>  UefiCpuPkg/CpuDxe/CpuPageTable.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index cfd4c415ae..76661cbcd9 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -404,7 +404,7 @@ CpuSetMemoryAttributes (
>// to avoid unnecessary computing.
>//
>if (mIsFlushingGCD) {
> -DEBUG((DEBUG_INFO, "  Flushing GCD\n"));
> +DEBUG((DEBUG_VERBOSE, "  Flushing GCD\n"));
>  return EFI_SUCCESS;
>}
>
> diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c 
> b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> index df021798c0..609df58e3a 100644
> --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> @@ -528,7 +528,7 @@ SplitPage (
>  ASSERT (SplitAttribute == Page4K);
>  if (SplitAttribute == Page4K) {
>NewPageEntry = AllocatePagesFunc (1);
> -  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
> +  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
>if (NewPageEntry == NULL) {
>  return RETURN_OUT_OF_RESOURCES;
>}
> @@ -549,7 +549,7 @@ SplitPage (
>  ASSERT (SplitAttribute == Page2M || SplitAttribute == Page4K);
>  if ((SplitAttribute == Page2M || SplitAttribute == Page4K)) {
>NewPageEntry = AllocatePagesFunc (1);
> -  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
> +  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
>if (NewPageEntry == NULL) {
>  return RETURN_OUT_OF_RESOURCES;
>}
>

Before you push this patch, please add a reference to

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

in the commit message.

With that:

Reviewed-by: Laszlo Ersek mailto:ler...@redhat.com>>

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


[edk2] [PATCH v1 8/9] BaseTools: refactor to not overcreate ModuleAutoGen objects

2018-08-29 Thread Jaben Carsey
currently created for 3 different purposes and saved once.
this makes it created once and saved and then referenced.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 57 +---
 1 file changed, 24 insertions(+), 33 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index b8ee9980ae39..ebc2a202338f 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1085,21 +1085,19 @@ class PlatformAutoGen(AutoGen):
 def GenFdsCommand(self):
 return self.Workspace.GenFdsCommand
 
-## Create makefile for the platform and mdoules in it
+## Create makefile for the platform and modules in it
 #
 #   @param  CreateModuleMakeFileFlag indicating if the makefile for
 #   modules will be created as well
 #
 def CreateMakeFile(self, CreateModuleMakeFile=False, FfsCommand = {}):
 if CreateModuleMakeFile:
-for ModuleFile in self.Platform.Modules:
-Ma = ModuleAutoGen(self.Workspace, ModuleFile, 
self.BuildTarget,
-   self.ToolChain, self.Arch, self.MetaFile)
-if (ModuleFile.File, self.Arch) in FfsCommand:
-Ma.CreateMakeFile(True, FfsCommand[ModuleFile.File, 
self.Arch])
+for Ma in self._MaList:
+key = (Ma.MetaFile.File, self.Arch)
+if key in FfsCommand:
+Ma.CreateMakeFile(True, FfsCommand[key])
 else:
 Ma.CreateMakeFile(True)
-#Ma.CreateAsBuiltInf()
 
 # no need to create makefile for the platform more than once
 if self.IsMakeFileCreated:
@@ -1231,16 +1229,11 @@ class PlatformAutoGen(AutoGen):
 for InfName in self._AsBuildInfList:
 InfName = mws.join(self.WorkspaceDir, InfName)
 FdfModuleList.append(os.path.normpath(InfName))
-for F in self.Platform.Modules.keys():
-M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, 
self.ToolChain, self.Arch, self.MetaFile)
-#GuidValue.update(M.Guids)
-
-self.Platform.Modules[F].M = M
-
+for M in self._MaList:
 for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:
 # make sure that the "VOID*" kind of datum has MaxDatumSize set
 if PcdFromModule.DatumType == TAB_VOID and not 
PcdFromModule.MaxDatumSize:
-NoDatumTypePcdList.add("%s.%s [%s]" % 
(PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))
+NoDatumTypePcdList.add("%s.%s [%s]" % 
(PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, M.MetaFile))
 
 # Check the PCD from Binary INF or Source INF
 if M.IsBinaryModule == True:
@@ -1250,7 +1243,7 @@ class PlatformAutoGen(AutoGen):
 PcdFromModule.IsFromDsc = (PcdFromModule.TokenCName, 
PcdFromModule.TokenSpaceGuidCName) in self.Platform.Pcds
 
 if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or 
PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET:
-if F.Path not in FdfModuleList:
+if M.MetaFile.Path not in FdfModuleList:
 # If one of the Source built modules listed in the DSC 
is not listed
 # in FDF modules, and the INF lists a PCD can only use 
the PcdsDynamic
 # access method (it is only listed in the DEC file 
that declares the
@@ -1930,19 +1923,25 @@ class PlatformAutoGen(AutoGen):
 TokenNumber += 1
 return RetVal
 
+@cached_property
+def _MaList(self):
+for ModuleFile in self.Platform.Modules:
+Ma = ModuleAutoGen(
+  self.Workspace,
+  ModuleFile,
+  self.BuildTarget,
+  self.ToolChain,
+  self.Arch,
+  self.MetaFile
+  )
+ModuleFile.M = Ma
+return [x.M for x in self.Platform.Modules]
+
 ## Summarize ModuleAutoGen objects of all modules to be built for this 
platform
 @cached_property
 def ModuleAutoGenList(self):
 RetVal = []
-for ModuleFile in self.Platform.Modules:
-Ma = ModuleAutoGen(
-self.Workspace,
-ModuleFile,
-self.BuildTarget,
-self.ToolChain,
-self.Arch,
-self.MetaFile
-)
+for Ma in self._MaList:
 if Ma not in RetVal:
 RetVal.append(Ma)
 return RetVal
@@ -1951,15 +1950,7 @@ class PlatformAutoGen(AutoGen):
 @cached_property
 def 

[edk2] [PATCH v1 9/9] BaseTools: refactor to cache InfBuildData data

2018-08-29 Thread Jaben Carsey
use Common.caching and auto cache properties and functions of InfBuildData

Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/InfBuildData.py | 842 +---
 1 file changed, 390 insertions(+), 452 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index adbff3c95ccc..aae03a3d0fc4 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -13,14 +13,14 @@
 #
 
 from __future__ import absolute_import
-from Common.StringUtils import *
 from Common.DataType import *
 from Common.Misc import *
+from Common.caching import cached_property, cached_class_function
 from types import *
 from .MetaFileParser import *
 from collections import OrderedDict
-
 from Workspace.BuildClassObject import ModuleBuildClassObject, 
LibraryClassObject, PcdClassObject
+
 ## Module build information from INF file
 #
 #  This class is used to retrieve information stored in database and convert 
them
@@ -77,9 +77,9 @@ class InfBuildData(ModuleBuildClassObject):
 }
 
 
-## Constructor of DscBuildData
+## Constructor of InfBuildData
 #
-#  Initialize object of DscBuildData
+#  Initialize object of InfBuildData
 #
 #   @param  FilePathThe path of platform description file
 #   @param  RawData The raw data of DSC file
@@ -97,10 +97,37 @@ class InfBuildData(ModuleBuildClassObject):
 self._Target = Target
 self._Toolchain = Toolchain
 self._Platform = TAB_COMMON
-self._SourceOverridePath = None
 if FilePath.Key in GlobalData.gOverrideDir:
 self._SourceOverridePath = GlobalData.gOverrideDir[FilePath.Key]
-self._Clear()
+else:
+self._SourceOverridePath = None
+self._TailComments = None
+self._BaseName = None
+self._DxsFile = None
+self._ModuleType = None
+self._ComponentType = None
+self._BuildType = None
+self._Guid = None
+self._Version = None
+self._PcdIsDriver = None
+self._BinaryModule = None
+self._Shadow = None
+self._MakefileName = None
+self._CustomMakefile = None
+self._Specification = None
+self._LibraryClass = None
+self._ModuleEntryPointList = None
+self._ModuleUnloadImageList = None
+self._ConstructorList = None
+self._DestructorList = None
+self._Defs = OrderedDict()
+self._ProtocolComments = None
+self._PpiComments = None
+self._GuidsUsedByPcd = OrderedDict()
+self._GuidComments = None
+self._PcdComments = None
+self._BuildOptions = None
+self._DependencyFileList = None
 
 ## XXX[key] = value
 def __setitem__(self, key, value):
@@ -114,89 +141,39 @@ class InfBuildData(ModuleBuildClassObject):
 def __contains__(self, key):
 return key in self._PROPERTY_
 
-## Set all internal used members of InfBuildData to None
-def _Clear(self):
-self._HeaderComments = None
-self._TailComments = None
-self._Header_   = None
-self._AutoGenVersion= None
-self._BaseName  = None
-self._DxsFile   = None
-self._ModuleType= None
-self._ComponentType = None
-self._BuildType = None
-self._Guid  = None
-self._Version   = None
-self._PcdIsDriver   = None
-self._BinaryModule  = None
-self._Shadow= None
-self._MakefileName  = None
-self._CustomMakefile= None
-self._Specification = None
-self._LibraryClass  = None
-self._ModuleEntryPointList  = None
-self._ModuleUnloadImageList = None
-self._ConstructorList   = None
-self._DestructorList= None
-self._Defs  = OrderedDict()
-self._Binaries  = None
-self._Sources   = None
-self._LibraryClasses= None
-self._Libraries = None
-self._Protocols = None
-self._ProtocolComments  = None
-self._Ppis  = None
-self._PpiComments   = None
-self._Guids = None
-self._GuidsUsedByPcd= OrderedDict()
-self._GuidComments  = None
-self._Includes  = None
-self._Packages  = None
-self._Pcds  = None
-self._PcdComments   = None
-self._BuildOptions  = None
-self._Depex = None
-

[edk2] [PATCH v1 4/9] BaseTools: refactor class properties

2018-08-29 Thread Jaben Carsey
use decorators and auto cache those that were cached manually
remove properties never used

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Misc.py | 90 +---
 1 file changed, 38 insertions(+), 52 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 5a63c83a2a0c..cb97fbae2a10 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -38,6 +38,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as 
open
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 import uuid
 from CommonDataClass.Exceptions import BadExpression
+from Common.caching import cached_property
 import subprocess
 ## Regular expression used to find out place holders in string template
 gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | 
re.UNICODE)
@@ -1717,8 +1718,6 @@ class PathClass(object):
 self.ToolCode = ToolCode
 self.ToolChainFamily = ToolChainFamily
 
-self._Key = None
-
 ## Convert the object of this class to a string
 #
 #  Convert member Path of the class to a string
@@ -1771,12 +1770,12 @@ class PathClass(object):
 def __hash__(self):
 return hash(self.Path)
 
-def _GetFileKey(self):
-if self._Key is None:
-self._Key = self.Path.upper()   # + self.ToolChainFamily + 
self.TagName + self.ToolCode + self.Target
-return self._Key
+@cached_property
+def Key(self):
+return self.Path.upper()
 
-def _GetTimeStamp(self):
+@property
+def TimeStamp(self):
 return os.stat(self.Path)[8]
 
 def Validate(self, Type='', CaseSensitive=True):
@@ -1815,9 +1814,6 @@ class PathClass(object):
 self.Path = os.path.join(RealRoot, RealFile)
 return ErrorCode, ErrorInfo
 
-Key = property(_GetFileKey)
-TimeStamp = property(_GetTimeStamp)
-
 ## Parse PE image to get the required PE informaion.
 #
 class PeImageClass():
@@ -1927,8 +1923,8 @@ class DefaultStore():
 for sid, name in self.DefaultStores.values():
 if sid == minid:
 return name
+
 class SkuClass():
-
 DEFAULT = 0
 SINGLE = 1
 MULTIPLE =2
@@ -1949,8 +1945,8 @@ class SkuClass():
 self.SkuIdSet = []
 self.SkuIdNumberSet = []
 self.SkuData = SkuIds
-self.__SkuInherit = {}
-self.__SkuIdentifier = SkuIdentifier
+self._SkuInherit = {}
+self._SkuIdentifier = SkuIdentifier
 if SkuIdentifier == '' or SkuIdentifier is None:
 self.SkuIdSet = ['DEFAULT']
 self.SkuIdNumberSet = ['0U']
@@ -1974,7 +1970,7 @@ class SkuClass():
 EdkLogger.error("build", PARAMETER_INVALID,
 ExtraData="SKU-ID [%s] is not supported by the 
platform. [Valid SKU-ID: %s]"
   % (each, " | ".join(SkuIds.keys(
-if self.SkuUsageType != self.SINGLE:
+if self.SkuUsageType != SkuClass.SINGLE:
 self.AvailableSkuIds.update({'DEFAULT':0, 'COMMON':0})
 if self.SkuIdSet:
 GlobalData.gSkuids = (self.SkuIdSet)
@@ -1988,11 +1984,11 @@ class SkuClass():
 GlobalData.gSkuids.sort()
 
 def GetNextSkuId(self, skuname):
-if not self.__SkuInherit:
-self.__SkuInherit = {}
+if not self._SkuInherit:
+self._SkuInherit = {}
 for item in self.SkuData.values():
-self.__SkuInherit[item[1]]=item[2] if item[2] else "DEFAULT"
-return self.__SkuInherit.get(skuname, "DEFAULT")
+self._SkuInherit[item[1]]=item[2] if item[2] else "DEFAULT"
+return self._SkuInherit.get(skuname, "DEFAULT")
 
 def GetSkuChain(self, sku):
 if sku == "DEFAULT":
@@ -2022,55 +2018,45 @@ class SkuClass():
 
 return skuorder
 
-def __SkuUsageType(self):
-
-if self.__SkuIdentifier.upper() == "ALL":
+@property
+def SkuUsageType(self):
+if self._SkuIdentifier.upper() == "ALL":
 return SkuClass.MULTIPLE
 
 if len(self.SkuIdSet) == 1:
 if self.SkuIdSet[0] == 'DEFAULT':
 return SkuClass.DEFAULT
-else:
-return SkuClass.SINGLE
-elif len(self.SkuIdSet) == 2:
-if 'DEFAULT' in self.SkuIdSet:
-return SkuClass.SINGLE
-else:
-return SkuClass.MULTIPLE
-else:
-return SkuClass.MULTIPLE
+return SkuClass.SINGLE
+if len(self.SkuIdSet) == 2 and 'DEFAULT' in self.SkuIdSet:
+return SkuClass.SINGLE
+return SkuClass.MULTIPLE
+
 def DumpSkuIdArrary(self):
-
+if self.SkuUsageType == SkuClass.SINGLE:
+return "{0x0}"
 ArrayStrList = []
-if 

[edk2] [PATCH v1 6/9] BaseTools: refactor Build Database objects

2018-08-29 Thread Jaben Carsey
1) use namedtuple instead of custom class when apropriate
2) rename collections.OrderedDict to OrderedDict since we import it already

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 32 ++--
 1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 88465c59ea30..e7259b2d3d50 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -11,8 +11,8 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
+from collections import OrderedDict, namedtuple
 from Common.DataType import *
-import collections
 
 ## PcdClassObject
 #
@@ -165,17 +165,17 @@ class StructurePcd(PcdClassObject):
 self.StructuredPcdIncludeFile = [] if StructuredPcdIncludeFile is None 
else StructuredPcdIncludeFile
 self.PackageDecs = Packages
 self.DefaultStoreName = [default_store]
-self.DefaultValues = collections.OrderedDict()
+self.DefaultValues = OrderedDict()
 self.PcdMode = None
-self.SkuOverrideValues = collections.OrderedDict()
+self.SkuOverrideValues = OrderedDict()
 self.FlexibleFieldName = None
 self.StructName = None
 self.PcdDefineLineNo = 0
 self.PkgPath = ""
 self.DefaultValueFromDec = ""
 self.ValueChain = set()
-self.PcdFieldValueFromComm = collections.OrderedDict()
-self.PcdFieldValueFromFdf = collections.OrderedDict()
+self.PcdFieldValueFromComm = OrderedDict()
+self.PcdFieldValueFromFdf = OrderedDict()
 def __repr__(self):
 return self.TypeName
 
@@ -189,9 +189,9 @@ class StructurePcd(PcdClassObject):
 self.DefaultValueFromDec = DefaultValue
 def AddOverrideValue (self, FieldName, Value, SkuName, DefaultStoreName, 
FileName="", LineNo=0):
 if SkuName not in self.SkuOverrideValues:
-self.SkuOverrideValues[SkuName] = collections.OrderedDict()
+self.SkuOverrideValues[SkuName] = OrderedDict()
 if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
-self.SkuOverrideValues[SkuName][DefaultStoreName] = 
collections.OrderedDict()
+self.SkuOverrideValues[SkuName][DefaultStoreName] = OrderedDict()
 if FieldName in self.SkuOverrideValues[SkuName][DefaultStoreName]:
 del self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName]
 self.SkuOverrideValues[SkuName][DefaultStoreName][FieldName] = 
[Value.strip(), FileName, LineNo]
@@ -241,21 +241,7 @@ class StructurePcd(PcdClassObject):
 self.PcdFieldValueFromComm = PcdObject.PcdFieldValueFromComm if 
PcdObject.PcdFieldValueFromComm else self.PcdFieldValueFromComm
 self.PcdFieldValueFromFdf = PcdObject.PcdFieldValueFromFdf if 
PcdObject.PcdFieldValueFromFdf else self.PcdFieldValueFromFdf
 
-## LibraryClassObject
-#
-# This Class defines LibraryClassObject used in BuildDatabase
-#
-# @param object:  Inherited from object class
-# @param Name:Input value for LibraryClassName, default is None
-# @param SupModList:  Input value for SupModList, default is []
-#
-# @var LibraryClass:  To store value for LibraryClass
-# @var SupModList:To store value for SupModList
-#
-class LibraryClassObject(object):
-def __init__(self, Name = None, SupModList = []):
-self.LibraryClass = Name
-self.SupModList = SupModList
+LibraryClassObject = namedtuple('LibraryClassObject', 
['LibraryClass','SupModList'], verbose=False)
 
 ## ModuleBuildClassObject
 #
@@ -323,7 +309,7 @@ class ModuleBuildClassObject(object):
 
 self.Binaries= []
 self.Sources = []
-self.LibraryClasses  = collections.OrderedDict()
+self.LibraryClasses  = OrderedDict()
 self.Libraries   = []
 self.Protocols   = []
 self.Ppis= []
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 5/9] BaseTools: Workspace classes refactor properties

2018-08-29 Thread Jaben Carsey
1) use decorators
2) also change some private functions to public when all callers are
external
3) change external callers to use functions instead of directly
accessing private data.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/FfsInfStatement.py  |   4 +-
 BaseTools/Source/Python/Workspace/DecBuildData.py  |  58 +++--
 BaseTools/Source/Python/Workspace/DscBuildData.py  | 151 ++---
 BaseTools/Source/Python/Workspace/InfBuildData.py  | 223 
++--
 BaseTools/Source/Python/Workspace/MetaFileParser.py|  18 +-
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py |  16 +-
 BaseTools/Source/Python/build/build.py |   4 +-
 7 files changed, 234 insertions(+), 240 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py 
b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 56bb966698ad..6149bc81b4ef 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -341,9 +341,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
 self.InfModule = Inf
 self.PcdIsDriver = Inf.PcdIsDriver
 self.IsBinaryModule = Inf.IsBinaryModule
-Inf._GetDepex()
-Inf._GetDepexExpression()
-if len(Inf._Depex.data) > 0 and len(Inf._DepexExpression.data) > 0:
+if len(Inf.Depex.data) > 0 and len(Inf.DepexExpression.data) > 0:
 self.Depex = True
 
 GenFdsGlobalVariable.VerboseLogger("BaseName : %s" % self.BaseName)
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py 
b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 45beaebc63ef..1f74e898f2ef 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -99,21 +99,22 @@ class DecBuildData(PackageBuildClassObject):
 self._CommonIncludes= None
 self._LibraryClasses= None
 self._Pcds  = None
-self.__Macros   = None
+self._MacroDict = None
 self._PrivateProtocols  = None
 self._PrivatePpis   = None
 self._PrivateGuids  = None
 self._PrivateIncludes   = None
 
 ## Get current effective macros
-def _GetMacros(self):
-if self.__Macros is None:
-self.__Macros = {}
-self.__Macros.update(GlobalData.gGlobalDefines)
-return self.__Macros
+@property
+def _Macros(self):
+if self._MacroDict is None:
+self._MacroDict = dict(GlobalData.gGlobalDefines)
+return self._MacroDict
 
 ## Get architecture
-def _GetArch(self):
+@property
+def Arch(self):
 return self._Arch
 
 ## Retrieve all information in [Defines] section
@@ -129,7 +130,8 @@ class DecBuildData(PackageBuildClassObject):
 self._Header = 'DUMMY'
 
 ## Retrieve package name
-def _GetPackageName(self):
+@property
+def PackageName(self):
 if self._PackageName is None:
 if self._Header is None:
 self._GetHeaderInfo()
@@ -138,7 +140,8 @@ class DecBuildData(PackageBuildClassObject):
 return self._PackageName
 
 ## Retrieve file guid
-def _GetFileGuid(self):
+@property
+def PackageName(self):
 if self._Guid is None:
 if self._Header is None:
 self._GetHeaderInfo()
@@ -147,7 +150,8 @@ class DecBuildData(PackageBuildClassObject):
 return self._Guid
 
 ## Retrieve package version
-def _GetVersion(self):
+@property
+def Version(self):
 if self._Version is None:
 if self._Header is None:
 self._GetHeaderInfo()
@@ -156,7 +160,8 @@ class DecBuildData(PackageBuildClassObject):
 return self._Version
 
 ## Retrieve protocol definitions (name/value pairs)
-def _GetProtocol(self):
+@property
+def Protocols(self):
 if self._Protocols is None:
 #
 # tdict is a special kind of dict, used for selecting correct
@@ -198,7 +203,8 @@ class DecBuildData(PackageBuildClassObject):
 return self._Protocols
 
 ## Retrieve PPI definitions (name/value pairs)
-def _GetPpi(self):
+@property
+def Ppis(self):
 if self._Ppis is None:
 #
 # tdict is a special kind of dict, used for selecting correct
@@ -240,7 +246,8 @@ class DecBuildData(PackageBuildClassObject):
 return self._Ppis
 
 ## Retrieve GUID definitions (name/value pairs)
-def _GetGuid(self):
+@property
+def Guids(self):
 if self._Guids is None:
 #
 # tdict is a special kind of dict, used for selecting correct
@@ -282,7 +289,8 @@ class DecBuildData(PackageBuildClassObject):
 return self._Guids
 
 ## Retrieve public include paths declared in this 

[edk2] [PATCH v1 3/9] BaseTools: AutoGen - refactor class properties

2018-08-29 Thread Jaben Carsey
use function decorators

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 55081acbd822..31b98267d4a2 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -454,7 +454,8 @@ cleanlib:
 self.FfsOutputFileList = []
 
 # Compose a dict object containing information used to do replacement in 
template
-def _CreateTemplateDict(self):
+@property
+def _TemplateDict(self):
 if self._FileType not in self._SEP_:
 EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile type 
[%s]" % self._FileType,
 ExtraData="[%s]" % str(self._AutoGenObject))
@@ -1094,8 +1095,6 @@ cleanlib:
 
 return DependencyList
 
-_TemplateDict = property(_CreateTemplateDict)
-
 ## CustomMakefile class
 #
 #  This class encapsules makefie and its generation for module. It uses 
template to generate
@@ -1204,7 +1203,8 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\
 self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]
 
 # Compose a dict object containing information used to do replacement in 
template
-def _CreateTemplateDict(self):
+@property
+def _TemplateDict(self):
 Separator = self._SEP_[self._FileType]
 MyAgo = self._AutoGenObject
 if self._FileType not in MyAgo.CustomMakefile:
@@ -1277,8 +1277,6 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\
 
 return MakefileTemplateDict
 
-_TemplateDict = property(_CreateTemplateDict)
-
 ## PlatformMakefile class
 #
 #  This class encapsules makefie and its generation for platform. It uses
@@ -1395,7 +1393,8 @@ cleanlib:
 self.LibraryMakeCommandList = []
 
 # Compose a dict object containing information used to do replacement in 
template
-def _CreateTemplateDict(self):
+@property
+def _TemplateDict(self):
 Separator = self._SEP_[self._FileType]
 
 MyAgo = self._AutoGenObject
@@ -1480,8 +1479,6 @@ cleanlib:
 DirList.append(os.path.join(self._AutoGenObject.BuildDir, 
LibraryAutoGen.BuildDir))
 return DirList
 
-_TemplateDict = property(_CreateTemplateDict)
-
 ## TopLevelMakefile class
 #
 #  This class encapsules makefie and its generation for entrance makefile. It
@@ -1501,7 +1498,8 @@ class TopLevelMakefile(BuildFile):
 self.IntermediateDirectoryList = []
 
 # Compose a dict object containing information used to do replacement in 
template
-def _CreateTemplateDict(self):
+@property
+def _TemplateDict(self):
 Separator = self._SEP_[self._FileType]
 
 # any platform autogen object is ok because we just need common 
information
@@ -1621,8 +1619,6 @@ class TopLevelMakefile(BuildFile):
 DirList.append(os.path.join(self._AutoGenObject.BuildDir, 
LibraryAutoGen.BuildDir))
 return DirList
 
-_TemplateDict = property(_CreateTemplateDict)
-
 # This acts like the main() function for the script, unless it is 'import'ed 
into another script.
 if __name__ == '__main__':
 pass
-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 7/9] BaseTools: Don't save unused workspace data

2018-08-29 Thread Jaben Carsey
  FlexibleFieldName was never used not set.
  DefinitionPosition (file and line number) are recalculated
and never used outside the function.  remove the saving of the
data.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 7 ---
 BaseTools/Source/Python/Workspace/DecBuildData.py | 7 ---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index e7259b2d3d50..f4ffd05324f4 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -66,7 +66,6 @@ class PcdClassObject(object):
 self.DscDefaultValue = Value
 self.PcdValueFromComm = ""
 self.PcdValueFromFdf = ""
-self.DefinitionPosition = ("","")
 
 ## Get the maximum number of bytes
 def GetPcdMaxSize(self):
@@ -168,7 +167,6 @@ class StructurePcd(PcdClassObject):
 self.DefaultValues = OrderedDict()
 self.PcdMode = None
 self.SkuOverrideValues = OrderedDict()
-self.FlexibleFieldName = None
 self.StructName = None
 self.PcdDefineLineNo = 0
 self.PkgPath = ""
@@ -200,9 +198,6 @@ class StructurePcd(PcdClassObject):
 def SetPcdMode (self, PcdMode):
 self.PcdMode = PcdMode
 
-def SetFlexibleFieldName (self, FlexibleFieldName):
-self.FlexibleFieldName = FlexibleFieldName
-
 def copy(self, PcdObject):
 self.TokenCName = PcdObject.TokenCName if PcdObject.TokenCName else 
self.TokenCName
 self.TokenSpaceGuidCName = PcdObject.TokenSpaceGuidCName if 
PcdObject.TokenSpaceGuidCName else PcdObject.TokenSpaceGuidCName
@@ -224,7 +219,6 @@ class StructurePcd(PcdClassObject):
 self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else 
self.DscRawValue
 self.PcdValueFromComm = PcdObject.PcdValueFromComm if 
PcdObject.PcdValueFromComm else self.PcdValueFromComm
 self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if 
PcdObject.PcdValueFromFdf else self.PcdValueFromFdf
-self.DefinitionPosition = PcdObject.DefinitionPosition if 
PcdObject.DefinitionPosition else self.DefinitionPosition
 if isinstance(PcdObject, StructurePcd):
 self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile 
if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
 self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs 
else self.PackageDecs
@@ -233,7 +227,6 @@ class StructurePcd(PcdClassObject):
 self.DefaultFromDSC=None
 self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if 
PcdObject.DefaultValueFromDec else self.DefaultValueFromDec
 self.SkuOverrideValues = PcdObject.SkuOverrideValues if 
PcdObject.SkuOverrideValues else self.SkuOverrideValues
-self.FlexibleFieldName = PcdObject.FlexibleFieldName if 
PcdObject.FlexibleFieldName else self.FlexibleFieldName
 self.StructName = PcdObject.DatumType if PcdObject.DatumType else 
self.StructName
 self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if 
PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
 self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else 
self.PkgPath
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py 
b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 1f74e898f2ef..31ee13eca91f 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -410,6 +410,7 @@ class DecBuildData(PackageBuildClassObject):
 if not (PcdCName, TokenSpaceGuid) in PcdSet:
 PcdSet.append((PcdCName, TokenSpaceGuid))
 
+DefinitionPosition = {}
 for PcdCName, TokenSpaceGuid in PcdSet:
 #
 # limit the ARCH to self._Arch, if no self._Arch found, tdict
@@ -436,7 +437,7 @@ class DecBuildData(PackageBuildClassObject):
 list(validlists),
 list(expressions)
 )
-PcdObj.DefinitionPosition = (self.MetaFile.File, LineNo)
+DefinitionPosition[PcdObj] = (self.MetaFile.File, LineNo)
 if "." in TokenSpaceGuid:
 StrPcdSet.append((PcdObj, LineNo))
 else:
@@ -449,10 +450,10 @@ class DecBuildData(PackageBuildClassObject):
 for pcd in Pcds.values():
 if pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, 
TAB_UINT64, TAB_VOID, "BOOLEAN"]:
 if StructPattern.match(pcd.DatumType) is None:
-EdkLogger.error('build', FORMAT_INVALID, "DatumType only 
support BOOLEAN, UINT8, UINT16, UINT32, UINT64, VOID* or a valid struct name.", 

[edk2] [PATCH v1 1/9] BaseTools: Refactor PlatformAutoGen

2018-08-29 Thread Jaben Carsey
use decorators for property and automatic caching
remove circular dependency between some APIs

Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 587 +---
 1 file changed, 264 insertions(+), 323 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 314a321e95c6..8c7bec664cbd 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1046,41 +1046,13 @@ class PlatformAutoGen(AutoGen):
 # get the original module/package/platform objects
 self.BuildDatabase = Workspace.BuildDatabase
 self.DscBuildDataObj = Workspace.Platform
-self._GuidDict = Workspace._GuidDict
 
 # flag indicating if the makefile/C-code file has been created or not
 self.IsMakeFileCreated  = False
-self.IsCodeFileCreated  = False
 
-self._Platform   = None
-self._Name   = None
-self._Guid   = None
-self._Version= None
-
-self._BuildRule = None
-self._SourceDir = None
-self._BuildDir = None
-self._OutputDir = None
-self._FvDir = None
-self._MakeFileDir = None
-self._FdfFile = None
-
-self._PcdTokenNumber = None# (TokenCName, TokenSpaceGuidCName) : 
GeneratedTokenNumber
 self._DynamicPcdList = None# [(TokenCName1, TokenSpaceGuidCName1), 
(TokenCName2, TokenSpaceGuidCName2), ...]
 self._NonDynamicPcdList = None # [(TokenCName1, TokenSpaceGuidCName1), 
(TokenCName2, TokenSpaceGuidCName2), ...]
-self._NonDynamicPcdDict = {}
 
-self._ToolDefinitions = None
-self._ToolDefFile = None  # toolcode : tool path
-self._ToolChainFamily = None
-self._BuildRuleFamily = None
-self._BuildOption = None  # toolcode : option
-self._EdkBuildOption = None   # edktoolcode : option
-self._EdkIIBuildOption = None # edkiitoolcode : option
-self._PackageList = None
-self._ModuleAutoGenList  = None
-self._LibraryAutoGenList = None
-self._BuildCommand = None
 self._AsBuildInfList = []
 self._AsBuildModuleList = []
 
@@ -1100,6 +1072,7 @@ class PlatformAutoGen(AutoGen):
 
 return True
 
+@cached_class_function
 def __repr__(self):
 return "%s [%s]" % (self.MetaFile, self.Arch)
 
@@ -,19 +1084,18 @@ class PlatformAutoGen(AutoGen):
 #   @param  CreateModuleCodeFileFlag indicating if creating 
module's
 #   autogen code file or not
 #
+@cached_class_function
 def CreateCodeFile(self, CreateModuleCodeFile=False):
 # only module has code to be greated, so do nothing if 
CreateModuleCodeFile is False
-if self.IsCodeFileCreated or not CreateModuleCodeFile:
+if not CreateModuleCodeFile:
 return
 
 for Ma in self.ModuleAutoGenList:
 Ma.CreateCodeFile(True)
 
-# don't do this twice
-self.IsCodeFileCreated = True
-
 ## Generate Fds Command
-def _GenFdsCommand(self):
+@cached_property
+def GenFdsCommand(self):
 return self.Workspace.GenFdsCommand
 
 ## Create makefile for the platform and mdoules in it
@@ -1185,7 +1157,6 @@ class PlatformAutoGen(AutoGen):
 LibAuto.ConstPcd[key] = FixedAtBuildPcds[key]
 
 def CollectVariables(self, DynamicPcdSet):
-
 VpdRegionSize = 0
 VpdRegionBase = 0
 if self.Workspace.FdfFile:
@@ -1197,7 +1168,6 @@ class PlatformAutoGen(AutoGen):
 VpdRegionBase = FdRegion.Offset
 break
 
-
 VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), 
self.DscBuildDataObj._GetSkuIds())
 VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
 VariableInfo.SetVpdRegionOffset(VpdRegionBase)
@@ -1250,7 +1220,6 @@ class PlatformAutoGen(AutoGen):
 #  This interface should be invoked explicitly when platform action is 
created.
 #
 def CollectPlatformDynamicPcds(self):
-
 for key in self.Platform.Pcds:
 for SinglePcd in GlobalData.MixedPcd:
 if (self.Platform.Pcds[key].TokenCName, 
self.Platform.Pcds[key].TokenSpaceGuidCName) == SinglePcd:
@@ -1683,308 +1652,318 @@ class PlatformAutoGen(AutoGen):
 EdkLogger.error("Build", FILE_NOT_FOUND, "Fail to find 
third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in 
tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
 
 ## Return the platform build data object
-def _GetPlatform(self):
-if self._Platform is None:
-self._Platform = self.BuildDatabase[self.MetaFile, self.Arch, 
self.BuildTarget, self.ToolChain]
-   

[edk2] [PATCH v1 0/9] BaseTools: refactor Workspace classes

2018-08-29 Thread Jaben Carsey
update the classes for the following:
1) use decorators for property
2) use decorators for caching property and caching function
  - this allows for objects to reduce in size as they get used
3) remove unused variables and properties
4) use tuple instead of custom class when apropriate
5) remove callers from accessing "private" data and use the existing 
properties
6) removed a circular dependency between APIs

Jaben Carsey (9):
  BaseTools: Refactor PlatformAutoGen
  BaseTools: AutoGen refactor WorkspaceAutoGen class
  BaseTools: AutoGen - refactor class properties
  BaseTools: refactor class properties
  BaseTools: Workspace classes refactor properties
  BaseTools: refactor Build Database objects
  BaseTools: Don't save unused workspace data
  BaseTools: refactor to not overcreate ModuleAutoGen objects
  BaseTools: refactor to cache InfBuildData data

 BaseTools/Source/Python/AutoGen/AutoGen.py | 691 +++---
 BaseTools/Source/Python/AutoGen/GenMake.py |  20 +-
 BaseTools/Source/Python/Common/Misc.py |  90 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py  |   4 +-
 BaseTools/Source/Python/Workspace/BuildClassObject.py  |  39 +-
 BaseTools/Source/Python/Workspace/DecBuildData.py  |  65 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py  | 151 +--
 BaseTools/Source/Python/Workspace/InfBuildData.py  | 965 
+---
 BaseTools/Source/Python/Workspace/MetaFileParser.py|  18 +-
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py |  16 +-
 BaseTools/Source/Python/build/build.py |   4 +-
 11 files changed, 938 insertions(+), 1125 deletions(-)

-- 
2.16.2.windows.1

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


[edk2] [PATCH v1 2/9] BaseTools: AutoGen refactor WorkspaceAutoGen class

2018-08-29 Thread Jaben Carsey
Update the WorkspaceAutoGen class to use caching decorators and remove
the no longer needed private variables.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 69 
 1 file changed, 28 insertions(+), 41 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 8c7bec664cbd..b8ee9980ae39 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -278,10 +278,6 @@ class WorkspaceAutoGen(AutoGen):
 self.FvTargetList   = Fvs if Fvs else []
 self.CapTargetList  = Caps if Caps else []
 self.AutoGenObjectList = []
-self._BuildDir  = None
-self._FvDir = None
-self._MakeFileDir   = None
-self._BuildCommand  = None
 self._GuidDict = {}
 
 # there's many relative directory operations, so ...
@@ -810,54 +806,56 @@ class WorkspaceAutoGen(AutoGen):
 return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList))
 
 ## Return the directory to store FV files
-def _GetFvDir(self):
-if self._FvDir is None:
-self._FvDir = path.join(self.BuildDir, TAB_FV_DIRECTORY)
-return self._FvDir
+@cached_property
+def FvDir(self):
+return path.join(self.BuildDir, TAB_FV_DIRECTORY)
 
 ## Return the directory to store all intermediate and final files built
-def _GetBuildDir(self):
-if self._BuildDir is None:
-return self.AutoGenObjectList[0].BuildDir
+@cached_property
+def BuildDir(self):
+return self.AutoGenObjectList[0].BuildDir
 
 ## Return the build output directory platform specifies
-def _GetOutputDir(self):
+@cached_property
+def OutputDir(self):
 return self.Platform.OutputDirectory
 
 ## Return platform name
-def _GetName(self):
+@cached_property
+def Name(self):
 return self.Platform.PlatformName
 
 ## Return meta-file GUID
-def _GetGuid(self):
+@cached_property
+def Guid(self):
 return self.Platform.Guid
 
 ## Return platform version
-def _GetVersion(self):
+@cached_property
+def Version(self):
 return self.Platform.Version
 
 ## Return paths of tools
-def _GetToolDefinition(self):
+@cached_property
+def ToolDefinition(self):
 return self.AutoGenObjectList[0].ToolDefinition
 
 ## Return directory of platform makefile
 #
 #   @retval string  Makefile directory
 #
-def _GetMakeFileDir(self):
-if self._MakeFileDir is None:
-self._MakeFileDir = self.BuildDir
-return self._MakeFileDir
+@cached_property
+def MakeFileDir(self):
+return self.BuildDir
 
 ## Return build command string
 #
 #   @retval string  Build command string
 #
-def _GetBuildCommand(self):
-if self._BuildCommand is None:
-# BuildCommand should be all the same. So just get one from 
platform AutoGen
-self._BuildCommand = self.AutoGenObjectList[0].BuildCommand
-return self._BuildCommand
+@cached_property
+def BuildCommand(self):
+# BuildCommand should be all the same. So just get one from platform 
AutoGen
+return self.AutoGenObjectList[0].BuildCommand
 
 ## Check the PCDs token value conflict in each DEC file.
 #
@@ -933,7 +931,8 @@ class WorkspaceAutoGen(AutoGen):
 )
 Count += 1
 ## Generate fds command
-def _GenFdsCommand(self):
+@property
+def GenFdsCommand(self):
 return 
(GenMake.TopLevelMakefile(self)._TEMPLATE_.Replace(GenMake.TopLevelMakefile(self)._TemplateDict)).strip()
 
 ## Create makefile for the platform and modules in it
@@ -966,18 +965,6 @@ class WorkspaceAutoGen(AutoGen):
 def CreateAsBuiltInf(self):
 return
 
-Name= property(_GetName)
-Guid= property(_GetGuid)
-Version = property(_GetVersion)
-OutputDir   = property(_GetOutputDir)
-
-ToolDefinition  = property(_GetToolDefinition)   # toolcode : tool 
path
-
-BuildDir= property(_GetBuildDir)
-FvDir   = property(_GetFvDir)
-MakeFileDir = property(_GetMakeFileDir)
-BuildCommand= property(_GetBuildCommand)
-GenFdsCommand   = property(_GenFdsCommand)
 
 ## AutoGen class for platform
 #
@@ -2587,7 +2574,7 @@ class ModuleAutoGen(AutoGen):
 ## Return the module build data object
 @cached_property
 def Module(self):
-return self.Workspace.BuildDatabase[self.MetaFile, self.Arch, 
self.BuildTarget, self.ToolChain]
+return self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, 
self.ToolChain]
 
 ## Return the 

[edk2] [PATCH v1 1/1] BaseTools: Clarify a DSC parsing error about PCDs

2018-08-29 Thread Jaben Carsey
This error needs the information about which DEC files were searched.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Cc: Lee Hamel 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623fd3..0c4f2a928c39 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -859,7 +859,7 @@ class DscBuildData(PlatformBuildClassObject):
 
 if (PcdCName, TokenSpaceGuid) not in self._DecPcds:
 EdkLogger.error('build', PARSER_ERROR,
-"Pcd (%s.%s) defined in DSC is not declared in DEC 
files. Arch: ['%s']" % (TokenSpaceGuid, PcdCName, self._Arch),
+"Pcd (%s.%s) defined in DSC is not declared in DEC 
files referenced in INF files in FDF. Arch: ['%s']" % (TokenSpaceGuid, 
PcdCName, self._Arch),
 File=self.MetaFile, Line=LineNo)
 ValueList, IsValid, Index = AnalyzeDscPcd(Setting, PcdType, 
self._DecPcds[PcdCName, TokenSpaceGuid].DatumType)
 if not IsValid:
-- 
2.16.2.windows.1

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


Re: [edk2] [Patch] BaseTools: Support multi thread build Basetool on Windows

2018-08-29 Thread Gao, Liming
Jaben:
  NmakeSubdirs.bat will be removed once NmakeSubdirs.py is stable. Now, bat is 
kept for a while.

Thanks
Liming
> -Original Message-
> From: Carsey, Jaben
> Sent: Wednesday, August 29, 2018 12:10 AM
> To: Gao, Liming 
> Cc: edk2-devel@lists.01.org; Guo, Dongao 
> Subject: Re: [edk2] [Patch] BaseTools: Support multi thread build Basetool on 
> Windows
> 
> This looks like a great change.  Why not delete the bat file?
> 
> Reviewed-by Jaben Carsey: 
> 
> Jaben
> 
> > On Aug 28, 2018, at 8:28 AM, Liming Gao  wrote:
> >
> > From: Dongao Guo 
> >
> > Add NmakeSubdirs.py to replace NmakeSubdirs.bat in VS Makefile. This script 
> > will
> > invoke nmake in multi thread mode. It can save more than half time of 
> > BaseTools
> > C clean build.
> > GCC make supports multiple thread in make phase. So, GNNmakefile doesn't 
> > need apply
> > this script.
> >
> > single task or job=1:
> >just single thread and invoke subprocess,subprocess will use
> >system.stdout to print output.
> > multi task:
> >thread number is logic cpu count.All subprocess output will pass to
> >python script by PIPE and then script print it to system.stdout.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Dongao Guo
> > Reviewed-by: Liming Gao 
> > Test-by: Liming Gao 
> > ---
> > BaseTools/Makefile   |  12 +-
> > BaseTools/Source/C/Makefile  |  14 +--
> > BaseTools/Source/C/Makefiles/NmakeSubdirs.py | 169 
> > +++
> > 3 files changed, 182 insertions(+), 13 deletions(-)
> > create mode 100644 BaseTools/Source/C/Makefiles/NmakeSubdirs.py
> >
> > diff --git a/BaseTools/Makefile b/BaseTools/Makefile
> > index 3736d85..b98cd85 100644
> > --- a/BaseTools/Makefile
> > +++ b/BaseTools/Makefile
> > @@ -1,7 +1,7 @@
> > ## @file
> > # Windows makefile for Base Tools project build.
> > #
> > -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
> > +# Copyright (c) 2007 - 2018, 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
> > @@ -20,19 +20,19 @@ SUBDIRS = $(BASE_TOOLS_PATH)\Source\C 
> > $(BASE_TOOLS_PATH)\Source\Python
> > all: c python
> >
> > c :
> > -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all 
> > $(BASE_TOOLS_PATH)\Source\C
> > +  @$(PYTHON_HOME)\python.exe 
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all
> $(BASE_TOOLS_PATH)\Source\C
> >
> > python:
> > -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all 
> > $(BASE_TOOLS_PATH)\Source\Python
> > +  @$(PYTHON_HOME)\python.exe 
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all
> $(BASE_TOOLS_PATH)\Source\Python
> >
> > subdirs: $(SUBDIRS)
> > -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat all $**
> > +  @$(PYTHON_HOME)\python.exe 
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**
> >
> > .PHONY: clean
> > clean:
> > -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat clean $(SUBDIRS)
> > +  $(PYTHON_HOME)\python.exe 
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
> >
> > .PHONY: cleanall
> > cleanall:
> > -  @$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.bat cleanall 
> > $(SUBDIRS)
> > +  $(PYTHON_HOME)\python.exe 
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)
> >
> > diff --git a/BaseTools/Source/C/Makefile b/BaseTools/Source/C/Makefile
> > index 5428180..1246d23 100644
> > --- a/BaseTools/Source/C/Makefile
> > +++ b/BaseTools/Source/C/Makefile
> > @@ -1,7 +1,7 @@
> > ## @file
> > # Windows makefile for C tools build.
> > #
> > -# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
> > +# Copyright (c) 2009 - 2018, 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
> > @@ -16,7 +16,7 @@ HOST_ARCH = IA32
> >
> > LIBRARIES = Common
> > APPLICATIONS = \
> > -  BootSectImage \
> > +  VfrCompile \
> >   BrotliCompress \
> >   EfiLdrImage \
> >   EfiRom \
> > @@ -32,7 +32,7 @@ APPLICATIONS = \
> >   Split \
> >   TianoCompress \
> >   VolInfo \
> > -  VfrCompile \
> > +  BootSectImage \
> >   DevicePath
> >
> > all: libs apps install
> > @@ -43,7 +43,7 @@ libs: $(LIBRARIES)
> >@echo # Build libraries
> >@echo ##
> >@if not exist $(LIB_PATH) mkdir $(LIB_PATH)
> > -@Makefiles\NmakeSubdirs.bat all $**
> > +@$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**
> >
> > apps: $(APPLICATIONS)
> >@echo.
> > @@ -51,7 +51,7 @@ apps: $(APPLICATIONS)
> >@echo # Build executables
> >@echo 

[edk2] [PATCH v1 1/1] BaseTools: Refactor to remove functionally equivalent functions

2018-08-29 Thread Jaben Carsey
IsSupportedArch and IsBinaryModule return the same value under the same
curcimstances.  Remove newer one with fewer callers and send them to the
other function.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 4 ++--
 BaseTools/Source/Python/Workspace/InfBuildData.py | 8 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b28388967..5c0df45bb90a 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1092,7 +1092,7 @@ class PlatformAutoGen(AutoGen):
 for Inf in self._AsBuildInfList:
 InfClass = PathClass(NormPath(Inf), GlobalData.gWorkspace, 
self.Arch)
 M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, 
self.ToolChain]
-if not M.IsSupportedArch:
+if not M.IsBinaryModule:
 continue
 self._AsBuildModuleList.append(InfClass)
 # get library/modules for build
@@ -1347,7 +1347,7 @@ class PlatformAutoGen(AutoGen):
 # If a module INF in FDF but not in current arch's DSC module 
list, it must be module (either binary or source)
 # for different Arch. PCDs in source module for different Arch 
is already added before, so skip the source module here.
 # For binary module, if in current arch, we need to list the 
PCDs into database.
-if not M.IsSupportedArch:
+if not M.IsBinaryModule:
 continue
 # Override the module PCD setting by platform setting
 ModulePcdList = self.ApplyPcdSetting(M, M.Pcds)
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 7c3d712efe63..44ced491ad55 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -578,12 +578,7 @@ class InfBuildData(ModuleBuildClassObject):
 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, 
ExtraData=ErrorInfo, File=self.MetaFile)
 
 return Binaries
-## Check whether it exists the binaries with current ARCH in AsBuild INF
-def _IsSupportedArch(self):
-if self._GetBinaries() and not self._GetSourceFiles():
-return True
-else:
-return False
+
 ## Retrieve source files
 def _GetSourceFiles(self):
 # Ignore all source files in a binary build mode
@@ -1170,4 +1165,3 @@ class InfBuildData(ModuleBuildClassObject):
 Depex   = property(_GetDepex)
 DepexExpression = property(_GetDepexExpression)
 IsBinaryModule  = property(_IsBinaryModule)
-IsSupportedArch = property(_IsSupportedArch)
-- 
2.16.2.windows.1

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


Re: [edk2] [PATCH] UefiCpuPkg/CpuDxe: change level of DEBUG message

2018-08-29 Thread Laszlo Ersek
On 08/29/18 05:21, Jian J Wang wrote:
> It's reported the debug message in CpuDxe driver is quite annoying in
> boot and shell, and slow down the boot process. To solve this issue,
> this patch changes the DEBUG_INFO to DEBUG_VERBOSE. On a typical Intel
> real platform, at least 16s boot time can be saved.
> 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c   | 2 +-
>  UefiCpuPkg/CpuDxe/CpuPageTable.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index cfd4c415ae..76661cbcd9 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -404,7 +404,7 @@ CpuSetMemoryAttributes (
>// to avoid unnecessary computing.
>//
>if (mIsFlushingGCD) {
> -DEBUG((DEBUG_INFO, "  Flushing GCD\n"));
> +DEBUG((DEBUG_VERBOSE, "  Flushing GCD\n"));
>  return EFI_SUCCESS;
>}
>  
> diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c 
> b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> index df021798c0..609df58e3a 100644
> --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> @@ -528,7 +528,7 @@ SplitPage (
>  ASSERT (SplitAttribute == Page4K);
>  if (SplitAttribute == Page4K) {
>NewPageEntry = AllocatePagesFunc (1);
> -  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
> +  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
>if (NewPageEntry == NULL) {
>  return RETURN_OUT_OF_RESOURCES;
>}
> @@ -549,7 +549,7 @@ SplitPage (
>  ASSERT (SplitAttribute == Page2M || SplitAttribute == Page4K);
>  if ((SplitAttribute == Page2M || SplitAttribute == Page4K)) {
>NewPageEntry = AllocatePagesFunc (1);
> -  DEBUG ((DEBUG_INFO, "Split - 0x%x\n", NewPageEntry));
> +  DEBUG ((DEBUG_VERBOSE, "Split - 0x%x\n", NewPageEntry));
>if (NewPageEntry == NULL) {
>  return RETURN_OUT_OF_RESOURCES;
>}
> 

Before you push this patch, please add a reference to

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

in the commit message.

With that:

Reviewed-by: Laszlo Ersek 

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


Re: [edk2] [PATCH v3 16/16] ShellPkg/UefiShellDebug1CommandsLib: Remove unused PCDs

2018-08-29 Thread Laszlo Ersek
On 08/28/18 05:42, shenglei wrote:
> The PCDs below are unused, so they have been removed from inf.
> gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize
> gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength
> 
> Cc: Jaben Carsey 
> Cc: Ruiyu Ni 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> Reviewed-by: Ruiyu Ni 
> ---
>  .../UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf   | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git 
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf 
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
> index 3ea51ec082..ec1f87ae19 100644
> --- 
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
> +++ 
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
> @@ -119,8 +119,6 @@
>  
>  [Pcd]
>gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask  ## CONSUMES
> -  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize## CONSUMES
> -  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength  ## CONSUMES
>  
>  [Protocols]
>gEfiPciRootBridgeIoProtocolGuid ## SOMETIMES_CONSUMES
> 

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


Re: [edk2] [PATCH v3 15/16] ShellPkg/UefiHandleParsingLib: Remove an unused PCD

2018-08-29 Thread Laszlo Ersek
On 08/28/18 05:42, shenglei wrote:
> The PCD below is unused, so it has been removed from inf.
> gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize
> 
> Cc: Jaben Carsey 
> Cc: Ruiyu Ni 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> Reviewed-by: Ruiyu Ni 
> ---
>  ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf 
> b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
> index e5e007bef3..a795fb92de 100644
> --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
> +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
> @@ -353,5 +353,4 @@
>gEfiAdapterInfoUndiIpv6SupportGuid  ## 
> SOMETIMES_CONSUMES ## GUID
>  
>  [Pcd.common]
> -  gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize  ## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellIncludeNtGuids   ## CONSUMES
> 

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


Re: [edk2] [PATCH v3 13/16] ShellPkg/Shell: Remove unused PCDs

2018-08-29 Thread Laszlo Ersek
On 08/28/18 05:42, shenglei wrote:
> The PCDs below are unused, so they have been removed from inf.
> gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize
> gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength
> 
> Cc: Jaben Carsey 
> Cc: Ruiyu Ni 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> Reviewed-by: Ruiyu Ni 
> ---
>  ShellPkg/Application/Shell/Shell.inf | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/ShellPkg/Application/Shell/Shell.inf 
> b/ShellPkg/Application/Shell/Shell.inf
> index d89f85bb76..83049844d6 100644
> --- a/ShellPkg/Application/Shell/Shell.inf
> +++ b/ShellPkg/Application/Shell/Shell.inf
> @@ -102,10 +102,8 @@
>gEfiShellPkgTokenSpaceGuid.PcdShellRequireHiiPlatform ## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellSupportFrameworkHii## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellPageBreakDefault   ## CONSUMES
> -  gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize  ## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellInsertModeDefault  ## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellScreenLogCount ## CONSUMES
> -  gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength  ## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellForceConsole   ## CONSUMES
>gEfiShellPkgTokenSpaceGuid.PcdShellSupplier   ## CONSUMES
> 

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


Re: [edk2] [PATCH v3 08/16] SecurityPkg/Tcg2Dxe: Remove unused PCDs

2018-08-29 Thread Laszlo Ersek
On 08/28/18 05:42, shenglei wrote:
> The PCDs below are unused, so they have been removed from inf.
> gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision
> 
> Cc: Jiewen Yao 
> Cc: Chao Zhang 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: shenglei 
> Reviewed-by: Chao Zhang 
> ---
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf | 6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf 
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> index b875ab7e01..2b89869ef1 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> @@ -101,12 +101,6 @@
>gEfiSecurityPkgTokenSpaceGuid.PcdTpmPlatformClass 
> ## SOMETIMES_CONSUMES
>gEfiSecurityPkgTokenSpaceGuid.PcdFirmwareDebuggerInitialized  
> ## SOMETIMES_CONSUMES
>gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid  
> ## CONSUMES
> -  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress   
> ## SOMETIMES_CONSUMES
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId
> ## SOMETIMES_CONSUMES
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId   
> ## SOMETIMES_CONSUMES
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision  
> ## SOMETIMES_CONSUMES
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId
> ## SOMETIMES_CONSUMES
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision  
> ## SOMETIMES_CONSUMES
>gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice  
> ## SOMETIMES_CONSUMES
>gEfiSecurityPkgTokenSpaceGuid.PcdTcg2HashAlgorithmBitmap  
> ## CONSUMES
>gEfiSecurityPkgTokenSpaceGuid.PcdTcg2NumberOfPCRBanks 
> ## CONSUMES
> 

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


Re: [edk2] OSFC tickets

2018-08-29 Thread Richardson, Brian
Note there will be a TianoCore hack-a-thon as part of the conference, focused 
on Signed UEFI Capsule Update & Recovery. There are also a number of sessions & 
workshops related to TianoCore.

More Info: https://github.com/tianocore/tianocore.github.io/wiki/OSFC-2018 

Thanks ... br
---
Brian Richardson, Senior Technical Marketing Engineer, Intel Software
brian.richard...@intel.com -- @intel_brian (Twitter & WeChat)
https://software.intel.com/en-us/meet-the-developers/evangelists/team/brian-richardson
 

-Original Message-
From: edk2-devel  On Behalf Of Philipp 
Deppenwiese
Sent: Wednesday, August 29, 2018 4:32 AM
To: edk2-devel@lists.01.org
Subject: [edk2] OSFC tickets

Friendly reminder.

2 days until the ticket sale is closed.

Buy your tickets now https://osfc.io/tickets

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


Re: [edk2] [Patch] BaseTools: Dynamic Pcd value override from command line.

2018-08-29 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Feng, Bob C
> Sent: Wednesday, August 29, 2018 4:48 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C ; Gao, Liming 
> Subject: [Patch] BaseTools: Dynamic Pcd value override from command line.
> 
> Fixed the pcd value override issue when Dynamic Pcd is from
> command line but is not list in Dsc file.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index 748452623f..d553536961 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -1268,13 +1268,18 @@ class DscBuildData(PlatformBuildClassObject):
>  PcdInDec = self.DecPcds.get((Name, Guid))
>  if PcdInDec:
>  PcdInDec.PcdValueFromComm = NoFiledValues[(Guid, 
> Name)][0]
>  if PcdInDec.Type in 
> [self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
>  
> self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE],
> -
> self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG]]:
> +
> self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG],
> +
> self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC],
> +
> self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]:
>  self.Pcds[Name, Guid] = copy.deepcopy(PcdInDec)
>  self.Pcds[Name, Guid].DefaultValue = NoFiledValues[( 
> Guid, Name)][0]
> +if PcdInDec.Type in 
> [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC],
> +
> self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]:
> +self.Pcds[Name, Guid].SkuInfoList = 
> {TAB_DEFAULT:SkuInfoClass(TAB_DEFAULT,
> self.SkuIds[TAB_DEFAULT][0], '', '', '', '', '', NoFiledValues[( Guid, 
> Name)][0])}
>  return AllPcds
> 
>  def OverrideByFdfOverAll(self,AllPcds):
> 
>  if GlobalData.gFdfParser is None:
> --
> 2.16.2.windows.1

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


[edk2] [PATCH edk2-platforms] sgi575/acpi: Use ACPI 6.2 specification

2018-08-29 Thread Chandni Cherukuri
Switched from using ACPI 6.1 to 6.2 specification for
SGI575 since SBBR 1.1 requires ACPI 6.2 tables or later.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Chandni Cherukuri 
---
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc |  8 ++--
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc | 48 ++--
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc |  4 +-
 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Spcr.aslc |  6 +--
 4 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
index ed671f3..0183685 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Dbg2.aslc
@@ -15,7 +15,7 @@
 
 #include "SgiAcpiHeader.h"
 #include 
-#include 
+#include 
 #include 
 
 #define SGI_DBG2_NUM_DEBUG_PORTS   1
@@ -29,7 +29,7 @@
 
 typedef struct {
   EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device;
-  EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
+  EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTUREBaseAddressRegister;
   UINT32AddressSize;
   UINT8 
NameSpaceString[SGI_DBG2_NS_STR_LENGTH];
 } DBG2_DEBUG_DEVICE_INFORMATION;
@@ -56,7 +56,7 @@ typedef struct {
 OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* UINT16  
  BaseAddressRegister Offset */  \
 OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize)  /* UINT16  
  AddressSize Offset */  \
   },   
 \
-  ARM_GAS32 (UartBase),/* 
EFI_ACPI_6_1_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
+  ARM_GAS32 (UartBase),/* 
EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
   UartAddrLen, /* UINT32  AddressSize */   
 \
   UartNameStr  /* UINT8   
NameSpaceString[MAX_DBG2_NAME_LEN] */ \
 }
@@ -64,7 +64,7 @@ typedef struct {
 STATIC DBG2_TABLE Dbg2 = {
   {
 ARM_ACPI_HEADER (
-  EFI_ACPI_6_1_DEBUG_PORT_2_TABLE_SIGNATURE,
+  EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
   DBG2_TABLE,
   EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
 ),
diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc 
b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
index 46d811e..39e3f02 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
+++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Gtdt.aslc
@@ -16,7 +16,7 @@
 #include "SgiAcpiHeader.h"
 #include 
 #include 
-#include 
+#include 
 
 #define SGI_PLATFORM_WATCHDOG_COUNT   2
 #define SGI_PLATFORM_TIMER_COUNT  (SGI_PLATFORM_WATCHDOG_COUNT + 1)
@@ -24,7 +24,7 @@
 
 #define SYSTEM_TIMER_BASE_ADDRESS 0x
 #define GTDT_GLOBAL_FLAGS 0
-#define GTDT_GTIMER_FLAGS 
EFI_ACPI_6_1_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
+#define GTDT_GTIMER_FLAGS 
EFI_ACPI_6_2_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
 
 #define SGI_GT_BLOCK_CTL_BASE 0x2A81
 #define SGI_GT_BLOCK_FRAME1_CTL_BASE  0x2A82
@@ -36,18 +36,18 @@
 #define SGI_GT_BLOCK_FRAME0_GSIV  0x5C
 
 #define SGI_GTX_TIMER_FLAGS   0
-#define GTX_TIMER_SECURE  
EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
+#define GTX_TIMER_SECURE  
EFI_ACPI_6_2_GTDT_GT_BLOCK_COMMON_FLAG_SECURE_TIMER
 #define GTX_TIMER_NON_SECURE  0
-#define GTX_TIMER_SAVE_CONTEXT
EFI_ACPI_6_1_GTDT_GT_BLOCK_COMMON_FLAG_ALWAYS_ON_CAPABILITY
+#define GTX_TIMER_SAVE_CONTEXT
EFI_ACPI_6_2_GTDT_GT_BLOCK_COMMON_FLAG_ALWAYS_ON_CAPABILITY
 #define SGI_GTX_COMMON_FLAGS_S(GTX_TIMER_SAVE_CONTEXT | 
GTX_TIMER_SECURE)
 #define SGI_GTX_COMMON_FLAGS_NS   (GTX_TIMER_SAVE_CONTEXT | 
GTX_TIMER_NON_SECURE)
 
-#define EFI_ACPI_6_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(\
+#define EFI_ACPI_6_2_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(\
   RefreshFramePhysicalAddress, ControlFramePhysicalAddress,   \
   WatchdogTimerGSIV, WatchdogTimerFlags)  \
   {   \
-EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG,  \
-sizeof (EFI_ACPI_6_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE),   \
+EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG,  \
+sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE),   \
 EFI_ACPI_RESERVED_WORD,   \
 RefreshFramePhysicalAddress,  \
 ControlFramePhysicalAddress,  \
@@ -58,20 

Re: [edk2] [patch V3] ShellPkg/SmbiosView: Update SmbiosView for SMBIOS3.2.0

2018-08-29 Thread Zeng, Star
Dandan, thanks.

Reviewed-by: Star Zeng 


Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Wednesday, August 29, 2018 4:53 PM
To: edk2-devel@lists.01.org
Cc: Carsey, Jaben ; Ni, Ruiyu ; 
Zeng, Star 
Subject: [edk2] [patch V3] ShellPkg/SmbiosView: Update SmbiosView for 
SMBIOS3.2.0

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

Update SmbiosView to parse the new definitions which are introduced in 
SMBIOS3.2.0

V2:
1. Add structure length check before dump the fileds in Type 9 and Type 17 in 
case some fileds are not organized and reported by drivers.
2. Dump the InterfaceTypeSpecificData in Type 42.

V3:
1. Correct the structure length in Type17.
2. Remove the redundant check "if (PeerGroupCount > 0)" in Type 9.
3. Use the Uint16 filed instead of Bits field in union 
MEMORY_DEVICE_OPERATING_MODE_CAPABILITY to dump data.

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../SmbiosView/PrintInfo.c |  86 ++---
 .../SmbiosView/QueryTable.c| 135 -
 .../SmbiosView/QueryTable.h|  26 +++-
 .../SmbiosView/SmbiosViewStrings.uni   |   9 +-
 4 files changed, 237 insertions(+), 19 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index 93c6094df1..af8551fe2e 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -541,26 +541,49 @@ SmbiosPrintStructure (
 
   //
   // System Slots (Type 9)
   //
   case 9:
-PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
-DisplaySystemSlotType (Struct->Type9->SlotType, Option);
-DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
-DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
-DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
-DisplaySystemSlotId (
-  Struct->Type9->SlotID,
-  Struct->Type9->SlotType,
-  Option
- );
-DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
-DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
-if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
-  PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+{
+  MISC_SLOT_PEER_GROUP  *PeerGroupPtr;
+  UINT8 PeerGroupCount;
+
+  PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
+  DisplaySystemSlotType (Struct->Type9->SlotType, Option);
+  DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
+  DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
+  DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
+  DisplaySystemSlotId (
+Struct->Type9->SlotID,
+Struct->Type9->SlotType,
+Option
+   );
+  DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
+  DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
+  if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
+PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+  }
+  if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+if (Struct->Hdr->Length > 0x11) {
+  PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth);
+}
+if (Struct->Hdr->Length > 0x12) {
+  PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount);
+
+  PeerGroupCount = Struct->Type9->PeerGroupingCount;
+  PeerGroupPtr   = Struct->Type9->PeerGroups;
+  for (Index = 0; Index < PeerGroupCount; Index++) {
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].SegmentGroupNum);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].BusNum);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DevFuncNum);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DataBusWidth);
+  }
+}
+  }
 }
 break;
 
   //
   // On Board Devices 

[edk2] [PATCH 1/2] MdeModulePkg PeiCore: Handle multiple FV images in one FV file

2018-08-29 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131

PI spec and BaseTools supports to generate multiple FV images
in one FV file.
This patch is to update PeiCore to handle the case.

Cc: Liming Gao 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/FwVol/FwVol.c | 267 +++-
 MdeModulePkg/Core/Pei/PeiMain.h |   2 +-
 2 files changed, 145 insertions(+), 124 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c 
b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 65c485549718..7ea503a10fb5 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -1358,7 +1358,7 @@ GetFvUsedSize (
 }
 
 /**
-  Get Fv image from the FV type file, then install FV INFO(2) ppi, Build FV 
hob.
+  Get Fv image(s) from the FV type file, then install FV INFO(2) ppi, Build 
FV(2, 3) hob.
 
   @param PrivateData  PeiCore's private data structure
   @param ParentFvCoreHandle   Pointer of EFI_CORE_FV_HANDLE to parent Fv image 
that contain this Fv image.
@@ -1391,6 +1391,7 @@ ProcessFvFile (
   UINT32AuthenticationStatus;
   UINT32FvUsedSize;
   UINT8 EraseByte;
+  UINTN Index;
 
   //
   // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
@@ -1412,144 +1413,164 @@ ProcessFvFile (
   ParentFvPpi= ParentFvCoreHandle->FvPpi;
 
   //
-  // Find FvImage in FvFile
+  // Find FvImage(s) in FvFile
   //
-  AuthenticationStatus = 0;
-  if ((ParentFvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&
-  (ParentFvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {
-Status = ParentFvPpi->FindSectionByType2 (
-ParentFvPpi,
-EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
-0,
-ParentFvFileHandle,
-(VOID **),
-
-);
-  } else {
-Status = ParentFvPpi->FindSectionByType (
-ParentFvPpi,
-EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
-ParentFvFileHandle,
-(VOID **)
-);
-  }
-  if (EFI_ERROR (Status)) {
-return Status;
-  }
-
-  Status = VerifyPeim (PrivateData, ParentFvHandle, ParentFvFileHandle, 
AuthenticationStatus);
-  if (Status == EFI_SECURITY_VIOLATION) {
-return Status;
-  }
-
-  //
-  // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first 
byte of the volume
-  // can be aligned on any power-of-two boundary. A weakly aligned volume can 
not be moved from
-  // its initial linked location and maintain its alignment.
-  //
-  if ((ReadUnaligned32 (>Attributes) & EFI_FVB2_WEAK_ALIGNMENT) != 
EFI_FVB2_WEAK_ALIGNMENT) {
-//
-// FvAlignment must be greater than or equal to 8 bytes of the minimum FFS 
alignment value.
-//
-FvAlignment = 1 << ((ReadUnaligned32 (>Attributes) & 
EFI_FVB2_ALIGNMENT) >> 16);
-if (FvAlignment < 8) {
-  FvAlignment = 8;
+  Index = 0;
+  do {
+AuthenticationStatus = 0;
+if ((ParentFvPpi->Signature == EFI_PEI_FIRMWARE_VOLUME_PPI_SIGNATURE) &&
+(ParentFvPpi->Revision == EFI_PEI_FIRMWARE_VOLUME_PPI_REVISION)) {
+  Status = ParentFvPpi->FindSectionByType2 (
+  ParentFvPpi,
+  EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
+  Index,
+  ParentFvFileHandle,
+  (VOID **),
+  
+  );
+} else {
+  //
+  // Old FvPpi has no parameter to input SearchInstance,
+  // only one instance is supported.
+  //
+  if (Index > 0) {
+break;
+  }
+  Status = ParentFvPpi->FindSectionByType (
+  ParentFvPpi,
+  EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
+  ParentFvFileHandle,
+  (VOID **)
+  );
+}
+if (EFI_ERROR (Status)) {
+  break;
 }
 
-DEBUG ((
-  DEBUG_INFO,
-  "%a() FV at 0x%x, FvAlignment required is 0x%x\n",
-  __FUNCTION__,
-  FvHeader,
-  FvAlignment
-  ));
+Status = VerifyPeim (PrivateData, ParentFvHandle, ParentFvFileHandle, 
AuthenticationStatus);
+if (Status == EFI_SECURITY_VIOLATION) {
+  break;
+}
 
 //
-// Check FvImage alignment.
+// If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first 
byte of the volume
+// can be aligned on any power-of-two boundary. A weakly aligned volume 
can not be moved from
+// its initial linked location and maintain its alignment.
 //
-if ((UINTN) FvHeader % FvAlignment != 0) {
-   

[edk2] [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in one FV file

2018-08-29 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131

PI spec and BaseTools supports to generate multiple FV images
in one FV file.
This patch is to update DxeCore to handle the case.

Cc: Liming Gao 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 241 ++
 1 file changed, 128 insertions(+), 113 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index f72c47a9e54c..086a590ef4e3 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -184,14 +184,13 @@ CoreAddToDriverList (
   );
 
 /**
-  Get the driver from the FV through driver name, and produce a FVB protocol 
on FvHandle.
+  Get Fv image(s) from the FV through file name, and produce FVB protocol for 
every Fv image(s).
 
   @param  FvThe FIRMWARE_VOLUME protocol installed on the 
FV.
   @param  FvHandle  The handle which FVB protocol installed on.
   @param  DriverNameThe driver guid specified.
 
   @retval EFI_OUT_OF_RESOURCES  No enough memory or other resource.
-  @retval EFI_VOLUME_CORRUPTED  Corrupted volume.
   @retval EFI_SUCCESS   Function successfully returned.
 
 **/
@@ -199,7 +198,7 @@ EFI_STATUS
 CoreProcessFvImageFile (
   IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,
   IN  EFI_HANDLE  FvHandle,
-  IN  EFI_GUID*DriverName
+  IN  EFI_GUID*FileName
   );
 
 
@@ -1004,14 +1003,13 @@ GetFvUsedSize (
 }
 
 /**
-  Get the driver from the FV through driver name, and produce a FVB protocol 
on FvHandle.
+  Get Fv image(s) from the FV through file name, and produce FVB protocol for 
every Fv image(s).
 
   @param  FvThe FIRMWARE_VOLUME protocol installed on the 
FV.
   @param  FvHandle  The handle which FVB protocol installed on.
   @param  DriverNameThe driver guid specified.
 
   @retval EFI_OUT_OF_RESOURCES  No enough memory or other resource.
-  @retval EFI_VOLUME_CORRUPTED  Corrupted volume.
   @retval EFI_SUCCESS   Function successfully returned.
 
 **/
@@ -1019,7 +1017,7 @@ EFI_STATUS
 CoreProcessFvImageFile (
   IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,
   IN  EFI_HANDLE  FvHandle,
-  IN  EFI_GUID*DriverName
+  IN  EFI_GUID*FileName
   )
 {
   EFI_STATUS  Status;
@@ -1033,141 +1031,158 @@ CoreProcessFvImageFile (
   EFI_DEVICE_PATH_PROTOCOL*FvFileDevicePath;
   UINT32  FvUsedSize;
   UINT8   EraseByte;
+  UINTN   Index;
 
   //
-  // Read the first (and only the first) firmware volume section
+  // Read firmware volume section(s)
   //
   SectionType   = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
-  FvHeader  = NULL;
-  FvAlignment   = 0;
-  Buffer= NULL;
-  BufferSize= 0;
-  AlignedBuffer = NULL;
-  Status = Fv->ReadSection (
- Fv,
- DriverName,
- SectionType,
- 0,
- ,
- ,
- 
- );
-  if (!EFI_ERROR (Status)) {
- //
-// Evaluate the authentication status of the Firmware Volume through
-// Security Architectural Protocol
-//
-if (gSecurity != NULL) {
-  FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
-  Status = gSecurity->FileAuthenticationState (
-gSecurity,
-AuthenticationStatus,
-FvFileDevicePath
-);
-  if (FvFileDevicePath != NULL) {
-FreePool (FvFileDevicePath);
-  }
 
-  if (Status != EFI_SUCCESS) {
-//
-// Security check failed. The firmware volume should not be used for 
any purpose.
-//
-if (Buffer != NULL) {
-  FreePool (Buffer);
+  Index = 0;
+  do {
+FvHeader  = NULL;
+FvAlignment   = 0;
+Buffer= NULL;
+BufferSize= 0;
+AlignedBuffer = NULL;
+Status = Fv->ReadSection (
+   Fv,
+   FileName,
+   SectionType,
+   Index,
+   ,
+   ,
+   
+   );
+if (!EFI_ERROR (Status)) {
+   //
+  // Evaluate the authentication status of the Firmware Volume through
+  // Security Architectural Protocol
+  //
+  if (gSecurity != NULL) {
+FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, FileName);
+Status = gSecurity->FileAuthenticationState (
+  gSecurity,
+  AuthenticationStatus,
+  FvFileDevicePath
+

[edk2] [PATCH 0/2] Core: Handle multiple FV images in one FV file

2018-08-29 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131

Star Zeng (2):
  MdeModulePkg PeiCore: Handle multiple FV images in one FV file
  MdeModulePkg DxeCore: Handle multiple FV images in one FV file

 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 241 ---
 MdeModulePkg/Core/Pei/FwVol/FwVol.c   | 267 ++
 MdeModulePkg/Core/Pei/PeiMain.h   |   2 +-
 3 files changed, 273 insertions(+), 237 deletions(-)

-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH] Maintainers.txt: Update maintainer of MdeModulePkg

2018-08-29 Thread Laszlo Ersek
On 08/28/18 07:36, Star Zeng wrote:
> Add Jian J Wang  and
> remove Eric Dong .
> Eric is focusing on UefiCpuPkg.
> 
> Cc: Jian J Wang 
> Cc: Eric Dong 
> Cc: Michael D Kinney 
> Cc: Laszlo Ersek 
> Cc: Andrew Fish 
> Cc: Leif Lindholm 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  Maintainers.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index df7dc48f75b5..61df6e198b79 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -172,7 +172,7 @@ M: Rangasai V Chaganty 
>  MdeModulePkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/MdeModulePkg
>  M: Star Zeng 
> -M: Eric Dong 
> +M: Jian J Wang 
>  M: NetworkPkg maintainers
>(Universal/Network and related libraries, header files)
>  R: Ruiyu Ni 
> 

Acked-by: Laszlo Ersek 

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


[edk2] [patch V3] ShellPkg/SmbiosView: Update SmbiosView for SMBIOS3.2.0

2018-08-29 Thread Dandan Bi
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1099

Update SmbiosView to parse the new definitions which
are introduced in SMBIOS3.2.0

V2:
1. Add structure length check before dump the fileds in
Type 9 and Type 17 in case some fileds are not organized
and reported by drivers.
2. Dump the InterfaceTypeSpecificData in Type 42.

V3:
1. Correct the structure length in Type17.
2. Remove the redundant check "if (PeerGroupCount > 0)" in Type 9.
3. Use the Uint16 filed instead of Bits field in union
MEMORY_DEVICE_OPERATING_MODE_CAPABILITY to dump data.

Cc: Jaben Carsey 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../SmbiosView/PrintInfo.c |  86 ++---
 .../SmbiosView/QueryTable.c| 135 -
 .../SmbiosView/QueryTable.h|  26 +++-
 .../SmbiosView/SmbiosViewStrings.uni   |   9 +-
 4 files changed, 237 insertions(+), 19 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
index 93c6094df1..af8551fe2e 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
@@ -541,26 +541,49 @@ SmbiosPrintStructure (
 
   //
   // System Slots (Type 9)
   //
   case 9:
-PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
-DisplaySystemSlotType (Struct->Type9->SlotType, Option);
-DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
-DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
-DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
-DisplaySystemSlotId (
-  Struct->Type9->SlotID,
-  Struct->Type9->SlotType,
-  Option
- );
-DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
-DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
-if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
-  PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
-  PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+{
+  MISC_SLOT_PEER_GROUP  *PeerGroupPtr;
+  UINT8 PeerGroupCount;
+
+  PRINT_PENDING_STRING (Struct, Type9, SlotDesignation);
+  DisplaySystemSlotType (Struct->Type9->SlotType, Option);
+  DisplaySystemSlotDataBusWidth (Struct->Type9->SlotDataBusWidth, Option);
+  DisplaySystemSlotCurrentUsage (Struct->Type9->CurrentUsage, Option);
+  DisplaySystemSlotLength (Struct->Type9->SlotLength, Option);
+  DisplaySystemSlotId (
+Struct->Type9->SlotID,
+Struct->Type9->SlotType,
+Option
+   );
+  DisplaySlotCharacteristics1 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics1), Option);
+  DisplaySlotCharacteristics2 (*(UINT8 *) 
&(Struct->Type9->SlotCharacteristics2), Option);
+  if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) {
+PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum);
+PRINT_STRUCT_VALUE_H (Struct, Type9, DevFuncNum);
+  }
+  if (AE_SMBIOS_VERSION (0x3, 0x2)) {
+if (Struct->Hdr->Length > 0x11) {
+  PRINT_STRUCT_VALUE (Struct, Type9, DataBusWidth);
+}
+if (Struct->Hdr->Length > 0x12) {
+  PRINT_STRUCT_VALUE (Struct, Type9, PeerGroupingCount);
+
+  PeerGroupCount = Struct->Type9->PeerGroupingCount;
+  PeerGroupPtr   = Struct->Type9->PeerGroups;
+  for (Index = 0; Index < PeerGroupCount; Index++) {
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SLOT_PEER_GROUPS), gShellDebug1HiiHandle, Index + 1);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_SEGMENT_GROUP_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].SegmentGroupNum);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_BUS_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].BusNum);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DEV_FUNC_NUM), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DevFuncNum);
+ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN 
(STR_SMBIOSVIEW_PRINTINFO_DATA_BUS_WIDTH), gShellDebug1HiiHandle, 
PeerGroupPtr[Index].DataBusWidth);
+  }
+}
+  }
 }
 break;
 
   //
   // On Board Devices Information (Type 10)
@@ -753,10 +776,33 @@ SmbiosPrintStructure (
 if (AE_SMBIOS_VERSION (0x2, 0x8) && (Struct->Hdr->Length > 0x22)) {
   PRINT_STRUCT_VALUE (Struct, Type17, MinimumVoltage);
   PRINT_STRUCT_VALUE (Struct, Type17, MaximumVoltage);
   PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredVoltage);
 }
+if (AE_SMBIOS_VERSION 

[edk2] [PATCH v2] MdeModulePkg/Network: Add 32bit subnet mask support for IP4 PXE boot.

2018-08-29 Thread Fu Siyuan
V2 update:
The original patch has a problem, that if an IP child which not using default 
address is
configured with /32 subnet mask, while the gateway is configured to the default 
route table,
then the gateway won't take effect on that IP child. This patch fixed the 
problem.

This patch updates IP4 stack to support 32bit subnet mask in PXE boot process.
When 32bit subnet mask is used, the IP4 driver couldn't use the subnet mask to 
determine
whether destination IP address is on-link or not, so it will always try to send 
all the
packets to the destination IP address directly first, if failed it will continue
to try the default gateway.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
---
 MdeModulePkg/Include/Library/NetLib.h |   5 +-
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c|  13 +-
 .../Universal/Network/Ip4Dxe/Ip4Common.h  |   2 +-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c | 117 --
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.h |   5 +-
 .../Universal/Network/Ip4Dxe/Ip4Impl.c|   2 +-
 .../Universal/Network/Ip4Dxe/Ip4Output.c  |  11 +-
 .../Universal/Network/Ip4Dxe/Ip4Route.c   |  26 +++-
 .../Universal/Network/Ip4Dxe/Ip4Route.h   |   9 +-
 .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c  |   6 +-
 10 files changed, 163 insertions(+), 33 deletions(-)

diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index ef7bc429c1..b7ef99c7b5 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -422,8 +422,9 @@ NetGetIpClass (
 
   If all bits of the host address of IP are 0 or 1, IP is also not a valid 
unicast address,
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
-  mask (RFC3021).
-
+  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
+  PPP link).
+  
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c 
b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index bf8f5523e6..63f4724062 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -654,8 +654,9 @@ NetGetIpClass (
 
   If all bits of the host address of IP are 0 or 1, IP is also not a valid 
unicast address,
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
-  mask (RFC3021).
-
+  mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
+  PPP link).
+  
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
@@ -669,18 +670,20 @@ NetIp4IsUnicast (
   IN IP4_ADDR   NetMask
   )
 {
+  INTN   MaskLength;
+  
   ASSERT (NetMask != 0);
 
   if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) {
 return FALSE;
   }
 
-  if (NetGetMaskLength (NetMask) != 31) {
+  MaskLength = NetGetMaskLength (NetMask);
+  ASSERT ((MaskLength >= 0) && (MaskLength <= IP4_MASK_NUM));
+  if (MaskLength < 31) {
 if (((Ip &~NetMask) == ~NetMask) || ((Ip &~NetMask) == 0)) {
   return FALSE;
 }
-  } else {
-return TRUE;
   }
 
   return TRUE;
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
index e0fffc9d0d..994a81f4de 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Common.h
@@ -55,7 +55,7 @@ typedef struct _IP4_SERVICEIP4_SERVICE;
 /// Compose the fragment field to be used in the IP4 header.
 ///
 #define IP4_HEAD_FRAGMENT_FIELD(Df, Mf, Offset) \
-((UINT16)(((Df) ? 0x4000 : 0) | ((Mf) ? 0x2000 : 0) | (((Offset) >> 3) & 
0x1fff)))
+((UINT16)(((Df) ? IP4_HEAD_DF_MASK : 0) | ((Mf) ? IP4_HEAD_MF_MASK : 0) | 
(((Offset) >> 3) & IP4_HEAD_OFFSET_MASK)))
 
 #define IP4_LAST_FRAGMENT(FragmentField)  \
   (((FragmentField) & IP4_HEAD_MF_MASK) == 0)
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
index 6e0e3290c7..b0172283b7 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
@@ -138,6 +138,7 @@ Ip4CancelFrameArp (
   @param[in]  CallBack  Call back function to execute if transmission
 finished.
   @param[in]  Context   Opaque parameter to the call back.
+  @param[in]  IpSb  The pointer to the IP4 service binding 
instance.
 
   @retval   Token   The wrapped token if succeed
   @retval   NULLThe wrapped token if NULL
@@ -149,7 +150,8 @@ Ip4WrapLinkTxToken (
   IN IP4_PROTOCOL   *IpInstance OPTIONAL,
   IN NET_BUF*Packet,
   IN IP4_FRAME_CALLBACK CallBack,
-  IN VOID   

[edk2] [Patch] BaseTools: Dynamic Pcd value override from command line.

2018-08-29 Thread BobCF
Fixed the pcd value override issue when Dynamic Pcd is from
command line but is not list in Dsc file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623f..d553536961 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1268,13 +1268,18 @@ class DscBuildData(PlatformBuildClassObject):
 PcdInDec = self.DecPcds.get((Name, Guid))
 if PcdInDec:
 PcdInDec.PcdValueFromComm = NoFiledValues[(Guid, Name)][0]
 if PcdInDec.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD],
 
self._PCD_TYPE_STRING_[MODEL_PCD_PATCHABLE_IN_MODULE],
-
self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG]]:
+
self._PCD_TYPE_STRING_[MODEL_PCD_FEATURE_FLAG],
+
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC],
+
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]:
 self.Pcds[Name, Guid] = copy.deepcopy(PcdInDec)
 self.Pcds[Name, Guid].DefaultValue = NoFiledValues[( 
Guid, Name)][0]
+if PcdInDec.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC],
+
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX]]:
+self.Pcds[Name, Guid].SkuInfoList = 
{TAB_DEFAULT:SkuInfoClass(TAB_DEFAULT, self.SkuIds[TAB_DEFAULT][0], '', '', '', 
'', '', NoFiledValues[( Guid, Name)][0])}
 return AllPcds
 
 def OverrideByFdfOverAll(self,AllPcds):
 
 if GlobalData.gFdfParser is None:
-- 
2.16.2.windows.1

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


[edk2] OSFC tickets

2018-08-29 Thread Philipp Deppenwiese
Friendly reminder.

2 days until the ticket sale is closed.

Buy your tickets now https://osfc.io/tickets

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


Re: [edk2] [PATCH 1/1] ArmPkg/OpteeLib: Add APIs to communicate with OP-TEE

2018-08-29 Thread Sumit Garg
Hi Bhupesh,

On Wed, 29 Aug 2018 at 11:11, Bhupesh Sharma  wrote:
>
> Hi Sumit,
>
> On Tue, Aug 28, 2018 at 10:04 PM, Sumit Garg  wrote:
> > Hi Achin,
> >
> > On Tue, 28 Aug 2018 at 18:38, Achin Gupta  wrote:
> >>
> >> Hi Sumit,
> >>
> >> Apologies for not replying sooner. Some questions and thoughts inline.
> >>
> >> On Mon, Aug 27, 2018 at 03:28:52PM +0530, Sumit Garg wrote:
> >> > On Fri, 24 Aug 2018 at 23:33, Matteo Carlini  
> >> > wrote:
> >> > >
> >> > > +Achin
> >> > >
> >> > > SPD (for OP-TEE and other Trusted-OSes payloads running at S-EL1) and 
> >> > > SPM (for Secure Partitions at S-EL0) are currently mutually exclusive 
> >> > > into Trusted Firmware-A codebase.
> >> > >
> >> > > In other words, you cannot turn them on in parallel and execute both a 
> >> > > S-EL1 Trusted OS AND (one or many) S-EL0 Secure Partitions in the 
> >> > > Secure World with the current Software Architecture.
> >> > >
> >> >
> >> > IIUC, currently BL32 image is common in Trusted Firmware-A code-base.
> >> > If we turn on SPD then BL32= else if we turn on SPM
> >> > then BL32=, correct?
> >>
> >> Yes! BL32 is a TOS image if SPD is enabled. It is a S-EL0 Standalone MM 
> >> Secure
> >> partition image if SPM is enabled.
> >>
> >> >
> >> > But I think SMC calling conventions (SMC Calling Convention [1] and
> >> > Management Mode Interface Specification [2]) doesn't put any such
> >> > restrictions as SMC function IDs are totally separate.
> >>
> >> Yes, this was an implementation choice to ensure that either a S-EL1 
> >> payload
> >> (Trusted OS) or a S-EL0 payload (MM SP) could be included in an Arm TF 
> >> build but
> >> not both.
> >>
> >> >
> >> > > Achin and other Arm architects are trying to figure out a way for 
> >> > > solving this problem without the need for a v8.4 Secure-EL2 
> >> > > Hypervisor, obviously without leveraging the isolation benefits of it 
> >> > > (see also [1]).
> >> > >
> >> >
> >> > Agree we won't be having isolation benefits which provides added level
> >> > of Security.
> >> >
> >> > > But Ard is right: there could be use-cases to ship UEFI systems with 
> >> > > OP-TEE and TAs on top...and this should still be currently possible 
> >> > > using the SPD dispatcher into TF-A. I've not looked deeply into this 
> >> > > patch, but it doesn’t seem to contradict the above Sw architecture.
> >> > >
> >> > > The question would be: would you foresee the need for running one (or 
> >> > > many) other (UEFI/EDK2-based) Secure Services in the Secure World into 
> >> > > a Secure Partition (using the StandaloneMmPkg) *together* with OP-TEE?
> >> > >
> >> >
> >> > As per following quote from Management Mode Interface Specification [2]:
> >> >
> >> > "Management Mode (MM) provides an environment for implementing OS
> >> > agnostic services (MM services) like RAS error handling, secure
> >> > variable storage, and firmware updates in system firmware. The
> >> > services can be invoked synchronously and asynchronously."
> >> >
> >> > It seems that MM mode is designed for more robust and platform
> >> > specific services whereas OP-TEE (or any trusted OS) use-cases seem to
> >> > be more complex like Entropy pool (RNG as in our case), DRM (could be
> >> > valid use-case for Android TV or Chromebook), keymaster or keystore
> >> > (for Edge devices) etc.
> >>
> >> It really depends upon the secure sw stack, use case and the requirements. 
> >> MM
> >> interface specification specifies a blocking SMC (MM_COMMUNICATE) to 
> >> access a
> >> secure service implemented in S-EL0.
> >>
> >> In the UEFI/PI/EDK2 context, MM drivers are used to satisfy a variety of 
> >> use
> >> cases during boot through the EFI_MM_COMMUNICATION_PROTOCOL (the bad press 
> >> of
> >> SMM aside!). MM_COMMUNICATE SMC provides a channel into the secure world 
> >> to the
> >> backend of this protocol on Arm systems. So any service accessible through 
> >> this
> >> protocol could be implemented on Arm systems in a MM SP.
> >>
> >> IIUC, in your case there is OP-TEE and firmware in the secure world. 
> >> OP-TEE has
> >> a static TA that provides the random data service and you want to leverage 
> >> it at
> >> boot time? Ditto for other services?
> >
> > Correct, actually we tried to create OP-TEE static (pseudo) TA that
> > provides RNG service using thermal sensor noise and secure timer
> > interrupts (FIQs) to fill entropy pool. Using this service via OP-TEE
> > library in UEFI (subset in terms of functionality as compared to
> > OP-TEE kernel driver) for features like KASLR etc.
>
> Commenting on this from a distribution p-o-v, we have arn64 boards
> available which have good entropy sources available but do not support
> EFI_RNG_PROTOCOL as they would not like the EFI firmware running in
> EL2 mode to use the secure entropy sources (which should be touched
> only by secure EL3 or EL1 softwares).
>
> In such cases, we are not able to support KASLR linux boot on such
> boards as there is basically no EFI_RNG_PROTOCOL support 

[edk2] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] Graphic Change.

2018-08-29 Thread zwei4
(1) Fixed the issue that the VBT passed to OS is not the right VBT file. All 
boards are affected.
(2) For UP2, disable Onboard LSPCON for HDMI 2.0 in VBT.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: David Wei 
CC: Mike Wu  
CC: Mang Guo 
---
 Platform/BroxtonPlatformPkg/Board/UP2/Vbt/Vbt.bin | Bin 5632 -> 5632 bytes
 .../PlatformPostMemPei/PlatformInit.c |   5 +++--
 .../PlatformPostMemPei/PlatformPostMemPei.inf |   1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/BroxtonPlatformPkg/Board/UP2/Vbt/Vbt.bin 
b/Platform/BroxtonPlatformPkg/Board/UP2/Vbt/Vbt.bin
index 
0d94dac62a8e410c4f456b52f4de37a50a6655e6..e9b20fe9f7082511c467160a94d0bc00b842c052
 100644
GIT binary patch
delta 25
hcmZqBY0#M<#e9gtU~(X%@J55xjEn-C?=Y%}003j{2UY+8

delta 25
hcmZqBY0#M<#k`NfU~(X%@J55xjEo|i?=Y%}003jX2UY+8

diff --git 
a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
 
b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
index 17c09ecf6f..acaaebbfbb 100644
--- 
a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
+++ 
b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c
@@ -271,7 +271,7 @@ BXTPolicyInit (
   VOID*   Buffer;
   UINT32  Size;
   EFI_GUIDPeiLogoGuid= { 0x7BB28B99, 0x61BB, 
0x11D5, {0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} };
-  EFI_GUIDTianmaVbtGuid  = { 0xE08CA6D5, 0x8D02, 
0x43ae, {0xAB, 0xB1, 0x95, 0x2C, 0xC7, 0x87, 0xC9, 0x33} };
+  EFI_GUIDVbtGuid;
   VBT_INFOVbtInfo;
 
 
@@ -286,7 +286,8 @@ BXTPolicyInit (
   //
   // May need a different VBT depending on PanelSel
   //
-  PeiGetSectionFromFv (TianmaVbtGuid, , );
+  CopyMem (, PcdGetPtr (PcdBoardVbtFileGuid), sizeof (EFI_GUID));
+  PeiGetSectionFromFv (VbtGuid, , );
 
   if (Buffer == NULL) {
 DEBUG (( DEBUG_ERROR, "Could not locate VBT"));
diff --git 
a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
 
b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
index 2fb7fb6a6f..35e6e1c4a0 100644
--- 
a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
+++ 
b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf
@@ -121,6 +121,7 @@
   gPlatformModuleTokenSpaceGuid.PcdVibratorFeature
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid   ## CONSUMES
   gPlatformModuleTokenSpaceGuid.PcdBoardPostMemInitFunc
+  gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid
 
 [Depex]
   gDramPolicyPpiGuid
-- 
2.14.1.windows.1

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


Re: [edk2] [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType

2018-08-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Saturday, August 25, 2018 12:33 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Zhu, Yonghong ; 
Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' 
from DataType

I see lots of 'MSFT' throughout code and this can reduce them.

Cc: Bob Feng 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py  |  8 
 BaseTools/Source/Python/AutoGen/BuildEngine.py  |  8 
 BaseTools/Source/Python/AutoGen/GenMake.py  |  3 ++-
 BaseTools/Source/Python/Common/DataType.py  |  2 ++
 BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py |  2 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py  |  4 ++--
 BaseTools/Source/Python/Workspace/DscBuildData.py   |  4 ++--
 BaseTools/Source/Python/Workspace/InfBuildData.py   | 14 
+++---
 BaseTools/Source/Python/build/build.py  |  2 +-
 9 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b28388967..cb302189d2a3 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -80,7 +80,7 @@ gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)")  
gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
 
 ## Mapping Makefile type
-gMakeTypeMap = {"MSFT":"nmake", "GCC":"gmake"}
+gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
 
 
 ## Build rule configuration file
@@ -1843,7 +1843,7 @@ class PlatformAutoGen(AutoGen):
or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]:
 EdkLogger.verbose("No tool chain family found in configuration 
for %s. Default to MSFT." \
% self.ToolChain)
-self._ToolChainFamily = "MSFT"
+self._ToolChainFamily = TAB_COMPILER_MSFT
 else:
 self._ToolChainFamily = 
ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]
 return self._ToolChainFamily
@@ -1856,7 +1856,7 @@ class PlatformAutoGen(AutoGen):
or not 
ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]:
 EdkLogger.verbose("No tool chain family found in configuration 
for %s. Default to MSFT." \
% self.ToolChain)
-self._BuildRuleFamily = "MSFT"
+self._BuildRuleFamily = TAB_COMPILER_MSFT
 else:
 self._BuildRuleFamily = 
ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]
 return self._BuildRuleFamily
@@ -2978,7 +2978,7 @@ class ModuleAutoGen(AutoGen):
 # Regular expression for finding Include Directories, the difference 
between MSFT and INTEL/GCC/RVCT
 # is the former use /I , the Latter used -I to specify include 
directories
 #
-if self.PlatformInfo.ToolChainFamily in ('MSFT'):
+if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT):
 BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
 elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
 BuildOptIncludeRegEx = gBuildOptIncludePatternOther diff --git 
a/BaseTools/Source/Python/AutoGen/BuildEngine.py 
b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index 4291da9001b8..ac7a6687552c 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -318,7 +318,7 @@ class BuildRule:
 #   @param  LineIndex   The line number from which the parsing 
will begin
 #   @param  SupportedFamily The list of supported tool chain families
 #
-def __init__(self, File=None, Content=None, LineIndex=0, 
SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]):
+def __init__(self, File=None, Content=None, LineIndex=0, 
SupportedFamily=[TAB_COMPILER_MSFT, "INTEL", "GCC", "RVCT"]):
 self.RuleFile = File
 # Read build rules from file if it's not none
 if File is not None:
@@ -596,17 +596,17 @@ if __name__ == '__main__':
 EdkLogger.Initialize()
 if len(sys.argv) > 1:
 Br = BuildRule(sys.argv[1])
-print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]))
+print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", 
+ TAB_COMPILER_MSFT][1]))
 print()
 print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]))
 print()
 print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]))
 print()
-print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
+print(str(Br[".ac", "ACPI_TABLE", "IA32", 
+