Re: [edk2-devel] [PATCH V2 0/2] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Friday, April 12, 2019 8:14 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Gao, Liming; Sean Brogan;
> Michael Turner; Bret Barkelew
> Subject: [edk2-devel] [PATCH V2 0/2] MdeModulePkg/CapsulePei: Update
> the debug code to print 64bit data
> 
> Change the EFI_D_ version debug MACRO to DEBUG_ version.
> And change the UINT64 value from '%x' to '%lx'.
> 
> V2:
> Seperate one patch to two to view different change goal.
> Change the pointer value from '%x' to '%p'.

The series looks good to me.
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu

> 
> Cc: Jian J Wang 
> Cc: Hao Wu 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> 
> Bret Barkelew (1):
>   MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
> 
> Zhichao Gao (1):
>   MdeModulePkg/CapsulePei: Change debug MACRO
> 
>  .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +--
>  .../Universal/CapsulePei/UefiCapsule.c| 46 +-
>  2 files changed, 68 insertions(+), 68 deletions(-)
> 
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38940): https://edk2.groups.io/g/devel/message/38940
Mute This Topic: https://groups.io/mt/31037123/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [platforms: PATCH] Marvell/Armada7k8k: Remove UefiDecompressLib

2019-04-11 Thread Ard Biesheuvel
On Thu, 11 Apr 2019 at 16:30, Marcin Wojtas  wrote:
>
> Recent changes in EDK2 moved UefiDecompressLib from the
> IntelFrameworkModulePkg, breaking the compilation of
> Armada platforms. It turned out it is not needed, so fix it by
> safely removing references to the problematic library.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas 

Reviewed-by: Ard Biesheuvel 

Pushed as 11c98f35af40..dc31a7feb81a

Thanks!

> ---
>  Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
> b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> index 1e2d248..8291582 100644
> --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> @@ -203,13 +203,11 @@
>
> DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf
>
>  [LibraryClasses.common.UEFI_APPLICATION]
> -  
> UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
>PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
>
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
>
>  [LibraryClasses.common.UEFI_DRIVER]
> -  
> UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
>
> ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
>PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
>
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> --
> 2.7.4
>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38939): https://edk2.groups.io/g/devel/message/38939
Mute This Topic: https://groups.io/mt/31036776/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 2/2] MdeModulePkg/GraphicsConsoleDxe: Do not clean the screen

2019-04-11 Thread Gao, Zhichao
From: Aaron Antone 

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

For now, most platform support to display during PEIM. It means the logo
can show at PEI phase. But the screen would be cleared at BDS connect
console phase. That may make the screen flush and turn into black screen.
So do not clear the screen while set the text mode for graphics console
device.
Also replace the debug code in GraphicsConsoleControllerDriverStart. The
origin one would set a basic mode and then print the text info to graphic
console device. Then the conspliter would set a best mode for graphics
console device. If the best mode is different with the basic one, the
screen would be cleared. So use the debug output instead.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 .../GraphicsConsoleDxe/GraphicsConsole.c  | 45 +--
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git 
a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c 
b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index 26ea19f300..0a35b59d64 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -1,7 +1,7 @@
 /** @file
   This is the main routine for initializing the Graphics Console support 
routines.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -567,16 +567,7 @@ GraphicsConsoleControllerDriverStart (
   //
   Private->SimpleTextOutputMode.MaxMode = (INT32) MaxMode;
 
-  DEBUG_CODE_BEGIN ();
-Status = GraphicsConsoleConOutSetMode (>SimpleTextOutput, 0);
-if (EFI_ERROR (Status)) {
-  goto Error;
-}
-Status = GraphicsConsoleConOutOutputString (>SimpleTextOutput, 
(CHAR16 *)L"Graphics Console Started\n\r");
-if (EFI_ERROR (Status)) {
-  goto Error;
-}
-  DEBUG_CODE_END ();
+  DEBUG ((DEBUG_INFO, "Graphics Console Started!\n\r"));
 
   //
   // Install protocol interfaces for the Graphics Console device.
@@ -1366,18 +1357,26 @@ GraphicsConsoleConOutSetMode (
   //
   // The current graphics mode is correct, so simply clear the entire 
display
   //
-  Status = GraphicsOutput->Blt (
-  GraphicsOutput,
-  [0],
-  EfiBltVideoFill,
-  0,
-  0,
-  0,
-  0,
-  ModeData->GopWidth,
-  ModeData->GopHeight,
-  0
-  );
+  //
+  // For the first time set the mode, do not clear the display.
+  // Some platform would show logo at PEIM and this would clear
+  // the whole screen. So for first time set mode, do not clear
+  // the screen.
+  //
+  if (This->Mode->Mode != -1) {
+Status = GraphicsOutput->Blt (
+GraphicsOutput,
+[0],
+EfiBltVideoFill,
+0,
+0,
+0,
+0,
+ModeData->GopWidth,
+ModeData->GopHeight,
+0
+);
+  }
 }
   } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
 //
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38938): https://edk2.groups.io/g/devel/message/38938
Mute This Topic: https://groups.io/mt/31038455/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 0/2] MdeModulePkg: Make the screen seamless

2019-04-11 Thread Gao, Zhichao
For now most platforms support display function at PEI phase.
But the conspliter and graphics console driver would clear the
screen at BDS connect console phase. Maybe some platforms would
show logo in the next or maybe not. For consumers, it looks like
the screen flashed.
So change the behavior of graphics console devices while connect
console devices to maintain seamless screen from PEI.

Test has done on MinPlatform Kabylake-RVP3 which support PEI
display.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 

Aaron Antone (2):
  MdeModulePkg/ConSplitterDxe: Optimize the ConSplitterTextOutSetMode
  MdeModulePkg/GraphicsConsoleDxe: Do not clean the screen

 .../Console/ConSplitterDxe/ConSplitter.c  | 34 +-
 .../Console/ConSplitterDxe/ConSplitter.h  |  4 +-
 .../GraphicsConsoleDxe/GraphicsConsole.c  | 45 +--
 3 files changed, 48 insertions(+), 35 deletions(-)

-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38936): https://edk2.groups.io/g/devel/message/38936
Mute This Topic: https://groups.io/mt/31038452/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 1/2] MdeModulePkg/ConSplitterDxe: Optimize the ConSplitterTextOutSetMode

2019-04-11 Thread Gao, Zhichao
From: Aaron Antone 

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

For Console Out device, it would always set all present devices'
text out mode again through ConSplitterTextOutSetMode while adding
devices. That may cause the screen cleared for serval times.
So add a BOOLEAN to judge if it is adding device then we will not
set the same text mode again for same console out device.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 .../Console/ConSplitterDxe/ConSplitter.c  | 34 +--
 .../Console/ConSplitterDxe/ConSplitter.h  |  4 ++-
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c 
b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index 6fc0e4796f..fc9b9e08e5 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
@@ -16,7 +16,7 @@
   never removed. Such design ensures sytem function well during none console
   device situation.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -180,7 +180,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED 
TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
   0,
   (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,
   0,
-  (INT32 *) NULL
+  (INT32 *) NULL,
+  FALSE
 };
 
 //
@@ -235,7 +236,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED 
TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
   0,
   (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,
   0,
-  (INT32 *) NULL
+  (INT32 *) NULL,
+  FALSE
 };
 
 //
@@ -3132,8 +3134,9 @@ ConSplitterTextOutAddDevice (
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
   EFI_STATUS   DeviceStatus;
 
-  Status= EFI_SUCCESS;
-  CurrentNumOfConsoles  = Private->CurrentNumberOfConsoles;
+  Status  = EFI_SUCCESS;
+  CurrentNumOfConsoles= Private->CurrentNumberOfConsoles;
+  Private->AddingConOutDevice = TRUE;
 
   //
   // If the Text Out List is full, enlarge it by calling 
ConSplitterGrowBuffer().
@@ -3290,6 +3293,8 @@ ConSplitterTextOutAddDevice (
   //
   ConsplitterSetConsoleOutMode (Private);
 
+  Private->AddingConOutDevice = FALSE;
+
   return Status;
 }
 
@@ -4849,12 +4854,19 @@ ConSplitterTextOutSetMode (
   //
   TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * 
ModeNumber;
   for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < 
Private->CurrentNumberOfConsoles; Index++) {
-Status = Private->TextOutList[Index].TextOut->SetMode (
-
Private->TextOutList[Index].TextOut,
-TextOutModeMap[Index]
-);
-if (EFI_ERROR (Status)) {
-  ReturnStatus = Status;
+//
+// While adding a console out device do not set same mode again for the 
same device.
+//
+if (Private->AddingConOutDevice != TRUE ||
+  TextOutModeMap[Index] != 
Private->TextOutList[Index].TextOut->Mode->Mode) {
+
+  Status = Private->TextOutList[Index].TextOut->SetMode (
+  
Private->TextOutList[Index].TextOut,
+  TextOutModeMap[Index]
+  );
+  if (EFI_ERROR (Status)) {
+ReturnStatus = Status;
+  }
 }
   }
 
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h 
b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h
index e9b68e58c6..419635c3f5 100644
--- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h
+++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.h
@@ -1,7 +1,7 @@
 /** @file
   Private data structures for the Console Splitter driver
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -218,6 +218,8 @@ typedef struct {
   UINTN TextOutQueryDataCount;
   INT32 *TextOutModeMap;
 
+  BOOLEAN   AddingConOutDevice;
+
 } TEXT_OUT_SPLITTER_PRIVATE_DATA;
 
 #define TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38937): https://edk2.groups.io/g/devel/message/38937
Mute This Topic: https://groups.io/mt/31038454/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-platforms/devel-MinPlatform][Patch v2] AdvancedFeaturePkg/AcpiDebug: Add new AcpiDebug modules.

2019-04-11 Thread Kubacki, Michael A
Reviewed-by: Michael Kubacki  

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Dong, Eric
> Sent: Sunday, April 7, 2019 9:50 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A ; Kubacki, Michael A
> 
> Subject: [edk2-devel] [edk2-platforms/devel-MinPlatform][Patch v2]
> AdvancedFeaturePkg/AcpiDebug: Add new AcpiDebug modules.
> 
> V2 changes:
> 1. Add error handling code instead of just assert.
> 2. Correct some comments and copy right.
> 
> 
> Add new AcpiDebug modules which provide ACPI Debug feature.
> Detail about this feature see the readme.txt in the patch.
> 
> 
> Cc: Hao Wu 
> Cc: Michael Kubacki 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong 
> ---
>  .../AcpiDebug/AcpiDebug.asl   | 109 
>  .../AdvancedFeaturePkg/AcpiDebug/AcpiDebug.c  | 528
> ++
>  .../AcpiDebug/AcpiDebugDxe.inf|  63 +++
>  .../AcpiDebug/AcpiDebugSmm.inf|  65 +++
>  .../AdvancedFeaturePkg/AcpiDebug/Readme.txt   |  31 +
>  .../AdvancedFeaturePkg/AdvancedFeaturePkg.dec |   8 +-
>  .../AdvancedFeaturePkg/AdvancedFeaturePkg.dsc |   4 +-
>  7 files changed, 806 insertions(+), 2 deletions(-)  create mode 100644
> Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebug.asl
>  create mode 100644
> Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebug.c
>  create mode 100644
> Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebugDxe.inf
>  create mode 100644
> Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebugSmm.inf
>  create mode 100644
> Platform/Intel/AdvancedFeaturePkg/AcpiDebug/Readme.txt
> 
> diff --git a/Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebug.asl
> b/Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebug.asl
> new file mode 100644
> index 000..7e05db1
> --- /dev/null
> +++ b/Platform/Intel/AdvancedFeaturePkg/AcpiDebug/AcpiDebug.asl
> @@ -0,0 +1,109 @@
> +/** @file
> +  Acpi Debug ASL code.
> +
> +Copyright (c) 2019, Intel Corporation. All rights reserved. This
> +program and the accompanying materials are licensed and made available
> +under the terms and conditions of the BSD License which accompanies
> +this distribution.  The full text of the license may be found at
> +http://opensource.org/licenses/bsd-license.php
> +
> +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> +
> +**/
> +
> +DefinitionBlock (
> +  "AcpiDebug.aml",
> +  "SSDT",
> +  2,
> +  "Intel ",
> +  "ADebTabl",
> +  0x1000
> +  )
> +{
> +  Scope(\)
> +  {
> +//
> +// These pointers are patched during POST.
> +//
> +Name (DPTR, 0x8000) // Address of Acpi debug memory buffer, fixed
> up during POST
> +Name (EPTR, 0x8000) // End of Acpi debug memory buffer, fixed up
> during POST
> +Name (CPTR, 0x8000) // Current pointer used as an index into
> +the buffer(starts after the Acpi Debug head), fixed up during POST
> +
> +//
> +// Use a Mutex to prevent multiple calls from simutaneously writing to
> the same memory.
> +//
> +Mutex (MMUT, 0)
> +
> +//
> +// Operational region for SMI port access
> +//
> +OperationRegion (ADBP, SystemIO, 0xB2, 2)
> +Field (ADBP, ByteAcc, NoLock, Preserve)
> +{
> +B2PT, 8,
> +B3PT, 8,
> +}
> +
> +//
> +// Write a string to a memory buffer
> +//
> +Method (MDBG, 1, Serialized)
> +{
> +  OperationRegion (ADHD, SystemMemory, DPTR, 32) // Operation region
> for Acpi Debug buffer first 0x20 bytes
> +  Field (ADHD, ByteAcc, NoLock, Preserve)
> +  {
> +Offset (0x0),
> +ASIG, 128,  // 16 bytes is Signature
> +Offset (0x10),
> +ASIZ, 32,   // 4 bytes is buffer size
> +ACHP, 32,   // 4 bytes is current head pointer, normally is DPTR 
> +
> 0x20,
> +//   if there's SMM handler to print, then it's the 
> starting of the
> info hasn't been printed yet.
> +ACTP, 32,   // 4 bytes is current tail pointer, is the same as 
> CPTR
> +SMIN, 8,// 1 byte of SMI Number for trigger callback
> +WRAP, 8,// 1 byte of wrap status
> +SMMV, 8,// 1 byte of SMM version status
> +TRUN, 8 // 1 byte of truncate status
> +  }
> +
> +  Store (Acquire (MMUT, 1000), Local0) // save Acquire result so we can
> check for Mutex acquired
> +  If (LEqual (Local0, Zero)) // check for Mutex acquired
> +  {
> +OperationRegion (ABLK, SystemMemory, CPTR, 32) // Operation region
> to allow writes to ACPI debug buffer
> +Field (ABLK, ByteAcc, NoLock, Preserve)
> +{
> +  Offset (0x0),
> +  , 256 // 32 bytes is max size for string or data
> +}
> +ToHexString (Arg0, Local1) // convert argument to Hexadecimal String
> +Store (0, TRUN)
> +If 

[edk2-devel] [Patch] BaseTools: Remove the unnecessary copy action for module output files

2019-04-11 Thread Liming Gao
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1673

Signed-off-by: Liming Gao 
Cc: Bob Feng 
---
 BaseTools/Conf/build_rule.template | 19 +--
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 030e74c35a..55d619c6ef 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -357,24 +357,11 @@
 
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(DEBUG_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
--$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
--$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) 
+
 
 $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
 $(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
-
-#
-#The below 2 lines are only needed for UNIXGCC tool chain, which 
generates PE image directly
-#
--$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
--$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
-
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(DEBUG_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
--$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 
 # tool to convert Mach-O to PE/COFF
@@ -382,9 +369,6 @@
 # create symbol file for GDB debug
 -$(DSYMUTIL) ${src}
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
-$(CP) ${dst} $(DEBUG_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
--$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 [Dependency-Expression-File]
 
@@ -540,7 +524,6 @@
 
 
 "$(GENFW)" -o ${dst} -j $(MICROCODE_BINARY_FILES) $(GENFW_FLAGS)
--$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).bin
 
 [EFI-Image-File]
 
-- 
2.13.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38934): https://edk2.groups.io/g/devel/message/38934
Mute This Topic: https://groups.io/mt/31037607/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 5/5] MdePkg/UefiDebugLibStdErr: Make it runtime safe

2019-04-11 Thread Gao, Zhichao
From: Aaron Antone 

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

After ExitBootServices, some pointer would be invalid such as
the Protocol pointer and gST. The function depend on those should
be prevent. So disable the related function while after
ExitBootServices.
Change the gST to a internal one, because there will be a cycle
consume between UefiBootServicesTableLib and DebugLib due to the
library constructors.
Also remove the SMM support for this instance.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdePkg/Library/UefiDebugLibStdErr/DebugLib.c  | 113 +-
 .../UefiDebugLibStdErr/DebugLibConstructor.c  |  77 
 .../UefiDebugLibStdErr/UefiDebugLibStdErr.inf |  12 +-
 3 files changed, 145 insertions(+), 57 deletions(-)
 create mode 100644 MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c

diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c 
b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
index 29f93cf3e3..40eb697e7e 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
@@ -10,7 +10,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -29,6 +28,8 @@
 //
 VA_LIST mVaListNull;
 
+extern BOOLEANmPostEBS;
+extern EFI_SYSTEM_TABLE   *mDebugST;
 
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
@@ -88,32 +89,34 @@ DebugPrintMarker (
 {
   CHAR16   Buffer[MAX_DEBUG_MESSAGE_LENGTH];
 
-  //
-  // If Format is NULL, then ASSERT().
-  //
-  ASSERT (Format != NULL);
-
-  //
-  // Check driver debug mask value and global mask
-  //
-  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
-return;
-  }
-
-  //
-  // Convert the DEBUG() message to a Unicode String
-  //
-  if (BaseListMarker == NULL) {
-UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, 
VaListMarker);
-  } else {
-UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, 
BaseListMarker);
-  }
-
-  //
-  // Send the print string to the Standard Error device
-  //
-  if ((gST != NULL) && (gST->StdErr != NULL)) {
-gST->StdErr->OutputString (gST->StdErr, Buffer);
+  if (!mPostEBS) {
+//
+// If Format is NULL, then ASSERT().
+//
+ASSERT (Format != NULL);
+
+//
+// Check driver debug mask value and global mask
+//
+if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
+  return;
+}
+
+//
+// Convert the DEBUG() message to a Unicode String
+//
+if (BaseListMarker == NULL) {
+  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, 
VaListMarker);
+} else {
+  UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, 
BaseListMarker);
+}
+
+//
+// Send the print string to the Standard Error device
+//
+if ((mDebugST != NULL) && (mDebugST->StdErr != NULL)) {
+  mDebugST->StdErr->OutputString (mDebugST->StdErr, Buffer);
+}
   }
 }
 
@@ -207,33 +210,35 @@ DebugAssert (
 {
   CHAR16  Buffer[MAX_DEBUG_MESSAGE_LENGTH];
 
-  //
-  // Generate the ASSERT() message in Unicode format
-  //
-  UnicodeSPrintAsciiFormat (
-Buffer,
-sizeof (Buffer),
-"ASSERT [%a] %a(%d): %a\n",
-gEfiCallerBaseName,
-FileName,
-LineNumber,
-Description
-);
-
-  //
-  // Send the print string to the Standard Error device
-  //
-  if ((gST != NULL) && (gST->StdErr != NULL)) {
-gST->StdErr->OutputString (gST->StdErr, Buffer);
-  }
-
-  //
-  // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
-  //
-  if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
-CpuBreakpoint ();
-  } else if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
-CpuDeadLoop ();
+  if (!mPostEBS) {
+//
+// Generate the ASSERT() message in Unicode format
+//
+UnicodeSPrintAsciiFormat (
+  Buffer,
+  sizeof (Buffer),
+  "ASSERT [%a] %a(%d): %a\n",
+  gEfiCallerBaseName,
+  FileName,
+  LineNumber,
+  Description
+  );
+
+//
+// Send the print string to the Standard Error device
+//
+if ((mDebugST != NULL) && (mDebugST->StdErr != NULL)) {
+  mDebugST->StdErr->OutputString (mDebugST->StdErr, Buffer);
+}
+
+//
+// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
+//
+if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+  CpuBreakpoint ();
+} else if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+  CpuDeadLoop ();
+}
   }
 }
 
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
new file mode 100644
index 00..d4fdfbab55
--- /dev/null
+++ 

