[edk2-devel] [PATCH] Maintainers.txt: Add 'Zhichao Gao' for ShellPkg review

2019-05-16 Thread Gao, Zhichao
Add 'Zhichao Gao' as a reviewer for ShellPkg.

Cc: Jaben Carsey 
Cc: Ray Ni 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 Maintainers.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 7315241b6e..6a5f5d6200 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -219,6 +219,7 @@ ShellPkg
 W: https://github.com/tianocore/tianocore.github.io/wiki/ShellPkg
 M: Jaben Carsey 
 M: Ray Ni 
+R: Zhichao Gao 
 
 Maintainers for stable Shell binaries generation
 when need to publish Shell binaries with edk2 release:
-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH v1 1/1] ShellPkg/UefiShellAcpiViewCommandLib: Fix PPTT cache attributes validation

2019-05-16 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Sami Mujawar
> Sent: Thursday, May 9, 2019 9:37 PM
> To: devel@edk2.groups.io
> Cc: Carsey, Jaben ; Ni, Ray ;
> Matteo Carlini ; Stephanie Hughes-Fitt
> ; nd ; Krzysztof Koch
> 
> Subject: Re: [edk2-devel] [PATCH v1 1/1]
> ShellPkg/UefiShellAcpiViewCommandLib: Fix PPTT cache attributes validation
> 
> Reviewed-by: Sami Mujawar 
> 
> Regards,
> 
> Sami Mujawar
> 
> -Original Message-
> From: Krzysztof Koch 
> Sent: 31 January 2019 01:30 PM
> To: edk2-de...@lists.01.org
> Cc: jaben.car...@intel.com; ray...@intel.com; Matteo Carlini
> ; Stephanie Hughes-Fitt  f...@arm.com>; Sami Mujawar ; nd
> 
> Subject: [PATCH v1 1/1] ShellPkg/UefiShellAcpiViewCommandLib: Fix PPTT
> cache attributes validation
> 
> Removed conditional pre-compiling for ARM CPUs because function
> ValidateCacheAttributes(..) is based on ACPI PPTT specification.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Krzysztof Koch 
> Reported-by: Zhichao Gao 
> ---
> 
> The code can be found at:
> https://github.com/KrzysztofKoch1/edk2/tree/woa_422_cache_valid_fix_v1
> 
> Notes:
> v1:
> - removed conditional precompilation[Krzysztof]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
> | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.
> c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.
> c
> index
> bc56fe9ea1dd9c1e98a6a568d3f9191263bedc90..b6b420890a3494869020ed8bc
> c7b791fcf7d70f3 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.
> c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.
> c
> @@ -86,11 +86,9 @@ ValidateCacheAttributes (
>IN VOID*  Context
>)
>  {
> -#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
>// Reference: Advanced Configuration and Power Interface (ACPI)
> Specification
>//Version 6.2 Errata A, September 2017
>// Table 5-153: Cache Type Structure
> -
>UINT8 Attributes;
>Attributes = *(UINT8*)Ptr;
> 
> @@ -102,7 +100,6 @@ ValidateCacheAttributes (
>);
>  return;
>}
> -#endif
>  }
> 
>  /**
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 


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

View/Reply Online (#40851): https://edk2.groups.io/g/devel/message/40851
Mute This Topic: https://groups.io/mt/30917572/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/1] ShellPkg: acpiview: Add GT Frame Number validation to GTDT parser

2019-05-16 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Thursday, May 16, 2019 4:44 PM
> To: devel@edk2.groups.io
> Cc: Carsey, Jaben ; Ni, Ray ;
> Gao, Zhichao ; sami.muja...@arm.com;
> n...@arm.com
> Subject: [PATCH v2 1/1] ShellPkg: acpiview: Add GT Frame Number validation
> to GTDT parser
> 
> The ACPI 6.2 specification mandates that the Generic Timer (GT) Block Timer
> Structures must have a frame number in the range 0-7.
> 
> Update the GTDT parser to warn if this condition is violated.
> 
> Signed-off-by: Krzysztof Koch 
> ---
> 
> The changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/528_acpiview_gt_frame_vali
> date_v2
> 
> Notes:
> v2:
> - Change FrameNumber data type to UINT8 [Zhichao]
> - Modify the patch based on upstream review [Krzysztof]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> | 47 +++-
>  1 file changed, 45 insertions(+), 2 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> index
> f31c4a2761751c58d4b1d3eb75084e24ec318e7f..1b7e56486c8fb98a8fe063ae5f
> a25d86500a58a9 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars
> +++ er.c
> @@ -1,7 +1,7 @@
>  /** @file
>GTDT table parser
> 
> -  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> +  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>@par Reference(s):
> @@ -38,6 +38,21 @@ ValidateGtBlockTimerCount (
>IN VOID*  Context
>);
> 
> +/**
> +  This function validates the GT Frame Number.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateGtFrameNumber (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  );
> +
>  /**
>An ACPI_PARSER array describing the ACPI GTDT Table.
>  **/
> @@ -92,7 +107,7 @@ STATIC CONST ACPI_PARSER GtBlockParser[] = {
>An ACPI_PARSER array describing the GT Block timer.
>  **/
>  STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
> -  {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL},
> +  {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber,
> + NULL},
>{L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
>{L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
>{L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, @@
> -145,6 +160,34 @@ ValidateGtBlockTimerCount (
>}
>  }
> 
> +/**
> +  This function validates the GT Frame Number.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateGtFrameNumber (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  )
> +{
> +  UINT8 FrameNumber;
> +
> +  FrameNumber = *(UINT8*)Ptr;
> +
> +  if (FrameNumber > 7) {
> +IncrementErrorCount ();
> +Print (
> +  L"\nERROR: GT Frame Number = %d. GT Frame Number must be in
> range 0-7.",
> +  FrameNumber
> +  );
> +  }
> +}
> +
>  /**
>This function parses the Platform GT Block.
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 


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

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



[edk2-devel] [PATCH] SecurityPkg/AuthSeriableLib: Always delete variable in certdb

2019-05-12 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1783

While cleaning the certdb, always delete the variable data in
the certdb regardless of its attribute.

Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Jian Wang 
Cc: Star Zeng 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 SecurityPkg/Library/AuthVariableLib/AuthService.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthService.c 
b/SecurityPkg/Library/AuthVariableLib/AuthService.c
index 7493a2ed9c..2340d47e77 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthService.c
+++ b/SecurityPkg/Library/AuthVariableLib/AuthService.c
@@ -1735,10 +1735,13 @@ CleanCertsFromDb (
);
 
   if (EFI_ERROR(Status) || (AuthVariableInfo.Attributes & 
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) == 0) {
+//
+// While cleaning certdb, always delete the variable in certdb 
regardless of it attributes.
+//
 Status  = DeleteCertsFromDb(
 VariableName,
 ,
-AuthVariableInfo.Attributes
+AuthVariableInfo.Attributes | EFI_VARIABLE_NON_VOLATILE
 );
 CertCleaned = TRUE;
 DEBUG((EFI_D_INFO, "Recovery!! Cert for Auth Variable %s Guid %g is 
removed for consistency\n", VariableName, ));
-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH v1 1/1] ShellPkg: acpiview: Add GT Frame Number validation to GTDT parser

2019-05-15 Thread Gao, Zhichao
Sorry for missing this email.

Some minor comments below.
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Krzysztof Koch
> Sent: Wednesday, May 8, 2019 9:44 PM
> To: devel@edk2.groups.io
> Cc: Carsey, Jaben ; Ni, Ray ;
> sami.muja...@arm.com; girish.pat...@arm.com;
> pierre.gond...@arm.com; matteo.carl...@arm.com; Stephanie.Hughes-
> f...@arm.com; n...@arm.com
> Subject: [edk2-devel] [PATCH v1 1/1] ShellPkg: acpiview: Add GT Frame
> Number validation to GTDT parser
> 
> 
> The ACPI 6.2 specification mandates that the Generic Timer (GT) Block Timer
> Structures must have a frame number in the range 0-7.
> 
> Update the GTDT parser to warn if this condition is violated.
> 
> Signed-off-by: Krzysztof Koch 
> ---
> 
> The changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/woa_528_acpiview_gt_fram
> e_validate_v1
> 
> Notes:
> v1:
>   - Add GTDT Frame Number checks [Krzysztof]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> | 47 +++-
>  1 file changed, 45 insertions(+), 2 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> index
> f31c4a2761751c58d4b1d3eb75084e24ec318e7f..572e52385c54932b14630481e
> 85a67d0b211966a 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars
> +++ er.c
> @@ -1,7 +1,7 @@
>  /** @file
>GTDT table parser
> 
> -  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> +  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>@par Reference(s):
> @@ -38,6 +38,21 @@ ValidateGtBlockTimerCount (
>IN VOID*  Context
>);
> 
> +/**
> +  This function validates the GT Frame Number.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateGtFrameNumber (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  );
> +
>  /**
>An ACPI_PARSER array describing the ACPI GTDT Table.
>  **/
> @@ -92,7 +107,7 @@ STATIC CONST ACPI_PARSER GtBlockParser[] = {
>An ACPI_PARSER array describing the GT Block timer.
>  **/
>  STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
> -  {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL},
> +  {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber,
> + NULL},
>{L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
>{L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
>{L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, @@
> -145,6 +160,34 @@ ValidateGtBlockTimerCount (
>}
>  }
> 
> +/**
> +  This function validates the GT Frame Number.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateGtFrameNumber (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  )
> +{
> +  UINT32 FrameNumber;

Refer to ACPI spec and the code blow, seems UINT8 is enough. I know it would 
work fine with a larger type.
Maybe I am overwrought.

Thanks,
Zhichao

> +
> +  FrameNumber = *(UINT8*)Ptr;
> +
> +  if (FrameNumber > 7) {
> +IncrementErrorCount ();
> +Print (
> +  L"\nERROR: GT Frame Number = %d. GT Frame Number must be in
> range 0-7.",
> +  FrameNumber
> +  );
> +  }
> +}
> +
>  /**
>This function parses the Platform GT Block.
> 
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended 
> recipient,
> please notify the sender immediately and do not disclose the contents to any
> other person, use it for any purpose, or store or copy the information in any
> medium. Thank you.
> 
> 


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

View/Reply Online (#40754): https://edk2.groups.io/g/devel/message/40754
Mute This Topic: https://groups.io/mt/31543249/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: Add a pcd to set the OS indications bit

2019-06-03 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add a pcd PcdPlatformRecoverySupport to conditionally
set an OS indications bit and set the 'PlatformRecovery'
variable. This pcd would also control whether the BDS
supports platform recovery or not.

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 
---
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 0a9fcddecc..da2b85770c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1660,6 +1660,12 @@
   # @Prompt Reset on memory type information change.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE|BOOLEAN|0x00010056
 
+  ## Indicates if the BDS supports Platform Recovery.
+  #   TRUE  - BDS supports Platform Recovery.
+  #   FALSE - BDS does not support Platform Recovery.
+  # @Prompt Support Platform Recovery.
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport|TRUE|BOOLEAN|0x00010078
+
   ## Specify the foreground color for Subtile text in HII Form Browser. The 
default value is EFI_BLUE.
   #  Only following values defined in UEFI specification are valid:
   #  0x00 (EFI_BLACK)
-- 
2.21.0.windows.1


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

View/Reply Online (#41793): https://edk2.groups.io/g/devel/message/41793
Mute This Topic: https://groups.io/mt/31907729/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] Use a pcd to control Platform Recovery behavior

2019-06-03 Thread Gao, Zhichao
V1:
Add a pcd PcdPlatformRecoverySupport to control the variable
PlatformRecovery and the EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY
bit of variable "OsIndicationsSupported".

V2:
While PcdPlatformRecoverySupport is FALSE, do not set a PlatformRecovery
Variable.
But remain boot from a default file path(such as \EFI\BOOT\BOOTX64.EFI).
Add memory check before build platform default boot option.

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: Add a pcd to set the OS indications bit

Zhichao Gao (1):
  MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

 MdeModulePkg/MdeModulePkg.dec|  6 ++
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 89 ++--
 3 files changed, 61 insertions(+), 37 deletions(-)

-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

2019-06-03 Thread Gao, Zhichao



> -Original Message-
> From: Ni, Ray
> Sent: Monday, June 3, 2019 3:27 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Wang, Jian J ; Wu, Hao A ;
> Zeng, Star ; Gao, Liming ;
> Sean Brogan ; Michael Turner
> ; Bret Barkelew
> 
> Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control
> PlatformRecovery
> 
> 
> 
> > -Original Message-
> > From: Gao, Zhichao 
> > Sent: Monday, June 3, 2019 3:13 PM
> > To: Ni, Ray ; devel@edk2.groups.io
> > Cc: Wang, Jian J ; Wu, Hao A
> > ; Zeng, Star ; Gao, Liming
> > ; Sean Brogan ;
> > Michael Turner ; Bret Barkelew
> > 
> > Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control
> > PlatformRecovery
> >
> >
> >
> > > -Original Message-
> > > From: Ni, Ray
> > > Sent: Monday, June 3, 2019 2:59 PM
> > > To: Gao, Zhichao ; devel@edk2.groups.io
> > > Cc: Wang, Jian J ; Wu, Hao A
> > > ; Zeng, Star ; Gao, Liming
> > > ; Sean Brogan ;
> > > Michael Turner ; Bret Barkelew
> > > 
> > > Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to control
> > > PlatformRecovery
> > >
> > > > +  //
> > > > +  // When platform recovery is not enabled, still boot to
> > > > + platform default
> > > > file path.
> > > > +  //
> > > > +  EfiBootManagerProcessLoadOption ();
> > > > +}
> > > >}
> > > > +  EfiBootManagerFreeLoadOption ();
> > >
> > > PlatformDefaultBootOption might be uninitialized if FilePath is NULL.
> >
> > EfiBootManagerFreeLoadOption would check the pointer before free. So
> > it is safe regardless of the PlatformDefaultBootOption is initialized or 
> > not.
> >
> > >
> > > FilePath is NULL when memory allocation fails.
> > > So I am thinking maybe ASSERT (FilePath != NULL) is enough when
> > > EfiBootManagerInitializeLoadOption().
> >
> > Maybe it is not enough. The ASSERT only work in DEBUG build. Did I
> > take a mistake?
> 
> You are right.
> How about do a DEBUG print followed by a CpuDeadLoop() when FilePath is
> NULL?
> 
> Then all code below that point doesn't need to take care this error any more.

I am OK with that because fail to allocate memory should be a serious error 
that would make the boot flow work incorrect. And putting the system into a 
dead loop to indicate the failure of boot is fine.

> 
> >
> > Thanks,
> > Zhichao
> >
> > >
> > >
> > >
> > > >
> > > >DEBUG ((EFI_D_ERROR, "[Bds] Unable to boot!\n"));
> > > >PlatformBootManagerUnableToBoot ();
> > > > --
> > > > 2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-06-03 Thread Gao, Zhichao



> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Leif Lindholm
> Sent: Saturday, June 1, 2019 12:44 AM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Bret Barkelew ; Wang, Jian J
> ; Wu, Hao A ; Ni, Ray
> ; Zeng, Star ; Gao, Liming
> ; Sean Brogan ;
> Michael Turner 
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize the
> CapsulePei
> 
> On Fri, May 31, 2019 at 01:46:14AM +, Gao, Zhichao wrote:
> > > So what modifications were made to the code on the way from the
> > > project Mu repository? That would be useful to mention in the commit
> message.
> >
> > I would add this info blow commit message(not in commit message). It
> > is helpful for review. But it may not be useful to add them in the
> > commit message.
> > On my opinion, the commit message should contain the summary and
> impact of the changes.
> 
> You are importing a file from a different repository, produced by a different
> company. As part of that import, you are claiming Intel copyright for 2019 for
> the code provided in the patch.
> 
> This means that you are making a legal claim to the intellectual property
> provided by the patch on behalf of Intel.
> Either:
> - you have modified the code compared to the original, at which
>   point the commit mesage *must* reflect this - it is no longer the
>   contribution that the original message describes.
>   For an example, see how Laszlo reflected his changes to 94e0dd1afe53.

Sorry. I can't understand the example. But maybe I got your point. I would 
update the commit message with the MU link and mention what changes I made. 
Then I would update the copyright of Intel. Is that the correct flow? 
By the way, I have done that in V2 but the link and change info didn't include 
to the commit message. I would put them into the commit message in next patch.

Thanks,
Zhichao

> - the Intel copyright addition is a mistake (and must be dropped).
> 
> Regards,
> 
> Leif
> 
> >
> > Thanks,
> > Zhichao
> >
> > >
> > > Regards,
> > >
> > > Leif
> > >
> > > > And I also make some minor changes on it.
> > > >
> > > > Thanks,
> > > > Zhichao
> > > >
> > > > > -Original Message-
> > > > > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > > > > Sent: Wednesday, May 29, 2019 7:12 PM
> > > > > To: devel@edk2.groups.io; Gao, Zhichao 
> > > > > Cc: Bret Barkelew ; Wang, Jian J
> > > > > ; Wu, Hao A ; Ni, Ray
> > > > > ; Zeng, Star ; Gao,
> > > > > Liming ; Sean Brogan
> > > > > ; Michael Turner
> > > > > 
> > > > > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei:
> > > > > Optimize the CapsulePei
> > > > >
> > > > > On Wed, May 29, 2019 at 08:45:55AM +0800, Gao, Zhichao wrote:
> > > > > > From: Bret Barkelew 
> > > > >
> > > > > If this code is from Microsoft...
> > > > >
> > > > > >
> > > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853
> > > > > >
> > > > > > Sperate the capsule check function from GetCapsuleDescriptors
> > > > > > and name it to AreCapsulesStaged.
> > > > > > Rename GetCapsuleDescriptors to GetScatterGatherHeadEntries.
> > > > > > And optimize its to remove the duplicated code.
> > > > > >
> > > > > > Cc: Jian J Wang 
> > > > > > Cc: Hao A Wu 
> > > > > > Cc: Ray Ni 
> > > > > > Cc: Star Zeng 
> > > > > > Cc: Liming Gao 
> > > > > > Cc: Sean Brogan 
> > > > > > Cc: Michael Turner 
> > > > > > Cc: Bret Barkelew 
> > > > > > Signed-off-by: Zhichao gao 
> > > > > > ---
> > > > > >  MdeModulePkg/Universal/CapsulePei/Capsule.h   |   3 +-
> > > > > >  .../Universal/CapsulePei/CapsulePei.inf   |   3 +-
> > > > > >  .../Universal/CapsulePei/UefiCapsule.c| 357 
> > > > > > ++---
> -
> > > > > >  3 files changed, 194 insertions(+), 169 deletions(-)
> > > > > >
> > > > > > diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > > > > > b/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > > > > > index baf40423af..fc20dd8b92 100644
&g

[edk2-devel] [PATCH v4 0/2] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-06-04 Thread Gao, Zhichao
v1:
Sperate the capsule check function from GetCapsuleDescriptors
and name it to AreCapsulesStaged.
Rename GetCapsuleDescriptors to GetScatterGatherHeadEntries.
And optimize its to remove the duplicated code.

V2:
Clarify the changes of the patch and descript in the commit
message.

V3:
Add the code change repo location in Mu and add description of
the changes on it.
Do not need to remain 2 byte for the null-terminate while using
UnicodeValueToStringS.

V4:
Separate the patch into 2 part. first part is changes from MU.
Second part is the substantial change on it.

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

Bret Barkelew (1):
  MdeModulePkg/CapsulePei: Optimize the CapsulePei

Zhichao Gao (1):
  MdeMoudlePkg/CapsulePei: Substantial change on UefiCapsule.c

 MdeModulePkg/Universal/CapsulePei/Capsule.h   |   1 +
 .../Universal/CapsulePei/CapsulePei.inf   |   1 +
 .../Universal/CapsulePei/UefiCapsule.c| 356 +-
 3 files changed, 190 insertions(+), 168 deletions(-)

-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH v4 2/2] MdeMoudlePkg/CapsulePei: Substantial change on UefiCapsule.c

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

AreCapsulesStaged do not need to return the status, only boolean
result is useful. So directly return a boolean value.
Cannot initialize the variable at its definition.

GetScatterGatherHeadEntries: use allocated buffer instead of fixed
array to handle the condition which the SG list is larger then the
array size.

Remove API specifier AreCapsulesStaged and GetScatterGatherHeadEntries
because they are internal used.

Fix some coding style issues.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 .../Universal/CapsulePei/UefiCapsule.c| 103 +-
 1 file changed, 54 insertions(+), 49 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index 7c8c7a0f45..fabf30926c 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -1,7 +1,7 @@
 /** @file
   Capsule update PEIM for UEFI2.0
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Incorporated. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Capsule.h"
 
+#define DEFAULT_SG_LIST_HEADS   (20)
+
 #ifdef MDE_CPU_IA32
 //
 // Global Descriptor Table (GDT)
@@ -793,30 +795,21 @@ BuildMemoryResourceDescriptor (
 /**
   Check if the capsules are staged.
 
-  @param UpdateCapsules   A pointer to return the check result.
-
-  @retval EFI_INVALID_PARAMETER   The parameter is null.
-  @retval EFI_SUCCESS The Capsules are staged.
+  @retval TRUE  The capsules are staged.
+  @retval FALSE The capsules are not staged.
 
 **/
-EFI_STATUS
-EFIAPI
-AreCapsulesStaged(
-  OUT BOOLEAN *UpdateCapsules
+BOOLEAN
+AreCapsulesStaged (
+  VOID
   )
 {
   EFI_STATUSStatus;
   UINTN Size;
   EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
-  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64 = 0;
-
-  if (UpdateCapsules == NULL) {
-DEBUG ((DEBUG_ERROR, "%a Invalid parameters.  Inputs can't be NULL\n", 
__FUNCTION__));
-ASSERT (UpdateCapsules != NULL);
-return EFI_INVALID_PARAMETER;
-  }
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
 
-  *UpdateCapsules = FALSE;
+  CapsuleDataPtr64 = 0;
 
   Status = PeiServicesLocatePpi(
   ,
@@ -827,7 +820,7 @@ AreCapsulesStaged(
 
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
-return Status;
+return FALSE;
   }
 
   //
@@ -844,14 +837,12 @@ AreCapsulesStaged(
   );
 
   if (!EFI_ERROR (Status)) {
-*UpdateCapsules = TRUE;
+return TRUE;
   }
 
-  return EFI_SUCCESS;
+  return FALSE;
 }
 
-#define MAX_SG_LIST_HEADS (20)
-
 /**
   Check all the variables for SG list heads and get the count and addresses.
 
@@ -865,23 +856,24 @@ AreCapsulesStaged(
 
 **/
 EFI_STATUS
-EFIAPI
-GetScatterGatherHeadEntries(
+GetScatterGatherHeadEntries (
   OUT UINTN *ListLength,
   OUT EFI_PHYSICAL_ADDRESS **HeadList
   )
 {
-  EFI_STATUS   Status;
-  UINTNSize;
-  UINTNIndex;
-  UINTNTempIndex;
-  UINTNValidIndex;
-  BOOLEAN  Flag;
-  CHAR16   CapsuleVarName[30];
-  CHAR16   *TempVarName;
-  EFI_PHYSICAL_ADDRESS CapsuleDataPtr64;
-  EFI_PEI_READ_ONLY_VARIABLE2_PPI  *PPIVariableServices;
-  EFI_PHYSICAL_ADDRESS TempList[MAX_SG_LIST_HEADS];
+  EFI_STATUSStatus;
+  UINTN Size;
+  UINTN Index;
+  UINTN TempIndex;
+  UINTN ValidIndex;
+  BOOLEAN   Flag;
+  CHAR16CapsuleVarName[30];
+  CHAR16*TempVarName;
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
+  EFI_PHYSICAL_ADDRESS  *TempList;
+  EFI_PHYSICAL_ADDRESS  *EnlargedTempList;
+  UINTN TempListLength;
 
   Index = 0;
   TempVarName   = NULL;
@@ -911,16 +903,26 @@ GetScatterGatherHeadEntries(
 return Status;
   }
 
+  //
+  // Allocate memory for sg list head
+  //
+  TempListLength = DEFAULT_SG_LIST_HEADS * sizeof (EFI_PHYSICAL_ADDRESS);
+  TempList = AllocateZeroPool (TempListLength);
+  if (TempList == NULL) {
+DEBUG((DEBUG_ERROR, "Failed to allocate memory\n"));
+return 

Re: [edk2-devel] [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogData

2019-05-28 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

> -Original Message-
> From: Bi, Dandan
> Sent: Tuesday, May 28, 2019 10:25 AM
> To: devel@edk2.groups.io; oleks...@ami.com
> Cc: Carsey, Jaben ; Ni, Ray ;
> Gao, Zhichao 
> Subject: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> DisplaySysEventLogData
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1498
> 
> This patch fix following bugs in func DisplaySysEventLogData:
> 1. Log increment (Log = (LOG_RECORD_FORMAT *) (LogData + Offset);)
> should happened in the end of while loop, not in the very beginning.
> 2. DisplaySELTypes function should be used in while loop instead of
> DisplaySELVarDataFormatType.
> 
> Cc: Jaben Carsey 
> Cc: Ray Ni 
> Cc: Zhichao Gao 
> Signed-off-by: Dandan Bi 
> ---
>  .../SmbiosView/EventLogInfo.c | 20 +--
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> o.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> o.c
> index b8adf438d3..984c178890 100644
> ---
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> o.c
> +++
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> +++ o.c
> @@ -1,9 +1,9 @@
>  /** @file
>Module for clarifying the content of the smbios structure element info.
> 
> -  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. 
> +  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
> + 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "UefiShellDebug1CommandsLib.h"
> @@ -345,20 +345,16 @@ DisplaySysEventLogData (
>// Print Log info
>//
>Offset  = 0;
>Log = (LOG_RECORD_FORMAT *) LogData;
>while (Log != NULL && Log->Type != END_OF_LOG && Offset <
> LogAreaLength) {
> -//
> -// Get a Event Log Record
> -//
> -Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> 
>  if (Log != NULL) {
>//
>// Display Event Log Record Information
>//
> -  DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);
> +  DisplaySELTypes (Log->Type, SHOW_DETAIL);
>DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
> 
>Offset += Log->Length;
>//
>// Display Log Header Date/Time Fields @@ -371,10 +367,14 @@
> DisplaySysEventLogData (
>  Print (L"19");
>} else if (Log != NULL && Log->Year <= 79) {
>  Print (L"20");
>} else {
>  ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN
> (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
> +//
> +// Get a Event Log Record
> +//
> +Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
>  continue;
>}
> 
>ShellPrintHiiEx(-1,-1,NULL,
>  STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
> @@ -389,13 +389,21 @@ DisplaySysEventLogData (
> 
>//
>// Display Variable Data Format
>//
>if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
> +//
> +// Get a Event Log Record
> +//
> +Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
>  continue;
>}
> 
>ElVdfType = Log->LogVariableData[0];
>DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
> +  //
> +  // Get a Event Log Record
> +  //
> +  Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
>  }
>}
>  }
> --
> 2.18.0.windows.1


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

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



[edk2-devel] [PATCH] MdeModulePkg: Clarify the lib supported ARCH

2019-05-28 Thread Gao, Zhichao
From: Bret Barkelew 

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

SmmLockBoxPeiLib only support IA32 and X64 ARCH. So put
this lib to a specific
[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM] section.

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 
---
 MdeModulePkg/MdeModulePkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index ac7111dea1..d2e88d6b65 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -114,6 +114,8 @@
   HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
   
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
   
ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
+
+[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM]
   LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
 
 [LibraryClasses.common.DXE_CORE]
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-05-28 Thread Gao, Zhichao
From: Bret Barkelew 

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

Sperate the capsule check function from GetCapsuleDescriptors
and name it to AreCapsulesStaged.
Rename GetCapsuleDescriptors to GetScatterGatherHeadEntries.
And optimize its to remove the duplicated code.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao gao 
---
 MdeModulePkg/Universal/CapsulePei/Capsule.h   |   3 +-
 .../Universal/CapsulePei/CapsulePei.inf   |   3 +-
 .../Universal/CapsulePei/UefiCapsule.c| 357 ++
 3 files changed, 194 insertions(+), 169 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h 
b/MdeModulePkg/Universal/CapsulePei/Capsule.h
index baf40423af..fc20dd8b92 100644
--- a/MdeModulePkg/Universal/CapsulePei/Capsule.h
+++ b/MdeModulePkg/Universal/CapsulePei/Capsule.h
@@ -1,6 +1,6 @@
 /** @file
 
-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
 
@@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "Common/CommonHeader.h"
 
diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf 
b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
index 5d43df3075..9c88b3986f 100644
--- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
+++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
@@ -6,7 +6,7 @@
 #  This external input must be validated carefully to avoid security issue like
 #  buffer overflow, integer overflow.
 #
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 # Copyright (c) 2017, AMD Incorporated. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -43,6 +43,7 @@
   BaseLib
   HobLib
   BaseMemoryLib
+  MemoryAllocationLib
   PeiServicesLib
   PeimEntryPoint
   DebugLib
diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index e967599e96..2d003369ca 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -1,7 +1,7 @@
 /** @file
   Capsule update PEIM for UEFI2.0
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Incorporated. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Capsule.h"
 
+#define DEFAULT_SG_LIST_HEADS   (20)
+
 #ifdef MDE_CPU_IA32
 //
 // Global Descriptor Table (GDT)
@@ -791,30 +793,89 @@ BuildMemoryResourceDescriptor (
 }
 
 /**
-  Checks for the presence of capsule descriptors.
-  Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, 
CapsuleUpdateData2...
-  and save to DescriptorBuffer.
+  Check if the capsules are staged.
 
-  @param DescriptorBufferPointer to the capsule descriptors
+  @retval TRUE  The capsules are staged.
+  @retval FALSE The capsules are not staged.
+
+**/
+BOOLEAN
+EFIAPI
+AreCapsulesStaged (
+  VOID
+  )
+{
+  EFI_STATUSStatus;
+  UINTN Size;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
+
+  CapsuleDataPtr64 = 0;
+
+  Status = PeiServicesLocatePpi (
+,
+0,
+NULL,
+(VOID **)
+);
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
+return FALSE;
+  }
+
+  //
+  // Check for Update capsule
+  //
+  Size = sizeof (CapsuleDataPtr64);
+  Status = PPIVariableServices->GetVariable(
+  PPIVariableServices,
+  EFI_CAPSULE_VARIABLE_NAME,
+  ,
+  NULL,
+  ,
+  (VOID *)
+  );
+
+  if (!EFI_ERROR (Status)) {
+return TRUE;
+  }
+
+  return FALSE;
+}
+
+/**
+  Check all the variables for SG list heads and get the count and addresses.
+
+  @param ListLength   A pointer would return the SG list length.
+  @param HeadList A ponter to the capsule SG list.
+
+  @retval EFI_SUCCESS a valid capsule is present
+  @retval EFI_NOT_FOUND   if a valid capsule is not present
+  @retval EFI_INVALID_PARAMETER   the input parameter is invalid
+  @retval EFI_OUT_OF_RESOURCE fail to allocate memory
 
-  @retval EFI_SUCCESS a valid capsule is present
-  @retval EFI_NOT_FOUND   if a valid capsule is not present
 **/
 EFI_STATUS

Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-05-30 Thread Gao, Zhichao


> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Wednesday, May 29, 2019 11:09 PM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Bret Barkelew ; Wang, Jian J
> ; Wu, Hao A ; Ni, Ray
> ; Zeng, Star ; Gao, Liming
> ; Sean Brogan ;
> Michael Turner 
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize the
> CapsulePei
> 
> On Wed, May 29, 2019 at 03:01:12PM +, Gao, Zhichao wrote:
> > I just update the date of copyright. And the code in Mu project didn't add
> its own copyright.
> > If it is required, I would add it for them.
> 
> Well, hopefully Microsoft will add their own copyright to the original
> :)
> 
> Although it would certainly be better to add it here as well anyway.

I think it is better to let MS to add the copyright by themselves.

> 
> So what modifications were made to the code on the way from the project
> Mu repository? That would be useful to mention in the commit message.

I would add this info blow commit message(not in commit message). It is helpful 
for review. But it may not be useful to add them in the commit message.
On my opinion, the commit message should contain the summary and impact of the 
changes.

Thanks,
Zhichao

> 
> Regards,
> 
> Leif
> 
> > And I also make some minor changes on it.
> >
> > Thanks,
> > Zhichao
> >
> > > -Original Message-
> > > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > > Sent: Wednesday, May 29, 2019 7:12 PM
> > > To: devel@edk2.groups.io; Gao, Zhichao 
> > > Cc: Bret Barkelew ; Wang, Jian J
> > > ; Wu, Hao A ; Ni, Ray
> > > ; Zeng, Star ; Gao, Liming
> > > ; Sean Brogan ;
> > > Michael Turner 
> > > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize
> > > the CapsulePei
> > >
> > > On Wed, May 29, 2019 at 08:45:55AM +0800, Gao, Zhichao wrote:
> > > > From: Bret Barkelew 
> > >
> > > If this code is from Microsoft...
> > >
> > > >
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853
> > > >
> > > > Sperate the capsule check function from GetCapsuleDescriptors and
> > > > name it to AreCapsulesStaged.
> > > > Rename GetCapsuleDescriptors to GetScatterGatherHeadEntries.
> > > > And optimize its to remove the duplicated code.
> > > >
> > > > Cc: Jian J Wang 
> > > > Cc: Hao A Wu 
> > > > Cc: Ray Ni 
> > > > Cc: Star Zeng 
> > > > Cc: Liming Gao 
> > > > Cc: Sean Brogan 
> > > > Cc: Michael Turner 
> > > > Cc: Bret Barkelew 
> > > > Signed-off-by: Zhichao gao 
> > > > ---
> > > >  MdeModulePkg/Universal/CapsulePei/Capsule.h   |   3 +-
> > > >  .../Universal/CapsulePei/CapsulePei.inf   |   3 +-
> > > >  .../Universal/CapsulePei/UefiCapsule.c| 357 ++
> > > >  3 files changed, 194 insertions(+), 169 deletions(-)
> > > >
> > > > diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > > > b/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > > > index baf40423af..fc20dd8b92 100644
> > > > --- a/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > > > +++ b/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > > > @@ -1,6 +1,6 @@
> > > >  /** @file
> > > >
> > > > -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
> > > >
> > > > @@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > #include   #include
> > > >  #include 
> > > > +#include 
> > > >  #include   #include
> > > > "Common/CommonHeader.h"
> > > >
> > > > diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > > > b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > > > index 5d43df3075..9c88b3986f 100644
> > > > --- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > > > +++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > > > @@ -6,7 +6,7 @@
> > > >  #  This external input must be validated carefully to avoid
> > > > security issue like  #  buffer overflow, integer overflow.
> > > >  #
> > > > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights
> > > > reserved.
> > > > +# Copyright (c) 2006 - 2019, Intel Corporation. All rights
> > > > +reserved.
> > >
> > > ...why does Intel get the copyright?
> > >
> > > /
> > > Leif
> >
> > 
> >

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

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



[edk2-devel] [PATCH V2] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-05-30 Thread Gao, Zhichao
From: Bret Barkelew 

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

Optimize some function in CapsulePei to make it easier
to maintian.
1. Separate the capsule check function form GetCapsuleDescriptors
to AreCapsulesStaged. The original logic is unclear.
2. Avoid querying the capsule variable twice. First time to count
the number of SG list and allocate a buffer to save SG list data.
Second time to save the SG list data to the buffer. Modified:
Using a template buffer to save the SG list data. After query,
we get the number of SG list, then allocate memory and copy
data form template buffer to the allocated memory.
3. Using MemoryAllocationLib instead of memory function in Pei
services.
4, Remain 2 byte(CHAR16) to be the null-terminate of CapsuleVarName.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao gao 
---

Code change from 
https://github.com/microsoft/mu_basecore/blob/release/201903/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c#L801

Note:
1. Change the AreCapsulesStaged: directly return the BOOLEAN result.
2. While the template buffer is to small, double its size through memory 
function.

 MdeModulePkg/Universal/CapsulePei/Capsule.h   |   3 +-
 .../Universal/CapsulePei/CapsulePei.inf   |   3 +-
 .../Universal/CapsulePei/UefiCapsule.c| 355 ++
 3 files changed, 192 insertions(+), 169 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h 
b/MdeModulePkg/Universal/CapsulePei/Capsule.h
index baf40423af..fc20dd8b92 100644
--- a/MdeModulePkg/Universal/CapsulePei/Capsule.h
+++ b/MdeModulePkg/Universal/CapsulePei/Capsule.h
@@ -1,6 +1,6 @@
 /** @file
 
-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
 
@@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "Common/CommonHeader.h"
 
diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf 
b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
index 5d43df3075..9c88b3986f 100644
--- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
+++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
@@ -6,7 +6,7 @@
 #  This external input must be validated carefully to avoid security issue like
 #  buffer overflow, integer overflow.
 #
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 # Copyright (c) 2017, AMD Incorporated. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -43,6 +43,7 @@
   BaseLib
   HobLib
   BaseMemoryLib
+  MemoryAllocationLib
   PeiServicesLib
   PeimEntryPoint
   DebugLib
diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index e967599e96..b3014478a3 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -1,7 +1,7 @@
 /** @file
   Capsule update PEIM for UEFI2.0
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Incorporated. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Capsule.h"
 
+#define DEFAULT_SG_LIST_HEADS   (20)
+
 #ifdef MDE_CPU_IA32
 //
 // Global Descriptor Table (GDT)
@@ -791,30 +793,87 @@ BuildMemoryResourceDescriptor (
 }
 
 /**
-  Checks for the presence of capsule descriptors.
-  Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, 
CapsuleUpdateData2...
-  and save to DescriptorBuffer.
+  Check if the capsules are staged.
 
-  @param DescriptorBufferPointer to the capsule descriptors
+  @retval TRUE  The capsules are staged.
+  @retval FALSE The capsules are not staged.
+
+**/
+BOOLEAN
+AreCapsulesStaged (
+  VOID
+  )
+{
+  EFI_STATUSStatus;
+  UINTN Size;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
+
+  CapsuleDataPtr64 = 0;
+
+  Status = PeiServicesLocatePpi (
+,
+0,
+NULL,
+(VOID **)
+);
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
+return FALSE;
+  }
+
+  //
+  // Check for Update capsule
+  //
+  Size = sizeof (CapsuleDataPtr64);
+  Status = PPIVariableServices->GetVariable(
+  PPIVariableServices,
+  EFI_CAPSULE_VARIABLE_NAME,
+  ,
+  NULL,
+  ,
+ 

Re: [edk2-devel] [PATCH v1 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser

2019-05-30 Thread Gao, Zhichao
Sorry for late update.

Some minor comments below.
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Krzysztof Koch
> Sent: Friday, May 17, 2019 12:06 AM
> To: devel@edk2.groups.io
> Cc: sami.muja...@arm.com; Carsey, Jaben ; Ni,
> Ray ; matteo.carl...@arm.com; Stephanie.Hughes-
> f...@arm.com; n...@arm.com
> Subject: [edk2-devel] [PATCH v1 1/1] ShellPkg: acpiview: ACPI 6.3 update for
> MADT parser
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1820
> 
> The ACPI 6.3 specification introduces a 'SPE overflow Interrupt' field as part
> of the GICC structure.
> 
> Update the MADT parser to decode this field and validate the interrupt ID
> used.
> 
> Signed-off-by: Krzysztof Koch 
> ---
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/477_acpiview_spe_v1
> 
> Notes:
> v1:
> - Decode and validate SPE Overflow Interrupt field [Krzysztof]
> 
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 86 ++--
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> h | 35 
>  2 files changed, 113 insertions(+), 8 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> index
> a1bf86ade5313f954a77b325c13394cfce133939..59c3df0cc8a080497b517baf36f
> c63f1e4ab866f 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> +++ er.c
> @@ -1,17 +1,21 @@
>  /** @file
>MADT table parser
> 
> -  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> +  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>@par Reference(s):
> -- ACPI 6.2 Specification - Errata A, September 2017
> +- ACPI 6.3 Specification - January 2019
> +- Arm Generic Interrupt Controller Architecture Specification,
> +  GIC architecture version 3 and version 4, issue E
> +- Arm Server Base System Architecture 5.0
>  **/
> 
>  #include 
>  #include 
>  #include "AcpiParser.h"
>  #include "AcpiTableParser.h"
> +#include "MadtParser.h"
> 
>  // Local Variables
>  STATIC CONST UINT8* MadtInterruptControllerType; @@ -33,6 +37,21 @@
> ValidateGICDSystemVectorBase (
>IN VOID*  Context
>);
> 
> +/**
> +  This function validates the SPE Overflow Interrupt in the GICC.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateSpeOverflowInterrupt (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  );
> +

>From ACPI 6.3 Table 5-60:
Statistical Profiling Extension buffer overflow GSIV. This interrupt is a level 
triggered PPI. Zero if SPE is not supported by this processor.

Seems it did descript which value is invalid. If it is mentioned in other spec, 
please help to figure out in the commit message.
Maybe I miss something. If so, please help to point.

>  /**
>An ACPI_PARSER array describing the GICC Interrupt Controller Structure.
>  **/
> @@ -56,7 +75,9 @@ STATIC CONST ACPI_PARSER GicCParser[] = {
>{L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL},
>{L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
> NULL},
> -  {L"Reserved", 3, 77, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
> +  {L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL},  {L"SPE
> + overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
> +ValidateSpeOverflowInterrupt, NULL}
>  };
> 
>  /**
> @@ -160,6 +181,55 @@ ValidateGICDSystemVectorBase (
>}
>  }
> 
> +/**
> +  This function validates the SPE Overflow Interrupt in the GICC.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateSpeOverflowInterrupt (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  )
> +{
> +  UINT16 SpeOverflowInterrupt;
> +
> +  SpeOverflowInterrupt = *(UINT16*)Ptr;
> +
> +  // SPE not supported by this processor  if (SpeOverflowInterrupt ==
> + 0) {
> +return;
> +  }
> +
> +  if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
> +  ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
> +   (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
> +  (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) {
> +IncrementErrorCount ();
> +Print (
> +  L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI 
> ID "
> +L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
> +  SpeOverflowInterrupt,
> +  ARM_PPI_ID_MIN,
> +  ARM_PPI_ID_MAX,
> +  

Re: [edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-05-29 Thread Gao, Zhichao



> -Original Message-
> From: Wu, Hao A
> Sent: Wednesday, May 29, 2019 2:55 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Bret Barkelew ; Wang, Jian J
> ; Ni, Ray ; Zeng, Star
> ; Gao, Liming ; Sean Brogan
> ; Michael Turner
> 
> Subject: RE: [PATCH] MdeModulePkg/CapsulePei: Optimize the CapsulePei
> 
> > -----Original Message-
> > From: Gao, Zhichao
> > Sent: Wednesday, May 29, 2019 8:46 AM
> > To: devel@edk2.groups.io
> > Cc: Bret Barkelew; Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Gao,
> > Liming; Sean Brogan; Michael Turner; Gao, Zhichao
> > Subject: [PATCH] MdeModulePkg/CapsulePei: Optimize the CapsulePei
> >
> > From: Bret Barkelew 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853
> >
> > Sperate the capsule check function from GetCapsuleDescriptors
> 
> Sperate -> Separate
> 
> > and name it to AreCapsulesStaged.
> > Rename GetCapsuleDescriptors to GetScatterGatherHeadEntries.
> > And optimize its to remove the duplicated code.
> >
> > Cc: Jian J Wang 
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Cc: Star Zeng 
> > Cc: Liming Gao 
> > Cc: Sean Brogan 
> > Cc: Michael Turner 
> > Cc: Bret Barkelew 
> > Signed-off-by: Zhichao gao 
> > ---
> >  MdeModulePkg/Universal/CapsulePei/Capsule.h   |   3 +-
> >  .../Universal/CapsulePei/CapsulePei.inf   |   3 +-
> >  .../Universal/CapsulePei/UefiCapsule.c| 357 ++
> >  3 files changed, 194 insertions(+), 169 deletions(-)
> 
> I am a bit confused for the purpose of this patch.
> 
> My understanding is that this patch will refine this driver to remove
> duplicated code by abstract common codes into a new function. And there
> will be no functional impact.
> 
> However, after the change, the line of codes of this driver increased by
> 20+ lines.
> 
> Did I miss something for the purpose of this patch?

The commit message should be update:
I view the code change again, here is the purpose of this patch:
1. separate the check function from GetCapsuleDescriptors. The original logic 
GetCapsuleDescriptors in  is unclear.
2. avoid calling query capsule variable twice, first time to get the SG list 
number and allocate buffer to save it, second time to copy the SG list to the 
buffer.
After the patch it would put the SG list data into a template buffer and count 
the number. Then allocate the memory and copy data.

I would update the above info to next patch. And remove the incorrect 
description.

> 
> Some additional comments below.
> 
> >
> > diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > b/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > index baf40423af..fc20dd8b92 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > +++ b/MdeModulePkg/Universal/CapsulePei/Capsule.h
> > @@ -1,6 +1,6 @@
> >  /** @file
> >
> > -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
> >
> > @@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> > #include   #include 
> > #include 
> > +#include 
> >  #include   #include
> > "Common/CommonHeader.h"
> >
> > diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > index 5d43df3075..9c88b3986f 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > +++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
> > @@ -6,7 +6,7 @@
> >  #  This external input must be validated carefully to avoid security
> > issue like  #  buffer overflow, integer overflow.
> >  #
> > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights
> > reserved.
> > +# Copyright (c) 2006 - 2019, Intel Corporation. All rights
> > +reserved.
> >  # Copyright (c) 2017, AMD Incorporated. All rights reserved.  #
> > # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -43,6 +43,7 @@
> >BaseLib
> >HobLib
> >BaseMemoryLib
> > +  MemoryAllocationLib
> >PeiServicesLib
> >PeimEntryPoint
> >DebugLib
> > diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > index e967599e96..2d003369ca 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > @@ -1,7 +1,7 @@
> >  /** @file
> >Capsule update PEIM for UEFI2.0
> >
>

[edk2-devel] [PATCH v3] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-06-03 Thread Gao, Zhichao
From: Bret Barkelew 

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

Change form Mu repo:
https://github.com/microsoft/mu_basecore/blob/release/201903/
MdeModulePkg/Universal/CapsulePei/UefiCapsule.c#L801

Minor changes on it:
1. Change the AreCapsulesStaged: directly return the BOOLEAN result.
2. In GetScatterGatherHeadEntries: using allocate memory instead of
the fixed template array. While the SG list is larger then the
pre-allocate buffer, enlarge the buffer.

Optimize some function in CapsulePei to make it easier
to maintain.
1. Separate the capsule check function form GetCapsuleDescriptors.
The original logic is unclear.
2. Avoid querying the capsule variable twice. First time to count
the number of SG list and allocate a buffer to save SG list data.
Second time to save the SG list data to the buffer. Modified:
Using a template buffer to save the SG list data. After query,
we get the number of SG list, then allocate memory and copy
data form template buffer to the allocated memory.
3. Using MemoryAllocationLib instead of memory function in Pei
services.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 MdeModulePkg/Universal/CapsulePei/Capsule.h   |   1 +
 .../Universal/CapsulePei/CapsulePei.inf   |   1 +
 .../Universal/CapsulePei/UefiCapsule.c| 355 ++
 3 files changed, 190 insertions(+), 167 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h 
b/MdeModulePkg/Universal/CapsulePei/Capsule.h
index baf40423af..3d9cab02c4 100644
--- a/MdeModulePkg/Universal/CapsulePei/Capsule.h
+++ b/MdeModulePkg/Universal/CapsulePei/Capsule.h
@@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "Common/CommonHeader.h"
 
diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf 
b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
index 5d43df3075..786c411633 100644
--- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
+++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
@@ -43,6 +43,7 @@
   BaseLib
   HobLib
   BaseMemoryLib
+  MemoryAllocationLib
   PeiServicesLib
   PeimEntryPoint
   DebugLib
diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index e967599e96..4adb0c1ac2 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -1,7 +1,7 @@
 /** @file
   Capsule update PEIM for UEFI2.0
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Incorporated. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Capsule.h"
 
+#define DEFAULT_SG_LIST_HEADS   (20)
+
 #ifdef MDE_CPU_IA32
 //
 // Global Descriptor Table (GDT)
@@ -791,30 +793,87 @@ BuildMemoryResourceDescriptor (
 }
 
 /**
-  Checks for the presence of capsule descriptors.
-  Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, 
CapsuleUpdateData2...
-  and save to DescriptorBuffer.
+  Check if the capsules are staged.
 
-  @param DescriptorBufferPointer to the capsule descriptors
+  @retval TRUE  The capsules are staged.
+  @retval FALSE The capsules are not staged.
+
+**/
+BOOLEAN
+AreCapsulesStaged (
+  VOID
+  )
+{
+  EFI_STATUSStatus;
+  UINTN Size;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
+
+  CapsuleDataPtr64 = 0;
+
+  Status = PeiServicesLocatePpi (
+,
+0,
+NULL,
+(VOID **)
+);
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
+return FALSE;
+  }
+
+  //
+  // Check for Update capsule
+  //
+  Size = sizeof (CapsuleDataPtr64);
+  Status = PPIVariableServices->GetVariable(
+  PPIVariableServices,
+  EFI_CAPSULE_VARIABLE_NAME,
+  ,
+  NULL,
+  ,
+  (VOID *)
+  );
+
+  if (!EFI_ERROR (Status)) {
+return TRUE;
+  }
+
+  return FALSE;
+}
+
+/**
+  Check all the variables for SG list heads and get the count and addresses.
+
+  @param ListLength   A pointer would return the SG list length.
+  @param HeadList A ponter to the capsule SG list.
+
+  @retval EFI_SUCCESS a valid capsule is present
+  @retval EFI_NOT_FOUND   if a valid capsule is not present
+  @retval EFI_INVALID_PARAMETER   the input parameter is invalid

[edk2-devel] [PATCH V3 1/2] MdeModulePkg: Add a pcd to set the OS indications bit

2019-06-03 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add a pcd PcdPlatformRecoverySupport to conditionally
set an OS indications bit and set the 'PlatformRecovery'
variable. This pcd would also control whether the BDS
support platform recovery or not.

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: Ray Ni 
---
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 0a9fcddecc..da2b85770c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1660,6 +1660,12 @@
   # @Prompt Reset on memory type information change.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE|BOOLEAN|0x00010056
 
+  ## Indicates if the BDS supports Platform Recovery.
+  #   TRUE  - BDS supports Platform Recovery.
+  #   FALSE - BDS does not support Platform Recovery.
+  # @Prompt Support Platform Recovery.
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport|TRUE|BOOLEAN|0x00010078
+
   ## Specify the foreground color for Subtile text in HII Form Browser. The 
default value is EFI_BLUE.
   #  Only following values defined in UEFI specification are valid:
   #  0x00 (EFI_BLACK)
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH V3 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

2019-06-03 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1678

Use the PcdPlatformRecoverySupport to control the function
of platform recovery in BDS.
First, set the variable's ("OsIndicationsSupported")
EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY bit base on the pcd.
It would affect the variable "OsIndications".
While the platform does not support the platform recovery,
it is inappropriate to set a PlatformRecovery variable. So
skip setting the variable. But it should remain the behavior of
booting from a default file path (such as \EFI\BOOT\BOOTX64.EFI)
to be compatible with the previous version UEFI spec.

Add memory check before build platform default boot option. If
fail to allocate memory for the defualt boot file path, put the
system into dead loop to indicate it is unable to boot.

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 
---
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
 2 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf 
b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
index 6913389d34..7f94ca17df 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -5,7 +5,7 @@
 #  gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will 
invoke Entry
 #  interface of protocol gEfiBdsArchProtocolGuid, then BDS phase is entered.
 #
-#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -95,6 +95,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable  ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed   ## 
CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport   ## 
CONSUMES
 
 [Depex]
   TRUE
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index 9d312bd982..8c8a0b5236 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -5,7 +5,7 @@
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be 
invoked
   to enter BDS phase.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -546,10 +546,14 @@ BdsFormalizeOSIndicationVariable (
   //
   Status = EfiBootManagerGetBootManagerMenu ();
   if (Status != EFI_NOT_FOUND) {
-OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI | 
EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
+OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
 EfiBootManagerFreeLoadOption ();
   } else {
-OsIndicationSupport = EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
+OsIndicationSupport = 0;
+  }
+
+  if (PcdGetBool (PcdPlatformRecoverySupport)) {
+OsIndicationSupport |= EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
   }
 
   Status = gRT->SetVariable (
@@ -662,6 +666,7 @@ BdsEntry (
   BOOLEAN BootSuccess;
   EFI_DEVICE_PATH_PROTOCOL*FilePath;
   EFI_STATUS  BootManagerMenuStatus;
+  EFI_BOOT_MANAGER_LOAD_OPTIONPlatformDefaultBootOption;
 
   HotkeyTriggered = NULL;
   Status  = EFI_SUCCESS;
@@ -763,14 +768,13 @@ BdsEntry (
   //
   InitializeLanguage (TRUE);
 
-  //
-  // System firmware must include a PlatformRecovery variable specifying
-  // a short-form File Path Media Device Path containing the platform default
-  // file path for removable media
-  //
   FilePath = FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME);
+  if (FilePath == NULL) {
+DEBUG ((DEBUG_ERROR, "Fail to allocate memory for defualt boot file path. 
Unable to boot.\n"));
+CpuDeadLoop ();
+  }
   Status = EfiBootManagerInitializeLoadOption (
- ,
+ ,
  LoadOptionNumberUnassigned,
  LoadOptionTypePlatformRecovery,
  LOAD_OPTION_ACTIVE,
@@ -780,24 +784,31 @@ BdsEntry (
  0
  );
   ASSERT_EFI_ERROR (Status);
-  LoadOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypePlatformRecovery);
-  if (EfiBootManagerFindLoadOption (, LoadOptions, LoadOptionCount) 
== -1) {
-for (Index = 0; Index < LoadOptionCount; Index++) {
-  //
-  // The PlatformRecovery options are sorted by OptionNumber.
-  // Find the the smallest unused number as the new OptionNumber.
-  //
-  if (LoadOptions[Index].OptionNumber != Index) {
-break;
+
+  //
+  // 

[edk2-devel] [PATCH V3 0/2] Use a pcd to control Platform Recovery behavior

2019-06-03 Thread Gao, Zhichao
V1:
Add a pcd PcdPlatformRecoverySupport to control the variable
PlatformRecovery and the EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY
bit of variable "OsIndicationsSupported".

V2:
While PcdPlatformRecoverySupport is FALSE, do not set a PlatformRecovery
Variable.
But remain boot from a default file path(such as \EFI\BOOT\BOOTX64.EFI).
Add memory check before build platform default boot option.

V3:
Modify the memory check operation. If fail to allocate memory for the defualt
boot file path, put the system into dead loop to indicate it is unable to boot.

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: Add a pcd to set the OS indications bit

Zhichao Gao (1):
  MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

 MdeModulePkg/MdeModulePkg.dec|  6 ++
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
 3 files changed, 53 insertions(+), 27 deletions(-)

-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH V3 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

2019-06-13 Thread Gao, Zhichao



> -Original Message-
> From: Wu, Hao A
> Sent: Thursday, June 13, 2019 3:39 PM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Wang, Jian J ; Ni, Ray ; Zeng,
> Star ; Gao, Liming ; Sean
> Brogan ; Michael Turner
> ; Bret Barkelew
> 
> Subject: RE: [edk2-devel] [PATCH V3 2/2] MdeModulePkg/BdsDxe: Use a pcd
> to control PlatformRecovery
> 
> One comment below:
> 
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Gao, Zhichao
> > Sent: Tuesday, June 04, 2019 9:05 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 V3 2/2] MdeModulePkg/BdsDxe: Use a pcd
> to
> > control PlatformRecovery
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1678
> >
> > Use the PcdPlatformRecoverySupport to control the function of platform
> > recovery in BDS.
> > First, set the variable's ("OsIndicationsSupported")
> > EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY bit base on the pcd.
> > It would affect the variable "OsIndications".
> > While the platform does not support the platform recovery, it is
> > inappropriate to set a PlatformRecovery variable. So skip setting
> > the variable. But it should remain the behavior of booting from a
> > default file path (such as \EFI\BOOT\BOOTX64.EFI) to be compatible
> > with the previous version UEFI spec.
> >
> > Add memory check before build platform default boot option. If fail to
> > allocate memory for the defualt boot file path, put the system into
> > dead loop to indicate it is unable to boot.
> >
> > 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 
> > ---
> >  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
> > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
> -
> > ---
> >  2 files changed, 47 insertions(+), 27 deletions(-)
> >
> > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > index 6913389d34..7f94ca17df 100644
> > --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > @@ -5,7 +5,7 @@
> >  #  gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore
> > will invoke Entry  #  interface of protocol gEfiBdsArchProtocolGuid,
> > then BDS phase is entered.
> >  #
> > -#  Copyright (c) 2008 - 2018, Intel Corporation. All rights
> > reserved.
> > +#  Copyright (c) 2008 - 2019, Intel Corporation. All rights
> > +reserved.
> >  #  SPDX-License-Identifier: BSD-2-Clause-Patent  #  ## @@ -95,6 +95,7
> > @@
> >gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand
> > ## CONSUMES
> >gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable  ##
> > SOMETIMES_CONSUMES
> >gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed   ##
> > CONSUMES
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport
> > ## CONSUMES
> >
> >  [Depex]
> >TRUE
> > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > index 9d312bd982..8c8a0b5236 100644
> > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > @@ -5,7 +5,7 @@
> >After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry
> > will be invoked
> >to enter BDS phase.
> >
> > -Copyright (c) 2004 - 2018, Intel Corporation. All rights
> > reserved.
> > +Copyright (c) 2004 - 2019, Intel Corporation. All rights
> > +reserved.
> >  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> >  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
> >  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -546,10 +546,14 @@
> > BdsFormalizeOSIndicationVariable (
> >//
> >Status = EfiBootManagerGetBootManagerMenu ();
> >if (Status != EFI_NOT_FOUND) {
> > -OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI |
> > EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
> > +OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> >  EfiBootManagerFreeLoadOption ();
> >} else {
> > -OsIndicationSupport =
> > EFI_OS_INDICATIONS_START_PLATFORM_RECO

[edk2-devel] [PATCH] MdeModulePkg/PeiMain: Substantial change for PeiAllocatePool

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

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

The original logic is ASSERT if fail to create HOB. But
that doesn't make sense for release version. So it is required
to set the Buffer to null to indicate the failure.

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 
---
 MdeModulePkg/Core/Pei/Memory/MemoryServices.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c 
b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
index 42f79ab076..37b0cfa3cf 100644
--- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
+++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
@@ -802,7 +802,12 @@ PeiAllocatePool (
  (VOID **)
  );
   ASSERT_EFI_ERROR (Status);
-  *Buffer = Hob+1;
+
+  if (EFI_ERROR (Status)) {
+*Buffer = NULL;
+  } else {
+*Buffer = Hob+1;
+  }
 
   return Status;
 }
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH] ShellPkg/UefiShellLib: Set input pointer parameter to null if failure

2019-06-12 Thread Gao, Zhichao
From: Bret Barkelew 

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

While failed to allocate memory to save the response,
set the input/output parameter 'Response'(VOID **) to
NULL to indicate the failure not only depend on the
returned status.

Cc: Jaben Carsey 
Cc: Ray Ni 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c 
b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 430b20e127..5be530092e 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -3366,6 +3366,9 @@ ShellPromptForResponse (
   if (Type != ShellPromptResponseTypeFreeform) {
 Resp = 
(SHELL_PROMPT_RESPONSE*)AllocateZeroPool(sizeof(SHELL_PROMPT_RESPONSE));
 if (Resp == NULL) {
+  if (Response != NULL) {
+*Response = NULL;
+  }
   return (EFI_OUT_OF_RESOURCES);
 }
   }
@@ -3568,6 +3571,8 @@ ShellPromptForResponse (
   *Response = Resp;
 } else if (Buffer != NULL) {
   *Response = Buffer;
+} else {
+  *Response = NULL;
 }
   } else {
 if (Resp != NULL) {
-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH v4 2/2] MdeMoudlePkg/CapsulePei: Substantial change on UefiCapsule.c

2019-06-09 Thread Gao, Zhichao



> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Thursday, June 6, 2019 7:18 PM
> To: Gao, Zhichao 
> Cc: devel@edk2.groups.io; Wang, Jian J ; Wu, Hao A
> ; Ni, Ray ; Zeng, Star
> ; Gao, Liming ; Sean Brogan
> ; Michael Turner
> ; Bret Barkelew
> 
> Subject: Re: [PATCH v4 2/2] MdeMoudlePkg/CapsulePei: Substantial change
> on UefiCapsule.c
> 
> Zhichao,
> 
> Thank you for splitting the patches up. This makes for much better history.
> However,
> 
> On Wed, Jun 05, 2019 at 09:15:45AM +0800, Zhichao Gao wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853
> >
> > AreCapsulesStaged do not need to return the status, only boolean
> > result is useful. So directly return a boolean value.
> > Cannot initialize the variable at its definition.
> >
> > GetScatterGatherHeadEntries: use allocated buffer instead of fixed
> > array to handle the condition which the SG list is larger then the
> > array size.
> >
> > Remove API specifier AreCapsulesStaged and
> GetScatterGatherHeadEntries
> > because they are internal used.
> >
> > Fix some coding style issues.
> 
> The above are three or four (is the EFIAPI change a coding style issue or 
> not?)
> unrelated changes. Could you please break this up further?

EFIAPI is mentioned in CCS_2_1 spec. So I think it is a coding style issue too. 
The other coding style issue is lacking space between the function name and 
bracket.
I would separate 2/2 base on the purpose to make the history clear.

Thanks,
Zhichao

> 
> Best Regards,
> 
> Leif
> 
> > Cc: Jian J Wang 
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Cc: Star Zeng 
> > Cc: Liming Gao 
> > Cc: Sean Brogan 
> > Cc: Michael Turner 
> > Cc: Bret Barkelew 
> > Cc: Leif Lindholm 
> > Signed-off-by: Zhichao gao 
> > ---
> >  .../Universal/CapsulePei/UefiCapsule.c| 103 +-
> >  1 file changed, 54 insertions(+), 49 deletions(-)
> >
> > diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > index 7c8c7a0f45..fabf30926c 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > @@ -1,7 +1,7 @@
> >  /** @file
> >Capsule update PEIM for UEFI2.0
> >
> > -Copyright (c) 2006 - 2018, Intel Corporation. All rights
> > reserved.
> > +Copyright (c) 2006 - 2019, Intel Corporation. All rights
> > +reserved.
> >  Copyright (c) 2017, AMD Incorporated. All rights reserved.
> >
> >  SPDX-License-Identifier: BSD-2-Clause-Patent @@ -10,6 +10,8 @@
> > SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  #include "Capsule.h"
> >
> > +#define DEFAULT_SG_LIST_HEADS   (20)
> > +
> >  #ifdef MDE_CPU_IA32
> >  //
> >  // Global Descriptor Table (GDT)
> > @@ -793,30 +795,21 @@ BuildMemoryResourceDescriptor (
> >  /**
> >Check if the capsules are staged.
> >
> > -  @param UpdateCapsules   A pointer to return the check result.
> > -
> > -  @retval EFI_INVALID_PARAMETER   The parameter is null.
> > -  @retval EFI_SUCCESS The Capsules are staged.
> > +  @retval TRUE  The capsules are staged.
> > +  @retval FALSE The capsules are not staged.
> >
> >  **/
> > -EFI_STATUS
> > -EFIAPI
> > -AreCapsulesStaged(
> > -  OUT BOOLEAN *UpdateCapsules
> > +BOOLEAN
> > +AreCapsulesStaged (
> > +  VOID
> >)
> >  {
> >EFI_STATUSStatus;
> >UINTN Size;
> >EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
> > -  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64 = 0;
> > -
> > -  if (UpdateCapsules == NULL) {
> > -DEBUG ((DEBUG_ERROR, "%a Invalid parameters.  Inputs can't be
> NULL\n", __FUNCTION__));
> > -ASSERT (UpdateCapsules != NULL);
> > -return EFI_INVALID_PARAMETER;
> > -  }
> > +  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
> >
> > -  *UpdateCapsules = FALSE;
> > +  CapsuleDataPtr64 = 0;
> >
> >Status = PeiServicesLocatePpi(
> >, @@ -827,7 +820,7 @@
> > AreCapsulesStaged(
> >
> >if (EFI_ERROR (Status)) {
> >  DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
> > -return Status;
> > +return FALSE;
> >}
> >
> >//
> > @@ -844,14 +83

[edk2-devel] [PATCH v5 2/5] MdeMoudlePkg/CapsulePei: Fix coding style issue

2019-06-09 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853

Remove API specifier AreCapsulesStaged and GetScatterGatherHeadEntries
because they are internal used.
Add space between function name and bracket.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 MdeModulePkg/Universal/CapsulePei/UefiCapsule.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index 7c8c7a0f45..b224e200fe 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -1,7 +1,7 @@
 /** @file
   Capsule update PEIM for UEFI2.0
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Incorporated. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -800,8 +800,7 @@ BuildMemoryResourceDescriptor (
 
 **/
 EFI_STATUS
-EFIAPI
-AreCapsulesStaged(
+AreCapsulesStaged (
   OUT BOOLEAN *UpdateCapsules
   )
 {
@@ -865,8 +864,7 @@ AreCapsulesStaged(
 
 **/
 EFI_STATUS
-EFIAPI
-GetScatterGatherHeadEntries(
+GetScatterGatherHeadEntries (
   OUT UINTN *ListLength,
   OUT EFI_PHYSICAL_ADDRESS **HeadList
   )
-- 
2.21.0.windows.1


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

View/Reply Online (#42056): https://edk2.groups.io/g/devel/message/42056
Mute This Topic: https://groups.io/mt/32001193/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/5] MdeMoudlePkg/CapsulePei: Optimize GetScatterGatherHeadEntries

2019-06-09 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853

Rename the MACRO from MAX_SG_LIST_HEADS to DEFAULT_SG_LIST_HEADS.
GetScatterGatherHeadEntries: use allocated buffer instead of fixed
array to handle the condition which the SG list is larger then the
array size.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 .../Universal/CapsulePei/UefiCapsule.c| 51 ++-
 1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index ce6d95a786..3ac95b7be6 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Capsule.h"
 
+#define DEFAULT_SG_LIST_HEADS   (20)
+
 #ifdef MDE_CPU_IA32
 //
 // Global Descriptor Table (GDT)
@@ -841,8 +843,6 @@ AreCapsulesStaged (
   return FALSE;
 }
 
-#define MAX_SG_LIST_HEADS (20)
-
 /**
   Check all the variables for SG list heads and get the count and addresses.
 
@@ -861,17 +861,19 @@ GetScatterGatherHeadEntries (
   OUT EFI_PHYSICAL_ADDRESS **HeadList
   )
 {
-  EFI_STATUS   Status;
-  UINTNSize;
-  UINTNIndex;
-  UINTNTempIndex;
-  UINTNValidIndex;
-  BOOLEAN  Flag;
-  CHAR16   CapsuleVarName[30];
-  CHAR16   *TempVarName;
-  EFI_PHYSICAL_ADDRESS CapsuleDataPtr64;
-  EFI_PEI_READ_ONLY_VARIABLE2_PPI  *PPIVariableServices;
-  EFI_PHYSICAL_ADDRESS TempList[MAX_SG_LIST_HEADS];
+  EFI_STATUSStatus;
+  UINTN Size;
+  UINTN Index;
+  UINTN TempIndex;
+  UINTN ValidIndex;
+  BOOLEAN   Flag;
+  CHAR16CapsuleVarName[30];
+  CHAR16*TempVarName;
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
+  EFI_PHYSICAL_ADDRESS  *TempList;
+  EFI_PHYSICAL_ADDRESS  *EnlargedTempList;
+  UINTN TempListLength;
 
   Index = 0;
   TempVarName   = NULL;
@@ -901,12 +903,22 @@ GetScatterGatherHeadEntries (
 return Status;
   }
 
+  //
+  // Allocate memory for sg list head
+  //
+  TempListLength = DEFAULT_SG_LIST_HEADS * sizeof (EFI_PHYSICAL_ADDRESS);
+  TempList = AllocateZeroPool (TempListLength);
+  if (TempList == NULL) {
+DEBUG((DEBUG_ERROR, "Failed to allocate memory\n"));
+return EFI_OUT_OF_RESOURCES;
+  }
+
   //
   // setup var name buffer for update capsules
   //
   StrCpyS (CapsuleVarName, sizeof (CapsuleVarName) / sizeof (CHAR16), 
EFI_CAPSULE_VARIABLE_NAME);
   TempVarName = CapsuleVarName + StrLen (CapsuleVarName);
-  while (ValidIndex < MAX_SG_LIST_HEADS) {
+  while (TRUE) {
 if (Index != 0) {
   UnicodeValueToStringS (
 TempVarName,
@@ -948,6 +960,17 @@ GetScatterGatherHeadEntries (
   continue;
 }
 
+//
+// The TempList is full, enlarge it
+//
+if ((ValidIndex + 1) >= TempListLength) {
+  EnlargedTempList = AllocateZeroPool (TempListLength * 2);
+  CopyMem (EnlargedTempList, TempList, TempListLength);
+  FreePool (TempList);
+  TempList = EnlargedTempList;
+  TempListLength *= 2;
+}
+
 //
 // add it to the cached list
 //
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH v5 0/5] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-06-09 Thread Gao, Zhichao
v1:
Sperate the capsule check function from GetCapsuleDescriptors
and name it to AreCapsulesStaged.
Rename GetCapsuleDescriptors to GetScatterGatherHeadEntries.
And optimize its to remove the duplicated code.

V2:
Clarify the changes of the patch and descript in the commit
message.

V3:
Add the code change repo location in Mu and add description of
the changes on it.
Do not need to remain 2 byte for the null-terminate while using
UnicodeValueToStringS.

V4:
Separate the patch into 2 part. first part is changes from MU.
Second part is the substantial change on it.

V5:
Separate the substantial change in 2/2 base on the purpose.

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

Bret Barkelew (1):
  MdeModulePkg/CapsulePei: Optimize the CapsulePei

Zhichao Gao (4):
  MdeMoudlePkg/CapsulePei: Fix coding style issue
  MdeMoudlePkg/CapsulePei: Optimize AreCapsulesStaged
  MdeMoudlePkg/CapsulePei: Optimize GetScatterGatherHeadEntries
  MdeMoudlePkg/CapsulePei: No need to remain space for null-terminate

 MdeModulePkg/Universal/CapsulePei/Capsule.h   |   1 +
 .../Universal/CapsulePei/CapsulePei.inf   |   1 +
 .../Universal/CapsulePei/UefiCapsule.c| 356 +-
 3 files changed, 190 insertions(+), 168 deletions(-)

-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH v5 1/5] MdeModulePkg/CapsulePei: Optimize the CapsulePei

2019-06-09 Thread Gao, Zhichao
From: Bret Barkelew 

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

Code change form Mu project:
https://github.com/microsoft/mu_basecore/blob/release/201903/
MdeModulePkg/Universal/CapsulePei/UefiCapsule.c#L801

Separate the capsule check function from GetCapsuleDescriptors
to AreCapsulesStaged. The original one is unclear.

Avoid querying the capsule variable twice. Use a fixed array
to cache the SG list during count the number of SG list. Then
allocate memory buffer to save the SG list from array.

Using MemoryAllocationLib instead of memory function in Pei
services.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 MdeModulePkg/Universal/CapsulePei/Capsule.h   |   1 +
 .../Universal/CapsulePei/CapsulePei.inf   |   1 +
 .../Universal/CapsulePei/UefiCapsule.c| 325 +-
 3 files changed, 172 insertions(+), 155 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Capsule.h 
b/MdeModulePkg/Universal/CapsulePei/Capsule.h
index baf40423af..3d9cab02c4 100644
--- a/MdeModulePkg/Universal/CapsulePei/Capsule.h
+++ b/MdeModulePkg/Universal/CapsulePei/Capsule.h
@@ -30,6 +30,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "Common/CommonHeader.h"
 
diff --git a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf 
b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
index 5d43df3075..786c411633 100644
--- a/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
+++ b/MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
@@ -43,6 +43,7 @@
   BaseLib
   HobLib
   BaseMemoryLib
+  MemoryAllocationLib
   PeiServicesLib
   PeimEntryPoint
   DebugLib
diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index e967599e96..7c8c7a0f45 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -791,18 +791,84 @@ BuildMemoryResourceDescriptor (
 }
 
 /**
-  Checks for the presence of capsule descriptors.
-  Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, 
CapsuleUpdateData2...
-  and save to DescriptorBuffer.
+  Check if the capsules are staged.
 
-  @param DescriptorBufferPointer to the capsule descriptors
+  @param UpdateCapsules   A pointer to return the check result.
+
+  @retval EFI_INVALID_PARAMETER   The parameter is null.
+  @retval EFI_SUCCESS The Capsules are staged.
 
-  @retval EFI_SUCCESS a valid capsule is present
-  @retval EFI_NOT_FOUND   if a valid capsule is not present
 **/
 EFI_STATUS
-GetCapsuleDescriptors (
-  IN EFI_PHYSICAL_ADDRESS *DescriptorBuffer
+EFIAPI
+AreCapsulesStaged(
+  OUT BOOLEAN *UpdateCapsules
+  )
+{
+  EFI_STATUSStatus;
+  UINTN Size;
+  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64 = 0;
+
+  if (UpdateCapsules == NULL) {
+DEBUG ((DEBUG_ERROR, "%a Invalid parameters.  Inputs can't be NULL\n", 
__FUNCTION__));
+ASSERT (UpdateCapsules != NULL);
+return EFI_INVALID_PARAMETER;
+  }
+
+  *UpdateCapsules = FALSE;
+
+  Status = PeiServicesLocatePpi(
+  ,
+  0,
+  NULL,
+  (VOID **)
+  );
+
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
+return Status;
+  }
+
+  //
+  // Check for Update capsule
+  //
+  Size = sizeof (CapsuleDataPtr64);
+  Status = PPIVariableServices->GetVariable (
+  PPIVariableServices,
+  EFI_CAPSULE_VARIABLE_NAME,
+  ,
+  NULL,
+  ,
+  (VOID *)
+  );
+
+  if (!EFI_ERROR (Status)) {
+*UpdateCapsules = TRUE;
+  }
+
+  return EFI_SUCCESS;
+}
+
+#define MAX_SG_LIST_HEADS (20)
+
+/**
+  Check all the variables for SG list heads and get the count and addresses.
+
+  @param ListLength   A pointer would return the SG list length.
+  @param HeadList A ponter to the capsule SG list.
+
+  @retval EFI_SUCCESS a valid capsule is present
+  @retval EFI_NOT_FOUND   if a valid capsule is not present
+  @retval EFI_INVALID_PARAMETER   the input parameter is invalid
+  @retval EFI_OUT_OF_RESOURCESfail to allocate memory
+
+**/
+EFI_STATUS
+EFIAPI
+GetScatterGatherHeadEntries(
+  OUT UINTN *ListLength,
+  OUT EFI_PHYSICAL_ADDRESS **HeadList
   )
 {
   EFI_STATUS   Status;
@@ -815,6 +881,7 @@ GetCapsuleDescriptors (
   CHAR16   *TempVarName;
   EFI_PHYSICAL_ADDRESS CapsuleDataPtr64;
   EFI_PEI_READ_ONLY_VARIABLE2_PPI  

[edk2-devel] [PATCH v5 3/5] MdeMoudlePkg/CapsulePei: Optimize AreCapsulesStaged

2019-06-09 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1853

AreCapsulesStaged do not need to return the status, only boolean
result is useful. So directly return a boolean value.
Cannot initialize the variable at its definition.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 .../Universal/CapsulePei/UefiCapsule.c| 42 ++-
 1 file changed, 13 insertions(+), 29 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index b224e200fe..ce6d95a786 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -793,29 +793,21 @@ BuildMemoryResourceDescriptor (
 /**
   Check if the capsules are staged.
 
-  @param UpdateCapsules   A pointer to return the check result.
-
-  @retval EFI_INVALID_PARAMETER   The parameter is null.
-  @retval EFI_SUCCESS The Capsules are staged.
+  @retval TRUE  The capsules are staged.
+  @retval FALSE The capsules are not staged.
 
 **/
-EFI_STATUS
+BOOLEAN
 AreCapsulesStaged (
-  OUT BOOLEAN *UpdateCapsules
+  VOID
   )
 {
   EFI_STATUSStatus;
   UINTN Size;
   EFI_PEI_READ_ONLY_VARIABLE2_PPI   *PPIVariableServices;
-  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64 = 0;
-
-  if (UpdateCapsules == NULL) {
-DEBUG ((DEBUG_ERROR, "%a Invalid parameters.  Inputs can't be NULL\n", 
__FUNCTION__));
-ASSERT (UpdateCapsules != NULL);
-return EFI_INVALID_PARAMETER;
-  }
+  EFI_PHYSICAL_ADDRESS  CapsuleDataPtr64;
 
-  *UpdateCapsules = FALSE;
+  CapsuleDataPtr64 = 0;
 
   Status = PeiServicesLocatePpi(
   ,
@@ -826,7 +818,7 @@ AreCapsulesStaged (
 
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "Failed to find ReadOnlyVariable2PPI\n"));
-return Status;
+return FALSE;
   }
 
   //
@@ -843,10 +835,10 @@ AreCapsulesStaged (
   );
 
   if (!EFI_ERROR (Status)) {
-*UpdateCapsules = TRUE;
+return TRUE;
   }
 
-  return EFI_SUCCESS;
+  return FALSE;
 }
 
 #define MAX_SG_LIST_HEADS (20)
@@ -1120,19 +1112,11 @@ CheckCapsuleUpdate (
   IN EFI_PEI_SERVICES   **PeiServices
   )
 {
-  EFI_STATUS  Status;
-  BOOLEAN Update;
-
-  Status = AreCapsulesStaged ();
-
-  if (!EFI_ERROR (Status)) {
-if (Update) {
-  Status = EFI_SUCCESS;
-} else {
-  Status = EFI_NOT_FOUND;
-}
+  if (AreCapsulesStaged ()) {
+return EFI_SUCCESS;
+  } else {
+return EFI_NOT_FOUND;
   }
-  return Status;
 }
 /**
   This function will look at a capsule and determine if it's a test pattern.
-- 
2.21.0.windows.1


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

View/Reply Online (#42057): https://edk2.groups.io/g/devel/message/42057
Mute This Topic: https://groups.io/mt/32001194/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/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser

2019-06-09 Thread Gao, Zhichao
Sorry for late update.

> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Friday, June 7, 2019 4:48 PM
> To: devel@edk2.groups.io
> Cc: sami.muja...@arm.com; Carsey, Jaben ; Ni,
> Ray ; Gao, Zhichao ;
> matteo.carl...@arm.com; stephanie.hughes-f...@arm.com; n...@arm.com
> Subject: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser
> 
> The ACPI 6.3 specification introduces a 'SPE overflow Interrupt' field as part
> of the GICC structure.
> 
> Update the MADT parser to decode this field and validate the interrupt ID
> used.
> 
> References:
> - ACPI 6.3 Specification - January 2019
> - Arm Generic Interrupt Controller Architecture Specification,
>   GIC architecture version 3 and version 4, issue E
> - Arm Server Base System Architecture 5.0
> 
> Signed-off-by: Krzysztof Koch 
> ---
> 
> Changes can be seen at:
> https://github.com/KrzysztofKoch1/edk2/tree/477_acpiview_spe_v2
> 
> Notes:
> v2:
> - Add include sandwich in MadtParser.h [Zhichao]
> - Add references to specifications in commit message [Zhichao]
> 
> v1:
> - Decode and validate SPE Overflow Interrupt field [Krzysztof]
> 
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 86 ++--
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> h | 40 +
>  2 files changed, 118 insertions(+), 8 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> index
> a1bf86ade5313f954a77b325c13394cfce133939..59c3df0cc8a080497b517baf36f
> c63f1e4ab866f 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> +++ er.c
> @@ -1,17 +1,21 @@
>  /** @file
>MADT table parser
> 
> -  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> +  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>@par Reference(s):
> -- ACPI 6.2 Specification - Errata A, September 2017
> +- ACPI 6.3 Specification - January 2019
> +- Arm Generic Interrupt Controller Architecture Specification,
> +  GIC architecture version 3 and version 4, issue E
> +- Arm Server Base System Architecture 5.0
>  **/
> 
>  #include 
>  #include 
>  #include "AcpiParser.h"
>  #include "AcpiTableParser.h"
> +#include "MadtParser.h"
> 
>  // Local Variables
>  STATIC CONST UINT8* MadtInterruptControllerType; @@ -33,6 +37,21 @@
> ValidateGICDSystemVectorBase (
>IN VOID*  Context
>);
> 
> +/**
> +  This function validates the SPE Overflow Interrupt in the GICC.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateSpeOverflowInterrupt (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  );
> +
>  /**
>An ACPI_PARSER array describing the GICC Interrupt Controller Structure.
>  **/
> @@ -56,7 +75,9 @@ STATIC CONST ACPI_PARSER GicCParser[] = {
>{L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL},
>{L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
> NULL},
> -  {L"Reserved", 3, 77, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
> +  {L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL},  {L"SPE
> + overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
> +ValidateSpeOverflowInterrupt, NULL}
>  };
> 
>  /**
> @@ -160,6 +181,55 @@ ValidateGICDSystemVectorBase (
>}
>  }
> 
> +/**
> +  This function validates the SPE Overflow Interrupt in the GICC.
> +
> +  @param [in] Ptr Pointer to the start of the field data.
> +  @param [in] Context Pointer to context specific information e.g. this
> +  could be a pointer to the ACPI table header.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +ValidateSpeOverflowInterrupt (
> +  IN UINT8* Ptr,
> +  IN VOID*  Context
> +  )
> +{
> +  UINT16 SpeOverflowInterrupt;
> +
> +  SpeOverflowInterrupt = *(UINT16*)Ptr;
> +
> +  // SPE not supported by this processor  if (SpeOverflowInterrupt ==
> + 0) {
> +return;
> +  }
> +
> +  if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
> +  ((SpeOverflowInte

Re: [edk2-devel] [PATCH v1 1/1] ShellPkg/acpiview: GTDT updates for ACPI 6.3

2019-06-09 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

I would collect the R-B and send to the maintainer to push.

Thanks,
Zhichao

> -Original Message-
> From: PierreGondois [mailto:pierre.gond...@arm.com]
> Sent: Thursday, June 6, 2019 8:29 PM
> To: devel@edk2.groups.io
> Cc: Carsey, Jaben ; Ni, Ray ;
> Gao, Zhichao ; sami.muja...@arm.com;
> matteo.carl...@arm.com; stephanie.hughes-f...@arm.com;
> pierre.gond...@arm.com; n...@arm.com
> Subject: [PATCH v1 1/1] ShellPkg/acpiview: GTDT updates for ACPI 6.3
> 
> From: Pierre Gondois 
> 
> The ACPI 6.3 specification introduces support to describe the ARMv8.1 virtual
> EL2 timers. This patch updates the GTDT parser of acpiview to decode the EL2
> virtual timer fields.
> 
> Signed-off-by: Pierre Gondois 
> ---
> 
> The changes can be seen at:
> https://github.com/PierreARM/edk2/tree/382_acpiview_gtdt_acpi6_3_upd
> ate_v1
> 
> Notes:
> v1:
> - GTDT updates for ACPI 6.3 [Pierre]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> index
> 1b7e56486c8fb98a8fe063ae5fa25d86500a58a9..3b05ff3015d4a3af62dd9fab05
> 7c32369a456267 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars
> +++ er.c
> @@ -5,7 +5,7 @@
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>@par Reference(s):
> -- ACPI 6.2 Specification - Errata A, September 2017
> +- ACPI 6.3 Specification - January 2019
>**/
> 
>  #include 
> @@ -77,7 +77,9 @@ STATIC CONST ACPI_PARSER GtdtParser[] = {
>{L"Platform Timer Count", 4, 88, L"%d", NULL,
> (VOID**), NULL, NULL},
>{L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
> -   (VOID**), NULL, NULL}
> +   (VOID**), NULL, NULL},  {L"Virtual EL2 Timer
> + GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},  {L"Virtual EL2 Timer
> + Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}
>  };
> 
>  /**
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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

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



[edk2-devel] [PATCH 0/6] Change the performance code

2019-06-10 Thread Gao, Zhichao
Add and rdjust the performance code.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Chao Zhang 
Cc: Jiewen Yao 

Bret Barkelew (6):
  MdeModulePkg/DxeMain: Add performance code
  MdeModule/PeiMain: Add performance code
  MdeModulePkg/UefiBootManagerLib: Change performance code
  SecurityPkg/Tcg2Dxe: Change performance code
  SecurityPkg/Tcg2Pei: Change performance code
  IntelSiliconPkg/IntelVtdDxe: Change the performance code

 .../Feature/VTd/IntelVTdDxe/IntelVTdDxe.c   | 13 +++--
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c   |  2 ++
 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c   | 10 ++
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c|  9 -
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c   |  6 ++
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c   |  8 +++-
 6 files changed, 24 insertions(+), 24 deletions(-)

-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 2/6] MdeModule/PeiMain: Add performance code

2019-06-10 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add performance code for PeiDisaptcher function and Image function.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index ba2fd0cae1..0caffe653b 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -983,6 +983,8 @@ PeiDispatcher (
   EFI_FV_FILE_INFOFvFileInfo;
   PEI_CORE_FV_HANDLE  *CoreFvHandle;
 
+  PERF_FUNCTION_BEGIN ();
+
   PeiServices = (CONST EFI_PEI_SERVICES **) >Ps;
   PeimEntryPoint = NULL;
   PeimFileHandle = NULL;
@@ -1004,6 +1006,7 @@ PeiDispatcher (
   Private->CurrentFileHandle   = PeimFileHandle;
   Private->CurrentPeimFvCount  = Index1;
   Private->CurrentPeimCount= Index2;
+  PERF_LOAD_IMAGE_BEGIN (NULL);
   Status = PeiLoadImage (
 (CONST EFI_PEI_SERVICES **) >Ps,
 PeimFileHandle,
@@ -1012,6 +1015,7 @@ PeiDispatcher (
 
 );
   if (Status == EFI_SUCCESS) {
+PERF_LOAD_IMAGE_END (PeimFileHandle);
 //
 // PEIM_STATE_REGISTER_FOR_SHADOW move to PEIM_STATE_DONE
 //
@@ -1118,6 +1122,7 @@ PeiDispatcher (
   //
   // For PEIM driver, Load its entry point
   //
+  PERF_LOAD_IMAGE_BEGIN (NULL);
   Status = PeiLoadImage (
  PeiServices,
  PeimFileHandle,
@@ -1126,6 +1131,7 @@ PeiDispatcher (
  
  );
   if (Status == EFI_SUCCESS) {
+PERF_LOAD_IMAGE_END (PeimFileHandle);
 //
 // The PEIM has its dependencies satisfied, and its entry point
 // has been found, so invoke it.
@@ -1197,6 +1203,7 @@ PeiDispatcher (
 //
 // Load PEIM into Memory for Register for shadow PEIM.
 //
+PERF_LOAD_IMAGE_BEGIN (NULL);
 Status = PeiLoadImage (
PeiServices,
PeimFileHandle,
@@ -1205,6 +1212,7 @@ PeiDispatcher (

);
 if (Status == EFI_SUCCESS) {
+  PERF_LOAD_IMAGE_END (PeimFileHandle);
   PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint;
 }
   }
@@ -1252,6 +1260,8 @@ PeiDispatcher (
 //
   } while (Private->PeimNeedingDispatch && Private->PeimDispatchOnThisPass);
 
+  PERF_FUNCTION_END ();
+
 }
 
 /**
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 4/6] SecurityPkg/Tcg2Dxe: Change performance code

2019-06-10 Thread Gao, Zhichao
From: Bret Barkelew 

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

Use PERF_FUNCTION_BEGIN and PERF_FUNCTION_END to replace
PERF_START_EX and PERF_FUNCTION_END.

Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Jian Wang 
Signed-off-by: Zhichao Gao 
---
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c 
b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
index a2729457b7..001e0aac4d 100644
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
@@ -45,8 +45,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 
-#define PERF_ID_TCG2_DXE  0x3120
-
 typedef struct {
   CHAR16 *VariableName;
   EFI_GUID   *VendorGuid;
@@ -2250,7 +2248,7 @@ OnReadyToBoot (
   EFI_STATUSStatus;
   TPM_PCRINDEX  PcrIndex;
 
-  PERF_START_EX (mImageHandle, "EventRec", "Tcg2Dxe", 0, PERF_ID_TCG2_DXE);
+  PERF_FUNCTION_BEGIN ();
   if (mBootAttempts == 0) {
 
 //
@@ -2332,7 +2330,7 @@ OnReadyToBoot (
   // Increase boot attempt counter.
   //
   mBootAttempts++;
-  PERF_END_EX (mImageHandle, "EventRec", "Tcg2Dxe", 0, PERF_ID_TCG2_DXE + 1);
+  PERF_FUNCTION_END ();
 }
 
 /**
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 6/6] IntelSiliconPkg/IntelVtdDxe: Change the performance code

2019-06-10 Thread Gao, Zhichao
From: Bret Barkelew 

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

Use PERF_INMODULE_BEGIN and PERF_INMODULE_END to replace
PERF_CODE.

Cc: Ray Ni 
Cc: Rangasai V Chaganty 
Signed-off-by: Zhichao Gao 
---
 .../Feature/VTd/IntelVTdDxe/IntelVTdDxe.c   | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c 
b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
index a6287be2cf..501933da5c 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.c
@@ -230,7 +230,6 @@ VTdSetAttribute (
   UINT16   Segment;
   VTD_SOURCE_IDSourceId;
   CHAR8PerfToken[sizeof("VTD(S.B00.D00.F00)")];
-  UINT32   Identifier;
 
   DumpVtdIfError ();
 
@@ -257,18 +256,12 @@ VTdSetAttribute (
 }
 Status = RequestAccessAttribute (Segment, SourceId, DeviceAddress, Length, 
IoMmuAccess);
   } else {
-PERF_CODE (
-  AsciiSPrint (PerfToken, sizeof(PerfToken), "S%04xB%02xD%02xF%01x", 
Segment, SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function);
-  Identifier = (Segment << 16) | SourceId.Uint16;
-  PERF_START_EX (gImageHandle, PerfToken, "IntelVTD", 0, Identifier);
-);
+AsciiSPrint (PerfToken, sizeof (PerfToken), "S%04xB%02xD%02xF%01x", 
Segment, SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function);
+PERF_INMODULE_BEGIN (PerfToken);
 
 Status = SetAccessAttribute (Segment, SourceId, DeviceAddress, Length, 
IoMmuAccess);
 
-PERF_CODE (
-  Identifier = (Segment << 16) | SourceId.Uint16;
-  PERF_END_EX (gImageHandle, PerfToken, "IntelVTD", 0, Identifier);
-);
+PERF_INMODULE_END (PerfToken);
   }
 
   if (!EFI_ERROR(Status)) {
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 1/6] MdeModulePkg/DxeMain: Add performance code

2019-06-10 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add missing PERF_FUNCTION_END before the return statement.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index c310b40b52..001a26aa62 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -418,6 +418,7 @@ CoreDispatcher (
 //
 // If the dispatcher is running don't let it be restarted.
 //
+PERF_FUNCTION_END ();
 return EFI_ALREADY_STARTED;
   }
 
@@ -432,6 +433,7 @@ CoreDispatcher (
  
  );
   if (EFI_ERROR (Status)) {
+PERF_FUNCTION_END ();
 return Status;
   }
 
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 3/6] MdeModulePkg/UefiBootManagerLib: Change performance code

2019-06-10 Thread Gao, Zhichao
From: Bret Barkelew 

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

Use PERF_INMODULE_BEGIN and PERF_INMODULE_END to replace PERF_START_EX,
PERF_CODE and PERF_END_EX.
Use PERF_CROSSMODULE_END and PERF_CROSSMODULE_BEGIN to get the info
of one boot image's performance.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 952033fc82..af1024cacd 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1812,7 +1812,7 @@ EfiBootManagerBoot (
 BmRepairAllControllers (0);
   }
 
-  PERF_START_EX (gImageHandle, "BdsAttempt", NULL, 0, (UINT32) OptionNumber);
+  PERF_INMODULE_BEGIN ("BdsAttempt");
 
   //
   // 5. Adjust the different type memory page number just before booting
@@ -1932,9 +1932,9 @@ EfiBootManagerBoot (
   //
   // Write boot to OS performance data for UEFI boot
   //
-  PERF_CODE (
-BmEndOfBdsPerfCode (NULL, NULL);
-  );
+  PERF_INMODULE_END ("BdsAttempt");
+  PERF_CROSSMODULE_END ("BDS");
+  PERF_CROSSMODULE_BEGIN ("BDS");
 
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, PcdGet32 
(PcdProgressCodeOsLoaderStart));
 
@@ -1947,7 +1947,6 @@ EfiBootManagerBoot (
 //
 BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED, Status);
   }
-  PERF_END_EX (gImageHandle, "BdsAttempt", NULL, 0, (UINT32) OptionNumber);
 
   //
   // Destroy the RAM disk
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 5/6] SecurityPkg/Tcg2Pei: Change performance code

2019-06-10 Thread Gao, Zhichao
From: Bret Barkelew 

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

Use PERF_FUNCTION_BEGIN and PERF_FUNCTION_END to replace
PERF_START_EX and PERF_FUNCTION_END.

Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Jian Wang 
Signed-off-by: Zhichao Gao 
---
 SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c 
b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
index f28f33fdec..4b5388726c 100644
--- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
+++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c
@@ -1,7 +1,7 @@
 /** @file
   Initialize TPM2 device and measure FVs before handing off control to DXE.
 
-Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
 Copyright (c) 2017, Microsoft Corporation.  All rights reserved. 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -38,8 +38,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 
-#define PERF_ID_TCG2_PEI  0x3080
-
 typedef struct {
   EFI_GUID   *EventGuid;
   EFI_TCG2_EVENT_LOG_FORMAT  LogFormat;
@@ -651,7 +649,7 @@ MeasureMainBios (
   EFI_FV_INFO   VolumeInfo;
   EFI_PEI_FIRMWARE_VOLUME_PPI   *FvPpi;
 
-  PERF_START_EX (mFileHandle, "EventRec", "Tcg2Pei", 0, PERF_ID_TCG2_PEI);
+  PERF_FUNCTION_BEGIN ();
 
   //
   // Only measure BFV at the very beginning. Other parts of Static Core Root of
@@ -682,7 +680,7 @@ MeasureMainBios (
 
   Status = MeasureFvImage ((EFI_PHYSICAL_ADDRESS) (UINTN) VolumeInfo.FvStart, 
VolumeInfo.FvSize);
 
-  PERF_END_EX (mFileHandle, "EventRec", "Tcg2Pei", 0, PERF_ID_TCG2_PEI + 1);
+  PERF_FUNCTION_END ();
 
   return Status;
 }
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH V4 2/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

2019-06-18 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1678

Use the PcdPlatformRecoverySupport to control the function
of platform recovery in BDS.
First, set the variable's ("OsIndicationsSupported")
EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY bit base on the pcd.
It would affect the variable "OsIndications".
While the platform does not support the platform recovery,
it is inappropriate to set a PlatformRecovery variable. So
skip setting the variable. But it should remain the behavior of
booting from a default file path (such as \EFI\BOOT\BOOTX64.EFI)
to be compatible with the previous version UEFI spec.

Add memory check before build platform default boot option. If
fail to allocate memory for the defualt boot file path, put the
system into dead loop to indicate it is unable to boot.

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 
---
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
 2 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf 
b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
index 6913389d34..7f94ca17df 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -5,7 +5,7 @@
 #  gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will 
invoke Entry
 #  interface of protocol gEfiBdsArchProtocolGuid, then BDS phase is entered.
 #
-#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -95,6 +95,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable  ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed   ## 
CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport   ## 
CONSUMES
 
 [Depex]
   TRUE
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index 9d312bd982..4f3168b62a 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -5,7 +5,7 @@
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be 
invoked
   to enter BDS phase.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -546,10 +546,14 @@ BdsFormalizeOSIndicationVariable (
   //
   Status = EfiBootManagerGetBootManagerMenu ();
   if (Status != EFI_NOT_FOUND) {
-OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI | 
EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
+OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
 EfiBootManagerFreeLoadOption ();
   } else {
-OsIndicationSupport = EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
+OsIndicationSupport = 0;
+  }
+
+  if (PcdGetBool (PcdPlatformRecoverySupport)) {
+OsIndicationSupport |= EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
   }
 
   Status = gRT->SetVariable (
@@ -662,6 +666,7 @@ BdsEntry (
   BOOLEAN BootSuccess;
   EFI_DEVICE_PATH_PROTOCOL*FilePath;
   EFI_STATUS  BootManagerMenuStatus;
+  EFI_BOOT_MANAGER_LOAD_OPTIONPlatformDefaultBootOption;
 
   HotkeyTriggered = NULL;
   Status  = EFI_SUCCESS;
@@ -763,14 +768,13 @@ BdsEntry (
   //
   InitializeLanguage (TRUE);
 
-  //
-  // System firmware must include a PlatformRecovery variable specifying
-  // a short-form File Path Media Device Path containing the platform default
-  // file path for removable media
-  //
   FilePath = FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME);
+  if (FilePath == NULL) {
+DEBUG ((DEBUG_ERROR, "Fail to allocate memory for defualt boot file path. 
Unable to boot.\n"));
+CpuDeadLoop ();
+  }
   Status = EfiBootManagerInitializeLoadOption (
- ,
+ ,
  LoadOptionNumberUnassigned,
  LoadOptionTypePlatformRecovery,
  LOAD_OPTION_ACTIVE,
@@ -780,24 +784,31 @@ BdsEntry (
  0
  );
   ASSERT_EFI_ERROR (Status);
-  LoadOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypePlatformRecovery);
-  if (EfiBootManagerFindLoadOption (, LoadOptions, LoadOptionCount) 
== -1) {
-for (Index = 0; Index < LoadOptionCount; Index++) {
-  //
-  // The PlatformRecovery options are sorted by OptionNumber.
-  // Find the the smallest unused number as the new OptionNumber.
-  //
-  if (LoadOptions[Index].OptionNumber != Index) {
-break;
+
+  //
+  // 

[edk2-devel] [PATCH V4 1/2] MdeModulePkg: Add a pcd to set the OS indications bit

2019-06-18 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add a pcd PcdPlatformRecoverySupport to conditionally
set an OS indications bit and set the 'PlatformRecovery'
variable. This pcd would also control whether the BDS
support platform recovery or not.
Update the uni file for description of the pcd.

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 
---
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 MdeModulePkg/MdeModulePkg.uni | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 0a9fcddecc..da2b85770c 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1660,6 +1660,12 @@
   # @Prompt Reset on memory type information change.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE|BOOLEAN|0x00010056
 
+  ## Indicates if the BDS supports Platform Recovery.
+  #   TRUE  - BDS supports Platform Recovery.
+  #   FALSE - BDS does not support Platform Recovery.
+  # @Prompt Support Platform Recovery.
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport|TRUE|BOOLEAN|0x00010078
+
   ## Specify the foreground color for Subtile text in HII Form Browser. The 
default value is EFI_BLUE.
   #  Only following values defined in UEFI specification are valid:
   #  0x00 (EFI_BLACK)
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index ed8ac9eadc..a265452eba 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -441,6 +441,8 @@
 
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdResetOnMemoryTypeInformationChange_PROMPT 
 #language en-US "Reset on memory type information change"
 
+#string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdResetOnMemoryTypeInformationChange  
#language en-US "Indicate the system support platform recovery or not"
+
 #string 
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdResetOnMemoryTypeInformationChange_HELP  
#language en-US "Indicates if to reset system when memory type information 
changes.\n"

"TRUE  - Resets system when memory type information 
changes.\n"

"FALSE - Does not reset system when memory type 
information changes."
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH V4 0/2] Use a pcd to control Platform Recovery behavior

2019-06-18 Thread Gao, Zhichao
V1:
Add a pcd PcdPlatformRecoverySupport to control the variable
PlatformRecovery and the EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY
bit of variable "OsIndicationsSupported".

V2:
While PcdPlatformRecoverySupport is FALSE, do not set a PlatformRecovery
Variable.
But remain boot from a default file path(such as \EFI\BOOT\BOOTX64.EFI).
Add memory check before build platform default boot option.

V3:
Modify the memory check operation. If fail to allocate memory for the defualt
boot file path, put the system into dead loop to indicate it is unable to boot.

v4:
Add the description of PcdPlatformRecoverySupport in MdeModulePkg.uni
Fix incorrect check of LoadOption. Should check PlatformDefaultBootOption.

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: Add a pcd to set the OS indications bit

Zhichao Gao (1):
  MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

 MdeModulePkg/MdeModulePkg.dec|  6 ++
 MdeModulePkg/MdeModulePkg.uni|  2 +
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
 4 files changed, 55 insertions(+), 27 deletions(-)

-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH] MdeModulePkg/CapsulePei: Add memory pointer check

2019-06-24 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1935

Before use the memory that is allocated through AllocateZeroPool,
we should check the memory pointer is valid to avoid using the
NULL pointer.
Add check for VariableArrayAddress that is returned from
GetScatterGatherHeadEntries. If it is NULL, directly return
the error status.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Universal/CapsulePei/UefiCapsule.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c 
b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index 8d4ae69bb2..51afab7b05 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -965,6 +965,10 @@ GetScatterGatherHeadEntries (
 //
 if ((ValidIndex + 1) >= TempListLength) {
   EnlargedTempList = AllocateZeroPool (TempListLength * 2);
+  if (EnlargedTempList == NULL) {
+DEBUG ((DEBUG_ERROR, "Fail to allocate memory!\n"));
+return EFI_OUT_OF_RESOURCES;
+  }
   CopyMem (EnlargedTempList, TempList, TempListLength);
   FreePool (TempList);
   TempList = EnlargedTempList;
@@ -1056,7 +1060,7 @@ CapsuleCoalesce (
   // Get SG list entries
   //
   Status = GetScatterGatherHeadEntries (, );
-  if (EFI_ERROR (Status)) {
+  if (EFI_ERROR (Status) || VariableArrayAddress == NULL) {
 DEBUG ((DEBUG_ERROR, "%a failed to get Scatter Gather List Head Entries.  
Status = %r\n", __FUNCTION__, Status));
 goto Done;
   }
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH V2] UefiCpuPkg/MpInitLib: MicrocodeDetect: Ensure checked range is valid

2019-06-25 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1934

V1:
Originally, the checksum part would done before verfiy the microcode
data. Which meas the checksum would be done for a meaningless data.
It would cause a incorrect TotalSize (the size of microcode data),
then incorrect checksum and incorrect pointer increasing would happen.
To fix this, move the checksum part 1 section in
'if (MicrocodeEntryPoint->HeaderVersion == 0x1)' section for a valid
microcode data.

V2:
'if (MicrocodeEntryPoint->HeaderVersion == 0x1)' condition doesn't
make sure the entry data is a valid microcode. So abandon it. Instead,
make sure the checked data is in the microcode data range. Because the
DataSize of non microcde data may make (MicrocodeEntryPoint + TotalSize)
larger than 0x. For PEI driver, UINTN is 32bit and the result is
overflow and it may be a very small value. That means the checksum check
would be done out of the microcode range.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 UefiCpuPkg/Library/MpInitLib/Microcode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c 
b/UefiCpuPkg/Library/MpInitLib/Microcode.c
index 4763dcfebe..6c0995cb0d 100644
--- a/UefiCpuPkg/Library/MpInitLib/Microcode.c
+++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation of loading microcode on processors.
 
-  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -170,6 +170,7 @@ MicrocodeDetect (
 /// Check overflow and whether TotalSize is aligned with 4 bytes.
 ///
 if ( ((UINTN)MicrocodeEntryPoint + TotalSize) > MicrocodeEnd ||
+ ((UINTN)MicrocodeEntryPoint + TotalSize) < (UINTN) 
CpuMpData->MicrocodePatchAddress ||
  (TotalSize & 0x3) != 0
) {
   MicrocodeEntryPoint = (CPU_MICROCODE_HEADER *) (((UINTN) 
MicrocodeEntryPoint) + SIZE_1KB);
-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH] CryptoPkg: Add lacking instances for build only

2019-06-12 Thread Gao, Zhichao
I would fix the typo and replace the word 'lacking' with 'missing' in both BZ 
and the subject.

Thanks,
Zhichao

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Laszlo Ersek
> Sent: Wednesday, June 12, 2019 4:38 PM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Bret Barkelew ; Wang, Jian J
> ; Ye, Ting ; Gao, Liming
> ; Sean Brogan ;
> Michael Turner 
> Subject: Re: [edk2-devel] [PATCH] CryptoPkg: Add lacking instances for build
> only
> 
> On 06/12/19 04:39, Gao, Zhichao wrote:
> > From: Bret Barkelew 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1900
> >
> > Add the lacking instance to [Componnets] of dsc file for build only.
> >
> > Cc: Jian Wang 
> > Cc: Ting Ye 
> > Cc: Liming Gao 
> > Cc: Sean Brogan 
> > Cc: Michael Turner 
> > Cc: Bret Barkelew 
> > Signed-off-by: Zhichao Gao 
> > ---
> >  CryptoPkg/CryptoPkg.dsc | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc index
> > 9dfa349f6d..c90e76c721 100644
> > --- a/CryptoPkg/CryptoPkg.dsc
> > +++ b/CryptoPkg/CryptoPkg.dsc
> > @@ -116,6 +116,7 @@
> >CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> >CryptoPkg/Library/TlsLib/TlsLib.inf
> >CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > +  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> >
> >  [Components.IA32, Components.X64]
> >CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> >
> 
> I'd like to suggest wording / spelling improvements:
> 
> - [Componnets] should be [Components]
> 
> - While I'm not a native English speaker, I believe "missing" would be more
> precise than "lacking". To me, "lacking" implies that the library instances in
> question have shortcomings. However, that's not what we mean here --
> those library instances are just fine, they are just missing from the DSC 
> files.
> Hence my suggestion to say "missing" (in both the subject line and the
> commit message).
> 
> Thank you
> Laszlo
> 
> 


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

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



Re: [edk2-devel] [PATCH] MdeModulePkg/PeiMain: Substantial change for PeiAllocatePool

2019-06-12 Thread Gao, Zhichao
Thanks for the comments.
Your example makes the purpose clear. I would update the subject like that.

Thanks,
Zhichao

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Laszlo Ersek
> Sent: Wednesday, June 12, 2019 4:34 PM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Bret Barkelew ; Wang, Jian J
> ; Wu, Hao A ; Ni, Ray
> ; Zeng, Star ; Gao, Liming
> ; Sean Brogan ;
> Michael Turner 
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PeiMain: Substantial
> change for PeiAllocatePool
> 
> Hi Zhichao,
> 
> On 06/12/19 06:50, Gao, Zhichao wrote:
> > From: Bret Barkelew 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1901
> >
> > The original logic is ASSERT if fail to create HOB. But that doesn't
> > make sense for release version. So it is required to set the Buffer to
> > null to indicate the failure.
> 
> this patch may or may not be worthwhile; that's for the PEI Core maintainers
> to evaluate.
> 
> Either way, the subject line is completely useless. "Substantial change"
> means nothing at all. Please write a subject line that reflects what this 
> patch
> *actually does*.
> 
> For example:
> 
> MdeModulePkg/PeiMain: PeiAllocatePool: output NULL if HOB creation fails
> 
> (72 characters).
> 
> Thanks
> Laszlo
> 
> > 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 
> > ---
> >  MdeModulePkg/Core/Pei/Memory/MemoryServices.c | 7 ++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
> > b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
> > index 42f79ab076..37b0cfa3cf 100644
> > --- a/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
> > +++ b/MdeModulePkg/Core/Pei/Memory/MemoryServices.c
> > @@ -802,7 +802,12 @@ PeiAllocatePool (
> >   (VOID **)
> >   );
> >ASSERT_EFI_ERROR (Status);
> > -  *Buffer = Hob+1;
> > +
> > +  if (EFI_ERROR (Status)) {
> > +*Buffer = NULL;
> > +  } else {
> > +*Buffer = Hob+1;
> > +  }
> >
> >return Status;
> >  }
> >
> 
> 
> 


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

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



[edk2-devel] [PATCH v2] SecurityPkg: Add missing instances for build only

2019-06-14 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add the missing instances to the [Components] of dsc file
for build only.

Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Jian Wang 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
  V2: fix with Laszlo's comment: https://edk2.groups.io/g/devel/message/42273

 SecurityPkg/SecurityPkg.dsc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index a2ee0528f0..ed0da7563d 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -199,6 +199,12 @@
   SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
   
SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/FmpAuthenticationLibRsa2048Sha256.inf
 
+  SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf
+  SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
+  SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
+  SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
+  SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf
+
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
   SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
 
-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH V4 1/2] MdeModulePkg: Add a pcd to set the OS indications bit

2019-06-19 Thread Gao, Zhichao
I am so sorry for my mistake.
There are still ECC errors in the change of uni file. The additional string 
should be
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPlatformRecoverySupport_PROMPT
STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPlatformRecoverySupport_HELP

I would update the patch.

Thanks,
Zhichao

> -Original Message-
> From: Ni, Ray
> Sent: Wednesday, June 19, 2019 1:06 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Bret Barkelew ; Wang, Jian J
> ; Wu, Hao A ; Zeng, Star
> ; Gao, Liming ; Sean Brogan
> ; Michael Turner
> 
> Subject: RE: [PATCH V4 1/2] MdeModulePkg: Add a pcd to set the OS
> indications bit
> 
> Reviewed-by: Ray Ni 
> 
> > -Original Message-
> > From: Gao, Zhichao
> > Sent: Wednesday, June 19, 2019 11:10 AM
> > To: devel@edk2.groups.io
> > Cc: Bret Barkelew ; Wang, Jian J
> > ; Wu, Hao A ; Ni, Ray
> > ; Zeng, Star ; Gao, Liming
> > ; Sean Brogan ;
> > Michael Turner 
> > Subject: [PATCH V4 1/2] MdeModulePkg: Add a pcd to set the OS
> > indications bit
> >
> > From: Bret Barkelew 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1678
> >
> > Add a pcd PcdPlatformRecoverySupport to conditionally set an OS
> > indications bit and set the 'PlatformRecovery'
> > variable. This pcd would also control whether the BDS support platform
> > recovery or not.
> > Update the uni file for description of the pcd.
> >
> > 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 
> > ---
> >  MdeModulePkg/MdeModulePkg.dec | 6 ++
> > MdeModulePkg/MdeModulePkg.uni | 2 ++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > b/MdeModulePkg/MdeModulePkg.dec index 0a9fcddecc..da2b85770c
> > 100644
> > --- a/MdeModulePkg/MdeModulePkg.dec
> > +++ b/MdeModulePkg/MdeModulePkg.dec
> > @@ -1660,6 +1660,12 @@
> ># @Prompt Reset on memory type information change.
> >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> h
> > ange|TRUE|BOOLEAN|0x00010056
> >
> > +  ## Indicates if the BDS supports Platform Recovery.
> > +  #   TRUE  - BDS supports Platform Recovery.
> > +  #   FALSE - BDS does not support Platform Recovery.
> > +  # @Prompt Support Platform Recovery.
> > +
> > +
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport|TRUE|B
> O
> > OLEAN
> > + |0x00010078
> > +
> >## Specify the foreground color for Subtile text in HII Form
> > Browser. The default value is EFI_BLUE.
> >#  Only following values defined in UEFI specification are valid:
> >#  0x00 (EFI_BLACK)
> > diff --git a/MdeModulePkg/MdeModulePkg.uni
> > b/MdeModulePkg/MdeModulePkg.uni index ed8ac9eadc..a265452eba
> > 100644
> > --- a/MdeModulePkg/MdeModulePkg.uni
> > +++ b/MdeModulePkg/MdeModulePkg.uni
> > @@ -441,6 +441,8 @@
> >
> >  #string
> >
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdResetOnMemoryTypeInforma
> ti
> > onChange_PROMPT  #language en-US "Reset on memory type information
> > change"
> >
> > +#string
> >
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdResetOnMemoryTypeInforma
> ti
> > onChange  #language en-US "Indicate the system support platform
> > recovery or not"
> > +
> >  #string
> >
> STR_gEfiMdeModulePkgTokenSpaceGuid_PcdResetOnMemoryTypeInforma
> ti
> > onChange_HELP  #language en-US "Indicates if to reset system when
> > memory type information changes.\n"
> >
> > "TRUE  - Resets system when memory type information changes.\n"
> >
> > "FALSE - Does not reset system when memory type information
> changes."
> > --
> > 2.21.0.windows.1


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

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



[edk2-devel] [PATCH v5 1/2] MdeModulePkg: Add a pcd to set the OS indications bit

2019-06-19 Thread Gao, Zhichao
From: Bret Barkelew 

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

Add a pcd PcdPlatformRecoverySupport to conditionally
set an OS indications bit and set the 'PlatformRecovery'
variable. This pcd would also control whether the BDS
support platform recovery or not.
Update the uni file to add the prompt and help string base on
the description in dec file.

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 
---
 MdeModulePkg/MdeModulePkg.dec | 6 ++
 MdeModulePkg/MdeModulePkg.uni | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 2dee139ba3..ab51392262 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1640,6 +1640,12 @@
   # @Prompt Reset on memory type information change.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|TRUE|BOOLEAN|0x00010056
 
+  ## Indicates if the BDS supports Platform Recovery.
+  #   TRUE  - BDS supports Platform Recovery.
+  #   FALSE - BDS does not support Platform Recovery.
+  # @Prompt Support Platform Recovery.
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport|TRUE|BOOLEAN|0x00010078
+
   ## Specify the foreground color for Subtile text in HII Form Browser. The 
default value is EFI_BLUE.
   #  Only following values defined in UEFI specification are valid:
   #  0x00 (EFI_BLACK)
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index ed8ac9eadc..eda1fc043e 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -445,6 +445,12 @@

"TRUE  - Resets system when memory type information 
changes.\n"

"FALSE - Does not reset system when memory type 
information changes."
 
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPlatformRecoverySupport_PROMPT  
#language en-US "Support Platform Recovery"
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPlatformRecoverySupport_HELP  
#language en-US "Indicates if the BDS supports Platform Recovery.\n"
+   
 "TRUE  - BDS supports Platform Recovery.\n"
+   
 "FALSE - BDS does not support Platform Recovery."
+
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdBrowserSubtitleTextColor_PROMPT  
#language en-US "Foreground color for browser subtitle"
 
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdBrowserSubtitleTextColor_HELP  
#language en-US "Specify the foreground color for Subtitle text in HII Form 
Browser. The default value is EFI_BLUE. Only following values defined in UEFI 
specification are valid:\n"
-- 
2.21.0.windows.1


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

View/Reply Online (#42625): https://edk2.groups.io/g/devel/message/42625
Mute This Topic: https://groups.io/mt/32140506/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/2] MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

2019-06-19 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1678

Use the PcdPlatformRecoverySupport to control the function
of platform recovery in BDS.
First, set the variable's ("OsIndicationsSupported")
EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY bit base on the pcd.
It would affect the variable "OsIndications".
While the platform does not support the platform recovery,
it is inappropriate to set a PlatformRecovery variable. So
skip setting the variable. But it should remain the behavior of
booting from a default file path (such as \EFI\BOOT\BOOTX64.EFI)
to be compatible with the previous version UEFI spec.

Add memory check before build platform default boot option. If
fail to allocate memory for the defualt boot file path, put the
system into dead loop to indicate it is unable to boot.

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 
---
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
 2 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf 
b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
index 6913389d34..7f94ca17df 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -5,7 +5,7 @@
 #  gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will 
invoke Entry
 #  interface of protocol gEfiBdsArchProtocolGuid, then BDS phase is entered.
 #
-#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -95,6 +95,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable  ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed   ## 
CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport   ## 
CONSUMES
 
 [Depex]
   TRUE
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index 9d312bd982..4f3168b62a 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -5,7 +5,7 @@
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be 
invoked
   to enter BDS phase.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -546,10 +546,14 @@ BdsFormalizeOSIndicationVariable (
   //
   Status = EfiBootManagerGetBootManagerMenu ();
   if (Status != EFI_NOT_FOUND) {
-OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI | 
EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
+OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
 EfiBootManagerFreeLoadOption ();
   } else {
-OsIndicationSupport = EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
+OsIndicationSupport = 0;
+  }
+
+  if (PcdGetBool (PcdPlatformRecoverySupport)) {
+OsIndicationSupport |= EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
   }
 
   Status = gRT->SetVariable (
@@ -662,6 +666,7 @@ BdsEntry (
   BOOLEAN BootSuccess;
   EFI_DEVICE_PATH_PROTOCOL*FilePath;
   EFI_STATUS  BootManagerMenuStatus;
+  EFI_BOOT_MANAGER_LOAD_OPTIONPlatformDefaultBootOption;
 
   HotkeyTriggered = NULL;
   Status  = EFI_SUCCESS;
@@ -763,14 +768,13 @@ BdsEntry (
   //
   InitializeLanguage (TRUE);
 
-  //
-  // System firmware must include a PlatformRecovery variable specifying
-  // a short-form File Path Media Device Path containing the platform default
-  // file path for removable media
-  //
   FilePath = FileDevicePath (NULL, EFI_REMOVABLE_MEDIA_FILE_NAME);
+  if (FilePath == NULL) {
+DEBUG ((DEBUG_ERROR, "Fail to allocate memory for defualt boot file path. 
Unable to boot.\n"));
+CpuDeadLoop ();
+  }
   Status = EfiBootManagerInitializeLoadOption (
- ,
+ ,
  LoadOptionNumberUnassigned,
  LoadOptionTypePlatformRecovery,
  LOAD_OPTION_ACTIVE,
@@ -780,24 +784,31 @@ BdsEntry (
  0
  );
   ASSERT_EFI_ERROR (Status);
-  LoadOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypePlatformRecovery);
-  if (EfiBootManagerFindLoadOption (, LoadOptions, LoadOptionCount) 
== -1) {
-for (Index = 0; Index < LoadOptionCount; Index++) {
-  //
-  // The PlatformRecovery options are sorted by OptionNumber.
-  // Find the the smallest unused number as the new OptionNumber.
-  //
-  if (LoadOptions[Index].OptionNumber != Index) {
-break;
+
+  //
+  // 

[edk2-devel] [PATCH v5 0/2] Use a pcd to control Platform Recovery behavior

2019-06-19 Thread Gao, Zhichao
V1:
Add a pcd PcdPlatformRecoverySupport to control the variable
PlatformRecovery and the EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY
bit of variable "OsIndicationsSupported".

V2:
While PcdPlatformRecoverySupport is FALSE, do not set a PlatformRecovery
Variable.
But remain boot from a default file path(such as \EFI\BOOT\BOOTX64.EFI).
Add memory check before build platform default boot option.

V3:
Modify the memory check operation. If fail to allocate memory for the defualt
boot file path, put the system into dead loop to indicate it is unable to boot.

v4:
Add the description of PcdPlatformRecoverySupport in MdeModulePkg.uni
Fix incorrect check of LoadOption. Should check PlatformDefaultBootOption.

v5:
Fix the incorrect string in MdeModulePkg.uni:
Add STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPlatformRecoverySupport_PROMPT
and STR_gEfiMdeModulePkgTokenSpaceGuid_PcdPlatformRecoverySupport_HELP
base on the description in MdeModulePkg.dec file.

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: Add a pcd to set the OS indications bit

Zhichao Gao (1):
  MdeModulePkg/BdsDxe: Use a pcd to control PlatformRecovery

 MdeModulePkg/MdeModulePkg.dec|  6 ++
 MdeModulePkg/MdeModulePkg.uni|  6 ++
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 71 +++-
 4 files changed, 59 insertions(+), 27 deletions(-)

-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH v1 2/2] ShellPkg: acpiview: Update SRAT parser to ACPI 6.3

2019-06-20 Thread Gao, Zhichao
We can review for your code change. And for our personal point, the change is 
OK.
But we can't verify this patch on our platform. For the patch which is not, it 
is better to do a test and get a tested-by from someone.

Thanks,
Zhichao

> -Original Message-
> From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> Sent: Thursday, June 20, 2019 10:54 PM
> To: devel@edk2.groups.io; Carsey, Jaben ; Ni, Ray
> ; Gao, Zhichao 
> Cc: Sami Mujawar ; nd 
> Subject: RE: [edk2-devel] [PATCH v1 2/2] ShellPkg: acpiview: Update SRAT
> parser to ACPI 6.3
> 
> Hi,
> 
> Is there any way I can help to get this patch merged upstream?
> 
> Kind regards,
> 
> Krzysztof
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Carsey,
> Jaben via Groups.Io
> Sent: Wednesday, June 12, 2019 21:58
> To: devel@edk2.groups.io; Krzysztof Koch 
> Cc: Ni, Ray ; Gao, Zhichao ;
> Kinney, Michael D ; Gao, Liming
> ; Sami Mujawar ; Matteo
> Carlini ; Stephanie Hughes-Fitt
> ; nd 
> Subject: Re: [edk2-devel] [PATCH v1 2/2] ShellPkg: acpiview: Update SRAT
> parser to ACPI 6.3
> 
> Reviewed-by: Jaben Carsey 
> 
> I don't have access to a platform with ACPI 6.3 to do a test.  Can someone do
> a test and respond with tested-by if possible?
> 
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Krzysztof Koch
> > Sent: Wednesday, June 12, 2019 7:11 AM
> > To: devel@edk2.groups.io
> > Cc: Carsey, Jaben ; Ni, Ray
> > ; Gao, Zhichao ; Kinney,
> > Michael D ; Gao, Liming
> > ; sami.muja...@arm.com;
> matteo.carl...@arm.com;
> > Stephanie.Hughes- f...@arm.com; n...@arm.com
> > Subject: [edk2-devel] [PATCH v1 2/2] ShellPkg: acpiview: Update SRAT
> > parser to ACPI 6.3
> > Importance: High
> >
> > Add support for parsing revision 3 of System Resource Affinity Table
> > (SRAT).
> >
> > Decode and dump the new Generic Initiator Affinity Structure.
> >
> > Validate the Device Handle Type field inside the Generic Initiator
> > Affinity Structure.
> >
> > Signed-off-by: Krzysztof Koch 
> > ---
> >
> > Changes can be seen at:
> > https://github.com/KrzysztofKoch1/edk2/tree/582_acpiview_6_3_srat_v1
> >
> > Notes:
> > v1:
> > - dump and validate the Generic Initiator Affinity Struct
> > [Krzysztof]
> >
> >  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c  |  
> > 35
> > ++-
> >  ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h  |  
> > 16
> ++
> >
> > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
> > |
> > 256 +++-
> >  3 files changed, 299 insertions(+), 8 deletions(-)
> >
> > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> > index
> >
> b5965507b498b9fa9bc4d3124b2285f509004c4f..60523936732f901317ee93d03f
> > e06df1403f3695 100644
> > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
> > @@ -1,7 +1,7 @@
> >  /** @file
> >ACPI parser
> >
> > -  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> > +  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
> >SPDX-License-Identifier: BSD-2-Clause-Patent  **/
> >
> > @@ -401,6 +401,39 @@ Dump8Chars (
> >  );
> >  }
> >
> > +/**
> > +  This function traces 12 characters which can be optionally
> > +  formated using the format string if specified.
> > +
> > +  If no format string is specified the Format must be NULL.
> > +
> > +  @param [in] Format  Optional format string for tracing the data.
> > +  @param [in] Ptr Pointer to the start of the buffer.
> > +**/
> > +VOID
> > +EFIAPI
> > +Dump12Chars (
> > +  IN CONST CHAR16* Format OPTIONAL,
> > +  IN   UINT8*  Ptr
> > +  )
> > +{
> > +  Print (
> > +(Format != NULL) ? Format : L"%c%c%c%c%c%c%c%c%c%c%c%c",
> > +Ptr[0],
> > +Ptr[1],
> > +Ptr[2],
> > +Ptr[3],
> > +Ptr[4],
> > +Ptr[5],
> > +Ptr[6],
> > +Ptr[7],
> > +Ptr[8],
> > +Ptr[9],
> > +Ptr[10],
> > +Ptr[11]
> > +);
> > +}
> > +
> >  /**
> >This function indents and prints the ACPI table Field Name.
> >
> > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiP

[edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Move checksum part for valid microcode data

2019-06-24 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1934

Originally, the checksum part would done before verfiy the microcode
data. Which meas the checksum would be done for a meaningless data.
It would cause a incorrect TotalSize (the size of microcode data),
then incorrect checksum and incorrect pointer increasing would happen.
To fix this, move the checksum part 1 section in
'if (MicrocodeEntryPoint->HeaderVersion == 0x1)' section for a valid
microcode data.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 UefiCpuPkg/Library/MpInitLib/Microcode.c | 52 
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c 
b/UefiCpuPkg/Library/MpInitLib/Microcode.c
index 4763dcfebe..f1a42f2d4e 100644
--- a/UefiCpuPkg/Library/MpInitLib/Microcode.c
+++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c
@@ -1,7 +1,7 @@
 /** @file
   Implementation of loading microcode on processors.
 
-  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -160,34 +160,34 @@ MicrocodeDetect (
 //
 CorrectMicrocode = FALSE;
 
-if (MicrocodeEntryPoint->DataSize == 0) {
-  TotalSize = sizeof (CPU_MICROCODE_HEADER) + 2000;
-} else {
-  TotalSize = sizeof (CPU_MICROCODE_HEADER) + 
MicrocodeEntryPoint->DataSize;
-}
+if (MicrocodeEntryPoint->HeaderVersion == 0x1) {
+  if (MicrocodeEntryPoint->DataSize == 0) {
+TotalSize = sizeof (CPU_MICROCODE_HEADER) + 2000;
+  } else {
+TotalSize = sizeof (CPU_MICROCODE_HEADER) + 
MicrocodeEntryPoint->DataSize;
+  }
 
-///
-/// Check overflow and whether TotalSize is aligned with 4 bytes.
-///
-if ( ((UINTN)MicrocodeEntryPoint + TotalSize) > MicrocodeEnd ||
- (TotalSize & 0x3) != 0
-   ) {
-  MicrocodeEntryPoint = (CPU_MICROCODE_HEADER *) (((UINTN) 
MicrocodeEntryPoint) + SIZE_1KB);
-  continue;
-}
+  ///
+  /// Check overflow and whether TotalSize is aligned with 4 bytes.
+  ///
+  if ( ((UINTN)MicrocodeEntryPoint + TotalSize) > MicrocodeEnd ||
+   (TotalSize & 0x3) != 0
+ ) {
+MicrocodeEntryPoint = (CPU_MICROCODE_HEADER *) (((UINTN) 
MicrocodeEntryPoint) + SIZE_1KB);
+continue;
+  }
 
-//
-// Save an in-complete CheckSum32 from CheckSum Part1 for common parts.
-//
-InCompleteCheckSum32 = CalculateSum32 (
- (UINT32 *) MicrocodeEntryPoint,
- TotalSize
- );
-InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorSignature.Uint32;
-InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorFlags;
-InCompleteCheckSum32 -= MicrocodeEntryPoint->Checksum;
+  //
+  // Save an in-complete CheckSum32 from CheckSum Part1 for common parts.
+  //
+  InCompleteCheckSum32 = CalculateSum32 (
+   (UINT32 *) MicrocodeEntryPoint,
+   TotalSize
+   );
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorSignature.Uint32;
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorFlags;
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->Checksum;
 
-if (MicrocodeEntryPoint->HeaderVersion == 0x1) {
   //
   // It is the microcode header. It is not the padding data between 
microcode patches
   // because the padding data should not include 0x0001 and it should 
be the repeated
-- 
2.21.0.windows.1


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

View/Reply Online (#42733): https://edk2.groups.io/g/devel/message/42733
Mute This Topic: https://groups.io/mt/32189383/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/1] ShellPkg: acpiview: ACPI 6.3 update for MADT parser

2019-06-12 Thread Gao, Zhichao
Thanks for the interpret. Seems I read the old version spec. Now it is clear 
for me.

Reviewed-by: Zhichao Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Krzysztof Koch
> Sent: Wednesday, June 12, 2019 6:44 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Sami Mujawar ; Carsey, Jaben
> ; Ni, Ray ; nd 
> Subject: Re: [edk2-devel] [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update
> for MADT parser
> 
> Hi Zhichao,
> 
> Please find my comments inline below. They are marked with [Krzysztof]
> 
> Kind regards,
> 
> Krzysztof
> 
> -Original Message-
> From: Gao, Zhichao 
> Sent: Monday, June 10, 2019 2:08
> To: Krzysztof Koch ; devel@edk2.groups.io
> Cc: Sami Mujawar ; Carsey, Jaben
> ; Ni, Ray ; Matteo Carlini
> ; Stephanie Hughes-Fitt  f...@arm.com>; nd 
> Subject: RE: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT
> parser
> 
> Sorry for late update.
> 
> > -Original Message-
> > From: Krzysztof Koch [mailto:krzysztof.k...@arm.com]
> > Sent: Friday, June 7, 2019 4:48 PM
> > To: devel@edk2.groups.io
> > Cc: sami.muja...@arm.com; Carsey, Jaben ; Ni,
> > Ray ; Gao, Zhichao ;
> > matteo.carl...@arm.com; stephanie.hughes-f...@arm.com; n...@arm.com
> > Subject: [PATCH v2 1/1] ShellPkg: acpiview: ACPI 6.3 update for MADT
> > parser
> >
> > The ACPI 6.3 specification introduces a 'SPE overflow Interrupt' field
> > as part of the GICC structure.
> >
> > Update the MADT parser to decode this field and validate the interrupt
> > ID used.
> >
> > References:
> > - ACPI 6.3 Specification - January 2019
> > - Arm Generic Interrupt Controller Architecture Specification,
> >   GIC architecture version 3 and version 4, issue E
> > - Arm Server Base System Architecture 5.0
> >
> > Signed-off-by: Krzysztof Koch 
> > ---
> >
> > Changes can be seen at:
> > https://github.com/KrzysztofKoch1/edk2/tree/477_acpiview_spe_v2
> >
> > Notes:
> > v2:
> > - Add include sandwich in MadtParser.h [Zhichao]
> > - Add references to specifications in commit message [Zhichao]
> >
> > v1:
> > - Decode and validate SPE Overflow Interrupt field [Krzysztof]
> >
> >
> >
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> > c | 86 ++--
> >
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> > h | 40 +
> >  2 files changed, 118 insertions(+), 8 deletions(-)
> >
> > diff --git
> >
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> >
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> > index
> >
> a1bf86ade5313f954a77b325c13394cfce133939..59c3df0cc8a080497b517baf36f
> > c63f1e4ab866f 100644
> > ---
> >
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> > +++
> >
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > +++ er.c
> > @@ -1,17 +1,21 @@
> >  /** @file
> >MADT table parser
> >
> > -  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
> > +  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
> >SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >@par Reference(s):
> > -- ACPI 6.2 Specification - Errata A, September 2017
> > +- ACPI 6.3 Specification - January 2019
> > +- Arm Generic Interrupt Controller Architecture Specification,
> > +  GIC architecture version 3 and version 4, issue E
> > +- Arm Server Base System Architecture 5.0
> >  **/
> >
> >  #include 
> >  #include 
> >  #include "AcpiParser.h"
> >  #include "AcpiTableParser.h"
> > +#include "MadtParser.h"
> >
> >  // Local Variables
> >  STATIC CONST UINT8* MadtInterruptControllerType; @@ -33,6 +37,21
> @@
> > ValidateGICDSystemVectorBase (
> >IN VOID*  Context
> >);
> >
> > +/**
> > +  This function validates the SPE Overflow Interrupt in the GICC.
> > +
> > +  @param [in] Ptr Pointer to the start of the field data.
> > +  @param [in] Context Pointer to context specific information e.g. this
> > +  could be a pointer to the ACPI table header.
> > +**/
> > +STATIC
> > +VOID
> > +EFIAPI
> > +ValidateSpeOverflowInterrupt (
> > +  IN UINT8* Ptr,
> > +  IN VOID*  Context
> > +  

[edk2-devel] [PATCH] CryptoPkg: Add lacking instances for build only

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

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

Add the lacking instance to [Componnets] of dsc file
for build only.

Cc: Jian Wang 
Cc: Ting Ye 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 CryptoPkg/CryptoPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 9dfa349f6d..c90e76c721 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -116,6 +116,7 @@
   CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
   CryptoPkg/Library/TlsLib/TlsLib.inf
   CryptoPkg/Library/OpensslLib/OpensslLib.inf
+  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
 
 [Components.IA32, Components.X64]
   CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH] SecurityPkg: Add lacking instances for build only

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

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

Add the lacking instance to the [Components] of dsc file
for build only.

Cc: Chao Zhang 
Cc: Jiewen Yao 
Cc: Jian Wang 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 SecurityPkg/SecurityPkg.dsc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index a2ee0528f0..ed0da7563d 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -199,6 +199,12 @@
   SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
   
SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/FmpAuthenticationLibRsa2048Sha256.inf
 
+  SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf
+  SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
+  SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
+  SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
+  SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf
+
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
   SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
 
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH] SourceLevelDebugPkg: Add lacking instances for build only

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

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

Add the lacking instance to the [Components] of dsc file
for build only.

Cc: Hao A Wu 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Leif Lindholm 
Signed-off-by: Zhichao gao 
---
 SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc 
b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index 8be6781296..a1a1b81d03 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -93,6 +93,8 @@
 
###
 
 [Components.common]
+  
SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+  
SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.inf
   
SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
   
SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.inf
   
SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH] MdeModulePkg: Add lacking instances for build only

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

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

Add the lacking instances to the [Components] of dsc file
for build only.

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 
---
 MdeModulePkg/MdeModulePkg.dsc | 16 
 1 file changed, 16 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 995fd805e1..f32adc3839 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -204,6 +204,22 @@
   MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.inf
   MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.inf
 
+  MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+  MdeModulePkg/Logo/Logo.inf
+  MdeModulePkg/Logo/LogoDxe.inf
+  MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
+  
MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+  MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
+  MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+  MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
+  MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+  MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
+  MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBridgeLibNull.inf
+  
MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf
+  MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+  MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.inf
+  
MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.inf
+
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
   MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
-- 
2.21.0.windows.1


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

View/Reply Online (#42243): https://edk2.groups.io/g/devel/message/42243
Mute This Topic: https://groups.io/mt/32037315/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] SecurityPkg: Add missing instances for build only

2019-06-17 Thread Gao, Zhichao
Added: https://bugzilla.tianocore.org/show_bug.cgi?id=1919

Thanks,
Zhichao

> -Original Message-
> From: Ni, Ray
> Sent: Friday, June 14, 2019 4:50 PM
> To: devel@edk2.groups.io; Yao, Jiewen ; Gao,
> Zhichao 
> Cc: Bret Barkelew ; Zhang, Chao B
> ; Wang, Jian J ; Gao,
> Liming ; Sean Brogan ;
> Michael Turner ; Leif Lindholm
> 
> Subject: RE: [edk2-devel] [PATCH v2] SecurityPkg: Add missing instances for
> build only
> 
> Yes I agree.
> Since UID feature was completely dropped early this year, this is a missing
> library that should be removed together with UID.
> 
> Zhichao,
> Can you help submit a BZ for this removal?
> I am ok with your current patch to include this library. This library can be
> removed by further patch that removes DxeDeferImageLoadLib.
> 
> Thanks,
> Ray
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Yao,
> > Jiewen
> > Sent: Friday, June 14, 2019 4:48 PM
> > To: devel@edk2.groups.io; Gao, Zhichao 
> > Cc: Bret Barkelew ; Zhang, Chao B
> > ; Wang, Jian J ; Gao,
> > Liming ; Sean Brogan
> > ; Michael Turner
> > ; Leif Lindholm
> > 
> > Subject: Re: [edk2-devel] [PATCH v2] SecurityPkg: Add missing
> > instances for build only
> >
> > Hi
> > It is good to add those to build.
> >
> > However, I think we should remove
> > SecurityPkg\Library\DxeDeferImageLoadLib from the code base.
> >
> > This lib supports old UID and may conflict with
> > MdeModulePkg\Universal\SecurityStubDxe\Defer3rdPartyImageLoad.c
> >
> >
> > Thank you
> > Yao Jiewen
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf
> > > Of Gao, Zhichao
> > > Sent: Friday, June 14, 2019 4:35 PM
> > > To: devel@edk2.groups.io
> > > Cc: Bret Barkelew ; Zhang, Chao B
> > > ; Yao, Jiewen ; Wang,
> > > Jian J ; Gao, Liming ;
> > > Sean Brogan ; Michael Turner
> > > ; Leif Lindholm
> > > ; Gao, Zhichao 
> > > Subject: [edk2-devel] [PATCH v2] SecurityPkg: Add missing instances
> > > for build only
> > >
> > > From: Bret Barkelew 
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1902
> > >
> > > Add the missing instances to the [Components] of dsc file for build
> > > only.
> > >
> > > Cc: Chao Zhang 
> > > Cc: Jiewen Yao 
> > > Cc: Jian Wang 
> > > Cc: Liming Gao 
> > > Cc: Sean Brogan 
> > > Cc: Michael Turner 
> > > Cc: Bret Barkelew 
> > > Cc: Leif Lindholm 
> > > Signed-off-by: Zhichao gao 
> > > ---
> > >   V2: fix with Laszlo's comment:
> > > https://edk2.groups.io/g/devel/message/42273
> > >
> > >  SecurityPkg/SecurityPkg.dsc | 6 ++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/SecurityPkg/SecurityPkg.dsc
> > > b/SecurityPkg/SecurityPkg.dsc index a2ee0528f0..ed0da7563d 100644
> > > --- a/SecurityPkg/SecurityPkg.dsc
> > > +++ b/SecurityPkg/SecurityPkg.dsc
> > > @@ -199,6 +199,12 @@
> > >
> > >
> >
> SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs
> > > 7
> > > .inf
> > >
> > >
> >
> SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/FmpAuthenticatio
> > > nLibRsa2048Sha256.inf
> > >
> > > +
> SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf
> > > +
> > >
> >
> SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
> > > +
> > > + SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.in
> > > + f  SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
> > > +  SecurityPkg/Library/TcgPpVendorLibNull/TcgPpVendorLibNull.inf
> > > +
> > >  [Components.IA32, Components.X64, Components.ARM,
> > Components.AARCH64]
> > >SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> > >
> > > --
> > > 2.21.0.windows.1
> > >
> > >
> > >
> >
> >
> > 


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

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



Re: [edk2-devel] [PATCH V1 1/1] ShellPkg/acpiview: GTDT updates for ACPI 6.3

2019-05-21 Thread Gao, Zhichao
The code change looks good for me. 
But when I try to apply your patch to my local edk2 code, I would encounter an 
error "error: corrupt patch at line 23".
Making sure the patch that can apply to the edk2 trunk is important. Otherwise, 
the testers and maintainers may take time to write the whole change to their 
own repo.
Most time, it is impossible for them to write the code again  because the 
patches are too many.

Thanks,
Zhichao

> -Original Message-
> From: PierreGondois [mailto:pierre.gond...@arm.com]
> Sent: Monday, May 20, 2019 9:33 PM
> To: devel@edk2.groups.io
> Cc: sami.muja...@arm.com; Carsey, Jaben ; Ni,
> Ray ; Gao, Zhichao ;
> matteo.carl...@arm.com; stephanie.hughes-f...@arm.com; n...@arm.com
> Subject: [PATCH V1 1/1] ShellPkg/acpiview: GTDT updates for ACPI 6.3
> 
> From: Pierre Gondois 
> 
> The ACPI 6.3 specification introduces support to describe the ARMv8.1 virtual
> EL2 timers. This patch updates the GTDT parser of acpiview to decode the EL2
> virtual timer fields.
> 
> Signed-off-by: Pierre Gondois 
> ---
> 
> The changes can be seen at:
> https://github.com/PierreARM/edk2/tree/382_acpiview_gtdt_acpi6_3_upd
> ate_v1
> 
> Notes:
> v1:
> - GTDT updates for ACPI 6.3 [Pierre]
> 
>  ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> index
> 1b7e56486c8fb98a8fe063ae5fa25d86500a58a9..3b05ff3015d4a3af62dd9fab05
> 7c32369a456267 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars
> +++ er.c
> @@ -5,7 +5,7 @@
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>@par Reference(s):
> -- ACPI 6.2 Specification - Errata A, September 2017
> +- ACPI 6.3 Specification - January 2019
>**/
> 
>  #include 
> @@ -77,7 +77,9 @@ STATIC CONST ACPI_PARSER GtdtParser[] = {
>{L"Platform Timer Count", 4, 88, L"%d", NULL,
> (VOID**), NULL, NULL},
>{L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
> -   (VOID**), NULL, NULL}
> +   (VOID**), NULL, NULL},  {L"Virtual EL2 Timer
> + GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},  {L"Virtual EL2 Timer
> + Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}
>  };
> 
>  /**
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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

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



Re: [edk2-devel] [PATCH 4/6] MdePkg: Add gEfiCpu2ProtocolGuid and header file

2019-05-23 Thread Gao, Zhichao
I have found it in UEFP spec and PI spec. It is not defined in these specs.
So I think maybe no spec has already defined it.

Thanks,
Zhichao

> -Original Message-
> From: Gao, Liming
> Sent: Friday, May 24, 2019 1:20 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Sean Brogan ; Kinney, Michael D
> ; Michael Turner
> ; Bret Barkelew
> 
> Subject: RE: [PATCH 4/6] MdePkg: Add gEfiCpu2ProtocolGuid and header file
> 
> Zhichao:
>   Which spec defines Cpu2 protocol?
> 
> Thanks
> Liming
> >-Original Message-
> >From: Gao, Zhichao
> >Sent: Friday, May 24, 2019 1:05 PM
> >To: devel@edk2.groups.io
> >Cc: Sean Brogan ; Kinney, Michael D
> >; Gao, Liming ;
> >Michael Turner ; Bret Barkelew
> >
> >Subject: [PATCH 4/6] MdePkg: Add gEfiCpu2ProtocolGuid and header file
> >
> >From: Sean Brogan 
> >
> >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1400
> >
> >Add gEfiCpu2ProtocolGuid to MdePkg.dec.
> >Add the header file of Cpu2 protocol: it has one interface to enable
> >interrupt and put cpu to sleep to wait for an interrupt.
> >
> >Cc: Michael D Kinney 
> >Cc: Liming Gao 
> >Cc: Sean Brogan 
> >Cc: Michael Turner 
> >Cc: Bret Barkelew 
> >Signed-off-by: Zhichao Gao 
> >---
> > MdePkg/Include/Protocol/Cpu2.h | 43
> >++
> > MdePkg/MdePkg.dec  |  3 +++
> > 2 files changed, 46 insertions(+)
> > create mode 100644 MdePkg/Include/Protocol/Cpu2.h
> >
> >diff --git a/MdePkg/Include/Protocol/Cpu2.h
> >b/MdePkg/Include/Protocol/Cpu2.h new file mode 100644 index
> >00..cacd948140
> >--- /dev/null
> >+++ b/MdePkg/Include/Protocol/Cpu2.h
> >@@ -0,0 +1,43 @@
> >+/** @file
> >+  CPU2 Protocol
> >+
> >+  This code abstracts the DXE core from processor implementation details.
> >+
> >+  Copyright (c) 2006 - 2018, Microsoft Corporation. All rights
> >+ reserved.
> >+
> >+  SPDX-License-Identifier: BSD-2-Clause-Patent
> >+
> >+**/
> >+
> >+#ifndef __PROTOCOL_CPU2_H__
> >+#define __PROTOCOL_CPU2_H__
> >+
> >+#include 
> >+
> >+typedef struct _EFI_CPU2_PROTOCOL   EFI_CPU2_PROTOCOL;
> >+
> >+
> >+/**
> >+  This function enables CPU interrupts and then waits for an interrupt
> >+to
> >arrive.
> >+
> >+  @param  This  The EFI_CPU2_PROTOCOL instance.
> >+
> >+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
> >+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the
> >processor.
> >+
> >+**/
> >+typedef
> >+EFI_STATUS
> >+(EFIAPI *EFI_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT)(
> >+  IN EFI_CPU2_PROTOCOL  *This
> >+  );
> >+
> >+//
> >+// The EFI_CPU2_PROTOCOL is used to abstract processor-specific
> >+functions
> >from the DXE
> >+// Foundation.
> >+//
> >+struct _EFI_CPU2_PROTOCOL {
> >+  EFI_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT
> >EnableAndWaitForInterrupt;
> >+};
> >+
> >+#endif
> >diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
> >6c563375ee..e8c6939849 100644
> >--- a/MdePkg/MdePkg.dec
> >+++ b/MdePkg/MdePkg.dec
> >@@ -1803,6 +1803,9 @@
> >   ## Include/Protocol/ShellDynamicCommand.h
> >   gEfiShellDynamicCommandProtocolGuid  = { 0x3c7200e9, 0x005f, 0x4ea4,
> >{0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 }}
> >
> >+  ## Include/Protocol/Cpu2.h
> >+  gEfiCpu2ProtocolGuid = { 0x55198405, 0x26C0, 0x4765, 
> >{0x8B,
> 0x7D,
> >0xBE, 0x1D, 0xF5, 0xF9, 0x97, 0x12 }}
> >+
> > #
> > # [Error.gEfiMdePkgTokenSpaceGuid]
> > #   0x8001 | Invalid value provided.
> >--
> >2.21.0.windows.1


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

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



[edk2-devel] [PATCH 1/6] MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for event

2019-05-23 Thread Gao, Zhichao
From: Sean Brogan 

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

Add common event protocol to support all TPL event:
Add the guid and header file of it.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Include/Protocol/CommonEvent.h | 18 ++
 MdeModulePkg/MdeModulePkg.dec   |  3 +++
 2 files changed, 21 insertions(+)
 create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h

diff --git a/MdeModulePkg/Include/Protocol/CommonEvent.h 
b/MdeModulePkg/Include/Protocol/CommonEvent.h
new file mode 100644
index 00..176be14101
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/CommonEvent.h
@@ -0,0 +1,18 @@
+/** @file
+  Common event protocol would provide a service of event.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef __COMMON_EVENT_H__
+#define __COMMON_EVENT_H__
+
+#include 
+
+typedef struct {
+  EFI_CREATE_EVENT_EX   CreateEventEx;
+  EFI_WAIT_FOR_EVENTWaitForEvent;
+} EDKII_COMMON_EVENT_PROTOCOL;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 0a9fcddecc..ff4337f235 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -630,6 +630,9 @@
   ## Include/Protocol/PeCoffImageEmulator.h
   gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793, { 
0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
 
+  ## Include/Protocole/CommonEvent.h
+  gEdkiiCommonEventProtocolGuid = { 0x8bfb3718, 0xdb10, 0x4cc1, { 0xa9, 0xf5, 
0x84, 0xae, 0xce, 0xce, 0x99, 0x55 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 2/6] MdePkg/BaseLib.h: Add EnableInterruptsAndSleep function declare

2019-05-23 Thread Gao, Zhichao
From: Sean Brogan 

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

Add EnableInterruptsAndSleep function.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdePkg/Include/Library/BaseLib.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index ebd7dd274c..8ab2c12328 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -5033,6 +5033,17 @@ LongJump (
   );
 
 
+/**
+  Enables CPU interrupts and then waits for an interrupt to arrive.
+
+**/
+VOID
+EFIAPI
+EnableInterruptsAndSleep (
+  VOID
+  );
+
+
 /**
   Enables CPU interrupts.
 
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 4/6] MdePkg: Add gEfiCpu2ProtocolGuid and header file

2019-05-23 Thread Gao, Zhichao
From: Sean Brogan 

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

Add gEfiCpu2ProtocolGuid to MdePkg.dec.
Add the header file of Cpu2 protocol: it has one interface
to enable interrupt and put cpu to sleep to wait for an
interrupt.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdePkg/Include/Protocol/Cpu2.h | 43 ++
 MdePkg/MdePkg.dec  |  3 +++
 2 files changed, 46 insertions(+)
 create mode 100644 MdePkg/Include/Protocol/Cpu2.h

diff --git a/MdePkg/Include/Protocol/Cpu2.h b/MdePkg/Include/Protocol/Cpu2.h
new file mode 100644
index 00..cacd948140
--- /dev/null
+++ b/MdePkg/Include/Protocol/Cpu2.h
@@ -0,0 +1,43 @@
+/** @file
+  CPU2 Protocol
+
+  This code abstracts the DXE core from processor implementation details.
+
+  Copyright (c) 2006 - 2018, Microsoft Corporation. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PROTOCOL_CPU2_H__
+#define __PROTOCOL_CPU2_H__
+
+#include 
+
+typedef struct _EFI_CPU2_PROTOCOL   EFI_CPU2_PROTOCOL;
+
+
+/**
+  This function enables CPU interrupts and then waits for an interrupt to 
arrive.
+
+  @param  This  The EFI_CPU2_PROTOCOL instance.
+
+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the 
processor.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT)(
+  IN EFI_CPU2_PROTOCOL  *This
+  );
+
+//
+// The EFI_CPU2_PROTOCOL is used to abstract processor-specific functions from 
the DXE
+// Foundation.
+//
+struct _EFI_CPU2_PROTOCOL {
+  EFI_CPU_ENABLE_AND_WAIT_FOR_INTERRUPTEnableAndWaitForInterrupt;
+};
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 6c563375ee..e8c6939849 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1803,6 +1803,9 @@
   ## Include/Protocol/ShellDynamicCommand.h
   gEfiShellDynamicCommandProtocolGuid  = { 0x3c7200e9, 0x005f, 0x4ea4, {0x87, 
0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3 }}
 
+  ## Include/Protocol/Cpu2.h
+  gEfiCpu2ProtocolGuid = { 0x55198405, 0x26C0, 0x4765, {0x8B, 
0x7D, 0xBE, 0x1D, 0xF5, 0xF9, 0x97, 0x12 }}
+
 #
 # [Error.gEfiMdePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 0/6] Fix race condition and add event protocol

2019-05-23 Thread Gao, Zhichao
There is a race condition in CoreWaitForEvent function:
If an interrupt happens between CheckEvent and gIdleLoopEvent,
there would be a event pending during cpu sleep. 
So it is required to check the gEventPending with the interrupt
disabled.
Implement a gEfiCpu2ProtocolGuid to fix that. The protocol include
one interface to enable interrupt and put the cpu to sleep.

Add a event protocol gEdkiiCommonEventProtocolGuid to support
all TPL event. It is require for PI drivers that use HW interrput.

Cc: Jian J Wang 
Cc: Hao A Wu 
cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Eric Dong 
Cc: Laszlo Ersek 

Sean Brogan (5):
  MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for event
  MdePkg/BaseLib.h: Add EnableInterruptsAndSleep function declare
  MdePkg/BaseLib: Implement EnableInterruptsAndSleep
  MdePkg: Add gEfiCpu2ProtocolGuid and header file
  MdeModulePkg/DxeMain: Implement common event protocol

Zhichao Gao (1):
  UefiCpuPkg/CpuDxe: Implement Cpu2 protocol

 MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
 MdeModulePkg/Core/Dxe/DxeMain.inf |   1 +
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
 .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
 MdeModulePkg/Core/Dxe/Event/Event.c   | 102 --
 MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
 MdeModulePkg/Include/Protocol/CommonEvent.h   |  18 
 MdeModulePkg/MdeModulePkg.dec |   3 +
 MdePkg/Include/Library/BaseLib.h  |  11 ++
 MdePkg/Include/Protocol/Cpu2.h|  43 
 .../Library/BaseLib/Ia32/EnableInterrupts.c   |  18 +++-
 .../BaseLib/Ia32/EnableInterrupts.nasm|  15 ++-
 .../Library/BaseLib/X64/EnableInterrupts.nasm |  15 ++-
 MdePkg/MdePkg.dec |   3 +
 UefiCpuPkg/CpuDxe/CpuDxe.c|  40 ++-
 UefiCpuPkg/CpuDxe/CpuDxe.h|  15 +++
 UefiCpuPkg/CpuDxe/CpuDxe.inf  |   3 +-
 17 files changed, 358 insertions(+), 18 deletions(-)
 create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h
 create mode 100644 MdePkg/Include/Protocol/Cpu2.h

-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 6/6] MdeModulePkg/DxeMain: Implement common event protocol

2019-05-23 Thread Gao, Zhichao
From: Sean Brogan 

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

If an interrupt happens between CheckEvent and gIdleLoopEvent,
there would be a event pending during cpu sleep. So it is
required to check the gEventPending with the interrupt disabled.

Implement a protocol gEdkiiCommonEventProtocolGuid to support
all TPL event for PI drivers that use HW interrput. It has two
interface, one is to create event and the other one is to wait for
event.

Add 'volatile' specifier for gEfiCurrentTpl and gEventPending
because they may be changed out of the context (interrupt context).

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
 MdeModulePkg/Core/Dxe/DxeMain.inf |   1 +
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
 .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
 MdeModulePkg/Core/Dxe/Event/Event.c   | 102 --
 MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
 6 files changed, 179 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 6a64852730..355f66bc44 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +48,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -274,10 +276,11 @@ extern EFI_METRONOME_ARCH_PROTOCOL  
*gMetronome;
 extern EFI_TIMER_ARCH_PROTOCOL  *gTimer;
 extern EFI_SECURITY_ARCH_PROTOCOL   *gSecurity;
 extern EFI_SECURITY2_ARCH_PROTOCOL  *gSecurity2;
+extern EFI_CPU2_PROTOCOL*gCpu2;
 extern EFI_BDS_ARCH_PROTOCOL*gBds;
 extern EFI_SMM_BASE2_PROTOCOL   *gSmmBase2;
 
-extern EFI_TPL  gEfiCurrentTpl;
+extern volatile EFI_TPL gEfiCurrentTpl;
 
 extern EFI_GUID *gDxeCoreFileName;
 extern EFI_LOADED_IMAGE_PROTOCOL*gDxeCoreLoadedImage;
@@ -1714,6 +1717,65 @@ CoreCheckEvent (
   );
 
 
+/**
+  Stops execution until an event is signaled.
+
+  Support all TPL.
+
+  @param  NumberOfEvents The number of events in the UserEvents array
+  @param  UserEvents An array of EFI_EVENT
+  @param  UserIndex  Pointer to the index of the event which
+ satisfied the wait condition
+
+  @retval EFI_SUCCESSThe event indicated by Index was signaled.
+  @retval EFI_INVALID_PARAMETER  The event indicated by Index has a 
notification
+ function or Event was not a valid type
+  @retval EFI_UNSUPPORTEDThe current TPL is not TPL_APPLICATION
+
+**/
+EFI_STATUS
+EFIAPI
+CommonWaitForEvent (
+  IN UINTNNumberOfEvents,
+  IN EFI_EVENT*UserEvents,
+  OUT UINTN   *UserIndex
+  );
+
+
+/**
+  Creates an event in a group.
+
+  Support all TPL.
+
+  @param  Type   The type of event to create and its mode and
+ attributes
+  @param  NotifyTpl  The task priority level of event notifications
+  @param  NotifyFunction Pointer to the events notification function
+  @param  NotifyContext  Pointer to the notification functions context;
+ corresponds to parameter "Context" in the
+ notification function
+  @param  EventGroup GUID for EventGroup if NULL act the same as
+ gBS->CreateEvent().
+  @param  Event  Pointer to the newly created event if the call
+ succeeds; undefined otherwise
+
+  @retval EFI_SUCCESSThe event structure was created
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value
+  @retval EFI_OUT_OF_RESOURCES   The event could not be allocated
+
+**/
+EFI_STATUS
+EFIAPI
+CommonCreateEventEx (
+  IN UINT32   Type,
+  IN EFI_TPL  NotifyTpl,
+  IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+  IN CONST VOID   *NotifyContext, OPTIONAL
+  IN CONST EFI_GUID   *EventGroup,OPTIONAL
+  OUT EFI_EVENT   *Event
+  );
+
+
 /**
   Adds reserved memory, system memory, or memory-mapped I/O resources to the
   global coherency domain of the processor.
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf 
b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 61161bee28..d758ee431e 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -171,6 +171,7 @@
   gEfiVariableArchProtocolGuid   

[edk2-devel] [PATCH 3/6] MdePkg/BaseLib: Implement EnableInterruptsAndSleep

2019-05-23 Thread Gao, Zhichao
From: Sean Brogan 

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

Implement EnableInterruptsAndSleep.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c | 18 +-
 .../Library/BaseLib/Ia32/EnableInterrupts.nasm | 15 ++-
 .../Library/BaseLib/X64/EnableInterrupts.nasm  | 15 ++-
 3 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c 
b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
index bc03144c42..c2a84342b1 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
+++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.c
@@ -1,7 +1,7 @@
 /** @file
   EnableInterrupts function
 
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -24,3 +24,19 @@ EnableInterrupts (
   }
 }
 
+/**
+  Enables CPU interrupts and then waits for an interrupt to arrive.
+
+**/
+VOID
+EFIAPI
+EnableInterruptsAndSleep (
+  VOID
+  )
+{
+  _asm {
+sti
+hlt
+  }
+}
+
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm 
b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm
index 979e708207..86902f61b6 100644
--- a/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm
+++ b/MdePkg/Library/BaseLib/Ia32/EnableInterrupts.nasm
@@ -1,6 +1,6 @@
 ;--
 ;
-; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ;
 ; Module Name:
@@ -29,3 +29,16 @@ ASM_PFX(EnableInterrupts):
 sti
 ret
 
+;--
+; VOID
+; EFIAPI
+; EnableInterruptsAndSleep (
+;   VOID
+;   );
+;--
+global ASM_PFX(EnableInterruptsAndSleep)
+ASM_PFX(EnableInterruptsAndSleep):
+sti
+hlt
+ret
+
diff --git a/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm 
b/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm
index 6057afd626..de8f2ad434 100644
--- a/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm
+++ b/MdePkg/Library/BaseLib/X64/EnableInterrupts.nasm
@@ -1,6 +1,6 @@
 ;--
 ;
-; Copyright (c) 2006, Intel Corporation. All rights reserved.
+; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ;
 ; Module Name:
@@ -30,3 +30,16 @@ ASM_PFX(EnableInterrupts):
 sti
 ret
 
+;--
+; VOID
+; EFIAPI
+; EnableInterruptsAndSleep (
+;   VOID
+;   );
+;--
+global ASM_PFX(EnableInterruptsAndSleep)
+ASM_PFX(EnableInterruptsAndSleep):
+sti
+hlt
+ret
+
-- 
2.21.0.windows.1


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

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



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

2019-05-23 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.

V2:
Make the SetMode not clear the screen only at the first boot during
the first conncettion of graphics device.

V3:
Abandon V2. Directly set the output mode without clear the screen
while initialize the graphics console device. Add clear screen operation
in stop function of graphics console device.

V4:
Fix incorrect mode check in V3.
Initialize the mode to an invalid mode. If no perfer mode is found, it
is better to initialize its text mode to an invalid one.
Remove the ClearScreen fuction in the BindingStop function in V3.
The graphics output driver may disconnect before graphics console, that
may cause a system exception because of using released resource.
Impact: the screen would not be cleared after reconnect the graphics device
thru software, such as 'reconnect -r' in shell.

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 
Cc: Laszlo Ersek 

Aaron Antone (1):
  MdeModulePkg/ConSplitterDxe: Optimize the ConSplitterTextOutSetMode

Zhichao Gao (1):
  MdeModulePkg/GraphicsConsoleDxe: Initialize the output mode

 .../Console/ConSplitterDxe/ConSplitter.c  | 33 ++-
 .../Console/ConSplitterDxe/ConSplitter.h  |  4 +-
 .../GraphicsConsoleDxe/GraphicsConsole.c  | 42 ++-
 .../GraphicsConsoleDxe/GraphicsConsoleDxe.inf |  2 +
 4 files changed, 59 insertions(+), 22 deletions(-)

-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH V4 2/2] MdeModulePkg/GraphicsConsoleDxe: Initialize the output mode

2019-05-23 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1412

Original logic:
Connect the graphics device -> connect it as graphics consoles
and initialize its parameters(Mode = -1, invalid) -> connect it
as console spliter and add the device to the list(use SetMode to
set mode to the user defined mode or the best mode the devices
supported if the mode is invalid. *clear the screen at this phase*)

Changed logic:
Connect the graphics device -> connect it as graphics consoles
and initialize its parameters(initialize the mode to the user
defined mode or the best mode. *directly set the mode value without
using SetMode, that would not clear the screen) -> connect it as
console spliter and add the device to the list(use SetMode to set
mode to the user defined mode or the best mode the devices supported
if the mode is invalid. *now the mode is already set, so it would
not clear the screen*).

Also remove the section of SetMode for debug version.

Impact: as the text mode may not be an invalid value, the SetMode
may have no chance to be called during reconnect the graphics device.
That means the screen may not be cleaned after finishing reconnect
operation. There is one common condition: shell command "recoonect -r".

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 
Cc: Laszlo Ersek 
Signed-off-by: Zhichao Gao 
---
 .../GraphicsConsoleDxe/GraphicsConsole.c  | 42 ++-
 .../GraphicsConsoleDxe/GraphicsConsoleDxe.inf |  2 +
 2 files changed, 34 insertions(+), 10 deletions(-)

diff --git 
a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c 
b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index 26ea19f300..c042451a9b 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
 
 **/
@@ -384,6 +384,12 @@ GraphicsConsoleControllerDriverStart (
   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE*Mode;
   UINTNSizeOfInfo;
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+  INT32PreferMode;
+  INT32Index;
+  UINTNColumn;
+  UINTNRow;
+  UINTNDefaultColumn;
+  UINTNDefaultRow;
 
   ModeNumber = 0;
 
@@ -567,16 +573,32 @@ 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;
+  //
+  // Initialize the Mode of graphics console devices
+  //
+  PreferMode = -1;
+  DefaultColumn = PcdGet32 (PcdConOutColumn);
+  DefaultRow = PcdGet32 (PcdConOutRow);
+  Column = 0;
+  Row = 0;
+  for (Index = 0; Index < (INT32)MaxMode; Index++) {
+if (DefaultColumn != 0 && DefaultRow != 0) {
+  if ((Private->ModeData[Index].Columns == DefaultColumn) &&
+  (Private->ModeData[Index].Rows == DefaultRow)) {
+PreferMode = Index;
+break;
+  }
+} else {
+  if ((Private->ModeData[Index].Columns > Column) &&
+  (Private->ModeData[Index].Rows > Row)) {
+Column = Private->ModeData[Index].Columns;
+Row = Private->ModeData[Index].Rows;
+PreferMode = Index;
+  }
 }
-  DEBUG_CODE_END ();
+  }
+  Private->SimpleTextOutput.Mode->Mode = (INT32)PreferMode;
+  DEBUG ((DEBUG_INFO, "Graphics Console Started, Mode: %d\n", PreferMode));
 
   //
   // Install protocol interfaces for the Graphics Console device.
diff --git 
a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf 
b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
index f7caa65aa9..bcfd306eee 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
@@ -65,6 +65,8 @@
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution   ## 
SOMETIMES_CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## 
SOMETIMES_CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn  ## 
SOMETIMES_CONSUMES
 
 [UserExtensions.TianoCore."ExtraFiles"]
   GraphicsConsoleDxeExtra.uni
-- 

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

2019-05-23 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  | 33 ---
 .../Console/ConSplitterDxe/ConSplitter.h  |  4 ++-
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c 
b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
index 6fc0e4796f..5de022b02a 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,18 @@ 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 (#41298): https://edk2.groups.io/g/devel/message/41298
Mute This Topic: https://groups.io/mt/31738400/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH 5/6] UefiCpuPkg/CpuDxe: Implement Cpu2 protocol

2019-05-23 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1400

Implement Cp2 protocol: it has one interface to enable the
interrupt and put cpu to sleep and wait for an interrupt.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c   | 40 +++-
 UefiCpuPkg/CpuDxe/CpuDxe.h   | 15 ++
 UefiCpuPkg/CpuDxe/CpuDxe.inf |  3 ++-
 3 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 7d7270e10b..0d0cdf6f86 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -1,7 +1,7 @@
 /** @file
   CPU DXE Module to produce CPU ARCH Protocol.
 
-  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -18,6 +18,7 @@
 //
 BOOLEAN   InterruptState = FALSE;
 EFI_HANDLEmCpuHandle = NULL;
+EFI_HANDLEmCpu2Handle = NULL;
 BOOLEAN   mIsFlushingGCD;
 BOOLEAN   mIsAllocatingPageTable = FALSE;
 UINT64mValidMtrrAddressMask;
@@ -96,6 +97,10 @@ EFI_CPU_ARCH_PROTOCOL  gCpu = {
   4   // DmaBufferAlignment
 };
 
+EFI_CPU2_PROTOCOL   gCpu2 = {
+  CpuEnableAndWaitForInterrupt
+};
+
 //
 // CPU Arch Protocol Functions
 //
@@ -499,6 +504,28 @@ CpuSetMemoryAttributes (
   return AssignMemoryPageAttributes (NULL, BaseAddress, Length, 
MemoryAttributes, NULL);
 }
 
+//
+// CPU2 Protocol Functions
+//
+/**
+  This function enables CPU interrupts and then waits for an interrupt to 
arrive.
+
+  @param  This  The EFI_CPU2_PROTOCOL instance.
+
+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the 
processor.
+
+**/
+EFI_STATUS
+CpuEnableAndWaitForInterrupt (
+  IN EFI_CPU2_PROTOCOL  *This
+  )
+{
+  EnableInterruptsAndSleep ();
+
+  return EFI_SUCCESS;
+}
+
 /**
   Initializes the valid bits mask and valid address mask for MTRRs.
 
@@ -1211,6 +1238,17 @@ InitializeCpu (
   );
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Install CPU2 Protocol
+  //
+  Status = gBS->InstallMultipleProtocolInterfaces (
+  ,
+  ,
+  ,
+  NULL
+  );
+  ASSERT_EFI_ERROR (Status);
+
   InitializeMpSupport ();
 
   return Status;
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h
index b029be430b..8698ff78eb 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.h
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.h
@@ -12,6 +12,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -305,6 +306,20 @@ PageFaultExceptionHandler (
   IN EFI_SYSTEM_CONTEXT   SystemContext
   );
 
+/**
+  This function enables CPU interrupts and then waits for an interrupt to 
arrive.
+
+  @param  This  The EFI_CPU2_PROTOCOL instance.
+
+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the 
processor.
+
+**/
+EFI_STATUS
+CpuEnableAndWaitForInterrupt (
+  IN EFI_CPU2_PROTOCOL  *This
+  );
+
 extern BOOLEAN mIsAllocatingPageTable;
 extern UINTN   mNumberOfProcessors;
 
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index 57381dbc85..d4ff562d89 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  CPU driver installs CPU Architecture Protocol and CPU MP protocol.
 #
-#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
 #  Copyright (c) 2017, AMD Incorporated. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -62,6 +62,7 @@
   gEfiCpuArchProtocolGuid   ## PRODUCES
   gEfiMpServiceProtocolGuid ## PRODUCES
   gEfiSmmBase2ProtocolGuid  ## SOMETIMES_CONSUMES
+  gEfiCpu2ProtocolGuid  ## PRODUCES
 
 [Guids]
   gIdleLoopEventGuid## CONSUMES   ## Event
-- 
2.21.0.windows.1


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

View/Reply Online (#41307): https://edk2.groups.io/g/devel/message/41307
Mute This Topic: https://groups.io/mt/31741732/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/6] Fix race condition and add event protocol

2019-05-24 Thread Gao, Zhichao
Sorry I didn't add the BZ link.
https://bugzilla.tianocore.org/show_bug.cgi?id=1400 

"If an interrupt happens between CheckEvent and gIdleLoopEvent, there would be 
a event pending during cpu sleep."

Here is the wait for event flow:

Result = CheckEvent
(interrupt happens here, and set the gEventPending)
Result == FALSE
Ilde event (put cpu to sleep)(there are events in pending list and they should 
be handle, but the cpu is hlt and cannot handle it)

Solution is here:
Result = CheckEvent
(interrupt happens)
Disable interrupt
PendingResult = Check gEventPending
If gEventPending == TRUE {
  Enable interrupt and goto CheckEvent to handle
} else {
  Enable interrupt and hlt (this should be 'atomic' so that no race condition 
would happen)
}

Thanks,
Zhichao

> -Original Message-
> From: Ni, Ray
> Sent: Friday, May 24, 2019 1:18 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Wang, Jian J ; Wu, Hao A ;
> Zeng, Star ; Gao, Liming ;
> Sean Brogan ; Michael Turner
> ; Bret Barkelew
> ; Kinney, Michael D
> ; Dong, Eric ; Laszlo
> Ersek 
> Subject: RE: [PATCH 0/6] Fix race condition and add event protocol
> 
> Zhichao,
> Did your detailed patch commit message describe the consequence of the
> race condition? (I haven't checked.) If no, could you please describe in 
> detail
> about the consequence?
> 
> Thanks,
> Ray
> 
> > -Original Message-
> > From: Gao, Zhichao
> > Sent: Friday, May 24, 2019 1:05 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J ; Wu, Hao A
> > ; Ni, Ray ; Zeng, Star
> > ; Gao, Liming ; Sean Brogan
> > ; Michael Turner
> > ; Bret Barkelew
> > ; Kinney, Michael D
> > ; Dong, Eric ; Laszlo
> > Ersek 
> > Subject: [PATCH 0/6] Fix race condition and add event protocol
> >
> > There is a race condition in CoreWaitForEvent function:
> > If an interrupt happens between CheckEvent and gIdleLoopEvent, there
> > would be a event pending during cpu sleep.
> > So it is required to check the gEventPending with the interrupt disabled.
> > Implement a gEfiCpu2ProtocolGuid to fix that. The protocol include one
> > interface to enable interrupt and put the cpu to sleep.
> >
> > Add a event protocol gEdkiiCommonEventProtocolGuid to support all TPL
> > event. It is require for PI drivers that use HW interrput.
> >
> > Cc: Jian J Wang 
> > Cc: Hao A Wu 
> > cc: Ray Ni 
> > Cc: Star Zeng 
> > Cc: Liming gao 
> > Cc: Sean Brogan 
> > Cc: Michael Turner 
> > Cc: Bret Barkelew 
> > Cc: Michael D Kinney 
> > Cc: Eric Dong 
> > Cc: Laszlo Ersek 
> >
> > Sean Brogan (5):
> >   MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for event
> >   MdePkg/BaseLib.h: Add EnableInterruptsAndSleep function declare
> >   MdePkg/BaseLib: Implement EnableInterruptsAndSleep
> >   MdePkg: Add gEfiCpu2ProtocolGuid and header file
> >   MdeModulePkg/DxeMain: Implement common event protocol
> >
> > Zhichao Gao (1):
> >   UefiCpuPkg/CpuDxe: Implement Cpu2 protocol
> >
> >  MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
> >  MdeModulePkg/Core/Dxe/DxeMain.inf |   1 +
> >  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
> >  .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
> >  MdeModulePkg/Core/Dxe/Event/Event.c   | 102 -
> -
> >  MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
> >  MdeModulePkg/Include/Protocol/CommonEvent.h   |  18 
> >  MdeModulePkg/MdeModulePkg.dec |   3 +
> >  MdePkg/Include/Library/BaseLib.h  |  11 ++
> >  MdePkg/Include/Protocol/Cpu2.h|  43 
> >  .../Library/BaseLib/Ia32/EnableInterrupts.c   |  18 +++-
> >  .../BaseLib/Ia32/EnableInterrupts.nasm|  15 ++-
> >  .../Library/BaseLib/X64/EnableInterrupts.nasm |  15 ++-
> >  MdePkg/MdePkg.dec |   3 +
> >  UefiCpuPkg/CpuDxe/CpuDxe.c|  40 ++-
> >  UefiCpuPkg/CpuDxe/CpuDxe.h|  15 +++
> >  UefiCpuPkg/CpuDxe/CpuDxe.inf  |   3 +-
> >  17 files changed, 358 insertions(+), 18 deletions(-)  create mode
> > 100644 MdeModulePkg/Include/Protocol/CommonEvent.h
> >  create mode 100644 MdePkg/Include/Protocol/Cpu2.h
> >
> > --
> > 2.21.0.windows.1


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

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



Re: [edk2-devel] [Patch 1/2] ShellPkg: Update DSC to use NetworkPkg's include fragment file

2019-05-19 Thread Gao, Zhichao
Reviewed-by: Zhichao Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Liming Gao
> Sent: Friday, May 17, 2019 4:51 PM
> To: devel@edk2.groups.io
> Cc: Gao, Zhichao ; Ni, Ray ;
> Carsey, Jaben 
> Subject: [edk2-devel] [Patch 1/2] ShellPkg: Update DSC to use NetworkPkg's
> include fragment file
> 
> Signed-off-by: Liming Gao 
> Cc: Zhichao Gao 
> Cc: Ray Ni 
> Cc: Jaben Carsey 
> ---
>  ShellPkg/ShellPkg.dsc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index
> 50d9bbb235..6a139b3b91 100644
> --- a/ShellPkg/ShellPkg.dsc
> +++ b/ShellPkg/ShellPkg.dsc
> @@ -40,7 +40,7 @@ [LibraryClasses.common]
> 
> UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib
> /UefiRuntimeServicesTableLib.inf
> 
> UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiService
> sLib.inf
>HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
> -  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
> +  !include NetworkPkg/NetworkLibs.dsc.inc
> 
>ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> 
> ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComma
> ndLib.inf
> --
> 2.13.0.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-04-08 Thread Gao, Zhichao
The patch code looks good to me.
But while I apply this patch, it will shows "error: corrupt patch at line 24" 
and " error: could not build fake ancestor". Maybe you direct change the patch 
file and remove some blank lines.
For Uefi BdsDxe driver, the variable "PlatfomLang" would be initialize all the 
time. But maybe other manufacturers may have their own Bds solution and do not 
set this variable. This patch makes the Shell app more compatible.

Without the patch warning.
Reviewed-by: Zhichao Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Heinrich Schuchardt
> Sent: Friday, April 5, 2019 9:29 AM
> To: Carsey, Jaben ; Ni, Ray ;
> Leif Lindholm ; Ard Biesheuvel
> 
> Cc: Ni, Ray ; devel@edk2.groups.io; Heinrich Schuchardt
> 
> Subject: [edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL
> derefence and memory leak
> 
> Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
> proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
> variable PlatformLang is not defined due to dereferencing gUnicodeCollation
> gUnicodeCollation (= NULL) in ShellCommandRegisterCommandName().
> 
> Furthermore CommandInit() is leaking PlatformLang if gUnicodeCollation !=
> NULL.
> 
> Close the memory leak and use the first UnicodeCollation instance if
> PlatfomLang is not defined.
> 
> Fixes: d65f2cea36d1 ("ShellPkg/CommandLib: Locate proper
> UnicodeCollation
> instance")
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Heinrich Schuchardt 
> ---
>  .../UefiShellCommandLib/UefiShellCommandLib.c | 20 +-
> -
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> index ddc4bb1567..e60279e5ac 100644
> --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> @@ -80,12 +80,10 @@ CommandInit(
>EFI_STATUS  Status;
>CHAR8   *PlatformLang;
> 
> -  GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME,
> (VOID**), NULL);
> -  if (PlatformLang == NULL) {
> -return EFI_UNSUPPORTED;
> -  }
> -
>if (gUnicodeCollation == NULL) {
> +
> +GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME,
> + (VOID**), NULL);
> +
>  Status = gBS->LocateHandleBuffer (
>  ByProtocol,
>  ,
> @@ -113,6 +111,14 @@ CommandInit(
>  continue;
>}
> 
> +  //
> +  // Without clue provided use the first Unicode Collation2 protocol.
> +  //
> +  if (PlatformLang == NULL) {
> +gUnicodeCollation = Uc;
> +break;
> +  }
> +
>//
>// Find the best matching matching language from the supported
> languages
>// of Unicode Collation2 protocol.
> @@ -132,7 +138,9 @@ CommandInit(
>  if (Handles != NULL) {
>FreePool (Handles);
>  }
> -FreePool (PlatformLang);
> +if (PlatformLang != NULL) {
> +  FreePool (PlatformLang);
> +}
>}
> 
>return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
> --
> 2.20.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#38597): https://edk2.groups.io/g/devel/message/38597
> Mute This Topic: https://groups.io/mt/30920004/1768756
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [zhichao@intel.com] -=-=-=-=-=-=


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

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



Re: [edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak

2019-04-09 Thread Gao, Zhichao
No problem with the attachment.
I usually use the command "git am --3way --ignore-space-change --keep-cr 
*.patch". That make the same meaning with your 'am' options if the patch is ok.
Compare with your attachment and the patch extract form the email, seems some 
blank lines is missing.

Thanks,
Zhichao

> -Original Message-
> From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de]
> Sent: Wednesday, April 10, 2019 12:37 AM
> To: Gao, Zhichao ; devel@edk2.groups.io; Carsey,
> Jaben ; Ni, Ray ; Leif Lindholm
> 
> Cc: Gao, Liming 
> Subject: Re: [edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL
> derefence and memory leak
> 
> On 4/9/19 7:33 AM, Gao, Zhichao wrote:
> > The patch code looks good to me.
> > But while I apply this patch, it will shows "error: corrupt patch at line 
> > 24"
> and " error: could not build fake ancestor". Maybe you direct change the
> patch file and remove some blank lines.
> > For Uefi BdsDxe driver, the variable "PlatfomLang" would be initialize all 
> > the
> time. But maybe other manufacturers may have their own Bds solution and
> do not set this variable. This patch makes the Shell app more compatible.
> >
> > Without the patch warning.
> > Reviewed-by: Zhichao Gao 
> 
> Hello Zhichao,
> 
> I am not able to reproduce the problem. I resend you the patch as
> attachment.
> 
> When applying I had to use --keep-cr:
> 
> git am --keep-cr \
> ../patch/0001-ShellPkg-CommandLib-avoid-NULL-derefence-and-memory-
> .patch
> 
> I have found no way neither on Windows nor on Linux to create a patch that
> applies without --keep-cr.
> 
> If you still have a problem, please, send me your global and local gitconfig
> files, your .gitattributes and indicate on which operating system you are
> working with which git version.
> 
> Best regards
> 
> Heinrich

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

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



Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to set OS indications bit

2019-04-09 Thread Gao, Zhichao
This section can work fine even through the L"PlatformRecovery" is not set.
But if we do not support it, it should be better not to run it.
Thanks for your comments, I will update it later.

Thanks,
Zhichao

> -Original Message-
> From: Ni, Ray
> Sent: Tuesday, April 9, 2019 5:32 PM
> To: Gao, Zhichao ; 'devel@edk2.groups.io'
> 
> Cc: Bret Barkelew ; Wang, Jian J
> ; Zeng, Star ; Gao, Liming
> ; Sean Brogan ;
> Michael Turner 
> Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to set OS
> indications bit
> 
> Resend to groups.io.
> 
> > -Original Message-
> > From: Ni, Ray
> > Sent: Tuesday, April 9, 2019 5:31 PM
> > To: Gao, Zhichao ; edk2-de...@lists.01.org
> > Cc: Bret Barkelew ; Wang, Jian J
> > ; Zeng, Star ; Gao, Liming
> > ; Sean Brogan ;
> > Michael Turner 
> > Subject: RE: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to set OS
> > indications bit
> >
> > Zhichao,
> > In the very bottom of BdsEntry(), below code is always executed no
> > matter the PCD is true or false.
> > I don't think that's the right behavior.
> >
> >   if (!BootSuccess) {
> > LoadOptions = EfiBootManagerGetLoadOptions (,
> > LoadOptionTypePlatformRecovery);
> > ProcessLoadOptions (LoadOptions, LoadOptionCount);
> > EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);
> >   }
> >
> > > -Original Message-
> > > From: Gao, Zhichao 
> > > Sent: Tuesday, April 2, 2019 1:50 PM
> > > To: edk2-de...@lists.01.org
> > > Cc: Bret Barkelew ; Wang, Jian J
> > > ; Ni, Ray ; Zeng, Star
> > > ; Gao, Liming ; Sean
> > > Brogan ; Michael Turner
> > > 
> > > Subject: [PATCH 2/2] MdeModulePkg/BdsDxe: Use a pcd to set OS
> > > indications bit
> > >
> > > From: Bret Barkelew 
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1678
> > >
> > > Use the pcd PcdPlatformRecoverySupport to control whether to set the
> > > PlatformRecovery variable and whether to set the
> > > EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY bit of variable
> > > "OsIndicationsSupported".
> > >
> > > 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 
> > > ---
> > >  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  1 +
> > > MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 74 +--
> --
> > --
> > > -
> > >  2 files changed, 41 insertions(+), 34 deletions(-)
> > >
> > > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > > b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > > index 82eb8aafc6..9caabbce7f 100644
> > > --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > > +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > > @@ -101,6 +101,7 @@
> > >gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand
> > > ## CONSUMES
> > >gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable
> ##
> > > SOMETIMES_CONSUMES
> > >gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed   ##
> > > CONSUMES
> > > +  gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformRecoverySupport
> > > ## CONSUMES
> > >
> > >  [Depex]
> > >TRUE
> > > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > > b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > > index 8946d79ab2..ade77adb7d 100644
> > > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> > > @@ -552,10 +552,14 @@ BdsFormalizeOSIndicationVariable (
> > >//
> > >Status = EfiBootManagerGetBootManagerMenu ();
> > >if (Status != EFI_NOT_FOUND) {
> > > -OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI |
> > > EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
> > > +OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> > >  EfiBootManagerFreeLoadOption ();
> > >} else {
> > > -OsIndicationSupport =
> > > EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
> > > +OsIndicationSupport = 0;
> > > +  }
> > > +
> > > +  if (PcdGetBool (PcdPlatformRecoverySupport)) {
> > > +OsIndicationSupport |=
> > > EFI_OS_INDICATIONS_START_

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

2019-04-10 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: 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 
---
 .../UefiDebugLibDebugPortProtocol/DebugLib.c  | 146 +-
 .../DebugLibConstructor.c |  72 +
 .../UefiDebugLibDebugPortProtocol.inf |  12 +-
 3 files changed, 158 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) {
-

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

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

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

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/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 (#38779): https://edk2.groups.io/g/devel/message/38779
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]
-=-=-=-=-=-=-=-=-=-=-=-



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

2019-04-10 Thread Gao, Zhichao
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

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 (#38778): https://edk2.groups.io/g/devel/message/38778
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]
-=-=-=-=-=-=-=-=-=-=-=-



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

2019-04-10 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 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: 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 
---
 MdePkg/Library/UefiDebugLibConOut/DebugLib.c  | 116 +-
 .../UefiDebugLibConOut/DebugLibConstructor.c  |  72 +++
 .../UefiDebugLibConOut/UefiDebugLibConOut.inf |  12 +-
 3 files changed, 142 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..48a761a71e
--- /dev/null
+++ 

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

2019-04-10 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 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: 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 
---
 MdePkg/Library/UefiDebugLibStdErr/DebugLib.c  | 113 +-
 .../UefiDebugLibStdErr/DebugLibConstructor.c  |  72 +++
 .../UefiDebugLibStdErr/UefiDebugLibStdErr.inf |  12 +-
 3 files changed, 140 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..48a761a71e
--- /dev/null
+++ 

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

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

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

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 
---
 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 (#38780): https://edk2.groups.io/g/devel/message/38780
Mute This Topic: https://groups.io/mt/31016458/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
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] [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

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));
&

[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] [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 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 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 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]
-=-=-=-=-=-=-=-=-=-=-=-



[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]
-=-=-=-=-=-=-=-=-=-=-=-



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

2019-04-13 Thread Gao, Zhichao


> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, April 12, 2019 4:06 PM
> To: devel@edk2.groups.io; Gao, Zhichao 
> Cc: Wang, Jian J ; Wu, Hao A ;
> Ni, Ray ; Zeng, Star ; Gao, Liming
> ; Sean Brogan ;
> Michael Turner ; Bret Barkelew
> 
> Subject: Re: [edk2-devel] [PATCH 0/2] MdeModulePkg: Make the screen
> seamless
> 
> On 04/12/19 05:14, Gao, Zhichao wrote:
> > 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(-)
> >
> 
> EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() is specified to clear the
> screen to black. Is this series compatible with that?

No. We only consider the console section.
There are two pcds to control the graphics output mode 
PcdVideoHorizontalResolution and PcdVideoVerticalResolution. Usually we set 
them as zero to make the mode to be the max mode the graphics supported and the 
graphics output protocol would initialize the mode to be the max mode in 
general. If so the SetMode would not  be runt. But that is done in the graphics 
output driver and the driver is usually a binary file. So we can't desire that 
the graphics driver  would set the max mode, that is the graphics output 
driver's vendor decided.
In the other condition, these two pcds would set a value and then graphics 
output driver would focus to set the mode and clear the screen. That is 
controlled by the consumer. By default the two pcds is initialized as 800 and 
600. Because this resolution may be the most normal resolution and the screen 
would always be cleared.
 
In my opinion, the behavior of graphics output section in this driver is fine 
and should not be changed. And also, it is hard for us to control it because 
the driver is usually not open source.
The upon results are based on kabylake Rvp3 platform. Maybe I missed something. 
Any incorrect, please feel free to point out.

Thanks,
Zhichao

> 
> Thanks,
> Laszlo

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

View/Reply Online (#38998): https://edk2.groups.io/g/devel/message/38998
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 09/25] MdeModulePkg/RuntimeResetSystemLib.c: Change comments

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

Refer to Uefi spec 2.8, the ResetData is valid while ResetStatus
is EFI_SUCCESS regardless of the ResetType is EfiResetPlatformSpecific
or not. So change the comments of ResetSystem.

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 
---
 .../Library/RuntimeResetSystemLib/RuntimeResetSystemLib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.c 
b/MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.c
index 7074f595b7..29b3f7ebd8 100644
--- a/MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.c
+++ b/MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.c
@@ -106,9 +106,7 @@ ResetPlatformSpecific (
 the data buffer starts with a Null-terminated 
string, optionally
 followed by additional binary data. The string is 
a description
 that the caller may use to further indicate the 
reason for the
-system reset. ResetData is only valid if 
ResetStatus is something
-other than EFI_SUCCESS unless the ResetType is 
EfiResetPlatformSpecific
-where a minimum amount of ResetData is always 
required.
+system reset.
 **/
 VOID
 EFIAPI
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 19/25] PcAtChipsetPkg/ResetSystemLib: Add new API ResetSystem

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

Add a new API ResetSystem to this ResetSystemLib instance.
It only adds the basic functions from ResetSystemRuntimeDxe.
Lacking of this interface may cause link error, if some drivers
use this new API and link to this library instance.
Notes:
This library API only provide a basic function of reset. Full
function should use the instance in the MdeModulePkg and make
sure the depex driver is dispatched.

Cc: Ray Ni 
Cc: Liming Gao 
Signed-off-by: Zhichao Gao 
---
 .../Library/ResetSystemLib/ResetSystemLib.c   | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c 
b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
index eccef89ebe..b215ebed61 100644
--- a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -99,3 +99,46 @@ ResetPlatformSpecific (
 {
   ResetCold ();
 }
+
+/**
+  The ResetSystem function resets the entire platform.
+
+  @param[in] ResetType  The type of reset to perform.
+  @param[in] ResetStatusThe status code for the reset.
+  @param[in] DataSize   The size, in bytes, of ResetData.
+  @param[in] ResetData  For a ResetType of EfiResetCold, EfiResetWarm, or 
EfiResetShutdown
+the data buffer starts with a Null-terminated 
string, optionally
+followed by additional binary data. The string is 
a description
+that the caller may use to further indicate the 
reason for the
+system reset.
+**/
+VOID
+EFIAPI
+ResetSystem (
+  IN EFI_RESET_TYPE   ResetType,
+  IN EFI_STATUS   ResetStatus,
+  IN UINTNDataSize,
+  IN VOID *ResetData OPTIONAL
+  )
+{
+  switch (ResetType) {
+  case EfiResetWarm:
+ResetWarm ();
+break;
+
+  case EfiResetCold:
+ResetCold ();
+break;
+
+  case EfiResetShutdown:
+ResetShutdown ();
+return ;
+
+  case EfiResetPlatformSpecific:
+ResetPlatformSpecific (DataSize, ResetData);
+return;
+
+  default:
+return ;
+  }
+}
-- 
2.21.0.windows.1


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

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



  1   2   3   4   5   6   7   8   9   >