[edk2-devel] [PATCH V2 1/5] MdeModulePkg: Change the SMM debug lib instance

2019-04-11 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1416

The UefiDebugLibConOut will not support DXE_SMM_DRIVER,
change UefiDebugLibConOut to BaseDebugLibNull.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
Reviewed-by: Hao Wu 
---
 MdeModulePkg/MdeModulePkg.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index b154f5d2ec..b302f4a4f3 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -144,7 +144,7 @@
 
 [LibraryClasses.common.DXE_SMM_DRIVER]
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
-  DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
   MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
   
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38929): https://edk2.groups.io/g/devel/message/38929
Mute This Topic: https://groups.io/mt/31037317/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 3/5] MdePkg/UefiDebugLibDebugPortProtocol: Make it runtime safe

2019-04-11 Thread Gao, Zhichao
From: Aaron Antone 

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

After ExitBootServices, some pointer would be invalid such as
the Protocol pointer and gBS. The function depend on those should
be prevent. So disable the related function while after
ExitBootServices.
Change the gBS to a internal one, because there will be a cycle
consume between UefiBootServicesTableLib and DebugLib due to the
library constructors.
Also remove the SMM support for this instance.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 .../UefiDebugLibDebugPortProtocol/DebugLib.c  | 146 +-
 .../DebugLibConstructor.c |  77 +
 .../UefiDebugLibDebugPortProtocol.inf |  12 +-
 3 files changed, 163 insertions(+), 72 deletions(-)
 create mode 100644 
MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c

diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c 
b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
index 24bfb4f37e..cd7e2abbd3 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
@@ -9,7 +9,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -37,6 +36,9 @@ EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL;
 //
 VA_LIST mVaListNull;
 
+extern BOOLEANmPostEBS;
+extern EFI_BOOT_SERVICES *mDebugBS;
+
 /**
   Send message to DebugPort Protocol.
 
@@ -56,31 +58,33 @@ UefiDebugLibDebugPortProtocolWrite (
   UINTN  Length;
   EFI_STATUS Status;
 
-  //
-  // If mDebugPort is NULL, initialize first.
-  //
-  if (mDebugPort == NULL) {
-  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
-  if (EFI_ERROR (Status)) {
-  return;
-  }
+  if (!mPostEBS) {
+//
+// If mDebugPort is NULL, initialize first.
+//
+if (mDebugPort == NULL) {
+Status = mDebugBS->LocateProtocol (, NULL, 
(VOID **));
+if (EFI_ERROR (Status)) {
+return;
+}
+
+mDebugPort->Reset (mDebugPort);
+}
 
-  mDebugPort->Reset (mDebugPort);
-  }
+//
+// EFI_DEBUGPORT_PROTOCOL.Write is called until all message is sent.
+//
+while (BufferLength > 0) {
+  Length = BufferLength;
 
-  //
-  // EFI_DEBUGPORT_PROTOCOL.Write is called until all message is sent.
-  //
-  while (BufferLength > 0) {
-Length = BufferLength;
+  Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, , (VOID *) 
Buffer);
+  if (EFI_ERROR (Status) || BufferLength < Length) {
+break;
+  }
 
-Status = mDebugPort->Write (mDebugPort, WRITE_TIMEOUT, , (VOID *) 
Buffer);
-if (EFI_ERROR (Status) || BufferLength < Length) {
-  break;
+  Buffer += Length;
+  BufferLength -= Length;
 }
-
-Buffer += Length;
-BufferLength -= Length;
   }
 }
 
@@ -142,31 +146,33 @@ DebugPrintMarker (
 {
   CHAR8  Buffer[MAX_DEBUG_MESSAGE_LENGTH];
 
-  //
-  // If Format is NULL, then ASSERT().
-  //
-  ASSERT (Format != NULL);
+  if (!mPostEBS) {
+//
+// If Format is NULL, then ASSERT().
+//
+ASSERT (Format != NULL);
+
+//
+// Check driver debug mask value and global mask
+//
+if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
+  return;
+}
 
-  //
-  // Check driver debug mask value and global mask
-  //
-  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
-return;
-  }
+//
+// Convert the DEBUG() message to an ASCII String
+//
+if (BaseListMarker == NULL) {
+  AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+} else {
+  AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+}
 
-  //
-  // Convert the DEBUG() message to an ASCII String
-  //
-  if (BaseListMarker == NULL) {
-AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
-  } else {
-AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+//
+// Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.
+//
+UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));
   }
-
-  //
-  // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.
-  //
-  UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));
 }
 
 
@@ -259,31 +265,33 @@ DebugAssert (
 {
   CHAR8  Buffer[MAX_DEBUG_MESSAGE_LENGTH];
 
-  //
-  // Generate the ASSERT() message in ASCII format
-  //
-  AsciiSPrint (
-Buffer,
-sizeof (Buffer),
-"ASSERT [%a] %a(%d): %a\n",
-gEfiCallerBaseName,
-FileName,
-LineNumber,
-Description
-);
-
-  //
-  // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.
-  //
-  UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));
-
-  //
-  // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
-  //
-  if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
-CpuBreakpoint ();
-  } else if 

[edk2-devel] [PATCH V2 2/5] SignedCapsulePkg: Change the SMM debug lib instance

2019-04-11 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1416

The UefiDebugLibConOut will not support DXE_SMM_DRIVER,
change UefiDebugLibConOut to BaseDebugLibNull.

Cc: Jiewen Yao 
Cc: Chao Zhang 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 SignedCapsulePkg/SignedCapsulePkg.dsc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SignedCapsulePkg/SignedCapsulePkg.dsc 
b/SignedCapsulePkg/SignedCapsulePkg.dsc
index 862756e233..0da445503b 100644
--- a/SignedCapsulePkg/SignedCapsulePkg.dsc
+++ b/SignedCapsulePkg/SignedCapsulePkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 # This package provides EDKII capsule related support.
 #
-# Copyright (c) 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
 #
 #SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -150,7 +150,7 @@
 
 [LibraryClasses.common.DXE_SMM_DRIVER]
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
-  DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
   
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
   SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38930): https://edk2.groups.io/g/devel/message/38930
Mute This Topic: https://groups.io/mt/31037318/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 4/5] MdePkg/UefidebugLibConOut: Make it runtime safe

2019-04-11 Thread Gao, Zhichao
From: Aaron Antone 

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

After ExitBootServices, some pointer would be invalid such as
the Protocol pointer and gST. The function depend on those should
be prevent. So disable the related function while after
ExitBootServices.
Change the gST to a internal one, because there will be a cycle
consume between UefiBootServicesTableLib and DebugLib due to the
library constructors.
Also remove the SMM support for this instance.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdePkg/Library/UefiDebugLibConOut/DebugLib.c  | 116 +-
 .../UefiDebugLibConOut/DebugLibConstructor.c  |  77 
 .../UefiDebugLibConOut/UefiDebugLibConOut.inf |  12 +-
 3 files changed, 147 insertions(+), 58 deletions(-)
 create mode 100644 MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c

diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c 
b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
index c430419c99..cf168d05cf 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
@@ -9,7 +9,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -27,6 +26,9 @@
 //
 VA_LIST mVaListNull;
 
+extern BOOLEANmPostEBS;
+extern EFI_SYSTEM_TABLE   *mDebugST;
+
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
 
@@ -85,33 +87,35 @@ DebugPrintMarker (
 {
   CHAR16   Buffer[MAX_DEBUG_MESSAGE_LENGTH];
 
-  //
-  // If Format is NULL, then ASSERT().
-  //
-  ASSERT (Format != NULL);
-
-  //
-  // Check driver debug mask value and global mask
-  //
-  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
-return;
-  }
-
-  //
-  // Convert the DEBUG() message to a Unicode String
-  //
-  if (BaseListMarker == NULL) {
-UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
VaListMarker);
-  } else {
-UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
BaseListMarker);
-  }
-
-
-  //
-  // Send the print string to the Console Output device
-  //
-  if ((gST != NULL) && (gST->ConOut != NULL)) {
-gST->ConOut->OutputString (gST->ConOut, Buffer);
+  if (!mPostEBS) {
+//
+// If Format is NULL, then ASSERT().
+//
+ASSERT (Format != NULL);
+
+//
+// Check driver debug mask value and global mask
+//
+if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
+  return;
+}
+
+//
+// Convert the DEBUG() message to a Unicode String
+//
+if (BaseListMarker == NULL) {
+  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
VaListMarker);
+} else {
+  UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
BaseListMarker);
+}
+
+
+//
+// Send the print string to the Console Output device
+//
+if ((mDebugST != NULL) && (mDebugST->ConOut != NULL)) {
+  mDebugST->ConOut->OutputString (mDebugST->ConOut, Buffer);
+}
   }
 }
 
@@ -205,33 +209,35 @@ DebugAssert (
 {
   CHAR16  Buffer[MAX_DEBUG_MESSAGE_LENGTH];
 
-  //
-  // Generate the ASSERT() message in Unicode format
-  //
-  UnicodeSPrintAsciiFormat (
-Buffer,
-sizeof (Buffer),
-"ASSERT [%a] %a(%d): %a\n",
-gEfiCallerBaseName,
-FileName,
-LineNumber,
-Description
-);
-
-  //
-  // Send the print string to the Console Output device
-  //
-  if ((gST != NULL) && (gST->ConOut != NULL)) {
-gST->ConOut->OutputString (gST->ConOut, Buffer);
-  }
-
-  //
-  // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
-  //
-  if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
-CpuBreakpoint ();
-  } else if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
-CpuDeadLoop ();
+  if (!mPostEBS) {
+//
+// Generate the ASSERT() message in Unicode format
+//
+UnicodeSPrintAsciiFormat (
+  Buffer,
+  sizeof (Buffer),
+  "ASSERT [%a] %a(%d): %a\n",
+  gEfiCallerBaseName,
+  FileName,
+  LineNumber,
+  Description
+  );
+
+//
+// Send the print string to the Console Output device
+//
+if ((mDebugST != NULL) && (mDebugST->ConOut != NULL)) {
+  mDebugST->ConOut->OutputString (mDebugST->ConOut, Buffer);
+}
+
+//
+// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
+//
+if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
+  CpuBreakpoint ();
+} else if ((PcdGet8(PcdDebugPropertyMask) & 
DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+  CpuDeadLoop ();
+}
   }
 }
 
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c 
b/MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
new file mode 100644
index 00..d4fdfbab55
--- /dev/null
+++ 

[edk2-devel] [PATCH V2 2/2] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Gao, Zhichao
From: Bret Barkelew 

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

For some pointer and UINT64 data, the debug code print with '%x'.
Which would loss the upper 32bit data. So update '%x' to '%lx'
for these data. And change the pointer value from '%x' to '%p'.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 .../CapsulePei/Common/CapsuleCoalesce.c| 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c 
b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
index a88b2fff95..468eea5d3f 100644
--- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
+++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
@@ -327,9 +327,9 @@ ValidateCapsuleIntegrity (
 return NULL;
   }
 
-  DEBUG ((DEBUG_INFO, "Ptr - 0x%x\n", Ptr));
-  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
+  DEBUG ((DEBUG_INFO, "Ptr - 0x%p\n", Ptr));
+  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
+  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
   while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer != 
(EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
 //
 // Make sure the descriptor is aligned at UINT64 in memory
@@ -348,9 +348,9 @@ ValidateCapsuleIntegrity (
   if (!ValidateCapsuleByMemoryResource (MemoryResource, 
(EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
 return NULL;
   }
-  DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%x\n", Ptr));
-  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", 
Ptr->Union.ContinuationPointer));
+  DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%p\n", Ptr));
+  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
+  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", 
Ptr->Union.ContinuationPointer));
 } else {
   if (!ValidateCapsuleByMemoryResource (MemoryResource, 
Ptr->Union.DataBlock, Ptr->Length)) {
 return NULL;
@@ -403,9 +403,9 @@ ValidateCapsuleIntegrity (
   if (!ValidateCapsuleByMemoryResource (MemoryResource, 
(EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
 return NULL;
   }
-  DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%x\n", Ptr));
-  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", 
Ptr->Union.ContinuationPointer));
+  DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%p\n", Ptr));
+  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
+  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", 
Ptr->Union.ContinuationPointer));
 }
   }
 
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38927): https://edk2.groups.io/g/devel/message/38927
Mute This Topic: https://groups.io/mt/31037126/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 0/2] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Gao, Zhichao
Change the EFI_D_ version debug MACRO to DEBUG_ version.
And change the UINT64 value from '%x' to '%lx'.

V2:
Seperate one patch to two to view different change goal.
Change the pointer value from '%x' to '%p'.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 

Bret Barkelew (1):
  MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

Zhichao Gao (1):
  MdeModulePkg/CapsulePei: Change debug MACRO

 .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +--
 .../Universal/CapsulePei/UefiCapsule.c| 46 +-
 2 files changed, 68 insertions(+), 68 deletions(-)

-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38925): https://edk2.groups.io/g/devel/message/38925
Mute This Topic: https://groups.io/mt/31037123/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 1/2] MdeModulePkg/CapsulePei: Change debug MACRO

2019-04-11 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677

Change debug printlevel from EFI_D_ to DEBUG_.
DEBUG_ version is recommanded to use.

Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +--
 .../Universal/CapsulePei/UefiCapsule.c| 46 +-
 2 files changed, 68 insertions(+), 68 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c 
b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
index 23e2637c31..a88b2fff95 100644
--- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
+++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
@@ -252,7 +252,7 @@ ValidateCapsuleByMemoryResource (
   // Sanity Check
   //
   if (Size > MAX_ADDRESS) {
-DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
+DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
 return FALSE;
   }
 
@@ -260,7 +260,7 @@ ValidateCapsuleByMemoryResource (
   // Sanity Check
   //
   if (Address > (MAX_ADDRESS - Size)) {
-DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS - 
Size(0x%lx))\n", Address, Size));
+DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS - 
Size(0x%lx))\n", Address, Size));
 return FALSE;
   }
 
@@ -274,14 +274,14 @@ ValidateCapsuleByMemoryResource (
   for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
 if ((Address >= MemoryResource[Index].PhysicalStart) &&
 ((Address + Size) <= (MemoryResource[Index].PhysicalStart + 
MemoryResource[Index].ResourceLength))) {
-  DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x%x] 
- Start(0x%lx) Length(0x%lx)\n",
+  DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x%x] 
- Start(0x%lx) Length(0x%lx)\n",
   Address, Size,
   Index, MemoryResource[Index].PhysicalStart, 
MemoryResource[Index].ResourceLength));
   return TRUE;
 }
   }
 
-  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any 
MemoryResource\n", Address, Size));
+  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any 
MemoryResource\n", Address, Size));
   return FALSE;
 }
 
@@ -306,7 +306,7 @@ ValidateCapsuleIntegrity (
   UINTN  CapsuleCount;
   EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
 
-  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
+  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
 
   //
   // Go through the list to look for inconsistencies. Check for:
@@ -327,15 +327,15 @@ ValidateCapsuleIntegrity (
 return NULL;
   }
 
-  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
-  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
+  DEBUG ((DEBUG_INFO, "Ptr - 0x%x\n", Ptr));
+  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
+  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
   while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer != 
(EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
 //
 // Make sure the descriptor is aligned at UINT64 in memory
 //
 if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
-  DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment 
check\n"));
+  DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment 
check\n"));
   return NULL;
 }
 
@@ -348,9 +348,9 @@ ValidateCapsuleIntegrity (
   if (!ValidateCapsuleByMemoryResource (MemoryResource, 
(EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
 return NULL;
   }
-  DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
-  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", 
Ptr->Union.ContinuationPointer));
+  DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%x\n", Ptr));
+  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
+  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", 
Ptr->Union.ContinuationPointer));
 } else {
   if (!ValidateCapsuleByMemoryResource (MemoryResource, 
Ptr->Union.DataBlock, Ptr->Length)) {
 return NULL;
@@ -369,14 +369,14 @@ ValidateCapsuleIntegrity (
 // Sanity check
 //
 if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
-  DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) < 
sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
+  DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) < 
sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
   return NULL;
 }
 //
 // Make sure HeaderSize field is valid
 //
 if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize) {
-  DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) > 
CapsuleHeader->CapsuleImageSize(0x%x)\n", 

[edk2-devel] [platforms: PATCH] Marvell/Armada7k8k: Remove UefiDecompressLib

2019-04-11 Thread Marcin Wojtas
Recent changes in EDK2 moved UefiDecompressLib from the
IntelFrameworkModulePkg, breaking the compilation of
Armada platforms. It turned out it is not needed, so fix it by
safely removing references to the problematic library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas 
---
 Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
index 1e2d248..8291582 100644
--- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
+++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
@@ -203,13 +203,11 @@
   
DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf
 
 [LibraryClasses.common.UEFI_APPLICATION]
-  
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
 
 [LibraryClasses.common.UEFI_DRIVER]
-  
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
   
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38924): https://edk2.groups.io/g/devel/message/38924
Mute This Topic: https://groups.io/mt/31036776/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH edk2-platforms] Platform/DeveloperBox: actually enable secure boot checking

2019-04-11 Thread Ard Biesheuvel
On Thu, 11 Apr 2019 at 12:29, Leif Lindholm  wrote:
>
> On Wed, Apr 10, 2019 at 11:06:02AM -0700, Ard Biesheuvel wrote:
> > The current secure boot enabled DeveloperBox build contains all the
> > pieces to maintain the authenticated variable store, but doesn't
> > actually bother to check the signature on anything it boots. Fix that.
> >
> > Signed-off-by: Ard Biesheuvel 
>
> We haven't actually dropped the CLA from edk2-platforms (yet), so we
> probably still need the contributed-under for now. If you add that
> before committing:
>
> Reviewed-by: Leif Lindholm 
>

Thanks. Pushed as 7d8dc6544c93..11c98f35af40

> > ---
> >  Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
> > b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > index 39077ab5ee79..4ddb0d427f13 100644
> > --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > @@ -245,7 +245,12 @@
> >}
> >MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> >MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > -  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
> > +
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  
> > NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
> > +!endif
> > +  }
> >ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> >ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
> >MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > --
> > 2.17.1
> >

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38922): https://edk2.groups.io/g/devel/message/38922
Mute This Topic: https://groups.io/mt/31021919/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v5 5/7] MdeModulePkg/EbcDxe: implement the PE/COFF emulator protocol

2019-04-11 Thread Michael D Kinney
Ard,

Comment below on a VS2015x86 build issue.

Mike

> -Original Message-
> From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of Ard
> Biesheuvel
> Sent: Thursday, April 11, 2019 11:58 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel ; Zimmer,
> Vincent ; Richardson, Brian
> ; Kinney, Michael D
> ; Andrew Fish
> ; Leif Lindholm
> ; Zeng, Star
> ; Dong, Eric
> ; Ni, Ray ; Gao,
> Liming ; Carsey, Jaben
> ; Shi, Steven
> 
> Subject: [edk2-devel] [PATCH v5 5/7]
> MdeModulePkg/EbcDxe: implement the PE/COFF emulator
> protocol
> 
> Implement the new EDK2 PE/COFF image emulator protocol
> so that we can
> remove the EBC specific handling in the DXE core and
> other places in
> the core code.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel
> 
> ---
>  MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf |   3 +
>  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf  |   3 +
>  MdeModulePkg/Universal/EbcDxe/EbcInt.c| 123
> 
>  MdeModulePkg/Universal/EbcDxe/EbcInt.h|   3 +
>  4 files changed, 132 insertions(+)
> 
> diff --git
> a/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
> b/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
> index 8f293f5c7c29..c7a9d519b080 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
> @@ -89,6 +89,8 @@
>BaseMemoryLib
>DebugLib
>BaseLib
> +  CacheMaintenanceLib
> +  PeCoffLib
> 
>  [Protocols]
>gEfiDebugSupportProtocolGuid  ##
> PRODUCES
> @@ -98,6 +100,7 @@
>gEfiEbcSimpleDebuggerProtocolGuid ##
> SOMETIMES_CONSUMES
>gEfiPciRootBridgeIoProtocolGuid   ##
> SOMETIMES_CONSUMES
>gEfiSimpleFileSystemProtocolGuid  ##
> SOMETIMES_CONSUMES
> +  gEdkiiPeCoffImageEmulatorProtocolGuid ##
> PRODUCES
> 
>  [Guids]
>gEfiFileInfoGuid  ##
> SOMETIMES_CONSUMES ## GUID
> diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> index d6ee6194a0c8..ecccf2c57ffe 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> @@ -57,7 +57,9 @@
>MdeModulePkg/MdeModulePkg.dec
> 
>  [LibraryClasses]
> +  CacheMaintenanceLib
>MemoryAllocationLib
> +  PeCoffLib
>UefiBootServicesTableLib
>BaseMemoryLib
>UefiDriverEntryPoint
> @@ -68,6 +70,7 @@
>  [Protocols]
>gEfiDebugSupportProtocolGuid  ##
> PRODUCES
>gEfiEbcProtocolGuid   ##
> PRODUCES
> +  gEdkiiPeCoffImageEmulatorProtocolGuid ##
> PRODUCES
>gEfiEbcVmTestProtocolGuid ##
> SOMETIMES_PRODUCES
>gEfiEbcSimpleDebuggerProtocolGuid ##
> SOMETIMES_CONSUMES
> 
> diff --git a/MdeModulePkg/Universal/EbcDxe/EbcInt.c
> b/MdeModulePkg/Universal/EbcDxe/EbcInt.c
> index 727ba8bcae44..051eb0aaa07b 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcInt.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcInt.c
> @@ -349,6 +349,119 @@ UINTN  mStackNum
> = 0;
>  EFI_EVENT  mEbcPeriodicEvent;
>  VM_CONTEXT *mVmPtr = NULL;
> 
> +/**
> +  Check whether the emulator supports executing a
> certain PE/COFF image
> +
> +  @param[in] This This pointer for
> EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
> +  structure
> +  @param[in] ImageTypeWhether the image is an
> application, a boot time
> +  driver or a runtime driver.
> +  @param[in] DevicePath   Path to device where the
> image originated
> +  (e.g., a PCI option ROM)
> +
> +  @retval TRUEThe image is supported by
> the emulator
> +  @retval FALSE   The image is not supported
> by the emulator.
> +**/
> +BOOLEAN
> +EFIAPI
> +EbcIsImageSupported (
> +  IN  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL*This,
> +  IN  UINT16
> ImageType,
> +  IN  EFI_DEVICE_PATH_PROTOCOL
> *DevicePath   OPTIONAL
> +  )
> +{
> +  if (ImageType != EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
> &&
> +  ImageType !=
> EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) {
> +return FALSE;
> +  }
> +  return TRUE;
> +}
> +
> +/**
> +  Register a supported PE/COFF image with the
> emulator. After this call
> +  completes successfully, the PE/COFF image may be
> started as usual, and
> +  it is the responsibility of the emulator
> implementation that any branch
> +  into the code section of the image (including
> returns from functions called
> +  from the foreign code) is executed as if it were
> running on the machine
> +  type it was built for.
> +
> +  @param[in]  This  This pointer for
> +
> EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure
> +  @param[in]  ImageBase The base address in
> memory of the PE/COFF image
> +  @param[in]  ImageSize The size in memory of
> the PE/COFF image
> +  @param[in,out]  EntryPointThe entry point of the
> PE/COFF 

Re: [edk2-devel] [PATCH v5 2/7] MdeModulePkg/DxeCore: invoke the emulator protocol for foreign images

2019-04-11 Thread Michael D Kinney
Ard,

A could small comments below on use of sizeof().

Mike

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Thursday, April 11, 2019 11:58 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel ; Zimmer,
> Vincent ; Richardson, Brian
> ; Kinney, Michael D
> ; Andrew Fish
> ; Leif Lindholm
> ; Zeng, Star
> ; Dong, Eric
> ; Ni, Ray ; Gao,
> Liming ; Carsey, Jaben
> ; Shi, Steven
> 
> Subject: [PATCH v5 2/7] MdeModulePkg/DxeCore: invoke
> the emulator protocol for foreign images
> 
> When encountering PE/COFF images that cannot be
> supported natively,
> attempt to locate an instance of the PE/COFF image
> emulator protocol,
> and if it supports the image, proceed with loading it
> and register it
> with the emulator.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel
> 
> ---
>  MdeModulePkg/Core/Dxe/DxeMain.h |   3 +
>  MdeModulePkg/Core/Dxe/DxeMain.inf   |   1 +
>  MdeModulePkg/Core/Dxe/Image/Image.c | 170
> ++--
>  3 files changed, 163 insertions(+), 11 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h
> b/MdeModulePkg/Core/Dxe/DxeMain.h
> index 2dec9da5e35b..48ec30a48aa2 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.h
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.h
> @@ -53,6 +53,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS
> OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -228,6 +229,8 @@ typedef struct {
>UINT16  Machine;
>/// EBC Protocol pointer
>EFI_EBC_PROTOCOL*Ebc;
> +  /// PE/COFF Image Emulator Protocol pointer
> +  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *PeCoffEmu;
>/// Runtime image list
>EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;
>/// Pointer to Loaded Image Device Path Protocol
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf
> b/MdeModulePkg/Core/Dxe/DxeMain.inf
> index 10375443c0f4..ce6fc19be5e4 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.inf
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
> @@ -162,6 +162,7 @@
>gEfiHiiPackageListProtocolGuid##
> SOMETIMES_PRODUCES
>gEfiEbcProtocolGuid   ##
> SOMETIMES_CONSUMES
>gEfiSmmBase2ProtocolGuid  ##
> SOMETIMES_CONSUMES
> +  gEdkiiPeCoffImageEmulatorProtocolGuid ##
> SOMETIMES_CONSUMES
> 
># Arch Protocols
>gEfiBdsArchProtocolGuid   ##
> CONSUMES
> diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c
> b/MdeModulePkg/Core/Dxe/Image/Image.c
> index eddca140ee1a..d00e50747040 100644
> --- a/MdeModulePkg/Core/Dxe/Image/Image.c
> +++ b/MdeModulePkg/Core/Dxe/Image/Image.c
> @@ -29,6 +29,15 @@ LOAD_PE32_IMAGE_PRIVATE_DATA
> mLoadPe32PrivateData = {
>}
>  };
> 
> +typedef struct {
> +  LIST_ENTRYLink;
> +  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *Emulator;
> +  UINT16MachineType;
> +} EMULATOR_ENTRY;
> +
> +STATIC LIST_ENTRY
> mAvailableEmulators;
> +STATIC EFI_EVENT
> mPeCoffEmuProtocolRegistrationEvent;
> +STATIC VOID
> *mPeCoffEmuProtocolNotifyRegistration;
> 
>  //
>  // This code is needed to build the Image handle for
> the DXE Core
> @@ -67,6 +76,7 @@ LOADED_IMAGE_PRIVATE_DATA
> mCorePrivateImage  = {
>NULL,   // JumpContext
>0,  // Machine
>NULL,   // Ebc
> +  NULL,   // PeCoffEmu
>NULL,   // RuntimeData
>NULL// LoadedImageDevicePath
>  };
> @@ -118,6 +128,61 @@ GetMachineTypeName (
>return L"";
>  }
> 
> +/**
> +  Notification event handler registered by
> CoreInitializeImageServices () to
> +  keep track of which PE/COFF image emulators are
> available.
> +
> +  @param  Event  The Event that is being
> processed, not used.
> +  @param  ContextEvent Context, not used.
> +
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +PeCoffEmuProtocolNotify (
> +  IN  EFI_EVENT   Event,
> +  IN  VOID*Context
> +  )
> +{
> +  EFI_STATUS  Status;
> +  UINTN   BufferSize;
> +  EFI_HANDLE  EmuHandle;
> +  EMULATOR_ENTRY  *Entry;
> +
> +  EmuHandle = NULL;
> +
> +  while (TRUE) {
> +BufferSize = sizeof EmuHandle;

Should be sizeof (EmuHandle);

> +Status = CoreLocateHandle (
> +   ByRegisterNotify,
> +   NULL,
> +   mPeCoffEmuProtocolNotifyRegistration,
> +   ,
> +   
> +   );
> +if (EFI_ERROR (Status)) {
> +  //
> +  // If no more notification events exit
> +  //
> +  return;
> +}
> +
> +Entry = AllocateZeroPool (sizeof *Entry);

Should be sizeof (*Entry)


> +ASSERT (Entry != NULL);
> +
> +Status = CoreHandleProtocol (
> +   EmuHandle,
> +   ,
> +   (VOID **)>Emulator
> +   );
> +

Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread Philippe Mathieu-Daudé
On 4/11/19 9:58 PM, Rebecca Cran wrote:
> On 2019-04-11 13:55, Philippe Mathieu-Daudé wrote:
>>
>> With the work around link added:
>> Reviewed-by: Philippe Mathieu-Daude 
> 
> 
> 
> But it's _not_ working around that bug. That was about "uname -p", but
> the patch is about "uname -m".

Ah you are right, the script simply parse the 'machine hardware name' to
extract the host architecture. We shouldn't rely on the 'processor type
name' which is non-portable. Simply checking for 'arm64' is enough.

So do not add the link, and keep my tag:
Reviewed-by: Philippe Mathieu-Daude 

Regards,

Phil.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38918): https://edk2.groups.io/g/devel/message/38918
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and improve E820 debug output

2019-04-11 Thread Philippe Mathieu-Daudé
On 4/11/19 9:53 PM, Rebecca Cran wrote:
> On 2019-04-11 13:30, Rebecca Cran via Groups.Io wrote:
>>
>> I'm sending emails on Thunderbird via Postfix, so there's no Outlook
>> involved.
>>
> 
> Let's try again: I've unset the groups.io fields, so I wonder if that'll
> change things.

Yes, I see your From address correctly now.

Now, how do we proceed to avoid the same problem with other users?

IMHO a git pre-push hook on the maintainer side would be easier to maintain.

Regards,

Phil.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38917): https://edk2.groups.io/g/devel/message/38917
Mute This Topic: https://groups.io/mt/30899017/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread rebecca via Groups.Io

On 2019-04-11 13:55, Philippe Mathieu-Daudé wrote:


With the work around link added:
Reviewed-by: Philippe Mathieu-Daude 




But it's _not_ working around that bug. That was about "uname -p", but 
the patch is about "uname -m".



--
Rebecca Cran


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38916): https://edk2.groups.io/g/devel/message/38916
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread Philippe Mathieu-Daudé
On 4/11/19 7:52 PM, Laszlo Ersek wrote:
> On 04/11/19 16:23, Philippe Mathieu-Daudé wrote:
>> On 4/11/19 5:16 AM, Rebecca Cran via Groups.Io wrote:
>>> Some systems such as FreeBSD identify the platform as 'arm64'
>>> and not 'aarch64' as Linux does.
>>
>> Per https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220297
>> this seems to be a FreeBSD bug.
> 
> You are correct, but that issue was filed on 2017-06-26. I don't think
> we should hold our breaths, as long as the workaround is simple. And, it
> does look simple. (We've worked around worse.)
> 
> I do suggest an addition to the patch, however: Rebecca, please add the
> link discovered by Phil near the "arm64" matches, in a comment.
> Something like:
> 
> # work around 

Good idea.

> Thanks,
> Laszlo
> 
>>
>>> Signed-off-by: Rebecca Cran 
>>> ---
>>>  BaseTools/Source/C/GNUmakefile   | 5 +++--
>>>  BaseTools/Source/C/Makefiles/header.makefile | 5 +++--
>>>  2 files changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile
>>> index 1d048c4cc6..37bcce519c 100644
>>> --- a/BaseTools/Source/C/GNUmakefile
>>> +++ b/BaseTools/Source/C/GNUmakefile
>>> @@ -21,8 +21,9 @@ ifndef HOST_ARCH
>>>endif
>>>ifneq (,$(findstring aarch64,$(uname_m)))
>>>  HOST_ARCH=AARCH64
>>> -  endif
>>> -  ifneq (,$(findstring arm,$(uname_m)))
>>> +  else ifneq (,$(findstring arm64,$(uname_m)))

Here you change 2 different if() blocks into a single if/elif/elif.
Although not mentioned in the patch description, it is cleaner than
before your patch.

With the work around link added:
Reviewed-by: Philippe Mathieu-Daude 

Thanks,

Phil.

>>> +HOST_ARCH=AARCH64
>>> +  else ifneq (,$(findstring arm,$(uname_m)))
>>>  HOST_ARCH=ARM
>>>endif
>>>ifndef HOST_ARCH
>>> diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
>>> b/BaseTools/Source/C/Makefiles/header.makefile
>>> index 90fb3453ad..d76b8283dd 100644
>>> --- a/BaseTools/Source/C/Makefiles/header.makefile
>>> +++ b/BaseTools/Source/C/Makefiles/header.makefile
>>> @@ -23,8 +23,9 @@ ifndef HOST_ARCH
>>>endif
>>>ifneq (,$(findstring aarch64,$(uname_m)))
>>>  HOST_ARCH=AARCH64
>>> -  endif
>>> -  ifneq (,$(findstring arm,$(uname_m)))
>>> +  else ifneq (,$(findstring arm64,$(uname_m)))
>>> +HOST_ARCH=AARCH64
>>> +  else ifneq (,$(findstring arm,$(uname_m)))
>>>  HOST_ARCH=ARM
>>>endif
>>>ifndef HOST_ARCH
>>>
>>
>> 
>>
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38915): https://edk2.groups.io/g/devel/message/38915
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread Rebecca Cran via Groups.Io

On 2019-04-11 11:52, Laszlo Ersek wrote:

On 04/11/19 16:23, Philippe Mathieu-Daudé wrote:

On 4/11/19 5:16 AM, Rebecca Cran via Groups.Io wrote:

Some systems such as FreeBSD identify the platform as 'arm64'
and not 'aarch64' as Linux does.

Per https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220297
this seems to be a FreeBSD bug.

You are correct, but that issue was filed on 2017-06-26. I don't think
we should hold our breaths, as long as the workaround is simple. And, it
does look simple. (We've worked around worse.)

I do suggest an addition to the patch, however: Rebecca, please add the
link discovered by Phil near the "arm64" matches, in a comment.
Something like:

# work around 




Thanks, I'll do that. I don't think there's anything to fix, because 
"uname -m" returns "arm64" and "uname -p" "aarch64". The EDK2 Makefiles 
use "uname -m" which I don't think anybody has complained about, but 
which return different values on Linux and FreeBSD.



--

Rebecca Cran


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38913): https://edk2.groups.io/g/devel/message/38913
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 4/7] MdeModulePkg/UefiBootManagerLib: allow foreign Driver#### images

2019-04-11 Thread Ard Biesheuvel
Allow PE/COFF images that must execute under emulation for Driver
options, by removing the redundant machine type check from the BDS code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
index 7bf96646c690..8e6caaa63548 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c
@@ -1233,10 +1233,8 @@ BmIsLoadOptionPeHeaderValid (
   // Check PE32 or PE32+ magic, and machine type
   //
   OptionalHeader = (EFI_IMAGE_OPTIONAL_HEADER32 *) 
>Pe32.OptionalHeader;
-  if ((OptionalHeader->Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC ||
-   OptionalHeader->Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) &&
-  EFI_IMAGE_MACHINE_TYPE_SUPPORTED (PeHeader->Pe32.FileHeader.Machine)
-  ) {
+  if (OptionalHeader->Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC ||
+  OptionalHeader->Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
 //
 // Check the Subsystem:
 //   Driver must be of type BootServiceDriver or RuntimeDriver
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38907): https://edk2.groups.io/g/devel/message/38907
Mute This Topic: https://groups.io/mt/31034151/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 2/7] MdeModulePkg/DxeCore: invoke the emulator protocol for foreign images

2019-04-11 Thread Ard Biesheuvel
When encountering PE/COFF images that cannot be supported natively,
attempt to locate an instance of the PE/COFF image emulator protocol,
and if it supports the image, proceed with loading it and register it
with the emulator.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Core/Dxe/DxeMain.h |   3 +
 MdeModulePkg/Core/Dxe/DxeMain.inf   |   1 +
 MdeModulePkg/Core/Dxe/Image/Image.c | 170 ++--
 3 files changed, 163 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 2dec9da5e35b..48ec30a48aa2 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -53,6 +53,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -228,6 +229,8 @@ typedef struct {
   UINT16  Machine;
   /// EBC Protocol pointer
   EFI_EBC_PROTOCOL*Ebc;
+  /// PE/COFF Image Emulator Protocol pointer
+  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *PeCoffEmu;
   /// Runtime image list
   EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;
   /// Pointer to Loaded Image Device Path Protocol
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf 
b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 10375443c0f4..ce6fc19be5e4 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -162,6 +162,7 @@
   gEfiHiiPackageListProtocolGuid## SOMETIMES_PRODUCES
   gEfiEbcProtocolGuid   ## SOMETIMES_CONSUMES
   gEfiSmmBase2ProtocolGuid  ## SOMETIMES_CONSUMES
+  gEdkiiPeCoffImageEmulatorProtocolGuid ## SOMETIMES_CONSUMES
 
   # Arch Protocols
   gEfiBdsArchProtocolGuid   ## CONSUMES
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c 
b/MdeModulePkg/Core/Dxe/Image/Image.c
index eddca140ee1a..d00e50747040 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -29,6 +29,15 @@ LOAD_PE32_IMAGE_PRIVATE_DATA  mLoadPe32PrivateData = {
   }
 };
 
+typedef struct {
+  LIST_ENTRYLink;
+  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *Emulator;
+  UINT16MachineType;
+} EMULATOR_ENTRY;
+
+STATIC LIST_ENTRY   mAvailableEmulators;
+STATIC EFI_EVENTmPeCoffEmuProtocolRegistrationEvent;
+STATIC VOID *mPeCoffEmuProtocolNotifyRegistration;
 
 //
 // This code is needed to build the Image handle for the DXE Core
@@ -67,6 +76,7 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage  = {
   NULL,   // JumpContext
   0,  // Machine
   NULL,   // Ebc
+  NULL,   // PeCoffEmu
   NULL,   // RuntimeData
   NULL// LoadedImageDevicePath
 };
@@ -118,6 +128,61 @@ GetMachineTypeName (
   return L"";
 }
 
+/**
+  Notification event handler registered by CoreInitializeImageServices () to
+  keep track of which PE/COFF image emulators are available.
+
+  @param  Event  The Event that is being processed, not used.
+  @param  ContextEvent Context, not used.
+
+**/
+STATIC
+VOID
+EFIAPI
+PeCoffEmuProtocolNotify (
+  IN  EFI_EVENT   Event,
+  IN  VOID*Context
+  )
+{
+  EFI_STATUS  Status;
+  UINTN   BufferSize;
+  EFI_HANDLE  EmuHandle;
+  EMULATOR_ENTRY  *Entry;
+
+  EmuHandle = NULL;
+
+  while (TRUE) {
+BufferSize = sizeof EmuHandle;
+Status = CoreLocateHandle (
+   ByRegisterNotify,
+   NULL,
+   mPeCoffEmuProtocolNotifyRegistration,
+   ,
+   
+   );
+if (EFI_ERROR (Status)) {
+  //
+  // If no more notification events exit
+  //
+  return;
+}
+
+Entry = AllocateZeroPool (sizeof *Entry);
+ASSERT (Entry != NULL);
+
+Status = CoreHandleProtocol (
+   EmuHandle,
+   ,
+   (VOID **)>Emulator
+   );
+ASSERT_EFI_ERROR (Status);
+
+Entry->MachineType = Entry->Emulator->MachineType;
+
+InsertTailList (, >Link);
+  }
+}
+
 /**
   Add the Image Services to EFI Boot Services Table and install the protocol
   interfaces for this image.
@@ -192,6 +257,30 @@ CoreInitializeImageServices (
   gDxeCoreImageHandle = Image->Handle;
   gDxeCoreLoadedImage = >Info;
 
+  //
+  // Create the PE/COFF emulator protocol registration event
+  //
+  Status = CoreCreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ PeCoffEmuProtocolNotify,
+ NULL,
+ 
+ );
+  ASSERT_EFI_ERROR(Status);
+
+  //
+  // Register for protocol notifications on this event
+  //
+  Status = CoreRegisterProtocolNotify (
+ ,
+ 

[edk2-devel] [PATCH v5 0/7] MdeModulePkg: add support for dispatching foreign arch PE/COFF images

2019-04-11 Thread Ard Biesheuvel
Add the basic plumbing to DXE core, the PCI bus driver and the boot manager
to allow PE/COFF images to be dispatched that target an architecture that is
not native for the platform, but which is supported by one of potentially
several available emulators.

One implementation of such an emulator can be found here:
https://github.com/ardbiesheuvel/X86EmulatorPkg/tree/upstream-v4

This also allows us to get rid of the special treatment of EBC images in
core code. Instead, the EbcDxe driver is augmented with an implementation
of the EDK2 PE/COFF image emulator protocol so that internal knowledge of
how EBC is implemented (I-cache flushing, thunks) is removed from the DXE
core.

Changes since v4:
- Fix an issue in the protocol notify handler pointed out by Mike Kinney (#2)

Changes since v3:
- Simplify the handling of option ROMs and Driver images, by simply
  deferring to the LoadImage() boot service to decide whether an image
  can be supported or not - this removes some redundant checks from the
  BDS layer and the PCI bus driver.
- Move the machine type supported by the emulator into the protocol struct,
  so we can optimize away calls into the emulator for each image loaded.
  Instead, the LoadImage() code will only invoke the IsSupported() method for
  images that are known to have a matching machine type.

Note that I have considered, but ultimately dismissed the suggestion to
register and unregister emulators via a new protocol. The main issue is
that registering and unregistering structs containing sets of function
pointers is awfully similar to managing a protocol database, and we already
have the code to do that in EDK2.

So instead, I have removed all the code that iterates over a handle buffer
of emu protocols and invokes each one to see if it will support the image.
Instead, this is all done by CoreLoadImage().

Changes since v2:
- incorporate feedback from Andrew Fish (delivered in person):
  * pass a device path into the IsImageSupported() protocol method so that an
implementation can blacklist or whitelist certain devices, or implement
other policies that depend on the device where the driver originated
  * allow the emulator to supersede the native loading of the image - this
permits things like X86 on X86 emulators for security sandboxing or debug

Changes since v1:
- subsume the EBC handling into the EDK2 emulator protocol and abstract
  away from EBC specifics in core code.
- allow multiple emulator implementations to co-exist
- incorporate Star's review feedback

Cc: Vincent Zimmer 
Cc: Brian Richardson 
Cc: Michael D Kinney 
Cc: Andrew Fish 
Cc: Leif Lindholm 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Ruiyu Ni 
Cc: Liming Gao 
Cc: Jaben Carsey 
Cc: Steven Shi 

Ard Biesheuvel (7):
  MdeModulePkg: introduce PE/COFF image emulator protocol
  MdeModulePkg/DxeCore: invoke the emulator protocol for foreign images
  MdeModulePkg/PciBusDxe: dispatch option ROMs for foreign architectures
  MdeModulePkg/UefiBootManagerLib: allow foreign Driver images
  MdeModulePkg/EbcDxe: implement the PE/COFF emulator protocol
  MdePkg/UefiBaseType.h: treat EBC as a non-native machine type
  MdeModulePkg/DxeCore: remove explicit EBC handling

 .../Bus/Pci/PciBusDxe/PciOptionRomSupport.c   |   7 -
 MdeModulePkg/Core/Dxe/DxeMain.h   |   6 +-
 MdeModulePkg/Core/Dxe/DxeMain.inf |   2 +-
 MdeModulePkg/Core/Dxe/Image/Image.c   | 209 +-
 .../Include/Protocol/PeCoffImageEmulator.h| 107 +
 .../Library/UefiBootManagerLib/BmLoadOption.c |   6 +-
 MdeModulePkg/MdeModulePkg.dec |   4 +
 MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf |   3 +
 MdeModulePkg/Universal/EbcDxe/EbcDxe.inf  |   3 +
 MdeModulePkg/Universal/EbcDxe/EbcInt.c| 123 +++
 MdeModulePkg/Universal/EbcDxe/EbcInt.h|   3 +
 MdePkg/Include/Uefi/UefiBaseType.h|   6 +-
 12 files changed, 407 insertions(+), 72 deletions(-)
 create mode 100644 MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h

-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38903): https://edk2.groups.io/g/devel/message/38903
Mute This Topic: https://groups.io/mt/31034147/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 6/7] MdePkg/UefiBaseType.h: treat EBC as a non-native machine type

2019-04-11 Thread Ard Biesheuvel
Instead of classifying EBC as a supported machine type and have special
handling in DXE core for loading EBC images, make it a foreign type and
rely on the EDK2 PE/COFF image emulator protocol to claim the image when
the DXE core finds that it cannot be supported natively.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdePkg/Include/Uefi/UefiBaseType.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Uefi/UefiBaseType.h 
b/MdePkg/Include/Uefi/UefiBaseType.h
index 8c9d571eb1ce..33b872af91a9 100644
--- a/MdePkg/Include/Uefi/UefiBaseType.h
+++ b/MdePkg/Include/Uefi/UefiBaseType.h
@@ -250,14 +250,14 @@ typedef union {
 #if   defined (MDE_CPU_IA32)
 
 #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
-  (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == 
EFI_IMAGE_MACHINE_EBC))
+  ((Machine) == EFI_IMAGE_MACHINE_IA32)
 
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == 
EFI_IMAGE_MACHINE_X64)
 
 #elif defined (MDE_CPU_X64)
 
 #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
-  (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == 
EFI_IMAGE_MACHINE_EBC))
+  ((Machine) == EFI_IMAGE_MACHINE_X64)
 
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == 
EFI_IMAGE_MACHINE_IA32)
 
@@ -270,7 +270,7 @@ typedef union {
 #elif defined (MDE_CPU_AARCH64)
 
 #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
-  (((Machine) == EFI_IMAGE_MACHINE_AARCH64) || ((Machine) == 
EFI_IMAGE_MACHINE_EBC))
+  ((Machine) == EFI_IMAGE_MACHINE_AARCH64)
 
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
 
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38909): https://edk2.groups.io/g/devel/message/38909
Mute This Topic: https://groups.io/mt/31034154/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 7/7] MdeModulePkg/DxeCore: remove explicit EBC handling

2019-04-11 Thread Ard Biesheuvel
Now that the EBC machine type is no longer classified as a
natively supported machine type on the architectures that can
support it via the EBC interpreter, the EBC specific handling
in DXE core is no longer used and can be removed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Core/Dxe/DxeMain.h |  3 --
 MdeModulePkg/Core/Dxe/DxeMain.inf   |  1 -
 MdeModulePkg/Core/Dxe/Image/Image.c | 53 ++--
 3 files changed, 3 insertions(+), 54 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 48ec30a48aa2..6e83f15a4541 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -42,7 +42,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -227,8 +226,6 @@ typedef struct {
   BASE_LIBRARY_JUMP_BUFFER*JumpContext;
   /// Machine type from PE image
   UINT16  Machine;
-  /// EBC Protocol pointer
-  EFI_EBC_PROTOCOL*Ebc;
   /// PE/COFF Image Emulator Protocol pointer
   EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *PeCoffEmu;
   /// Runtime image list
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf 
b/MdeModulePkg/Core/Dxe/DxeMain.inf
index ce6fc19be5e4..68413517f2a7 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -160,7 +160,6 @@
   gEfiLoadedImageProtocolGuid   ## PRODUCES
   gEfiLoadedImageDevicePathProtocolGuid ## PRODUCES
   gEfiHiiPackageListProtocolGuid## SOMETIMES_PRODUCES
-  gEfiEbcProtocolGuid   ## SOMETIMES_CONSUMES
   gEfiSmmBase2ProtocolGuid  ## SOMETIMES_CONSUMES
   gEdkiiPeCoffImageEmulatorProtocolGuid ## SOMETIMES_CONSUMES
 
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c 
b/MdeModulePkg/Core/Dxe/Image/Image.c
index d00e50747040..565008177e96 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -75,7 +75,6 @@ LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage  = {
   NULL,   // JumpBuffer
   NULL,   // JumpContext
   0,  // Machine
-  NULL,   // Ebc
   NULL,   // PeCoffEmu
   NULL,   // RuntimeData
   NULL// LoadedImageDevicePath
@@ -92,9 +91,6 @@ typedef struct {
   CHAR16  *MachineTypeName;
 } MACHINE_TYPE_INFO;
 
-//
-// EBC machine is not listed in this table, because EBC is in the default 
supported scopes of other machine type.
-//
 GLOBAL_REMOVE_IF_UNREFERENCED MACHINE_TYPE_INFO  mMachineTypeInfo[] = {
   {EFI_IMAGE_MACHINE_IA32,   L"IA32"},
   {EFI_IMAGE_MACHINE_IA64,   L"IA64"},
@@ -773,51 +769,15 @@ CoreLoadPeImage (
   InvalidateInstructionCacheRange ((VOID 
*)(UINTN)Image->ImageContext.ImageAddress, 
(UINTN)Image->ImageContext.ImageSize);
 
   //
-  // Copy the machine type from the context to the image private data. This
-  // is needed during image unload to know if we should call an EBC protocol
-  // to unload the image.
+  // Copy the machine type from the context to the image private data.
   //
   Image->Machine = Image->ImageContext.Machine;
 
   //
-  // Get the image entry point. If it's an EBC image, then call into the
-  // interpreter to create a thunk for the entry point and use the returned
-  // value for the entry point.
+  // Get the image entry point.
   //
   Image->EntryPoint   = 
(EFI_IMAGE_ENTRY_POINT)(UINTN)Image->ImageContext.EntryPoint;
-  if (Image->ImageContext.Machine == EFI_IMAGE_MACHINE_EBC) {
-//
-// Locate the EBC interpreter protocol
-//
-Status = CoreLocateProtocol (, NULL, (VOID 
**)>Ebc);
-if (EFI_ERROR(Status) || Image->Ebc == NULL) {
-  DEBUG ((DEBUG_LOAD | DEBUG_ERROR, "CoreLoadPeImage: There is no EBC 
interpreter for an EBC image.\n"));
-  goto Done;
-}
-
-//
-// Register a callback for flushing the instruction cache so that created
-// thunks can be flushed.
-//
-Status = Image->Ebc->RegisterICacheFlush (Image->Ebc, 
(EBC_ICACHE_FLUSH)InvalidateInstructionCacheRange);
-if (EFI_ERROR(Status)) {
-  goto Done;
-}
-
-//
-// Create a thunk for the image's entry point. This will be the new
-// entry point for the image.
-//
-Status = Image->Ebc->CreateThunk (
-   Image->Ebc,
-   Image->Handle,
-   (VOID *)(UINTN) Image->ImageContext.EntryPoint,
-   (VOID **) >EntryPoint
-   );
-if (EFI_ERROR(Status)) {
-  goto Done;
-}
-  } else if (Image->PeCoffEmu != NULL) {
+  if (Image->PeCoffEmu != NULL) {
 Status = Image->PeCoffEmu->RegisterImage (Image->PeCoffEmu,
  Image->ImageBasePage,
  

[edk2-devel] [PATCH v5 5/7] MdeModulePkg/EbcDxe: implement the PE/COFF emulator protocol

2019-04-11 Thread Ard Biesheuvel
Implement the new EDK2 PE/COFF image emulator protocol so that we can
remove the EBC specific handling in the DXE core and other places in
the core code.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf |   3 +
 MdeModulePkg/Universal/EbcDxe/EbcDxe.inf  |   3 +
 MdeModulePkg/Universal/EbcDxe/EbcInt.c| 123 
 MdeModulePkg/Universal/EbcDxe/EbcInt.h|   3 +
 4 files changed, 132 insertions(+)

diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf 
b/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
index 8f293f5c7c29..c7a9d519b080 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf
@@ -89,6 +89,8 @@
   BaseMemoryLib
   DebugLib
   BaseLib
+  CacheMaintenanceLib
+  PeCoffLib
 
 [Protocols]
   gEfiDebugSupportProtocolGuid  ## PRODUCES
@@ -98,6 +100,7 @@
   gEfiEbcSimpleDebuggerProtocolGuid ## SOMETIMES_CONSUMES
   gEfiPciRootBridgeIoProtocolGuid   ## SOMETIMES_CONSUMES
   gEfiSimpleFileSystemProtocolGuid  ## SOMETIMES_CONSUMES
+  gEdkiiPeCoffImageEmulatorProtocolGuid ## PRODUCES
 
 [Guids]
   gEfiFileInfoGuid  ## SOMETIMES_CONSUMES ## GUID
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf 
b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
index d6ee6194a0c8..ecccf2c57ffe 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
@@ -57,7 +57,9 @@
   MdeModulePkg/MdeModulePkg.dec
 
 [LibraryClasses]
+  CacheMaintenanceLib
   MemoryAllocationLib
+  PeCoffLib
   UefiBootServicesTableLib
   BaseMemoryLib
   UefiDriverEntryPoint
@@ -68,6 +70,7 @@
 [Protocols]
   gEfiDebugSupportProtocolGuid  ## PRODUCES
   gEfiEbcProtocolGuid   ## PRODUCES
+  gEdkiiPeCoffImageEmulatorProtocolGuid ## PRODUCES
   gEfiEbcVmTestProtocolGuid ## SOMETIMES_PRODUCES
   gEfiEbcSimpleDebuggerProtocolGuid ## SOMETIMES_CONSUMES
 
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcInt.c 
b/MdeModulePkg/Universal/EbcDxe/EbcInt.c
index 727ba8bcae44..051eb0aaa07b 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcInt.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcInt.c
@@ -349,6 +349,119 @@ UINTN  mStackNum = 0;
 EFI_EVENT  mEbcPeriodicEvent;
 VM_CONTEXT *mVmPtr = NULL;
 
+/**
+  Check whether the emulator supports executing a certain PE/COFF image
+
+  @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
+  structure
+  @param[in] ImageTypeWhether the image is an application, a boot time
+  driver or a runtime driver.
+  @param[in] DevicePath   Path to device where the image originated
+  (e.g., a PCI option ROM)
+
+  @retval TRUEThe image is supported by the emulator
+  @retval FALSE   The image is not supported by the emulator.
+**/
+BOOLEAN
+EFIAPI
+EbcIsImageSupported (
+  IN  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL*This,
+  IN  UINT16  ImageType,
+  IN  EFI_DEVICE_PATH_PROTOCOL*DevicePath   OPTIONAL
+  )
+{
+  if (ImageType != EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION &&
+  ImageType != EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) {
+return FALSE;
+  }
+  return TRUE;
+}
+
+/**
+  Register a supported PE/COFF image with the emulator. After this call
+  completes successfully, the PE/COFF image may be started as usual, and
+  it is the responsibility of the emulator implementation that any branch
+  into the code section of the image (including returns from functions called
+  from the foreign code) is executed as if it were running on the machine
+  type it was built for.
+
+  @param[in]  This  This pointer for
+EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure
+  @param[in]  ImageBase The base address in memory of the PE/COFF image
+  @param[in]  ImageSize The size in memory of the PE/COFF image
+  @param[in,out]  EntryPointThe entry point of the PE/COFF image. Passed by
+reference so that the emulator may modify it.
+
+  @retval EFI_SUCCESS   The image was registered with the emulator and
+can be started as usual.
+  @retval other The image could not be registered.
+
+  If the PE/COFF machine type or image type are not supported by the emulator,
+  then ASSERT().
+**/
+EFI_STATUS
+EFIAPI
+EbcRegisterImage (
+  IN  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL*This,
+  IN  EFI_PHYSICAL_ADDRESSImageBase,
+  IN  UINT64  ImageSize,
+  IN  OUT EFI_IMAGE_ENTRY_POINT   *EntryPoint
+  )
+{
+  DEBUG_CODE_BEGIN ();
+PE_COFF_LOADER_IMAGE_CONTEXT  

[edk2-devel] [PATCH v5 1/7] MdeModulePkg: introduce PE/COFF image emulator protocol

2019-04-11 Thread Ard Biesheuvel
Introduce a protocol that can be invoked by the image loading services
to execute foreign architecture PE/COFF images via an emulator.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h | 107 
 MdeModulePkg/MdeModulePkg.dec   |   4 +
 2 files changed, 111 insertions(+)

diff --git a/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h 
b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
new file mode 100644
index ..1ca302440e4a
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
@@ -0,0 +1,107 @@
+/** @file
+  Copyright (c) 2019, Linaro, Ltd. All rights reserved.
+
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License which accompanies this
+  distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H
+#define PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H
+
+#define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \
+  { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA, 
0x97 } }
+
+typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL 
EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;
+
+/**
+  Check whether the emulator supports executing a certain PE/COFF image
+
+  @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
+  structure
+  @param[in] ImageTypeWhether the image is an application, a boot time
+  driver or a runtime driver.
+  @param[in] DevicePath   Path to device where the image originated
+  (e.g., a PCI option ROM)
+
+  @retval TRUEThe image is supported by the emulator
+  @retval FALSE   The image is not supported by the emulator.
+**/
+typedef
+BOOLEAN
+(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED) (
+  IN  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL*This,
+  IN  UINT16  ImageType,
+  IN  EFI_DEVICE_PATH_PROTOCOL*DevicePath   OPTIONAL
+  );
+
+/**
+  Register a supported PE/COFF image with the emulator. After this call
+  completes successfully, the PE/COFF image may be started as usual, and
+  it is the responsibility of the emulator implementation that any branch
+  into the code section of the image (including returns from functions called
+  from the foreign code) is executed as if it were running on the machine
+  type it was built for.
+
+  @param[in]  This  This pointer for
+EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure
+  @param[in]  ImageBase The base address in memory of the PE/COFF image
+  @param[in]  ImageSize The size in memory of the PE/COFF image
+  @param[in,out]  EntryPointThe entry point of the PE/COFF image. Passed by
+reference so that the emulator may modify it.
+
+  @retval EFI_SUCCESS   The image was registered with the emulator and
+can be started as usual.
+  @retval other The image could not be registered.
+
+  If the PE/COFF machine type or image type are not supported by the emulator,
+  then ASSERT().
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE) (
+  IN  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL*This,
+  IN  EFI_PHYSICAL_ADDRESSImageBase,
+  IN  UINT64  ImageSize,
+  IN  OUT EFI_IMAGE_ENTRY_POINT   *EntryPoint
+  );
+
+/**
+  Unregister a PE/COFF image that has been registered with the emulator.
+  This should be done before the image is unloaded from memory.
+
+  @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
+  structure
+  @param[in] ImageBaseThe base address in memory of the PE/COFF image
+
+  @retval EFI_SUCCESS The image was unregistered with the emulator.
+  @retval other   Image could not be unloaded.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE) (
+  IN  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL*This,
+  IN  EFI_PHYSICAL_ADDRESSImageBase
+  );
+
+#define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1
+
+typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {
+  EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTEDIsImageSupported;
+  EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGERegisterImage;
+  EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE  UnregisterImage;
+
+  // Protocol version implemented by the emulator
+  UINT32Version;
+  // The machine type 

[edk2-devel] [PATCH v5 3/7] MdeModulePkg/PciBusDxe: dispatch option ROMs for foreign architectures

2019-04-11 Thread Ard Biesheuvel
Delete the explicit machine type check for option ROM images, and instead,
rely on the LoadImage() boot service to decide whether an option ROM can
be dispatched or not. This permits platforms to ship with emulators to
execute option ROMs that are not native to the processor architecture.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
index c75ef1a82505..54cf4251cc86 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
@@ -699,13 +699,6 @@ ProcessOpRomImage (
   goto NextImage;
 }
 
-//
-// Skip the EFI PCI Option ROM image if its machine type is not supported
-//
-if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (EfiRomHeader->EfiMachineType)) {
-  goto NextImage;
-}
-
 //
 // Ignore the EFI PCI Option ROM image if it is an EFI application
 //
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38906): https://edk2.groups.io/g/devel/message/38906
Mute This Topic: https://groups.io/mt/31034150/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread Laszlo Ersek
On 04/11/19 16:23, Philippe Mathieu-Daudé wrote:
> On 4/11/19 5:16 AM, Rebecca Cran via Groups.Io wrote:
>> Some systems such as FreeBSD identify the platform as 'arm64'
>> and not 'aarch64' as Linux does.
> 
> Per https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220297
> this seems to be a FreeBSD bug.

You are correct, but that issue was filed on 2017-06-26. I don't think
we should hold our breaths, as long as the workaround is simple. And, it
does look simple. (We've worked around worse.)

I do suggest an addition to the patch, however: Rebecca, please add the
link discovered by Phil near the "arm64" matches, in a comment.
Something like:

# work around 

Thanks,
Laszlo

> 
>> Signed-off-by: Rebecca Cran 
>> ---
>>  BaseTools/Source/C/GNUmakefile   | 5 +++--
>>  BaseTools/Source/C/Makefiles/header.makefile | 5 +++--
>>  2 files changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile
>> index 1d048c4cc6..37bcce519c 100644
>> --- a/BaseTools/Source/C/GNUmakefile
>> +++ b/BaseTools/Source/C/GNUmakefile
>> @@ -21,8 +21,9 @@ ifndef HOST_ARCH
>>endif
>>ifneq (,$(findstring aarch64,$(uname_m)))
>>  HOST_ARCH=AARCH64
>> -  endif
>> -  ifneq (,$(findstring arm,$(uname_m)))
>> +  else ifneq (,$(findstring arm64,$(uname_m)))
>> +HOST_ARCH=AARCH64
>> +  else ifneq (,$(findstring arm,$(uname_m)))
>>  HOST_ARCH=ARM
>>endif
>>ifndef HOST_ARCH
>> diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
>> b/BaseTools/Source/C/Makefiles/header.makefile
>> index 90fb3453ad..d76b8283dd 100644
>> --- a/BaseTools/Source/C/Makefiles/header.makefile
>> +++ b/BaseTools/Source/C/Makefiles/header.makefile
>> @@ -23,8 +23,9 @@ ifndef HOST_ARCH
>>endif
>>ifneq (,$(findstring aarch64,$(uname_m)))
>>  HOST_ARCH=AARCH64
>> -  endif
>> -  ifneq (,$(findstring arm,$(uname_m)))
>> +  else ifneq (,$(findstring arm64,$(uname_m)))
>> +HOST_ARCH=AARCH64
>> +  else ifneq (,$(findstring arm,$(uname_m)))
>>  HOST_ARCH=ARM
>>endif
>>ifndef HOST_ARCH
>>
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38901): https://edk2.groups.io/g/devel/message/38901
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and improve E820 debug output

2019-04-11 Thread Laszlo Ersek
On 04/11/19 16:32, Philippe Mathieu-Daudé wrote:
> Hi Liming, Rebecca.
> 
> On 4/11/19 3:52 PM, Liming Gao wrote:
>> Phil:
>>   I use Outlook to receive the patch mail, and save as mail file. This file 
>> shows From: Rebecca Cran via Groups.Io . So, 
>> I use it as patch author. I also check my patch with the same way. It shows 
>> From: Liming Gao . This is correct. So, I don't know 
>> this is user setting issue or group.io issue. 
> 
> On https://edk2.groups.io/g/devel/editprofile
> 
> So on Groups.Io I went to
> - Your groups
>   -> EDK2
>  -> devel
> -> Suscription
>-> Group Profile
>   -> Edit Group Profile
> 
> I see 2 fields:
> 
> - User Name
> - Display Name
> 
> The latter field is described as:
> 
>   The name listed with your posts. Note: When you post,
>   your email address is also shown to group members who
>   receive messages via email.
> 
> My guess is Groups.Io rewrites the sender From if an user change one of
> these fields.
> 
> Rebecca: do you remember if you modified something in your profile?
> How are you sending your patches to the list?
> 
> Sorry you became our 'patches via groups.io' guinea pig ;)

My understanding is that this is unrelated to groups.io. The same kind of email 
mangling used to happen a *lot* on the old <01.org> list. (From a number of 
senders.) Here's an example:

(1) Locate the message at

  https://lists.01.org/pipermail/edk2-devel/2019-March/038118.html

It looks correct, right?

(2) Now locate the same message in a different archive, e.g. at:

  http://mid.mail-archive.com/20190324020033.50367-1-rebecca@bluestop.org

Notice it says "Rebecca Cran via edk2-devel".

(3) In my local copy of that message, I see the following headers:

- From: Rebecca Cran via edk2-devel 
- Reply-To: Rebecca Cran 
- Sender: "edk2-devel" 

The damage is done before the patch receives the list(s), and/or is fed to 
git-am on the maintainer side.

If I remember correctly, this is somehow related to Outlook (i.e., the sender's 
MUA / first MTA), not the mailing list(s), or git.

Thanks
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38900): https://edk2.groups.io/g/devel/message/38900
Mute This Topic: https://groups.io/mt/30899017/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2] [PATCH v4 0/7] MdeModulePkg: add support for dispatching foreign arch PE/COFF images

2019-04-11 Thread Ard Biesheuvel
On Wed, 10 Apr 2019 at 23:23, Kinney, Michael D
 wrote:
>
> Ard,
>
> Thank you for the update on this patch series.
> This design is very clean.  One logic issue for
> protocol notifications, but that should be only
> require a small update.
>

Thanks Mike

I'll get that fixed and send out v5 shortly.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38899): https://edk2.groups.io/g/devel/message/38899
Mute This Topic: https://groups.io/mt/31028066/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] The rumours of Leif Lindholm's early retirement have been greatly exaggerated

2019-04-11 Thread Ard Biesheuvel
He is here at UEFI Plugfest, but suffering from a nasty case of food
poisoning and hiding in his room.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38895): https://edk2.groups.io/g/devel/message/38895
Mute This Topic: https://groups.io/mt/31032198/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and improve E820 debug output

2019-04-11 Thread Philippe Mathieu-Daudé
Hi Liming, Rebecca.

On 4/11/19 3:52 PM, Liming Gao wrote:
> Phil:
>   I use Outlook to receive the patch mail, and save as mail file. This file 
> shows From: Rebecca Cran via Groups.Io . So, 
> I use it as patch author. I also check my patch with the same way. It shows 
> From: Liming Gao . This is correct. So, I don't know 
> this is user setting issue or group.io issue. 

On https://edk2.groups.io/g/devel/editprofile

So on Groups.Io I went to
- Your groups
  -> EDK2
 -> devel
-> Suscription
   -> Group Profile
  -> Edit Group Profile

I see 2 fields:

- User Name
- Display Name

The latter field is described as:

  The name listed with your posts. Note: When you post,
  your email address is also shown to group members who
  receive messages via email.

My guess is Groups.Io rewrites the sender From if an user change one of
these fields.

Rebecca: do you remember if you modified something in your profile?
How are you sending your patches to the list?

Sorry you became our 'patches via groups.io' guinea pig ;)

Thanks,

Phil.

> Thanks
> Liming
>> -Original Message-
>> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of 
>> Philippe Mathieu-Daudé
>> Sent: Thursday, April 11, 2019 6:59 PM
>> To: Gao, Liming ; Kinney, Michael D 
>> ; Laszlo Ersek 
>> Cc: devel@edk2.groups.io; rebe...@bluestop.org; Stephano Cetola 
>> 
>> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and 
>> improve E820 debug output
>>
>> Hi Liming,
>>
>> On 4/11/19 2:32 AM, Liming Gao wrote:
>>> Push on commit ddb8cedce7e07b87c0ac6b84cd750a6d3dac47c8
>>
>> I see in the git history the authorship passed
>> from: rebe...@bluestop.org 
>> to: Rebecca Cran via Groups.Io 
>>
>> I wonder if we shouldn't block pushes until the
>> BaseTools/Scripts/PatchCheck.py tool get fixed to avoid such mistakes
>> which are likely to get reproduced now that we switched to Groups.Io.
>>
>> Thoughts?
>>
>> Regards,
>>
>> Phil.
>>
 -Original Message-
 From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
 Liming Gao
 Sent: Monday, April 08, 2019 9:16 PM
 To: Philippe Mathieu-Daudé ; rebe...@bluestop.org
 Cc: devel@edk2.groups.io
 Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments
 and improve E820 debug output

 Reviewed-by: Liming Gao 

> -Original Message-
> From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
> Sent: Friday, April 5, 2019 5:05 PM
> To: rebe...@bluestop.org; Gao, Liming 
> Cc: devel@edk2.groups.io
> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix
 comments and improve E820 debug output
>
> On 4/4/19 7:56 PM, Rebecca Cran via Groups.Io wrote:
>> Fix a few typos in LegacyBiosBuildE820, and improve the debug output of
>> the E820 table to pad with zeros instead of spaces, remove extra hyphens
>> and display the memory type in decimal.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Rebecca Cran 
>
> Reviewed-by: Philippe Mathieu-Daude 
>
>> ---
[...]

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38892): https://edk2.groups.io/g/devel/message/38892
Mute This Topic: https://groups.io/mt/30899017/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread Philippe Mathieu-Daudé
On 4/11/19 5:16 AM, Rebecca Cran via Groups.Io wrote:
> Some systems such as FreeBSD identify the platform as 'arm64'
> and not 'aarch64' as Linux does.

Per https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220297
this seems to be a FreeBSD bug.

> Signed-off-by: Rebecca Cran 
> ---
>  BaseTools/Source/C/GNUmakefile   | 5 +++--
>  BaseTools/Source/C/Makefiles/header.makefile | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile
> index 1d048c4cc6..37bcce519c 100644
> --- a/BaseTools/Source/C/GNUmakefile
> +++ b/BaseTools/Source/C/GNUmakefile
> @@ -21,8 +21,9 @@ ifndef HOST_ARCH
>endif
>ifneq (,$(findstring aarch64,$(uname_m)))
>  HOST_ARCH=AARCH64
> -  endif
> -  ifneq (,$(findstring arm,$(uname_m)))
> +  else ifneq (,$(findstring arm64,$(uname_m)))
> +HOST_ARCH=AARCH64
> +  else ifneq (,$(findstring arm,$(uname_m)))
>  HOST_ARCH=ARM
>endif
>ifndef HOST_ARCH
> diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
> b/BaseTools/Source/C/Makefiles/header.makefile
> index 90fb3453ad..d76b8283dd 100644
> --- a/BaseTools/Source/C/Makefiles/header.makefile
> +++ b/BaseTools/Source/C/Makefiles/header.makefile
> @@ -23,8 +23,9 @@ ifndef HOST_ARCH
>endif
>ifneq (,$(findstring aarch64,$(uname_m)))
>  HOST_ARCH=AARCH64
> -  endif
> -  ifneq (,$(findstring arm,$(uname_m)))
> +  else ifneq (,$(findstring arm64,$(uname_m)))
> +HOST_ARCH=AARCH64
> +  else ifneq (,$(findstring arm,$(uname_m)))
>  HOST_ARCH=ARM
>endif
>ifndef HOST_ARCH
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38891): https://edk2.groups.io/g/devel/message/38891
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and improve E820 debug output

2019-04-11 Thread Liming Gao
Phil:
  I use Outlook to receive the patch mail, and save as mail file. This file 
shows From: Rebecca Cran via Groups.Io . So, I 
use it as patch author. I also check my patch with the same way. It shows From: 
Liming Gao . This is correct. So, I don't know this is 
user setting issue or group.io issue. 

Thanks
Liming
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of 
> Philippe Mathieu-Daudé
> Sent: Thursday, April 11, 2019 6:59 PM
> To: Gao, Liming ; Kinney, Michael D 
> ; Laszlo Ersek 
> Cc: devel@edk2.groups.io; rebe...@bluestop.org; Stephano Cetola 
> 
> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and 
> improve E820 debug output
> 
> Hi Liming,
> 
> On 4/11/19 2:32 AM, Liming Gao wrote:
> > Push on commit ddb8cedce7e07b87c0ac6b84cd750a6d3dac47c8
> 
> I see in the git history the authorship passed
> from: rebe...@bluestop.org 
> to: Rebecca Cran via Groups.Io 
> 
> I wonder if we shouldn't block pushes until the
> BaseTools/Scripts/PatchCheck.py tool get fixed to avoid such mistakes
> which are likely to get reproduced now that we switched to Groups.Io.
> 
> Thoughts?
> 
> Regards,
> 
> Phil.
> 
> >> -Original Message-
> >> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> >> Liming Gao
> >> Sent: Monday, April 08, 2019 9:16 PM
> >> To: Philippe Mathieu-Daudé ; rebe...@bluestop.org
> >> Cc: devel@edk2.groups.io
> >> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments
> >> and improve E820 debug output
> >>
> >> Reviewed-by: Liming Gao 
> >>
> >>> -Original Message-
> >>> From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
> >>> Sent: Friday, April 5, 2019 5:05 PM
> >>> To: rebe...@bluestop.org; Gao, Liming 
> >>> Cc: devel@edk2.groups.io
> >>> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix
> >> comments and improve E820 debug output
> >>>
> >>> On 4/4/19 7:56 PM, Rebecca Cran via Groups.Io wrote:
>  Fix a few typos in LegacyBiosBuildE820, and improve the debug output of
>  the E820 table to pad with zeros instead of spaces, remove extra hyphens
>  and display the memory type in decimal.
> 
>  Contributed-under: TianoCore Contribution Agreement 1.1
>  Signed-off-by: Rebecca Cran 
> >>>
> >>> Reviewed-by: Philippe Mathieu-Daude 
> >>>
>  ---
>   .../Csm/LegacyBiosDxe/LegacyBootSupport.c  | 10 +-
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
>  diff --git
> >> a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
> >>> b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
>  index a7b8e6a9a0..8c415cdfc6 100644
>  ---
> >> a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
>  +++
> >> b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
>  @@ -1711,9 +1711,9 @@ LegacyBiosBuildE820 (
> 
> do {
>   //
>  -// Use size returned back plus 1 descriptor for the AllocatePool.
>  +// Use size returned for the AllocatePool.
>   // We don't just multiply by 2 since the "for" loop below 
>  terminates on
>  -// EfiMemoryMapEnd which is dependent upon EfiMemoryMapSize.
> >> Otherwize
>  +// EfiMemoryMapEnd which is dependent upon EfiMemoryMapSize.
> >> Otherwise
>   // we process bogus entries and create bogus E820 entries.
>   //
>   EfiMemoryMap = (EFI_MEMORY_DESCRIPTOR *) AllocatePool
> >> (EfiMemoryMapSize);
>  @@ -1801,7 +1801,7 @@ LegacyBiosBuildE820 (
>   MemoryBlockLength = (UINT64) (LShiftU64 (EfiEntry->NumberOfPages,
> >> 12));
>   if ((EfiEntry->PhysicalStart + MemoryBlockLength) < 0x10) {
> //
>  -  // Skip the memory block is under 1MB
>  +  // Skip the memory block if under 1MB
> //
>   } else {
> if (EfiEntry->PhysicalStart < 0x10) {
>  @@ -1926,7 +1926,7 @@ LegacyBiosBuildE820 (
> *Size = (UINTN) (Index * sizeof (EFI_E820_ENTRY64));
> 
> //
>  -  // Determine OS usable memory above 1Mb
>  +  // Determine OS usable memory above 1MB
> //
> Private->IntThunk->EfiToLegacy16BootTable.OsMemoryAbove1Mb =
> >> 0x;
> for (TempIndex = Above1MIndex; TempIndex < Index; TempIndex++) {
>  @@ -1948,7 +1948,7 @@ LegacyBiosBuildE820 (
> // Print DEBUG information
> //
> for (TempIndex = 0; TempIndex < Index; TempIndex++) {
>  -DEBUG((EFI_D_INFO, "E820[%2d]: 0x%16lx  0x%16lx, Type = 0x%x
> >> \n",
>  +DEBUG((EFI_D_INFO, "E820[%2d]: 0x%016lx - 0x%016lx, Type = %d\n",
> TempIndex,
> E820Table[TempIndex].BaseAddr,
> (E820Table[TempIndex].BaseAddr + E820Table[TempIndex].Length),
> 
> >>
> >>
> >
> >
> >
> >
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online 

Re: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in addition to aarch64

2019-04-11 Thread Liming Gao
Reviewed-by: Liming Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Rebecca 
> Cran via Groups.Io
> Sent: Thursday, April 11, 2019 11:17 AM
> To: devel@edk2.groups.io; Gao, Liming ; Zhu, Yonghong 
> 
> Cc: Rebecca Cran 
> Subject: [edk2-devel] [PATCH] BaseTools: support arm64 as a platform name in 
> addition to aarch64
> 
> Some systems such as FreeBSD identify the platform as 'arm64'
> and not 'aarch64' as Linux does.
> 
> Signed-off-by: Rebecca Cran 
> ---
>  BaseTools/Source/C/GNUmakefile   | 5 +++--
>  BaseTools/Source/C/Makefiles/header.makefile | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile
> index 1d048c4cc6..37bcce519c 100644
> --- a/BaseTools/Source/C/GNUmakefile
> +++ b/BaseTools/Source/C/GNUmakefile
> @@ -21,8 +21,9 @@ ifndef HOST_ARCH
>endif
>ifneq (,$(findstring aarch64,$(uname_m)))
>  HOST_ARCH=AARCH64
> -  endif
> -  ifneq (,$(findstring arm,$(uname_m)))
> +  else ifneq (,$(findstring arm64,$(uname_m)))
> +HOST_ARCH=AARCH64
> +  else ifneq (,$(findstring arm,$(uname_m)))
>  HOST_ARCH=ARM
>endif
>ifndef HOST_ARCH
> diff --git a/BaseTools/Source/C/Makefiles/header.makefile 
> b/BaseTools/Source/C/Makefiles/header.makefile
> index 90fb3453ad..d76b8283dd 100644
> --- a/BaseTools/Source/C/Makefiles/header.makefile
> +++ b/BaseTools/Source/C/Makefiles/header.makefile
> @@ -23,8 +23,9 @@ ifndef HOST_ARCH
>endif
>ifneq (,$(findstring aarch64,$(uname_m)))
>  HOST_ARCH=AARCH64
> -  endif
> -  ifneq (,$(findstring arm,$(uname_m)))
> +  else ifneq (,$(findstring arm64,$(uname_m)))
> +HOST_ARCH=AARCH64
> +  else ifneq (,$(findstring arm,$(uname_m)))
>  HOST_ARCH=ARM
>endif
>ifndef HOST_ARCH
> --
> 2.20.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#38845): https://edk2.groups.io/g/devel/message/38845
> Mute This Topic: https://groups.io/mt/31026994/1759384
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [liming@intel.com]
> -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#3): https://edk2.groups.io/g/devel/message/3
Mute This Topic: https://groups.io/mt/31026994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH v2 1/3] OvmfPkg/XenSupport: remove usage of prefetchable PCI host bridge aperture

2019-04-11 Thread Anthony PERARD
On Tue, Apr 09, 2019 at 04:12:38AM +0100, Igor Druzhinin wrote:
> This aperture doesn't exist in QEMU-XEN and hvmloader places BARs
> in arbitrary order disregarding prefetchable bit. This makes
> prefetchable and non-prefetchable BARs to follow each other that's
> quite likely with PCI passthrough devices. In that case, the existing
> code, that tries to work out aperture boundaries by reading hvmloader
> BAR placement, will report a bogus prefetchable aperture which overlaps
> with the regular one. It will eventually trigger an assertion in
> DXE PCI initialization code.
> 
> Do the same thing as OVMF on QEMU-KVM and pass a non-existing aperture
> there. It's not necessary to pass additional allocation flags as we set
> ResourceAssigned flag on the root bridge which means they will be ignored.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Igor Druzhinin 
> ---
> Changes in v2:
> * remove usage of prefetchable aperture entirely
> * explained rationale for the change in the description
> ---

Reviewed-by: Anthony PERARD 

Thanks,

-- 
Anthony PERARD

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38887): https://edk2.groups.io/g/devel/message/38887
Mute This Topic: https://groups.io/mt/31030418/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments and improve E820 debug output

2019-04-11 Thread Philippe Mathieu-Daudé
Hi Liming,

On 4/11/19 2:32 AM, Liming Gao wrote:
> Push on commit ddb8cedce7e07b87c0ac6b84cd750a6d3dac47c8

I see in the git history the authorship passed
from: rebe...@bluestop.org 
to: Rebecca Cran via Groups.Io 

I wonder if we shouldn't block pushes until the
BaseTools/Scripts/PatchCheck.py tool get fixed to avoid such mistakes
which are likely to get reproduced now that we switched to Groups.Io.

Thoughts?

Regards,

Phil.

>> -Original Message-
>> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>> Liming Gao
>> Sent: Monday, April 08, 2019 9:16 PM
>> To: Philippe Mathieu-Daudé ; rebe...@bluestop.org
>> Cc: devel@edk2.groups.io
>> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix comments
>> and improve E820 debug output
>>
>> Reviewed-by: Liming Gao 
>>
>>> -Original Message-
>>> From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
>>> Sent: Friday, April 5, 2019 5:05 PM
>>> To: rebe...@bluestop.org; Gao, Liming 
>>> Cc: devel@edk2.groups.io
>>> Subject: Re: [edk2-devel] [PATCH] IntelFrameworkModulePkg: Fix
>> comments and improve E820 debug output
>>>
>>> On 4/4/19 7:56 PM, Rebecca Cran via Groups.Io wrote:
 Fix a few typos in LegacyBiosBuildE820, and improve the debug output of
 the E820 table to pad with zeros instead of spaces, remove extra hyphens
 and display the memory type in decimal.

 Contributed-under: TianoCore Contribution Agreement 1.1
 Signed-off-by: Rebecca Cran 
>>>
>>> Reviewed-by: Philippe Mathieu-Daude 
>>>
 ---
  .../Csm/LegacyBiosDxe/LegacyBootSupport.c  | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

 diff --git
>> a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
>>> b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
 index a7b8e6a9a0..8c415cdfc6 100644
 ---
>> a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
 +++
>> b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBootSupport.c
 @@ -1711,9 +1711,9 @@ LegacyBiosBuildE820 (

do {
  //
 -// Use size returned back plus 1 descriptor for the AllocatePool.
 +// Use size returned for the AllocatePool.
  // We don't just multiply by 2 since the "for" loop below terminates 
 on
 -// EfiMemoryMapEnd which is dependent upon EfiMemoryMapSize.
>> Otherwize
 +// EfiMemoryMapEnd which is dependent upon EfiMemoryMapSize.
>> Otherwise
  // we process bogus entries and create bogus E820 entries.
  //
  EfiMemoryMap = (EFI_MEMORY_DESCRIPTOR *) AllocatePool
>> (EfiMemoryMapSize);
 @@ -1801,7 +1801,7 @@ LegacyBiosBuildE820 (
  MemoryBlockLength = (UINT64) (LShiftU64 (EfiEntry->NumberOfPages,
>> 12));
  if ((EfiEntry->PhysicalStart + MemoryBlockLength) < 0x10) {
//
 -  // Skip the memory block is under 1MB
 +  // Skip the memory block if under 1MB
//
  } else {
if (EfiEntry->PhysicalStart < 0x10) {
 @@ -1926,7 +1926,7 @@ LegacyBiosBuildE820 (
*Size = (UINTN) (Index * sizeof (EFI_E820_ENTRY64));

//
 -  // Determine OS usable memory above 1Mb
 +  // Determine OS usable memory above 1MB
//
Private->IntThunk->EfiToLegacy16BootTable.OsMemoryAbove1Mb =
>> 0x;
for (TempIndex = Above1MIndex; TempIndex < Index; TempIndex++) {
 @@ -1948,7 +1948,7 @@ LegacyBiosBuildE820 (
// Print DEBUG information
//
for (TempIndex = 0; TempIndex < Index; TempIndex++) {
 -DEBUG((EFI_D_INFO, "E820[%2d]: 0x%16lx  0x%16lx, Type = 0x%x
>> \n",
 +DEBUG((EFI_D_INFO, "E820[%2d]: 0x%016lx - 0x%016lx, Type = %d\n",
TempIndex,
E820Table[TempIndex].BaseAddr,
(E820Table[TempIndex].BaseAddr + E820Table[TempIndex].Length),

>>
>>
> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38874): https://edk2.groups.io/g/devel/message/38874
Mute This Topic: https://groups.io/mt/30899017/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [RFC] Propose to remove IpSecDxe

2019-04-11 Thread Siyuan, Fu
Bugzilla created for this https://bugzilla.tianocore.org/show_bug.cgi?id=1697

BestRegards
Fu Siyuan

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Siyuan, Fu
Sent: Thursday, April 11, 2019 6:39 PM
To: devel@edk2.groups.io
Cc: Wu, Jiaxin ; Gao, Liming 
Subject: [edk2-devel] [RFC] Propose to remove IpSecDxe

All,

You might notice that some activities about reducing edk2 repo happened or are 
happening.

I propose to remove the IpSecDxe driver from NetworkPkg. Anyone who wants to 
use IpSecDxe can fetch it from stable tag
https://github.com/tianocore/edk2/releases/tag/edk2-stable201903

If you have any concern regarding this, please let me know before 4/20/2019.

Thanks,
Siyuan


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38873): https://edk2.groups.io/g/devel/message/38873
Mute This Topic: https://groups.io/mt/31029253/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [RFC] Propose to remove IpSecDxe

2019-04-11 Thread Siyuan, Fu
Bugzilla created for this 
https://github.com/tianocore/edk2/releases/tag/edk2-stable201903

BestRegards
Fu Siyuan

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Siyuan, Fu
Sent: Thursday, April 11, 2019 6:39 PM
To: devel@edk2.groups.io
Cc: Wu, Jiaxin ; Gao, Liming 
Subject: [edk2-devel] [RFC] Propose to remove IpSecDxe

All,

You might notice that some activities about reducing edk2 repo happened or are 
happening.

I propose to remove the IpSecDxe driver from NetworkPkg. Anyone who wants to 
use IpSecDxe can fetch it from stable tag
https://github.com/tianocore/edk2/releases/tag/edk2-stable201903

If you have any concern regarding this, please let me know before 4/20/2019.

Thanks,
Siyuan


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38872): https://edk2.groups.io/g/devel/message/38872
Mute This Topic: https://groups.io/mt/31029253/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [RFC] Propose to remove IpSecDxe

2019-04-11 Thread Siyuan, Fu
All,

You might notice that some activities about reducing edk2 repo happened or are 
happening.

I propose to remove the IpSecDxe driver from NetworkPkg. Anyone who wants to 
use IpSecDxe can fetch it from stable tag
https://github.com/tianocore/edk2/releases/tag/edk2-stable201903

If you have any concern regarding this, please let me know before 4/20/2019.

Thanks,
Siyuan
_._,_._,_


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38869): https://edk2.groups.io/g/devel/message/38869
Mute This Topic: https://groups.io/mt/31029253/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Philippe Mathieu-Daudé
Hi Zhichao,

This is not a technical comment related to your patch.

I understand the migration from lists.01.org to edk2.groups.io was in
part motivated to help developpers having a restricted email setup to
easily use a mailing list. I see you top posting your replies so I
wonder if groups.io is really helpful to you.
Are you missing other features that would make your list email workflow
easier?

Thanks,

Phil.

On 4/11/19 11:33 AM, Gao, Zhichao wrote:
> Thanks for you advices.
> 
> I would better to keep the 'UINTN' with '%x' because PEIM is compiled as 32 
> bit object. And lots of PEIMs keep this combine.
> 
> Thanks,
> Zhichao
> 
>> -Original Message-
>> From: Wu, Hao A
>> Sent: Thursday, April 11, 2019 4:12 PM
>> To: Gao, Zhichao ; Philippe Mathieu-Daudé
>> ; devel@edk2.groups.io
>> Cc: Bret Barkelew ; Michael Turner
>> ; Gao, Liming ;
>> Zeng, Star ; Wang, Jian J 
>> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
>> code to print 64bit data
>>
>>> -Original Message-
>>> From: Gao, Zhichao
>>> Sent: Thursday, April 11, 2019 3:47 PM
>>> To: Philippe Mathieu-Daudé; devel@edk2.groups.io
>>> Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao A;
>>> Wang, Jian J
>>> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
>> debug
>>> code to print 64bit data
>>>
>>> Sorry for missing this email.
>>>
>>> While I change the code, it couldn't pass the Patchcher.py because of
>>> the 'EFI_D_" version MACRO. So I change all the debug message in this
>> driver.
>>> Maybe that is a redundant work.
>>
>> Hello Zhichao,
>>
>> For this case, you can work out a first patch to replace all the macros 
>> starting
>> with 'EFI_D_' with 'DEBUG_'. And a second patch to address the real issue.
>>
>>>
>>> Thanks,
>>> Zhichao
>>>
 -Original Message-
 From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
 Sent: Tuesday, April 2, 2019 11:36 PM
 To: Gao, Zhichao ; edk2-de...@lists.01.org
 Cc: Bret Barkelew ; Michael Turner
 ; Gao, Liming ;
 Zeng, Star 
 Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
>>> debug
 code to print 64bit data

 Hi Bret,

 On 4/2/19 7:50 AM, Zhichao Gao wrote:
> From: Bret Barkelew 
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
>
> For some pointer and UINT64 data, the debug code print with '%x'.
> Which would loss the upper 32bit data. So update '%x' to '%lx'
> for these data.

 Some are UINTN. Per Laszlo answer on this thread:
 https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
 for those, casting and changing format is the accepted way.
>>
>> After a skim of the patch, I think there seems only 2 cases that are handled 
>> in
>> this patch:
>>
>> 1. UINT64
>> For this one, the change in this patch looks good to me.
>>
>> 2. Pointers
>> I think we can directly use '%p' for pointers.
>>
>> If I happen to miss other cases, please do follow the above link to handle
>> UINTN.
>>
>>
>> Best Regards,
>> Hao Wu
>>

 However this is a change,

> Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> DEBUG_ version is recommended to use.

 and this is another change.

 Splitting this patch in 2 would make it more digestable.
[...]

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38867): https://edk2.groups.io/g/devel/message/38867
Mute This Topic: https://groups.io/mt/31028411/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Gao, Zhichao
Thanks for you advices.

I would better to keep the 'UINTN' with '%x' because PEIM is compiled as 32 bit 
object. And lots of PEIMs keep this combine.

Thanks,
Zhichao

> -Original Message-
> From: Wu, Hao A
> Sent: Thursday, April 11, 2019 4:12 PM
> To: Gao, Zhichao ; Philippe Mathieu-Daudé
> ; devel@edk2.groups.io
> Cc: Bret Barkelew ; Michael Turner
> ; Gao, Liming ;
> Zeng, Star ; Wang, Jian J 
> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> > -Original Message-
> > From: Gao, Zhichao
> > Sent: Thursday, April 11, 2019 3:47 PM
> > To: Philippe Mathieu-Daudé; devel@edk2.groups.io
> > Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao A;
> > Wang, Jian J
> > Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> debug
> > code to print 64bit data
> >
> > Sorry for missing this email.
> >
> > While I change the code, it couldn't pass the Patchcher.py because of
> > the 'EFI_D_" version MACRO. So I change all the debug message in this
> driver.
> > Maybe that is a redundant work.
> 
> Hello Zhichao,
> 
> For this case, you can work out a first patch to replace all the macros 
> starting
> with 'EFI_D_' with 'DEBUG_'. And a second patch to address the real issue.
> 
> >
> > Thanks,
> > Zhichao
> >
> > > -Original Message-
> > > From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
> > > Sent: Tuesday, April 2, 2019 11:36 PM
> > > To: Gao, Zhichao ; edk2-de...@lists.01.org
> > > Cc: Bret Barkelew ; Michael Turner
> > > ; Gao, Liming ;
> > > Zeng, Star 
> > > Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> > debug
> > > code to print 64bit data
> > >
> > > Hi Bret,
> > >
> > > On 4/2/19 7:50 AM, Zhichao Gao wrote:
> > > > From: Bret Barkelew 
> > > >
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> > > >
> > > > For some pointer and UINT64 data, the debug code print with '%x'.
> > > > Which would loss the upper 32bit data. So update '%x' to '%lx'
> > > > for these data.
> > >
> > > Some are UINTN. Per Laszlo answer on this thread:
> > > https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
> > > for those, casting and changing format is the accepted way.
> 
> After a skim of the patch, I think there seems only 2 cases that are handled 
> in
> this patch:
> 
> 1. UINT64
> For this one, the change in this patch looks good to me.
> 
> 2. Pointers
> I think we can directly use '%p' for pointers.
> 
> If I happen to miss other cases, please do follow the above link to handle
> UINTN.
> 
> 
> Best Regards,
> Hao Wu
> 
> > >
> > > However this is a change,
> > >
> > > > Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> > > > DEBUG_ version is recommended to use.
> > >
> > > and this is another change.
> > >
> > > Splitting this patch in 2 would make it more digestable.
> > >
> > > >
> > > > Cc: Jian J Wang 
> > > > Cc: Ray Ni 
> > > > Cc: Star Zeng 
> > > > Cc: Liming Gao 
> > > > Cc: Sean Brogan 
> > > > Cc: Michael Turner 
> > > > Cc: Bret Barkelew 
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Zhichao Gao 
> > > > ---
> > > >  .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +-
> -
> > > >  .../Universal/CapsulePei/UefiCapsule.c| 46 +-
> > > >  .../Universal/CapsulePei/X64/X64Entry.c   |  2 +-
> > > >  3 files changed, 69 insertions(+), 69 deletions(-)
> > > >
> > > > diff --git
> > > > a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > index 3575a94d0f..2a527054bd 100644
> > > > ---
> a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > +++
> > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
> > > >// Sanity Check
> > > >//
> > > >if (Size > MAX_ADDRESS) {
> > > > -DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > Size));
> > > > +DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > > > + Size));
> > > >  return FALSE;
> > > >}
> > > >
> > > > @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
> > > >// Sanity Check
> > > >//
> > > >if (Address > (MAX_ADDRESS - Size)) {
> > > > -DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > > Size(0x%lx))\n", Address, Size));
> > > > +DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) >
> (MAX_ADDRESS -
> > > > + Size(0x%lx))\n", Address, Size));
> > > >  return FALSE;
> > > >}
> > > >
> > > > @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
> > > >for (Index = 0; MemoryResource[Index].ResourceLength != 0;
> > > > Index++)
> > {
> > > >  if ((Address >= MemoryResource[Index].PhysicalStart) &&
> > > >  ((Address + Size) <= (MemoryResource[Index].PhysicalStart
> > > > +
> > > MemoryResource[Index].ResourceLength))) {
> > > > -  

Re: [edk2-devel] [PATCH 1/5] MdeModulePkg: Change the SMM debug lib instance

2019-04-11 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Wednesday, April 10, 2019 3:03 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Ni, Ray; Zeng, Star; Gao, Liming; Sean Brogan; Michael
> Turner; Bret Barkelew
> Subject: [edk2-devel] [PATCH 1/5] MdeModulePkg: Change the SMM debug
> lib instance
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1416
> 
> The UefiDebugLibConOut will not support DXE_SMM_DRIVER,
> change UefiDebugLibConOut to PeiDxeDebugLibReportStatusCode.

Is this a typo?
Should be 'BaseDebugLibNull' according to your change.

With this addressed,
Reviewed-by: Hao Wu 


Best Regards,
Hao Wu

> 
> Cc: Jian J Wang 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> Signed-off-by: Zhichao Gao 
> ---
>  MdeModulePkg/MdeModulePkg.dsc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/MdeModulePkg.dsc
> b/MdeModulePkg/MdeModulePkg.dsc
> index 7ef39af847..0da28e74c2 100644
> --- a/MdeModulePkg/MdeModulePkg.dsc
> +++ b/MdeModulePkg/MdeModulePkg.dsc
> @@ -144,7 +144,7 @@
> 
>  [LibraryClasses.common.DXE_SMM_DRIVER]
>HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> -  DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
> +  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> 
> MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe
> moryAllocationLib.inf
> 
> MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTabl
> eLib.inf
> 
> SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT
> ableLib.inf
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38862): https://edk2.groups.io/g/devel/message/38862
Mute This Topic: https://groups.io/mt/31016457/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 0/5] Make some DebugLib instance runtime safe

2019-04-11 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Gao, Zhichao
> Sent: Wednesday, April 10, 2019 3:03 PM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen; Zhang, Chao B; Wang, Jian J; Ni, Ray; Zeng, Star; Gao, 
> Liming;
> Sean Brogan; Michael Turner; Bret Barkelew
> Subject: [edk2-devel] [PATCH 0/5] Make some DebugLib instance runtime
> safe
> 
> Some pointer will be invalid after ExitBootServices, such as protocol pointer,
> gST, gBS and so on. Disable the functions which used that pointer.
> 
> Remove SMM support of UefiDebugLibDebugPortProtocol,
> UefidebugLibConOut
> and UefiDebugLibStdErr.
> Before removing, should change the SMM instance in the dsc file which use
> them as SMM instance. And null version is safe.
> 
> Cc: Jiewen Yao 
> Cc: Chao Zhang 
> Cc: Jian J Wang 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> 
> Aaron Antone (3):
>   MdeModulePkg/UefiDebugLibDebugPortProtocol: Make it runtime safe
>   MdeModulePkg/UefidebugLibConOut: Make it runtime safe
>   MdeModule/UefiDebugLibStdErr: Make it runtime safe

Seems some typos here.
Should be MdePkg instead of MdeModulePkg (MdeModule).

Best Regards,
Hao Wu

> 
> Zhichao Gao (2):
>   MdeModulePkg: Change the SMM debug lib instance
>   SignedCapsulePkg: Change the SMM debug lib instance
> 
>  MdeModulePkg/MdeModulePkg.dsc |   2 +-
>  MdePkg/Library/UefiDebugLibConOut/DebugLib.c  | 116 +++---
>  .../UefiDebugLibConOut/DebugLibConstructor.c  |  72 +
>  .../UefiDebugLibConOut/UefiDebugLibConOut.inf |  12 +-
>  .../UefiDebugLibDebugPortProtocol/DebugLib.c  | 146 +-
>  .../DebugLibConstructor.c |  72 +
>  .../UefiDebugLibDebugPortProtocol.inf |  12 +-
>  MdePkg/Library/UefiDebugLibStdErr/DebugLib.c  | 113 +++---
>  .../UefiDebugLibStdErr/DebugLibConstructor.c  |  72 +
>  .../UefiDebugLibStdErr/UefiDebugLibStdErr.inf |  12 +-
>  SignedCapsulePkg/SignedCapsulePkg.dsc |   4 +-
>  11 files changed, 443 insertions(+), 190 deletions(-)
>  create mode 100644
> MdePkg/Library/UefiDebugLibConOut/DebugLibConstructor.c
>  create mode 100644
> MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLibConstructor.c
>  create mode 100644
> MdePkg/Library/UefiDebugLibStdErr/DebugLibConstructor.c
> 
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38861): https://edk2.groups.io/g/devel/message/38861
Mute This Topic: https://groups.io/mt/31016456/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, April 11, 2019 3:47 PM
> To: Philippe Mathieu-Daudé; devel@edk2.groups.io
> Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao A; Wang,
> Jian J
> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> Sorry for missing this email.
> 
> While I change the code, it couldn't pass the Patchcher.py because of the
> 'EFI_D_" version MACRO. So I change all the debug message in this driver.
> Maybe that is a redundant work.

Hello Zhichao,

For this case, you can work out a first patch to replace all the macros
starting with 'EFI_D_' with 'DEBUG_'. And a second patch to address the real
issue.

> 
> Thanks,
> Zhichao
> 
> > -Original Message-
> > From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
> > Sent: Tuesday, April 2, 2019 11:36 PM
> > To: Gao, Zhichao ; edk2-de...@lists.01.org
> > Cc: Bret Barkelew ; Michael Turner
> > ; Gao, Liming ;
> > Zeng, Star 
> > Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> debug
> > code to print 64bit data
> >
> > Hi Bret,
> >
> > On 4/2/19 7:50 AM, Zhichao Gao wrote:
> > > From: Bret Barkelew 
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> > >
> > > For some pointer and UINT64 data, the debug code print with '%x'.
> > > Which would loss the upper 32bit data. So update '%x' to '%lx'
> > > for these data.
> >
> > Some are UINTN. Per Laszlo answer on this thread:
> > https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
> > for those, casting and changing format is the accepted way.

After a skim of the patch, I think there seems only 2 cases that are
handled in this patch:

1. UINT64
For this one, the change in this patch looks good to me.

2. Pointers
I think we can directly use '%p' for pointers.

If I happen to miss other cases, please do follow the above link to handle
UINTN.


Best Regards,
Hao Wu

> >
> > However this is a change,
> >
> > > Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> > > DEBUG_ version is recommended to use.
> >
> > and this is another change.
> >
> > Splitting this patch in 2 would make it more digestable.
> >
> > >
> > > Cc: Jian J Wang 
> > > Cc: Ray Ni 
> > > Cc: Star Zeng 
> > > Cc: Liming Gao 
> > > Cc: Sean Brogan 
> > > Cc: Michael Turner 
> > > Cc: Bret Barkelew 
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Zhichao Gao 
> > > ---
> > >  .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +--
> > >  .../Universal/CapsulePei/UefiCapsule.c| 46 +-
> > >  .../Universal/CapsulePei/X64/X64Entry.c   |  2 +-
> > >  3 files changed, 69 insertions(+), 69 deletions(-)
> > >
> > > diff --git
> > > a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > index 3575a94d0f..2a527054bd 100644
> > > --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > +++
> b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
> > >// Sanity Check
> > >//
> > >if (Size > MAX_ADDRESS) {
> > > -DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> Size));
> > > +DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > > + Size));
> > >  return FALSE;
> > >}
> > >
> > > @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
> > >// Sanity Check
> > >//
> > >if (Address > (MAX_ADDRESS - Size)) {
> > > -DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > Size(0x%lx))\n", Address, Size));
> > > +DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > > + Size(0x%lx))\n", Address, Size));
> > >  return FALSE;
> > >}
> > >
> > > @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
> > >for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++)
> {
> > >  if ((Address >= MemoryResource[Index].PhysicalStart) &&
> > >  ((Address + Size) <= (MemoryResource[Index].PhysicalStart +
> > MemoryResource[Index].ResourceLength))) {
> > > -  DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> > MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > > +  DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> > > + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > >Address, Size,
> > >Index, MemoryResource[Index].PhysicalStart,
> > MemoryResource[Index].ResourceLength));
> > >return TRUE;
> > >  }
> > >}
> > >
> > > -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> > > MemoryResource\n", Address, Size));
> > > +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in
> any
> > > + MemoryResource\n", Address, Size));
> > >return FALSE;
> > >  }
> > >
> > > @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
> > >

Re: [edk2-devel] [PATCH 1/5] OvmfPkg/build.sh: Require QEMU 1.6 or newer and always enable flash

2019-04-11 Thread Laszlo Ersek
On 04/10/19 22:18, Jordan Justen wrote:
> On 2019-04-10 07:16:34, Laszlo Ersek wrote:
>> Hi Jordan,
>>
>> I've asked Phil (CC'd) to review this series in my stead. I'll be happy
>> to provide an ACK when Phil gives his R-b (if I should forget, please
>> ping me separately).
>>
>> In the future, please include a cover letter; a cumulative diffstat
>> usually helps with the review. (I've had to check all patches to see
>> that only build.sh is being modified.)
> 
> I did create a cover letter, but then I deleted it. I thought I was
> making too much out of it...
Personally I appreciate a cover letter even if it consists only of:
- public repo / branch reference
- one sentence on the goal
- a CC list
- cumulative diffstat

It helps a lot with grouping emails too.

> From what I gather, you don't find this script useful,

That's correct. I prefer to use the "build" utility directly, and I set
it up in every situation where it is needed specifically for that
situation/environment. I have a number of scripts around "build".

Regarding testing / launching QEMU, for years I've considered the QEMU
command line a computer-only interface. I do 99% of my testing via
libvirt, and for the remaining 1%, I have humongous hand-written command
lines, stashed in a bunch of scripts. Whenever I have to change to that
directory on my laptop, I cringe.

It's possible that some "simple" command lines exist for QEMU, but for
me they've always turned out deceptive. They are simple to *start*, but
soon you find you have to add 7 more options, and now your command line
stretches multiple lines in your terminal and it's hard to navigate, so
you start writing a script in order to break each option to a separate
line with a backslash, but then some individual options are still too
long to fit into 80 characters, so you introduce shell variables for
abbreviations, etc etc etc gr. :)

Libvirt puts all that to rest.

> and therefore I sometimes wonder if I'm the only one that uses it. :)

I can't tell, but even if you are, that should be no problem! It's just
that I might not have much time to review or discuss changes to it. I
really dislike this situation, but I'm at the point where I'm
practically *stealing* the time to discuss anything that's not directly
assigned to me. :(

Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38859): https://edk2.groups.io/g/devel/message/38859
Mute This Topic: https://groups.io/mt/31017199/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Gao, Zhichao
Sorry for missing this email.

While I change the code, it couldn't pass the Patchcher.py because of the 
'EFI_D_" version MACRO. So I change all the debug message in this driver.
Maybe that is a redundant work.

Thanks,
Zhichao

> -Original Message-
> From: Philippe Mathieu-Daudé [mailto:phi...@redhat.com]
> Sent: Tuesday, April 2, 2019 11:36 PM
> To: Gao, Zhichao ; edk2-de...@lists.01.org
> Cc: Bret Barkelew ; Michael Turner
> ; Gao, Liming ;
> Zeng, Star 
> Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> Hi Bret,
> 
> On 4/2/19 7:50 AM, Zhichao Gao wrote:
> > From: Bret Barkelew 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> >
> > For some pointer and UINT64 data, the debug code print with '%x'.
> > Which would loss the upper 32bit data. So update '%x' to '%lx'
> > for these data.
> 
> Some are UINTN. Per Laszlo answer on this thread:
> https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
> for those, casting and changing format is the accepted way.
> 
> However this is a change,
> 
> > Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> > DEBUG_ version is recommended to use.
> 
> and this is another change.
> 
> Splitting this patch in 2 would make it more digestable.
> 
> >
> > Cc: Jian J Wang 
> > Cc: Ray Ni 
> > Cc: Star Zeng 
> > Cc: Liming Gao 
> > Cc: Sean Brogan 
> > Cc: Michael Turner 
> > Cc: Bret Barkelew 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Zhichao Gao 
> > ---
> >  .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +--
> >  .../Universal/CapsulePei/UefiCapsule.c| 46 +-
> >  .../Universal/CapsulePei/X64/X64Entry.c   |  2 +-
> >  3 files changed, 69 insertions(+), 69 deletions(-)
> >
> > diff --git
> > a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > index 3575a94d0f..2a527054bd 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
> >// Sanity Check
> >//
> >if (Size > MAX_ADDRESS) {
> > -DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
> > +DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > + Size));
> >  return FALSE;
> >}
> >
> > @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
> >// Sanity Check
> >//
> >if (Address > (MAX_ADDRESS - Size)) {
> > -DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> Size(0x%lx))\n", Address, Size));
> > +DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > + Size(0x%lx))\n", Address, Size));
> >  return FALSE;
> >}
> >
> > @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
> >for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
> >  if ((Address >= MemoryResource[Index].PhysicalStart) &&
> >  ((Address + Size) <= (MemoryResource[Index].PhysicalStart +
> MemoryResource[Index].ResourceLength))) {
> > -  DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > +  DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> > + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> >Address, Size,
> >Index, MemoryResource[Index].PhysicalStart,
> MemoryResource[Index].ResourceLength));
> >return TRUE;
> >  }
> >}
> >
> > -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> > MemoryResource\n", Address, Size));
> > +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> > + MemoryResource\n", Address, Size));
> >return FALSE;
> >  }
> >
> > @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
> >UINTN  CapsuleCount;
> >EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
> >
> > -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> > +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
> >
> >//
> >// Go through the list to look for inconsistencies. Check for:
> > @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
> >  return NULL;
> >}
> >
> > -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> > -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n",
> > Ptr->Union.ContinuationPointer));
> > +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));  DEBUG
> > + ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));  DEBUG
> > + ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > + Ptr->Union.ContinuationPointer));
> >while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer !=
> (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
> >  //
> >  // Make sure the descriptor is aligned at UINT64 in memory
> >  //
> >  if ((UINTN) Ptr & (sizeof(UINT64) - 1)) 

Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data

2019-04-11 Thread Gao, Zhichao
Resend to gourps.io. And add the missing people.

Thanks,
Zhichao

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Zhichao Gao
> Sent: Tuesday, April 2, 2019 1:50 PM
> To: edk2-de...@lists.01.org
> Cc: Bret Barkelew ; Michael Turner
> ; Gao, Liming ;
> Zeng, Star 
> Subject: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> From: Bret Barkelew 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> 
> For some pointer and UINT64 data, the debug code print with '%x'.
> Which would loss the upper 32bit data. So update '%x' to '%lx'
> for these data.
> Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> DEBUG_ version is recommended to use.
> 
> Cc: Jian J Wang 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao 
> ---
>  .../CapsulePei/Common/CapsuleCoalesce.c   | 90 +--
>  .../Universal/CapsulePei/UefiCapsule.c| 46 +-
>  .../Universal/CapsulePei/X64/X64Entry.c   |  2 +-
>  3 files changed, 69 insertions(+), 69 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> index 3575a94d0f..2a527054bd 100644
> --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
>// Sanity Check
>//
>if (Size > MAX_ADDRESS) {
> -DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
> +DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
>  return FALSE;
>}
> 
> @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
>// Sanity Check
>//
>if (Address > (MAX_ADDRESS - Size)) {
> -DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> Size(0x%lx))\n", Address, Size));
> +DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> + Size(0x%lx))\n", Address, Size));
>  return FALSE;
>}
> 
> @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
>for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
>  if ((Address >= MemoryResource[Index].PhysicalStart) &&
>  ((Address + Size) <= (MemoryResource[Index].PhysicalStart +
> MemoryResource[Index].ResourceLength))) {
> -  DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> +  DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
>Address, Size,
>Index, MemoryResource[Index].PhysicalStart,
> MemoryResource[Index].ResourceLength));
>return TRUE;
>  }
>}
> 
> -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> MemoryResource\n", Address, Size));
> +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> + MemoryResource\n", Address, Size));
>return FALSE;
>  }
> 
> @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
>UINTN  CapsuleCount;
>EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
> 
> -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
> 
>//
>// Go through the list to look for inconsistencies. Check for:
> @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
>  return NULL;
>}
> 
> -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));  DEBUG
> + ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));  DEBUG
> + ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> + Ptr->Union.ContinuationPointer));
>while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer !=
> (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
>  //
>  // Make sure the descriptor is aligned at UINT64 in memory
>  //
>  if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
> -  DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment
> check\n"));
> +  DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment
> + check\n"));
>return NULL;
>  }
> 
> @@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
>if (!ValidateCapsuleByMemoryResource (MemoryResource,
> (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
>  return NULL;
>}
> -  DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
> -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> +  DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", 

Re: [edk2-devel] [Patch] BaseTools/PatchCheck: Generate error if Contributed under found

2019-04-11 Thread Michael D Kinney
Liming,

Yes.  I have that patch queued and will be sent out tomorrow.

There are other Wiki changes for the preferred license.

Mike

> -Original Message-
> From: Gao, Liming
> Sent: Wednesday, April 10, 2019 6:37 PM
> To: devel@edk2.groups.io; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [Patch] BaseTools/PatchCheck:
> Generate error if Contributed under found
> 
> Mike:
>   Could you also update wiki
> https://github.com/tianocore/tianocore.github.io/wiki/C
> ommit-Message-Format to remove Contributed-under:
> TianoCore Contribution Agreement 1.1?
> 
> Thanks
> Liming
> >-Original Message-
> >From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of
> >Michael D Kinney
> >Sent: Friday, April 05, 2019 6:43 AM
> >To: devel@edk2.groups.io
> >Cc: Justen, Jordan L ;
> Feng, Bob C
> >; Gao, Liming
> ; Zhu,
> >Yonghong 
> >Subject: [edk2-devel] [Patch] BaseTools/PatchCheck:
> Generate error if
> >Contributed under found
> >
> >https://bugzilla.tianocore.org/show_bug.cgi?id=1655
> >
> >With the change to BSD+Patent License, the TianoCore
> Contributor's
> >Agreement has been removed and as a result, a
> Contributed under
> >tag is no longer appropriate in patches.  Remove the
> check for
> >the TianoCore Contributor's Agreement and instead,
> generate an
> >error if a patch contains a Contributed under tag in
> the commit
> >message.
> >
> >Cc: Jordan Justen 
> >Cc: Bob Feng 
> >Cc: Liming Gao 
> >Cc: Yonghong Zhu 
> >Signed-off-by: Michael D Kinney
> 
> >---
> > BaseTools/Scripts/PatchCheck.py | 12 
> > 1 file changed, 4 insertions(+), 8 deletions(-)
> >
> >diff --git a/BaseTools/Scripts/PatchCheck.py
> >b/BaseTools/Scripts/PatchCheck.py
> >index 0b580f3b31..19a7159358 100755
> >--- a/BaseTools/Scripts/PatchCheck.py
> >+++ b/BaseTools/Scripts/PatchCheck.py
> >@@ -1,7 +1,7 @@
> > ## @file
> > #  Check a patch for various format issues
> > #
> >-#  Copyright (c) 2015 - 2018, Intel Corporation. All
> rights reserved.
> >+#  Copyright (c) 2015 - 2019, 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
> >@@ -75,13 +75,9 @@ class CommitMessageCheck:
> > count += 1
> >
> > def check_contributed_under(self):
> >-cu_msg='Contributed-under: TianoCore
> Contribution Agreement 1.1'
> >-if self.msg.find(cu_msg) < 0:
> >-# Allow 1.0 for now while EDK II
> community transitions to 1.1
> >-cu_msg='Contributed-under: TianoCore
> Contribution Agreement 1.0'
> >-if self.msg.find(cu_msg) < 0:
> >-self.error('Missing Contributed-
> under! (Note: this must be ' +
> >-   'added by the code
> contributor!)')
> >+if self.msg.find('Contributed-under') >= 0:
> >+self.error('Contributed-under! (Note:
> this must be ' +
> >+   'removed by the code
> contributor!)')
> >
> > @staticmethod
> > def make_signature_re(sig, re_input=False):
> >--
> >2.21.0.windows.1
> >
> >
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38855): https://edk2.groups.io/g/devel/message/38855
Mute This Topic: https://groups.io/mt/30911614/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2] [PATCH v4 0/7] MdeModulePkg: add support for dispatching foreign arch PE/COFF images

2019-04-11 Thread Michael D Kinney
Ard,

Thank you for the update on this patch series.
This design is very clean.  One logic issue for
protocol notifications, but that should be only
require a small update.

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Ard Biesheuvel
> Sent: Sunday, March 31, 2019 8:27 PM
> To: edk2-de...@lists.01.org
> Cc: Ni, Ray ; Zimmer, Vincent
> ; Dong, Eric
> ; Carsey, Jaben
> ; Richardson, Brian
> ; Gao, Liming
> ; Kinney, Michael D
> ; Zeng, Star
> 
> Subject: [edk2] [PATCH v4 0/7] MdeModulePkg: add
> support for dispatching foreign arch PE/COFF images
> 
> Add the basic plumbing to DXE core, the PCI bus driver
> and the boot manager
> to allow PE/COFF images to be dispatched that target an
> architecture that is
> not native for the platform, but which is supported by
> one of potentially
> several available emulators.
> 
> One implementation of such an emulator can be found
> here:
> https://github.com/ardbiesheuvel/X86EmulatorPkg/tree/up
> stream-v4
> 
> This also allows us to get rid of the special treatment
> of EBC images in
> core code. Instead, the EbcDxe driver is augmented with
> an implementation
> of the EDK2 PE/COFF image emulator protocol so that
> internal knowledge of
> how EBC is implemented (I-cache flushing, thunks) is
> removed from the DXE
> core.
> 
> Changes since v3:
> - Simplify the handling of option ROMs and Driver
> images, by simply
>   deferring to the LoadImage() boot service to decide
> whether an image
>   can be supported or not - this removes some redundant
> checks from the
>   BDS layer and the PCI bus driver.
> - Move the machine type supported by the emulator into
> the protocol struct,
>   so we can optimize away calls into the emulator for
> each image loaded.
>   Instead, the LoadImage() code will only invoke the
> IsSupported() method for
>   images that are known to have a matching machine
> type.
> 
> Note that I have considered, but ultimately dismissed
> the suggestion to
> register and unregister emulators via a new protocol.
> The main issue is
> that registering and unregistering struct containing
> sets of function
> pointers is awfully similar to managing a protocol
> database, and we already
> have the code to do that in EDK2.
> 
> So instead, I have removed all the code that iterates
> over a handle buffer
> of emu protocols and invokes each one to see if it will
> support the image.
> Instead, this is all done by CoreLoadImage().
> 
> Changes since v2:
> - incorporate feedback from Andrew Fish (delivered in
> person):
>   * pass a device path into the IsImageSupported()
> protocol method so that an
> implementation can blacklist or whitelist certain
> devices, or implement
> other policies that depend on the device where the
> driver originated
>   * allow the emulator to supersede the native loading
> of the image - this
> permits things like X86 on X86 emulators for
> security sandboxing or debug
> 
> Changes since v1:
> - subsume the EBC handling into the EDK2 emulator
> protocol and abstract
>   away from EBC specifics in core code.
> - allow multiple emulator implementations to co-exist
> - incorporate Star's review feedback
> 
> Cc: Vincent Zimmer 
> Cc: Brian Richardson 
> Cc: Michael D Kinney 
> Cc: Andrew Fish 
> Cc: Leif Lindholm 
> Cc: Star Zeng 
> Cc: Eric Dong 
> Cc: Ruiyu Ni 
> Cc: Liming Gao 
> Cc: Jaben Carsey 
> Cc: Steven Shi 
> 
> Ard Biesheuvel (7):
>   MdeModulePkg: introduce PE/COFF image emulator
> protocol
>   MdeModulePkg/DxeCore: invoke the emulator protocol
> for foreign images
>   MdeModulePkg/PciBusDxe: dispatch option ROMs for
> foreign architectures
>   MdeModulePkg/UefiBootManagerLib: allow foreign
> Driver images
>   MdeModulePkg/EbcDxe: implement the PE/COFF emulator
> protocol
>   MdePkg/UefiBaseType.h: treat EBC as a non-native
> machine type
>   MdeModulePkg/DxeCore: remove explicit EBC handling
> 
>  .../Bus/Pci/PciBusDxe/PciOptionRomSupport.c   |   7 -
>  MdeModulePkg/Core/Dxe/DxeMain.h   |   6 +-
>  MdeModulePkg/Core/Dxe/DxeMain.inf |   2 +-
>  MdeModulePkg/Core/Dxe/Image/Image.c   | 183
> --
>  .../Include/Protocol/PeCoffImageEmulator.h| 107
> ++
>  .../Library/UefiBootManagerLib/BmLoadOption.c |   6 +-
>  MdeModulePkg/MdeModulePkg.dec |   4 +
>  MdeModulePkg/Universal/EbcDxe/EbcDebugger.inf |   3 +
>  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf  |   3 +
>  MdeModulePkg/Universal/EbcDxe/EbcInt.c| 123
> 
>  MdeModulePkg/Universal/EbcDxe/EbcInt.h|   3 +
>  MdePkg/Include/Uefi/UefiBaseType.h|   6 +-
>  12 files changed, 381 insertions(+), 72 deletions(-)
>  create mode 100644
> MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
> 
> --
> 2.17.1
> 
> ___
> edk2-devel mailing list
> edk2-de...@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [patch] CorebootPayloadPkg: Remove the dependency of ShellBinPkg

2019-04-11 Thread Benjamin You
Reviewed-by: Benjamin You 

Thanks,

- ben

> -Original Message-
> From: Bi, Dandan
> Sent: Wednesday, April 10, 2019 1:34 PM
> To: devel@edk2.groups.io
> Cc: Ma, Maurice ; Agyeman, Prince
> ; You, Benjamin 
> Subject: [patch] CorebootPayloadPkg: Remove the dependency of ShellBinPkg
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1675
> 
> In long term we will remove ShellBinPkg, so now we update
> platform to use ShellPkg only.
> 
> Cc: Maurice Ma 
> Cc: Prince Agyeman 
> Cc: Benjamin You 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi 
> ---
>  CorebootPayloadPkg/CorebootPayloadPkg.fdf  | 18 --
>  CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc  |  9 -
>  .../CorebootPayloadPkgIa32X64.dsc  |  9 -
>  3 files changed, 36 deletions(-)
> 
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> index 0c24f96a15..d399ad8eb8 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> +++ b/CorebootPayloadPkg/CorebootPayloadPkg.fdf
> @@ -177,31 +177,13 @@ INF
> MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
>  INF QuarkSocPkg/QuarkSouthCluster/Usb/Ohci/Dxe/OhciDxe.inf
> 
>  #
>  # Shell
>  #
> -!if $(SHELL_TYPE) == BUILD_SHELL
>  INF
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>  INF
> ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
>  INF ShellPkg/Application/Shell/Shell.inf
> -!endif
> -
> -!if $(SHELL_TYPE) == MIN_BIN
> -!if $(ARCH) == IA32
> -INF  RuleOverride = BINARY USE = IA32
> ShellBinPkg/MinUefiShell/MinUefiShell.inf
> -!else
> -INF  RuleOverride = BINARY USE = X64
> ShellBinPkg/MinUefiShell/MinUefiShell.inf
> -!endif
> -!endif
> -
> -!if $(SHELL_TYPE) == UEFI_BIN
> -!if $(ARCH) == IA32
> -INF  RuleOverride = BINARY USE = IA32 ShellBinPkg/UefiShell/UefiShell.inf
> -!else
> -INF  RuleOverride = BINARY USE = X64 ShellBinPkg/UefiShell/UefiShell.inf
> -!endif
> -!endif
> 
>  FILE FREEFORM=
> PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
>SECTION RAW = MdeModulePkg/Logo/Logo.bmp
>  }
> 
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> index 98d6073866..c53b53b2f7 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> +++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32.dsc
> @@ -80,15 +80,10 @@
>#
># Chipset options
>#
>DEFINE USE_HPET_TIMER   = FALSE
> 
> -  #
> -  # Shell options: [BUILD_SHELL, MIN_BIN, NONE, UEFI]
> -  #
> -  DEFINE SHELL_TYPE  = UEFI_BIN
> -
>  [BuildOptions]
>*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
>GCC:*_UNIXGCC_*_CC_FLAGS   = -DMDEPKG_NDEBUG
>GCC:RELEASE_*_*_CC_FLAGS   = -DMDEPKG_NDEBUG
>INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
> @@ -520,12 +515,10 @@
> 
>#--
>#  Build the shell
>#--
> 
> -!if $(SHELL_TYPE) == BUILD_SHELL
> -
>#
># Shell Lib
>#
>  [LibraryClasses]
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCo
> mmandLib.inf
> @@ -583,7 +576,5 @@
>PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
>
> ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
> 
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLi
> b.inf
>SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>}
> -
> -!endif
> diff --git a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> index 608a288c42..3ecc0d0039 100644
> --- a/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> +++ b/CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
> @@ -80,15 +80,10 @@
>#
># Chipset options
>#
>DEFINE USE_HPET_TIMER   = FALSE
> 
> -  #
> -  # Shell options: [BUILD_SHELL, MIN_BIN, NONE, UEFI]
> -  #
> -  DEFINE SHELL_TYPE  = UEFI_BIN
> -
>  [BuildOptions]
>*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
>GCC:*_UNIXGCC_*_CC_FLAGS   = -DMDEPKG_NDEBUG
>GCC:RELEASE_*_*_CC_FLAGS   = -DMDEPKG_NDEBUG
>INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
> @@ -521,12 +516,10 @@
> 
>#--
>#  Build the shell
>#--
> 
> -!if $(SHELL_TYPE) == BUILD_SHELL
> -
>#
># Shell Lib
>#
>  [LibraryClasses]
> 
> BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCo
> mmandLib.inf
> @@ -584,7 +577,5 @@
>PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
>
> ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
> 
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLi
> b.inf
>SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>}
> -
> -!endif
> --
> 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v4 2/7] MdeModulePkg/DxeCore: invoke the emulator protocol for foreign images

2019-04-11 Thread Michael D Kinney
Ard,

Resend to devel@edk2.groups.io

One comment below on a logic issue that would be exposed 
if multiple emulators are present.

Mike

> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Sunday, March 31, 2019 8:27 PM
> To: edk2-de...@lists.01.org
> Cc: Ard Biesheuvel ; Zimmer,
> Vincent ; Richardson, Brian
> ; Kinney, Michael D
> ; Andrew Fish
> ; Leif Lindholm
> ; Zeng, Star
> ; Dong, Eric
> ; Ni, Ray ; Gao,
> Liming ; Carsey, Jaben
> ; Shi, Steven
> 
> Subject: [PATCH v4 2/7] MdeModulePkg/DxeCore: invoke
> the emulator protocol for foreign images
> 
> When encountering PE/COFF images that cannot be
> supported natively,
> attempt to locate an instance of the PE/COFF image
> emulator protocol,
> and if it supports the image, proceed with loading it
> and register it
> with the emulator.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel
> 
> ---
>  MdeModulePkg/Core/Dxe/DxeMain.h |   3 +
>  MdeModulePkg/Core/Dxe/DxeMain.inf   |   1 +
>  MdeModulePkg/Core/Dxe/Image/Image.c | 144
> ++--
>  3 files changed, 137 insertions(+), 11 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h
> b/MdeModulePkg/Core/Dxe/DxeMain.h
> index 2dec9da5e35b..48ec30a48aa2 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.h
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.h
> @@ -53,6 +53,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS
> OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -228,6 +229,8 @@ typedef struct {
>UINT16  Machine;
>/// EBC Protocol pointer
>EFI_EBC_PROTOCOL*Ebc;
> +  /// PE/COFF Image Emulator Protocol pointer
> +  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *PeCoffEmu;
>/// Runtime image list
>EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;
>/// Pointer to Loaded Image Device Path Protocol
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf
> b/MdeModulePkg/Core/Dxe/DxeMain.inf
> index 10375443c0f4..ce6fc19be5e4 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.inf
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
> @@ -162,6 +162,7 @@
>gEfiHiiPackageListProtocolGuid##
> SOMETIMES_PRODUCES
>gEfiEbcProtocolGuid   ##
> SOMETIMES_CONSUMES
>gEfiSmmBase2ProtocolGuid  ##
> SOMETIMES_CONSUMES
> +  gEdkiiPeCoffImageEmulatorProtocolGuid ##
> SOMETIMES_CONSUMES
> 
># Arch Protocols
>gEfiBdsArchProtocolGuid   ##
> CONSUMES
> diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c
> b/MdeModulePkg/Core/Dxe/Image/Image.c
> index eddca140ee1a..cda447d23ec5 100644
> --- a/MdeModulePkg/Core/Dxe/Image/Image.c
> +++ b/MdeModulePkg/Core/Dxe/Image/Image.c
> @@ -29,6 +29,15 @@ LOAD_PE32_IMAGE_PRIVATE_DATA
> mLoadPe32PrivateData = {
>}
>  };
> 
> +typedef struct {
> +  LIST_ENTRYLink;
> +  EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL  *Emulator;
> +  UINT16MachineType;
> +} EMULATOR_ENTRY;
> +
> +STATIC LIST_ENTRY
> mAvailableEmulators;
> +STATIC EFI_EVENT
> mPeCoffEmuProtocolRegistrationEvent;
> +STATIC VOID
> *mPeCoffEmuProtocolNotifyRegistration;
> 
>  //
>  // This code is needed to build the Image handle for
> the DXE Core
> @@ -67,6 +76,7 @@ LOADED_IMAGE_PRIVATE_DATA
> mCorePrivateImage  = {
>NULL,   // JumpContext
>0,  // Machine
>NULL,   // Ebc
> +  NULL,   // PeCoffEmu
>NULL,   // RuntimeData
>NULL// LoadedImageDevicePath
>  };
> @@ -118,6 +128,39 @@ GetMachineTypeName (
>return L"";
>  }
> 
> +/**
> +  Notification event handler registered by
> CoreInitializeImageServices () to
> +  keep track of which PE/COFF image emulators are
> available.
> +
> +  @param  Event  The Event that is being
> processed, not used.
> +  @param  ContextEvent Context, not used.
> +
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +PeCoffEmuProtocolNotify (
> +  IN  EFI_EVENT   Event,
> +  IN  VOID*Context
> +  )
> +{
> +  EFI_STATUS  Status;
> +  EMULATOR_ENTRY  *Entry;
> +
> +  Entry = AllocateZeroPool (sizeof *Entry);
> +  ASSERT (Entry != NULL);
> +
> +  Status = CoreLocateProtocol
> (,
> +
> mPeCoffEmuProtocolNotifyRegistration,
> +   (VOID **)
> >Emulator
> +   );

A protocol notification function that only expects a single
instance of the protocol can use LocateProtocol().  However,
this use case needs to support one or more Emu Protocol 
instances and add each of them to the linked list.  So the
function LocateHandle() should be used with ByRegisterNotify
to make sure the handle with the installation of the specific
protocol instance is located.  Then HandleProtocol() can be
used on that handle to get the protocol instance.

There is 

[edk2-devel] [Patch V2] BaseTools: Add a build option to treat DynPcd as DynExPcd

2019-04-11 Thread BobCF
From: BobCF 

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1688
In order to support binary build, build tool add a
flag to convert type of Dynamic Pcd to DynamicEx Pcd

User can append -D PCD_DYNAMIC_AS_DYNAMICEX to build command
to enable this function.
Also, user can add "PCD_DYNAMIC_AS_DYNAMICEX = TRUE/FALSE" to the
defines section of Dsc file to enable this function.
PCD_DYNAMIC_AS_DYNAMICEX is a new reserved key word for this function.

Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Common/DataType.py|   1 +
 .../Python/Workspace/BuildClassObject.py  | 153 --
 .../Source/Python/Workspace/DecBuildData.py   |  16 +-
 .../Source/Python/Workspace/DscBuildData.py   |  19 +--
 .../Source/Python/Workspace/InfBuildData.py   |  15 +-
 5 files changed, 73 insertions(+), 131 deletions(-)

diff --git a/BaseTools/Source/Python/Common/DataType.py 
b/BaseTools/Source/Python/Common/DataType.py
index 780711bf8e..96f2d9b290 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -396,10 +396,11 @@ TAB_DSC_DEFINES_DSC_SPECIFICATION = 'DSC_SPECIFICATION'
 TAB_DSC_DEFINES_OUTPUT_DIRECTORY = 'OUTPUT_DIRECTORY'
 TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES = 'SUPPORTED_ARCHITECTURES'
 TAB_DSC_DEFINES_BUILD_TARGETS = 'BUILD_TARGETS'
 TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
 TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
+TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX = 'PCD_DYNAMIC_AS_DYNAMICEX'
 TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION = 'PCD_VAR_CHECK_GENERATION'
 TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
 TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
 TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
 TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress'
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 33d88c6921..7ab8a54869 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -10,10 +10,12 @@ from Common.DataType import *
 import collections
 import re
 from collections import OrderedDict
 from Common.Misc import CopyDict
 import copy
+from CommonDataClass.DataClass import *
+import Common.GlobalData as GlobalData
 StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
 ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
 ## PcdClassObject
 #
 # This Class is used for PcdObject
@@ -350,10 +352,71 @@ class StructurePcd(PcdClassObject):
 new_pcd.ValueChain = {item for item in self.ValueChain}
 return new_pcd
 
 LibraryClassObject = namedtuple('LibraryClassObject', 
['LibraryClass','SupModList'])
 
+class BuildData(object):
+# dict used to convert PCD type in database to string used by build tool
+
+_PCD_TYPE_STRING_ = {
+MODEL_PCD_FIXED_AT_BUILD:   TAB_PCDS_FIXED_AT_BUILD,
+MODEL_PCD_PATCHABLE_IN_MODULE   :   TAB_PCDS_PATCHABLE_IN_MODULE,
+MODEL_PCD_FEATURE_FLAG  :   TAB_PCDS_FEATURE_FLAG,
+MODEL_PCD_DYNAMIC   :   TAB_PCDS_DYNAMIC,
+MODEL_PCD_DYNAMIC_DEFAULT   :   TAB_PCDS_DYNAMIC,
+MODEL_PCD_DYNAMIC_HII   :   TAB_PCDS_DYNAMIC_HII,
+MODEL_PCD_DYNAMIC_VPD   :   TAB_PCDS_DYNAMIC_VPD,
+MODEL_PCD_DYNAMIC_EX:   TAB_PCDS_DYNAMIC_EX,
+MODEL_PCD_DYNAMIC_EX_DEFAULT:   TAB_PCDS_DYNAMIC_EX,
+MODEL_PCD_DYNAMIC_EX_HII:   TAB_PCDS_DYNAMIC_EX_HII,
+MODEL_PCD_DYNAMIC_EX_VPD:   TAB_PCDS_DYNAMIC_EX_VPD,
+}
+
+def UpdatePcdTypeDict(self):
+if 
GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX,"FALSE").upper()
 == "TRUE":
+self._PCD_TYPE_STRING_ = {
+MODEL_PCD_FIXED_AT_BUILD:   TAB_PCDS_FIXED_AT_BUILD,
+MODEL_PCD_PATCHABLE_IN_MODULE   :   
TAB_PCDS_PATCHABLE_IN_MODULE,
+MODEL_PCD_FEATURE_FLAG  :   TAB_PCDS_FEATURE_FLAG,
+MODEL_PCD_DYNAMIC   :   TAB_PCDS_DYNAMIC_EX,
+MODEL_PCD_DYNAMIC_DEFAULT   :   TAB_PCDS_DYNAMIC_EX,
+MODEL_PCD_DYNAMIC_HII   :   TAB_PCDS_DYNAMIC_EX_HII,
+MODEL_PCD_DYNAMIC_VPD   :   TAB_PCDS_DYNAMIC_EX_VPD,
+MODEL_PCD_DYNAMIC_EX:   TAB_PCDS_DYNAMIC_EX,
+MODEL_PCD_DYNAMIC_EX_DEFAULT:   TAB_PCDS_DYNAMIC_EX,
+MODEL_PCD_DYNAMIC_EX_HII:   TAB_PCDS_DYNAMIC_EX_HII,
+MODEL_PCD_DYNAMIC_EX_VPD:   TAB_PCDS_DYNAMIC_EX_VPD,
+}
+
+## Convert the class to a string
+#
+#  Convert member MetaFile of the class to a string
+#
+#  @retval string Formatted String
+#
+def __str__(self):
+return str(self.MetaFile)
+
+## Override __eq__ function
+#
+# Check whether ModuleBuildClassObjects are the same
+#
+