Re: [edk2-devel] [Patch 1/1] BaseTools: Fixed a bug of IgnoreAutoGen

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

>-Original Message-
>From: Feng, Bob C
>Sent: Wednesday, September 11, 2019 6:14 PM
>To: devel@edk2.groups.io
>Cc: Gao, Liming ; Feng, Bob C 
>Subject: [Patch 1/1] BaseTools: Fixed a bug of IgnoreAutoGen
>
>REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2080
>After checking that if the build can't
>ignore Autogen due to there is no compelet autogen files,
>the build tool need to do a completely Autogen.
>
>This patch is to fix a bug that if AutoGen
>can't be skiped, the SkipAutoGen flag
>need to set to False
>
>Cc: Liming Gao 
>Signed-off-by: Bob Feng 
>---
> BaseTools/Source/Python/build/build.py | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/BaseTools/Source/Python/build/build.py
>b/BaseTools/Source/Python/build/build.py
>index 13be6c33ecd5..a034664dc388 100755
>--- a/BaseTools/Source/Python/build/build.py
>+++ b/BaseTools/Source/Python/build/build.py
>@@ -2202,10 +2202,11 @@ class Build():
> ExitFlag = threading.Event()
> ExitFlag.clear()
> if self.SkipAutoGen:
> Wa = self.VerifyAutoGenFiles()
> if Wa is None:
>+self.SkipAutoGen = False
> Wa, self.BuildModules =
>self.PerformAutoGen(BuildTarget,ToolChain)
> else:
> GlobalData.gAutoGenPhase = True
> self.BuildModules = self.SetupMakeSetting(Wa)
> else:
>--
>2.20.1.windows.1


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

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



Re: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state may be unsupported

2019-09-11 Thread Heinrich Schuchardt

On 9/12/19 4:32 AM, Jin, Eric wrote:

Heinrich,

Could you please provide your company/organization info in copyright part?


Hello Eric,

my work on EDK2 has neither been on behalf of a company or organization,
nor have I received any remuneration for it. If you deem it appropriate,
feel free to add my name.

Best regards

Heinrich Schuchardt


I could help to add it when I push the patch.

With that - Reviewed by: Eric Jin 

Best Regards
Eric

-Original Message-
From: Heinrich Schuchardt 
Sent: Thursday, September 12, 2019 2:45 AM
To: EDK II Development 
Cc: Jin, Eric ; Supreeth Venkatesh ; 
Stephano Cetola ; Heinrich Schuchardt 
Subject: [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state 
may be unsupported

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

The UEFI specification allows EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState()
to return EFI_UNSUPPORTED if a state change is not supported. This for instance 
may be the case when connecting via a serial connection.

Up to now the SCT has marked the conformance test as FAILED if SetState() was 
called with invalid parameters and EFI_UNSUPPORTED was returned which 
contradicts the specification.

Instead create a warning if SetState() returns EFI_UNSUPPORTED. This allows the 
user to check if the non-support is justified.

Signed-off-by: Heinrich Schuchardt 
---
v2:
Issue warning if EFI_UNSUPPORTED is returned when called with
invalid parameters.
---
  .../BlackBoxTest/SimpleTextInputExBBTestConformance.c   | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
index d997b651..946cb274 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestConformance.c
@@ -483,8 +483,10 @@ BBTestSetStateConformanceTestCheckpoint1 (
  ); }   }-  -  if ( EFI_INVALID_PARAMETER != 
Status) {++  if (Status == EFI_UNSUPPORTED) {+AssertionType = 
EFI_TEST_ASSERTION_WARNING;+  } else if (Status != EFI_INVALID_PARAMETER) { 
AssertionType = EFI_TEST_ASSERTION_FAILED;   } else { AssertionType = 
EFI_TEST_ASSERTION_PASSED;--
2.20.1





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

View/Reply Online (#47169): https://edk2.groups.io/g/devel/message/47169
Mute This Topic: https://groups.io/mt/34106966/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/CpuDxe: clean up PAGE_TABLE_LIB_PAGING_CONTEXT usage.

2019-09-11 Thread Dong, Eric
V2 changes:
Avoid use type case, use different file implementation.

V1 changes:
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1039

Current implementation not checks system mode before using
PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.X64 or
PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.Ia32. This patch check the
mode before using the correct one.

Cc: Ray Ni 
Cc: Laszlo Ersek 
Signed-off-by: Eric Dong 
---
 UefiCpuPkg/CpuDxe/CpuDxe.inf |  4 ++-
 UefiCpuPkg/CpuDxe/CpuPageTable.c | 41 +++-
 UefiCpuPkg/CpuDxe/CpuPageTable.h | 15 +
 UefiCpuPkg/CpuDxe/Ia32/PagingAttribute.c | 34 
 UefiCpuPkg/CpuDxe/X64/PagingAttribute.c  | 34 
 5 files changed, 112 insertions(+), 16 deletions(-)
 create mode 100644 UefiCpuPkg/CpuDxe/Ia32/PagingAttribute.c
 create mode 100644 UefiCpuPkg/CpuDxe/X64/PagingAttribute.c

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index 57381dbc85..d87fe503d1 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
@@ -54,9 +54,11 @@
 
 [Sources.IA32]
   Ia32/CpuAsm.nasm
+  Ia32/PagingAttribute.c
 
 [Sources.X64]
   X64/CpuAsm.nasm
+  X64/PagingAttribute.c
 
 [Protocols]
   gEfiCpuArchProtocolGuid   ## PRODUCES
diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTable.c
index ec5cd424fc..cb12177142 100644
--- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
+++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
@@ -155,6 +155,8 @@ GetCurrentPagingContext (
   MSR_IA32_EFER_REGISTER  MsrEfer;
   IA32_CR4Cr4;
   IA32_CR0Cr0;
+  UINT32  *Attributes;
+  UINTN   *PageTableBase;
 
   //
   // Don't retrieve current paging context from processor if in SMM mode.
@@ -167,25 +169,27 @@ GetCurrentPagingContext (
   mPagingContext.MachineType = IMAGE_FILE_MACHINE_I386;
 }
 
+GetPagingDetails (, , 
);
+
 Cr0.UintN = AsmReadCr0 ();
 Cr4.UintN = AsmReadCr4 ();
 
 if (Cr0.Bits.PG != 0) {
-  mPagingContext.ContextData.X64.PageTableBase = (AsmReadCr3 () & 
PAGING_4K_ADDRESS_MASK_64);
+  *PageTableBase = (AsmReadCr3 () & PAGING_4K_ADDRESS_MASK_64);
 } else {
-  mPagingContext.ContextData.X64.PageTableBase = 0;
+  *PageTableBase = 0;
 }
 if (Cr0.Bits.WP  != 0) {
-  mPagingContext.ContextData.Ia32.Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE;
+  *Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE;
 }
 if (Cr4.Bits.PSE != 0) {
-  mPagingContext.ContextData.Ia32.Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE;
+  *Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE;
 }
 if (Cr4.Bits.PAE != 0) {
-  mPagingContext.ContextData.Ia32.Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE;
+  *Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE;
 }
 if (Cr4.Bits.LA57 != 0) {
-  mPagingContext.ContextData.Ia32.Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL;
+  *Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL;
 }
 
 AsmCpuid (CPUID_EXTENDED_FUNCTION, , NULL, NULL, NULL);
@@ -197,12 +201,12 @@ GetCurrentPagingContext (
 MsrEfer.Uint64 = AsmReadMsr64(MSR_CORE_IA32_EFER);
 if (MsrEfer.Bits.NXE != 0) {
   // XD activated
-  mPagingContext.ContextData.Ia32.Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED;
+  *Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED;
 }
   }
 
   if (RegEdx.Bits.Page1GB != 0) {
-mPagingContext.ContextData.Ia32.Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAGE_1G_SUPPORT;
+*Attributes |= 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAGE_1G_SUPPORT;
   }
 }
   }
@@ -395,6 +399,7 @@ ConvertPageEntryAttribute (
 {
   UINT64  CurrentPageEntry;
   UINT64  NewPageEntry;
+  UINT32  *PageAttributes;
 
   CurrentPageEntry = *PageEntry;
   NewPageEntry = CurrentPageEntry;
@@ -438,7 +443,10 @@ ConvertPageEntryAttribute (
   break;
 }
   }
-  if ((PagingContext->ContextData.Ia32.Attributes & 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED) != 0) {
+
+  GetPagingDetails (>ContextData, NULL, );
+
+  if ((*PageAttributes & 
PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_XD_ACTIVATED) != 0) {
 if ((Attributes & EFI_MEMORY_XP) != 0) {
   switch 

Re: [edk2-devel] [PATCH v2 0/3] add DwMmcHcDxe driver

2019-09-11 Thread Loh, Tien Hock
Hi Ard, Leif, Christopher,

Any comments on the patches?

Thanks!
Tien Hock 
> -Original Message-
> From: Haojian Zhuang 
> Sent: Monday, September 2, 2019 5:31 PM
> To: Loh, Tien Hock 
> Cc: leif.lindh...@linaro.org; ard.biesheu...@linaro.org;
> christopher...@microsoft.com; devel@edk2.groups.io; thlo...@gmail.com
> Subject: Re: [PATCH v2 0/3] add DwMmcHcDxe driver
> 
> Hi Leif, Ard, Christopher,
> 
> Could you help to share the comments on this patch set? Thanks a lot.
> 
> Best Regards
> Haojian
> 
> On Thu, Aug 15, 2019 at 09:09:19AM +, Loh, Tien Hock wrote:
> > Hi Leif, Ard, Christopher,
> >
> > Haojian and I have tested the driver on 2 platforms, any further comments
> on this?
> >
> > Thanks
> > Tien Hock
> >
> > > -Original Message-
> > > From: Haojian Zhuang 
> > > Sent: Tuesday, July 30, 2019 3:33 PM
> > > To: Loh, Tien Hock ;
> > > leif.lindh...@linaro.org; ard.biesheu...@linaro.org;
> > > christopher...@microsoft.com
> > > Cc: devel@edk2.groups.io; thlo...@gmail.com
> > > Subject: Re: [PATCH v2 0/3] add DwMmcHcDxe driver
> > >
> > > On Wed, Jul 24, 2019 at 05:26:03PM +0800, tien.hock@intel.com
> wrote:
> > > > From: "Tien Hock, Loh" 
> > > >
> > > > Changelog:
> > > > v3:
> > > >   * Fix an issue in NonDiscoverableDeviceDxe driver where it did
> > > > not
> > > invalidate
> > > > cache before copying the memory.
> > > > v2:
> > > >   *Split DwMmcHcDxe driver into two patches. One is for
> > > > PlatformDwMmc
> > > protocol,
> > > >and the other is for DwMmcHcDxe driver.
> > > > v1:
> > > >   *Add NonDiscoverableDeviceDxe for embedded platform. Make
> > > DwMmcHcDxe driver
> > > >to support both eMMC and SD controller.
> > > >
> > > > Haojian Zhuang (3):
> > > >   EmbeddedPkg: add NonDiscoverableDeviceDxe driver
> > > >   EmbeddedPkg: add PlatformDwMmc protocol
> > > >   EmbeddedPkg/Drivers: add DwMmcHcDxe driver
> > > >
> > > >  .../Drivers/DwMmcHcDxe/ComponentName.c|  214 ++
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c   | 1295
> > > +
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec |   40 +
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h   |  815
> ++
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf |   69 +
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c | 2366
> > > +
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h |  983 +++
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c   | 1042
> 
> > > >  EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c | 1104 
> > > >  EmbeddedPkg/EmbeddedPkg.dec   |1 +
> > > >  EmbeddedPkg/Include/Protocol/PlatformDwMmc.h  |   79 +
> > > >  .../NonDiscoverableDeviceDxe/ComponentName.c  |  124 +
> > > >  .../NonDiscoverableDeviceDxe.c|  243 ++
> > > >  .../NonDiscoverableDeviceDxe.inf  |   52 +
> > > >  .../NonDiscoverableDeviceIo.c |  976 +++
> > > >  .../NonDiscoverableDeviceIo.h |   92 +
> > > >  16 files changed, 9495 insertions(+)  create mode 100644
> > > EmbeddedPkg/Drivers/DwMmcHcDxe/ComponentName.c
> > > >  create mode 100644
> > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.c
> > > >  create mode 100644
> > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.dec
> > > >  create mode 100644
> > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.h
> > > >  create mode 100644
> > > EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHcDxe.inf
> > > >  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.c
> > > >  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/DwMmcHci.h
> > > >  create mode 100644
> EmbeddedPkg/Drivers/DwMmcHcDxe/EmmcDevice.c
> > > >  create mode 100644 EmbeddedPkg/Drivers/DwMmcHcDxe/SdDevice.c
> > > >  create mode 100644
> EmbeddedPkg/Include/Protocol/PlatformDwMmc.h
> > > >  create mode 100644
> > > >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/ComponentName.c
> > > >  create mode 100644
> > > >
> > >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> > > eDx
> > > > e.c  create mode 100644
> > > >
> > >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> > > eDx
> > > > e.inf  create mode 100644
> > > >
> > >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> > > eIo
> > > > .c  create mode 100644
> > > >
> > >
> EmbeddedPkg/Universal/NonDiscoverableDeviceDxe/NonDiscoverableDevic
> > > eIo
> > > > .h
> > > >
> > > > --
> > > > 2.19.0
> > > >
> > >
> > > Hi Leif, Ard & Chris,
> > >
> > > Could you help to share your comments on this patch set?
> > >
> > > Best Regards
> > > Haojian

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

View/Reply Online (#47167): https://edk2.groups.io/g/devel/message/47167
Mute This Topic: https://groups.io/mt/32582252/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 2/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable

2019-09-11 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Thursday, September 12, 2019 11:27 AM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Gao, Liming 
> Subject: [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error handling to
> SortCpuLocalApicInTable
> 
> Change ASSERT_EFI_ERROR to return value when the "if" statement is true.
> As a result, when SortCpuLocalApicInTable is called, error handling is
> needed. So add "if" statement to judge the returned Status from
> SortCpuLocalApicInTable () in function InstallMadtFromScratch().
> 
> Cc: Michael Kubacki 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> index 2cc55ee8..ae25d753 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> @@ -354,7 +354,7 @@ SortCpuLocalApicInTable (
> 
>if(MAX_CPU_NUM <= Index) {
>  DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable
> Index Bufferflow\n"));
> -ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER);
> +return EFI_INVALID_PARAMETER;
>}
> 
>TempVal = mCpuApicIdOrderTable[Index].ApicId;
> @@ -874,7 +874,11 @@ InstallMadtFromScratch (
>DetectApicIdMap();
> 
>// Call for Local APIC ID Reorder
> -  SortCpuLocalApicInTable ();
> +  Status = SortCpuLocalApicInTable ();
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((EFI_D_ERROR, "SortCpuLocalApicInTable failed: %r\n",
> Status));
> +goto Done;
> +  }
> 
>MaxMadtStructCount = (UINT32) (
>  MAX_CPU_NUM +// processor local APIC structures
> --
> 2.18.0.windows.1


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

View/Reply Online (#47166): https://edk2.groups.io/g/devel/message/47166
Mute This Topic: https://groups.io/mt/34111553/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/2] MinPlatformPkg/AcpiTables: Initialize variables before used

2019-09-11 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Thursday, September 12, 2019 11:27 AM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Gao, Liming 
> Subject: [PATCH v2 1/2] MinPlatformPkg/AcpiTables: Initialize variables
> before used
> 
> MadtStructs, NewMadtTable and MaxMadtStructCount are not initialized
> before used or at the proper place. So assign values to them at the
> beginning and change the logic when freeing MadtStructs and
> NewMadtTable.
> 
> Cc: Michael Kubacki 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Acpi/AcpiTables/AcpiPlatform.c| 21 +++
>  1 file changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> index 5eb72792..2cc55ee8 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> @@ -1,7 +1,7 @@
>  /** @file
>ACPI Platform Driver
> 
> -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -867,13 +867,15 @@ InstallMadtFromScratch (
>UINT32
> PcIoApicMask;
>UINTN
> PcIoApicIndex;
> 
> +  MadtStructs = NULL;
> +  NewMadtTable = NULL;
> +  MaxMadtStructCount = 0;
> +
>DetectApicIdMap();
> 
>// Call for Local APIC ID Reorder
>SortCpuLocalApicInTable ();
> 
> -  NewMadtTable = NULL;
> -
>MaxMadtStructCount = (UINT32) (
>  MAX_CPU_NUM +// processor local APIC structures
>  MAX_CPU_NUM +// processor local x2APIC structures
> @@ -1115,14 +1117,15 @@ Done:
>//
>// Free memory
>//
> -  for (MadtStructsIndex = 0; MadtStructsIndex < MaxMadtStructCount;
> MadtStructsIndex++) {
> -if (MadtStructs[MadtStructsIndex] != NULL) {
> -  FreePool (MadtStructs[MadtStructsIndex]);
> +  if (MadtStructs != NULL){
> +for (MadtStructsIndex = 0; MadtStructsIndex < MaxMadtStructCount;
> MadtStructsIndex++) {
> +  if (MadtStructs[MadtStructsIndex] != NULL) {
> +FreePool (MadtStructs[MadtStructsIndex]);
> +  }
>  }
> +FreePool (MadtStructs);
>}
> -
> -  FreePool (MadtStructs);
> -
> +
>if (NewMadtTable != NULL) {
>  FreePool (NewMadtTable);
>}
> --
> 2.18.0.windows.1


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

View/Reply Online (#47165): https://edk2.groups.io/g/devel/message/47165
Mute This Topic: https://groups.io/mt/34111552/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] Add error handling and initialize variables

2019-09-11 Thread Zhang, Shenglei
1.Add error handling to enhance status checking.
2.Initialize the variables before used and add check before
  FreePool().

v2: Update copyright in 01/02.

Cc: Michael Kubacki 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 

Shenglei Zhang (2):
  MinPlatformPkg/AcpiTables: Initialize variables before used
  MinPlatformPkg/AcpiTables: Add error handling to
SortCpuLocalApicInTable

 .../Acpi/AcpiTables/AcpiPlatform.c| 29 ---
 1 file changed, 18 insertions(+), 11 deletions(-)

-- 
2.18.0.windows.1


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

View/Reply Online (#47162): https://edk2.groups.io/g/devel/message/47162
Mute This Topic: https://groups.io/mt/34111550/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/2] MinPlatformPkg/AcpiTables: Add error handling to SortCpuLocalApicInTable

2019-09-11 Thread Zhang, Shenglei
Change ASSERT_EFI_ERROR to return value when the "if" statement is true.
As a result, when SortCpuLocalApicInTable is called, error handling is
needed. So add "if" statement to judge the returned Status from
SortCpuLocalApicInTable () in function InstallMadtFromScratch().

Cc: Michael Kubacki 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .../Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index 2cc55ee8..ae25d753 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -354,7 +354,7 @@ SortCpuLocalApicInTable (
 
   if(MAX_CPU_NUM <= Index) {
 DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable Index 
Bufferflow\n"));
-ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER);
+return EFI_INVALID_PARAMETER;
   }
 
   TempVal = mCpuApicIdOrderTable[Index].ApicId;
@@ -874,7 +874,11 @@ InstallMadtFromScratch (
   DetectApicIdMap();
 
   // Call for Local APIC ID Reorder
-  SortCpuLocalApicInTable ();
+  Status = SortCpuLocalApicInTable ();
+  if (EFI_ERROR (Status)) {
+DEBUG ((EFI_D_ERROR, "SortCpuLocalApicInTable failed: %r\n", Status));
+goto Done;
+  }
 
   MaxMadtStructCount = (UINT32) (
 MAX_CPU_NUM +// processor local APIC structures
-- 
2.18.0.windows.1


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

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



[edk2-devel] [PATCH v2 1/2] MinPlatformPkg/AcpiTables: Initialize variables before used

2019-09-11 Thread Zhang, Shenglei
MadtStructs, NewMadtTable and MaxMadtStructCount are not initialized
before used or at the proper place. So assign values to them at the
beginning and change the logic when freeing MadtStructs and
NewMadtTable.

Cc: Michael Kubacki 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .../Acpi/AcpiTables/AcpiPlatform.c| 21 +++
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index 5eb72792..2cc55ee8 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -1,7 +1,7 @@
 /** @file
   ACPI Platform Driver
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -867,13 +867,15 @@ InstallMadtFromScratch (
   UINT32  PcIoApicMask;
   UINTN   PcIoApicIndex;
 
+  MadtStructs = NULL;
+  NewMadtTable = NULL;
+  MaxMadtStructCount = 0;
+
   DetectApicIdMap();
 
   // Call for Local APIC ID Reorder
   SortCpuLocalApicInTable ();
 
-  NewMadtTable = NULL;
-
   MaxMadtStructCount = (UINT32) (
 MAX_CPU_NUM +// processor local APIC structures
 MAX_CPU_NUM +// processor local x2APIC structures
@@ -1115,14 +1117,15 @@ Done:
   //
   // Free memory
   //
-  for (MadtStructsIndex = 0; MadtStructsIndex < MaxMadtStructCount; 
MadtStructsIndex++) {
-if (MadtStructs[MadtStructsIndex] != NULL) {
-  FreePool (MadtStructs[MadtStructsIndex]);
+  if (MadtStructs != NULL){
+for (MadtStructsIndex = 0; MadtStructsIndex < MaxMadtStructCount; 
MadtStructsIndex++) {
+  if (MadtStructs[MadtStructsIndex] != NULL) {
+FreePool (MadtStructs[MadtStructsIndex]);
+  }
 }
+FreePool (MadtStructs);
   }
-
-  FreePool (MadtStructs);
-
+  
   if (NewMadtTable != NULL) {
 FreePool (NewMadtTable);
   }
-- 
2.18.0.windows.1


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

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



[edk2-devel] [edk2-test][Patch 2/3] uefi-sct/SctPkg: Add HiiConfigAccess to IHVSCT build/configuration

2019-09-11 Thread Eric Jin
From: shrishail patil 

Cc: Supreeth Venkatesh 
Cc: Eric Jin 
Signed-off-by: shrishail patil 
---
 uefi-sct/SctPkg/UEFI/IHV_SCT.dsc | 2 ++
 uefi-sct/SctPkg/Config/Data/Category.ini | 8 
 2 files changed, 10 insertions(+)

diff --git a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
index 83396f1af0f5..4ba0c83e46ba 100644
--- a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2016 Unified EFI, Inc.
 #  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019,Microchip Technology Inc.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -210,6 +211,7 @@ 
SctPkg/TestCase/UEFI/IHV/Protocol/UsbIo/BlackBoxTest/IhvUsbIoTest.inf
 
SctPkg/TestCase/UEFI/IHV/Protocol/GraphicsOutput/BlackBoxTest/IhvGraphicsOutputBBTest.inf
 
SctPkg/TestCase/UEFI/IHV/Protocol/ExtScsiPassThru/BlackBoxTest/IhvExtScsiPassThruBBTest.inf
 SctPkg/TestCase/UEFI/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf
+SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
 
SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsiInitiatorNameBBTest.inf
 
 
SctPkg/TestCase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolutePointerBBTest.inf
diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini 
b/uefi-sct/SctPkg/Config/Data/Category.ini
index 3e9f5e52078d..6a9c123cedaa 100644
--- a/uefi-sct/SctPkg/Config/Data/Category.ini
+++ b/uefi-sct/SctPkg/Config/Data/Category.ini
@@ -3,6 +3,7 @@
 #  Copyright 2006 - 2017 Unified EFI, Inc.
 #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
 #  (C) Copyright 2017 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2019,Microchip Technology Inc.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -479,6 +480,13 @@ InterfaceGuid = 330D4706-F2A0-4E4F-A369-B66FA8D54385
 Name  = HIITest\HIIConfigAccessProtocolTest
 Description   =
 
+[Category Data]
+Revision  = 0x0001
+CategoryGuid  = 68820884-4BE3-4CA9-8381-9E98F3F48DAF
+InterfaceGuid = 330D4706-F2A0-4E4F-A369-B66FA8D54385
+Name  = IHV\HIITest\HIIConfigAccessProtocolTest
+Description   =
+
 [Category Data]
 Revision  = 0x0001
 CategoryGuid  = 587E72D7-CC50-4F79-8209-CA291FC1A10F
-- 
2.20.0.windows.1


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

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



[edk2-devel] [edk2-test][Patch 3/3] uefi-sct/SctPkg: Add HiiConfigAccess to IHV SCT binary package

2019-09-11 Thread Eric Jin
From: shrishail patil 

Cc: Supreeth Venkatesh 
Cc: Eric Jin 
Signed-off-by: shrishail patil 
---
 uefi-sct/SctPkg/CommonGenFramework.bat | 4 +++-
 uefi-sct/SctPkg/CommonGenFramework.sh  | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat 
b/uefi-sct/SctPkg/CommonGenFramework.bat
index 5c614eaa9a74..d84cbf379fc9 100644
--- a/uefi-sct/SctPkg/CommonGenFramework.bat
+++ b/uefi-sct/SctPkg/CommonGenFramework.bat
@@ -2,6 +2,7 @@
 @REM  Copyright 2006 - 2017 Unified EFI, Inc.
 @REM  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
 @REM  (C) Copyright 2017 Hewlett Packard Enterprise Development LP
+@REM  Copyright (c) 2019,Microchip Technology Inc.
 @REM
 @REM  This program and the accompanying materials
 @REM  are licensed and made available under the terms and conditions of the 
BSD License
@@ -279,7 +280,8 @@ rem  copy %ProcessorType%\IhvUsbHcTest.efi  
   %Framework%\T
   copy %ProcessorType%\IhvUsb2HcTest.efi
%Framework%\Test\ > NUL
   copy %ProcessorType%\IhviScsiInitiatorNameBBTest.efi  
%Framework%\Test\ > NUL
   copy %ProcessorType%\IhvStorageSecurityCommandBBTest.efi  
%Framework%\Test\ > NUL
-  
+  copy %ProcessorType%\IhvHIIConfigAccessBBTest.efi 
%Framework%\Test\ > NUL
+
   rem *
   rem Copy the UEFI 2.1 Test Cases for IHV
   rem *
diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh 
b/uefi-sct/SctPkg/CommonGenFramework.sh
index c422034a6457..7e15094d36f4 100755
--- a/uefi-sct/SctPkg/CommonGenFramework.sh
+++ b/uefi-sct/SctPkg/CommonGenFramework.sh
@@ -4,6 +4,7 @@
 #  Copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.
 #  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
 #  (C) Copyright 2017 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2019,Microchip Technology Inc.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -312,6 +313,7 @@ then
   cp $ProcessorType/IhvUsb2HcTest.efi$Framework/Test/ 
> NUL
   cp $ProcessorType/IhviScsiInitiatorNameBBTest.efi  $Framework/Test/ 
> NUL
   cp $ProcessorType/IhvStorageSecurityCommandBBTest.efi  $Framework/Test/ 
> NUL
+  cp $ProcessorType/IhvHIIConfigAccessBBTest.efi $Framework/Test/ 
> NUL
 
   # *
   # Copy the UEFI 2.1 Test Cases for IHV
-- 
2.20.0.windows.1


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

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



[edk2-devel] [edk2-test][Patch 1/3] uefi-sct/SctPkg: Add HiiConfigAccess test source to IHVSCT

2019-09-11 Thread Eric Jin
From: shrishail patil 

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

Adding HiiConfigAccess Protocol to IHVSCT.
This patch contains source code which is copied from
UEFISCT and added into IHVSCT.

Cc: Supreeth Venkatesh 
Cc: Eric Jin 
Signed-off-by: shrishail patil 
---
 .../BlackBoxTest/IhvHIIConfigAccessBBTest.inf |  56 ++
 .../HIIConfigAccess/BlackBoxTest/Guid.h   |  82 +++
 .../BlackBoxTest/HIIConfigAccessBBTestMain.h  | 145 
 .../HIIConfigAccess/BlackBoxTest/Guid.c   |  50 ++
 .../HIIConfigAccessBBTestConformance.c| 619 +
 .../HIIConfigAccessBBTestFunction.c   | 451 +
 .../BlackBoxTest/HIIConfigAccessBBTestMain.c  | 621 ++
 7 files changed, 2024 insertions(+)
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
new file mode 100644
index ..81252d100841
--- /dev/null
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
@@ -0,0 +1,56 @@
+## @file
+#
+#  Copyright 2006 - 2012 Unified EFI, Inc.
+#  Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019, ARM Ltd. All rights reserved.
+#  Copyright (c) 2019,Microchip Technology Inc.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD 
License
+#  which accompanies this distribution.  The full text of the license may be 
found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+#
+##
+#/*++
+#
+# Module Name:
+#
+#   HIIConfigAccessBBTest.inf
+#
+# Abstract:
+#
+#   Component description file for IHV HII Config Access Protocol Black-Box 
Test.
+#
+#--*/
+
+[defines]
+INF_VERSION  = 0x00010005
+BASE_NAME= IhvHIIConfigAccessBBTest
+FILE_GUID= D39F2A3B-72BF-40F5-86BF-2E1E96D15EA3
+MODULE_TYPE  = UEFI_DRIVER
+VERSION_STRING   = 1.0
+ENTRY_POINT  = InitializeHIIConfigAccessBBTest
+
+[sources.common]
+  HIIConfigAccessBBTestConformance.c
+  HIIConfigAccessBBTestFunction.c
+  HIIConfigAccessBBTestMain.c
+  Guid.c
+
+[Packages]
+  SctPkg/SctPkg.dec
+  SctPkg/UEFI/UEFI.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+  SctLib
+  EfiTestLib
+
+[Protocols]
+  gBlackBoxEfiHIIConfigAccessProtocolGuid
+  gBlackBoxEfiHIIConfigRoutingProtocolGuid
+  gBlackBoxEfiDevicePathProtocolGuid
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
new file mode 100644
index ..0baaf4b72539
--- /dev/null
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
@@ -0,0 +1,82 @@
+/** @file
+
+  Copyright 2006 - 2011 Unified EFI, Inc.
+  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+  Copyright (c) 2019,Microchip Technology Inc.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+/*++
+
+ Module Name:
+
+   Guid.h
+
+ Abstract:
+
+   GUIDs auto-generated for EFI test assertion.
+
+--*/
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_001_GUID \
+{ 0xa7173eb5, 0xf76a, 0x4ea1, { 0x95, 0xd, 0x14, 0x91, 0x1e, 0x49, 0x86, 0xc1 
} }
+
+extern EFI_GUID gHIIConfigAccessBBTestConformanceAssertionGuid001;
+
+#define EFI_TEST_HIICONFIGACCESSBBTESTCONFORMANCE_ASSERTION_002_GUID \
+{ 0xfa5973e2, 0xd05, 0x44c2, { 0xaf, 0x2d, 0x1b, 0x68, 0x33, 0x42, 0x6d, 0x76 
} }
+
+extern 

[edk2-devel] [edk2-test][Patch 0/3] Add HiiConfigAccess test to IHV

2019-09-11 Thread Eric Jin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2187
It is a request to add HiiConfigAccess test to IHV

Eric Jin (3):
  uefi-sct/SctPkg: Add HiiConfigAccess test source to IHVSCT
  uefi-sct/SctPkg: Add HiiConfigAccess to IHVSCT build/configuration
  uefi-sct/SctPkg: Add HiiConfigAccess to IHV SCT binary package

 uefi-sct/SctPkg/UEFI/IHV_SCT.dsc  |   2 +
 .../BlackBoxTest/IhvHIIConfigAccessBBTest.inf |  56 ++
 .../HIIConfigAccess/BlackBoxTest/Guid.h   |  82 +++
 .../BlackBoxTest/HIIConfigAccessBBTestMain.h  | 145 
 .../HIIConfigAccess/BlackBoxTest/Guid.c   |  50 ++
 .../HIIConfigAccessBBTestConformance.c| 619 +
 .../HIIConfigAccessBBTestFunction.c   | 451 +
 .../BlackBoxTest/HIIConfigAccessBBTestMain.c  | 621 ++
 uefi-sct/SctPkg/CommonGenFramework.bat|   4 +-
 uefi-sct/SctPkg/CommonGenFramework.sh |   2 +
 uefi-sct/SctPkg/Config/Data/Category.ini  |   8 +
 11 files changed, 2039 insertions(+), 1 deletion(-)
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/IhvHIIConfigAccessBBTest.inf
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.h
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.h
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/Guid.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestConformance.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestMain.c

-- 
2.20.0.windows.1


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

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



[edk2-devel] [PATCH] MinPlatformPkg/TestPointCheckLib: Add check for pointers

2019-09-11 Thread Zhang, Shenglei
In DxeCheckBootVariable.c, add check for BootOrder and Variable
that return EFI_NOT_FOUND when they are NULL.
In DxeCheckGcd.c, add check for GcdIoMap to ensure it not NULL
when allocating memory to what it points to.

Cc: Michael Kubacki 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---

v2: Update copyright

 .../Test/Library/TestPointCheckLib/DxeCheckBootVariable.c | 8 +++-
 .../Test/Library/TestPointCheckLib/DxeCheckGcd.c  | 6 --
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckBootVariable.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckBootVariable.c
index 85bd5b3d..98130683 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckBootVariable.c
+++ 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckBootVariable.c
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -130,6 +130,9 @@ TestPointCheckLoadOptionVariable (
   for (ListIndex = 0; ListIndex < 
sizeof(mLoadOptionVariableList)/sizeof(mLoadOptionVariableList[0]); 
ListIndex++) {
 UnicodeSPrint (BootOrderName, sizeof(BootOrderName), L"%sOrder", 
mLoadOptionVariableList[ListIndex]);
 Status = GetVariable2 (BootOrderName, , (VOID 
**), );
+if(BootOrder == NULL) {
+  return EFI_NOT_FOUND;;
+}
 if (EFI_ERROR(Status)) {
   continue;
 }
@@ -222,6 +225,9 @@ TestPointCheckKeyOptionVariable (
 for (Index = 0; ; Index++) {
   UnicodeSPrint (KeyOptionName, sizeof(KeyOptionName), L"%s%04x", 
mKeyOptionVariableList[ListIndex], Index);
   Status = GetVariable2 (KeyOptionName, , 
, );
+  if(Variable == NULL) {
+return EFI_NOT_FOUND;;
+  } 
   if (!EFI_ERROR(Status)) {
 DumpKeyOption (KeyOptionName, Variable, Size);
   } else {
diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckGcd.c 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckGcd.c
index 82709d44..c90b37f2 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckGcd.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckGcd.c
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -241,7 +241,9 @@ TestPointDumpGcd (
   }
 }
 if (GcdMemoryMap != NULL) {
-  *GcdIoMap = AllocateCopyPool (NumberOfDescriptors * 
sizeof(EFI_GCD_IO_SPACE_DESCRIPTOR), IoMap);
+  if (GcdIoMap != NULL){
+*GcdIoMap = AllocateCopyPool (NumberOfDescriptors * 
sizeof(EFI_GCD_IO_SPACE_DESCRIPTOR), IoMap);
+  }
   *GcdIoMapNumberOfDescriptors = NumberOfDescriptors;
 }
   }
-- 
2.18.0.windows.1


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

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



Re: [edk2-devel] [Patch] UefiCpuPkg/CpuDxe: clean up PAGE_TABLE_LIB_PAGING_CONTEXT usage.

2019-09-11 Thread Dong, Eric
Hi Laszlo,

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Wednesday, September 11, 2019 11:25 PM
> To: Dong, Eric ; devel@edk2.groups.io
> Cc: Ni, Ray 
> Subject: Re: [Patch] UefiCpuPkg/CpuDxe: clean up
> PAGE_TABLE_LIB_PAGING_CONTEXT usage.
> 
> On 09/11/19 03:45, Eric Dong wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1039
> >
> > Current implementation not checks system mode before using
> > PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.X64 or
> > PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.Ia32. This patch check
> the
> > mode before using the correct one.
> >
> > Cc: Ray Ni 
> > Cc: Laszlo Ersek 
> > Signed-off-by: Eric Dong 
> > ---
> >  UefiCpuPkg/CpuDxe/CpuPageTable.c | 52
> > +++-
> >  1 file changed, 37 insertions(+), 15 deletions(-)
> >
> > diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> > b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> > index ec5cd424fc..308f93b1cd 100644
> > --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> > +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> > @@ -155,6 +155,8 @@ GetCurrentPagingContext (
> >MSR_IA32_EFER_REGISTER  MsrEfer;
> >IA32_CR4Cr4;
> >IA32_CR0Cr0;
> > +  UINT32  *Attributes;
> > +  UINTN   *PageTableBase;
> >
> >//
> >// Don't retrieve current paging context from processor if in SMM mode.
> > @@ -163,29 +165,33 @@ GetCurrentPagingContext (
> >  ZeroMem (, sizeof(mPagingContext));
> >  if (sizeof(UINTN) == sizeof(UINT64)) {
> >mPagingContext.MachineType = IMAGE_FILE_MACHINE_X64;
> > +  Attributes = 
> > +  PageTableBase = 
> >  } else {
> >mPagingContext.MachineType = IMAGE_FILE_MACHINE_I386;
> > +  Attributes = 
> > +  PageTableBase = (UINTN
> > + *)
> 
> (1) This is quite unfortunate. I don't like the cast.
> 
> I understand why it is used here -- when we build for X64, then UINTN is
> UINT64, and so PageTableBase points to a UINT64. But
> "mPagingContext.ContextData.Ia32.PageTableBase" is a UINT32, so the
> compiler will complain about the incompatible pointer assignment.
> Therefore you use an explicit cast -- which would be wrong, if the code ever 
> ran,
> but then again, that code will never run.
> 
> I don't like this trick.
> 
> Furthermore, the same issue will exist on the *other* branch, if you build the
> present code for IA32 -- you didn't use a cast there. When building for IA32,
> PageTableBase points to a UINT32. But, on the first branch,
> "mPagingContext.ContextData.X64.PageTableBase" is a UINT64.
> Therefore, the compiler will warn the same (although the code will never run).
> 
> Did you build the patch for IA32?
Yes, I have got a report said IA32 and GCC5 build failure. I have prepared V2 
change to fix this issue. I don't want to send too much version of code change, 
so I wait for some feedback from this mail list before I send v2 change.

> 
> 
> I think there are two ways to fix this.
> 
> (1a) The ugly (but correct) fix is to use "#ifdef MDE_CPU_IA32" and "#ifdef
> MDE_CPU_X64" directives, and *no* casts. In other words, we should never
> compile the code that we won't run.
> 
> (1b) The nice (and also correct) fix is to introduce a helper function:
> 
> VOID
> GetPagingDetails (
>   IN  PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData,
>   OUT UINTN  **PageTableBase OPTIONAL,
>   OUT UINT32 **AttributesOPTIONAL
>   );
> 
> There would be two implementations:
> 
> - IA32 subdirectory:
> 
>   if (PageTableBase != NULL) {
> *PageTableBase = >Ia32.PageTableBase;
>   }
>   if (Attributes != NULL) {
> *Attributes = >Ia32.Attributes;
>   }
> 
> - X64 subdirectory:
> 
>   if (PageTableBase != NULL) {
> *PageTableBase = >X64.PageTableBase;
>   }
>   if (Attributes != NULL) {
> *Attributes = >X64.Attributes;
>   }
> 
> And here we'd do
> 
>   GetPagingDetails (
> ,
> ,
> 
> );
> 
> and the rest of the GetCurrentPagingContext() updates would be the same.
> 

I will use this option to update my code.

> 
> >  }
> >
> >  Cr0.UintN = AsmReadCr0 ();
> >  Cr4.UintN = AsmReadCr4 ();
> >
> >  if (Cr0.Bits.PG != 0) {
> > -  mPagingContext.ContextData.X64.PageTableBase = (AsmReadCr3 () &
> PAGING_4K_ADDRESS_MASK_64);
> > +  *PageTableBase = (AsmReadCr3 () & PAGING_4K_ADDRESS_MASK_64);
> >  } else {
> > -  mPagingContext.ContextData.X64.PageTableBase = 0;
> > +  *PageTableBase = 0;
> >  }
> >  if (Cr0.Bits.WP  != 0) {
> > -  mPagingContext.ContextData.Ia32.Attributes |=
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE;
> > +  *Attributes |=
> > +
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE;
> >  }
> >  if (Cr4.Bits.PSE != 0) {
> > -  mPagingContext.ContextData.Ia32.Attributes |=
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE;
> 

Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu

2019-09-11 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, September 12, 2019 9:03 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray
> Subject: [PATCH 3/3] MdeModulePkg/BM_UI: Add the new terminal types
> to related menu
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> 
> Add the new introduced terminal types to related setup menu to change
> the terminal type from setup. Most platforms would have its own
> configure setup menu and they need to change it to support these.
> The new introduced terminal types are Linux, XtermR6, VT400 and SCO.
> 


I will leave the patch to Ray, Dandan and Eric for review.

Best Regards,
Hao Wu


> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Zhichao Gao 
> ---
>  .../BootMaintenanceManager.h  | 13 ---
>  .../BootMaintenanceManagerStrings.uni | 10 +-
>  .../ConsoleOption.c   | 35 ++-
>  .../BootMaintenanceManagerUiLib/Data.c| 16 ++---
>  4 files changed, 40 insertions(+), 34 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManager.h
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManager.h
> index ea3cdce794..822401e68c 100644
> ---
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManager.h
> +++
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManager.h
> @@ -1,7 +1,7 @@
>  /** @file
>  Header file for boot maintenance module.
> 
> -Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include "FormGuid.h"
> 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -92,7 +93,11 @@ typedef enum _TYPE_OF_TERMINAL {
>TerminalTypeVt100,
>TerminalTypeVt100Plus,
>TerminalTypeVtUtf8,
> -  TerminalTypeTtyTerm
> +  TerminalTypeTtyTerm,
> +  TerminalTypeLinux,
> +  TerminalTypeXtermR6,
> +  TerminalTypeVt400,
> +  TerminalTypeSCO
>  } TYPE_OF_TERMINAL;
> 
>  //
> @@ -1301,12 +1306,12 @@ extern BM_MENU_OPTION
> ConsoleOutMenu;
>  extern BM_MENU_OPTION ConsoleErrMenu;
>  extern BM_MENU_OPTION DriverMenu;
>  extern BM_MENU_OPTION TerminalMenu;
> -extern UINT16 TerminalType[5];
> +extern UINT16 TerminalType[9];
>  extern COM_ATTR   BaudRateList[19];
>  extern COM_ATTR   DataBitsList[4];
>  extern COM_ATTR   ParityList[5];
>  extern COM_ATTR   StopBitsList[3];
> -extern EFI_GUID   TerminalTypeGuid[5];
> +extern EFI_GUID   TerminalTypeGuid[9];
>  extern EFI_DEVICE_PATH_PROTOCOL   EndDevicePath[];
>  extern UINT16 mFlowControlType[2];
>  extern UINT32 mFlowControlValue[2];
> diff --git
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManagerStrings.uni
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManagerStrings.uni
> index 2e67d27bd0..3d47473e6c 100644
> ---
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManagerStrings.uni
> +++
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc
> eManagerStrings.uni
> @@ -1,7 +1,7 @@
>  ///** @file
>  //  String definitions for Boot Maintenance Utility.
>  //
> -//  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
> +//  Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
>  //  SPDX-License-Identifier: BSD-2-Clause-Patent
>  //
>  //**/
> @@ -233,6 +233,14 @@
> #language fr-FR  "VT_UTF8"
>  #string STR_COM_TYPE_4 #language en-US  "TTY_TERM"
> #language fr-FR  "TTY_TERM"
> +#string STR_COM_TYPE_5 #language en-US  "LINUX"
> +   #language fr-FR  "LINUX"
> +#string STR_COM_TYPE_6 #language en-US  "XTERM_R6"
> +   #language fr-FR  "XTERM_R6"
> +#string STR_COM_TYPE_7 #language en-US  "VT_400"
> +   #language fr-FR  "VT_400"
> +#string STR_COM_TYPE_8 #language en-US  "SCO"
> +   #language fr-FR  "SCO"
>  #string STR_RESET  #language en-US  "Reset System"
> #language fr-FR  "Reset System"
>  #string STR_FORM_GOTO_MAIN #language en-US  "Go Back To Main
> Page"
> diff --git
> a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
> b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
> index 7a53b58771..b0641c5ee9 100644
> ---
> 

Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types

2019-09-11 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, September 12, 2019 9:02 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray
> Subject: [PATCH 2/3] MdeModulePkg/TerminalDxe: Extend the terminal
> console support types
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> 
> Extend the support types of terminal console driver. New added types
> are Linux, XtermR6, VT400 and SCO.
> 
> Refer to
> https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-
> funkeys
> 
> Add the missing VT100+ function keys map.
> 
> Add F1-F12 function keys map for Linux, XtermR6, VT400 and SCO.


I will leave the patch to Ray for review.

Best Regards,
Hao Wu


> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Zhichao Gao 
> ---
>  .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
>  .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
>  .../Console/TerminalDxe/TerminalConIn.c   | 281 --
>  .../Console/TerminalDxe/TerminalConOut.c  |   4 +
>  .../Console/TerminalDxe/TerminalDxe.inf   |   6 +-
>  5 files changed, 319 insertions(+), 26 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> index c76b2c5100..526067d023 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
> @@ -2,7 +2,7 @@
>Produces Simple Text Input Protocol, Simple Text Input Extended Protocol
> and
>Simple Text Output Protocol upon Serial IO Protocol.
> 
> -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
> 
>  **/
> @@ -28,7 +28,11 @@ EFI_GUID  *mTerminalType[] = {
>,
>,
>,
> -  
> +  ,
> +  ,
> +  ,
> +  ,
> +  
>  };
> 
> 
> @@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
>L"VT-100 Serial Console",
>L"VT-100+ Serial Console",
>L"VT-UTF8 Serial Console",
> -  L"Tty Terminal Serial Console"
> +  L"Tty Terminal Serial Console",
> +  L"Linux Mode Terminal Serial Console",
> +  L"Xterm R6 Terminal Serial Console",
> +  L"VT400 Terminal Serial Console",
> +  L"SCO Terminal Serial Console"
>  };
> 
>  TERMINAL_DEV  mTerminalDevTemplate = {
> @@ -187,7 +195,8 @@ TerminalDriverBindingSupported (
> 
>}
>//
> -  // only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm terminal
> types
> +  // only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm
> +  // Linux, XtermR6, VT400 and SCO terminal types
>//
>if (TerminalTypeFromGuid (>Guid) == ARRAY_SIZE
> (mTerminalType)) {
>  return EFI_UNSUPPORTED;
> diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> index b2f0901fc1..d683aa792f 100644
> --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
> @@ -1,7 +1,7 @@
>  /** @file
>Header file for Terminal driver.
> 
> -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
>  Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -81,7 +81,11 @@ typedef enum {
>TerminalTypeVt100,
>TerminalTypeVt100Plus,
>TerminalTypeVtUtf8,
> -  TerminalTypeTtyTerm
> +  TerminalTypeTtyTerm,
> +  TerminalTypeLinux,
> +  TerminalTypeXtermR6,
> +  TerminalTypeVt400,
> +  TerminalTypeSCO
>  } TERMINAL_TYPE;
> 
>  typedef struct {
> @@ -126,7 +130,9 @@ typedef struct {
>  #define INPUT_STATE_LEFTOPENBRACKET   0x04
>  #define INPUT_STATE_O 0x08
>  #define INPUT_STATE_2 0x10
> -#define INPUT_STATE_LEFTOPENBRACKET_2 0x20
> +#define INPUT_STATE_LEFTOPENBRACKET_TTY   0x20
> +#define INPUT_STATE_1 0x40
> +#define INPUT_STATE_LEFTOPENBRACKET_2ND   0x80
> 
>  #define RESET_STATE_DEFAULT   0x00
>  #define RESET_STATE_ESC_R 0x01
> @@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable (
>  /**
>Build termial device path according to terminal type.
> 
> -  @param  TerminalType   The terminal type is PC ANSI, VT100, VT100+ 
> or
> VT-UTF8.
> +  @param  TerminalType   The terminal type is PC ANSI, VT100, VT100+,
> VT-UTF8, TTY-Term,
> + Linux, XtermR6 or VT400.
>@param  ParentDevicePath   Parent device path.
>@param  TerminalDevicePath Returned terminal device path, if building
> successfully.
> 
> @@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode (
>| F12 | 0x16 |   | ESC @|  |
>+=+==+===+==+==+
> 
> +Putty function key map:
> +
> +=+==+===+=+=+

Re: [edk2-devel] [PATCH 1/3] MdeModulePkg: Entend the support keyboard type of Terminal console

2019-09-11 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, September 12, 2019 9:02 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray
> Subject: [PATCH 1/3] MdeModulePkg: Entend the support keyboard type of
> Terminal console


Hello,

Entend -> Extend


> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2186
> 
> A common terminal console software Putty support various types of
> keyboard type, such as normal mode, Linux mode, Xterm R6, Vt400,
> VT100+ and SCO. Refer to the link:
> https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-
> funkeys
> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Zhichao Gao 
> ---
>  .../Include/Guid/TerminalConExtendedType.h| 25
> +++
>  MdeModulePkg/MdeModulePkg.dec |  6 +
>  2 files changed, 31 insertions(+)
>  create mode 100644
> MdeModulePkg/Include/Guid/TerminalConExtendedType.h
> 
> diff --git a/MdeModulePkg/Include/Guid/TerminalConExtendedType.h
> b/MdeModulePkg/Include/Guid/TerminalConExtendedType.h
> new file mode 100644
> index 00..18667413e8
> --- /dev/null
> +++ b/MdeModulePkg/Include/Guid/TerminalConExtendedType.h
> @@ -0,0 +1,25 @@
> +/** @file
> +  GUID definition for Linux, XtermR6, Vt400 and SCO terminal type.
> +
> +
> +  Copyright (c) 2019, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __TERMINAL_CON_EXTENDED_TYPE_H__
> +#define __TERMINAL_CON_EXTENDED_TYPE_H__
> +
> +#define EDKII_LINUX_MODE_GUID   \
> +{ 0xe4364a7f, 0xf825, 0x430e, { 0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c,
> 0xa5 } }
> +
> +#define EDKII_XTERM_R6_GUID \
> +{ 0xfbfca56b, 0xbb36, 0x4b78, { 0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c,
> 0xcb } }
> +
> +#define EDKII_VT400_GUID\
> +{ 0x8e46, 0x3d49, 0x4a9d, { 0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2,
> 0xbd } }
> +
> +#define EDKII_SCO_GUID  \
> +{ 0xfc7dd6e0, 0x813c, 0x434d, { 0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1,
> 0x5a } }
> +


I would suggest to add corresponding GUID declarations just as what has been
done in:

MdePkg/Include/Guid/PcAnsi.h
MdeModulePkg/Include/Guid/TtyTerm.h


> +#endif
> diff --git a/MdeModulePkg/MdeModulePkg.dec
> b/MdeModulePkg/MdeModulePkg.dec
> index 17beb45235..7528d52fcb 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -343,6 +343,12 @@
>## Include/Guid/TtyTerm.h
>gEfiTtyTermGuid= { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 
> 0x8f, 0xe2,
> 0x5f, 0xdd, 0x51, 0xef, 0x94 }}
> 
> +  ## Include/Guid/TerminalConExtendedType.h
> +  gEdkiiLinuxModeGuid   = { 0xe4364a7f, 0xf825, 0x430e, { 0x9d, 0x3a,
> 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }
> +  gEdkiiXtermR6Guid = { 0xfbfca56b, 0xbb36, 0x4b78, { 0xaa, 0xab,
> 0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }
> +  gEdkiiVT400Guid   = { 0x8e46, 0x3d49, 0x4a9d, { 0xb8, 
> 0x75, 0x3c,
> 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }
> +  gEdkiiSCOGuid = { 0xfc7dd6e0, 0x813c, 0x434d, { 0xb4, 
> 0xda, 0x3b,
> 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }
> +


After this patch, there will be 3 header files that describe different terminal
modes supported in TerminalDxe driver:

MdePkg/Include/Guid/PcAnsi.h (PcAnsi, VT100, VT100+, VTUTF8)
MdeModulePkg/Include/Guid/TtyTerm.h (TtyTerm)
MdeModulePkg/Include/Guid/TerminalConExtendedType.h (Linux, Xterm R6, Vt400, 
SCO)

Do we have a plan to add those 5 non-UEFI modes in the UEFI spec?

If not, I am wondering is it possible to at least merge TtyTerm.h and
TerminalConExtendedType.h into one file so that we can avoid introducing new
header files every time new terminal modes are being added.

Best Regards,
Hao Wu


>## Include/Guid/HiiBootMaintenanceFormset.h
>gEfiIfrBootMaintenanceGuid  = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 
> 0x8a,
> 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
> 
> --
> 2.21.0.windows.1


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

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



[edk2-devel] [PATCH] BaseTools/LzmaCompress: Add two switches

2019-09-11 Thread Zhang, Shenglei
As is requested in the BZ 2077, add two switches to support setting
compression mode and dictionary size.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)

Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 .../Source/C/LzmaCompress/LzmaCompress.c  | 39 +++
 BaseTools/Source/C/LzmaCompress/Makefile  |  4 +-
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c 
b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
index a3607f9b2084..e18a1e0365f6 100644
--- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
+++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
@@ -5,7 +5,7 @@
 LzmaUtil.c -- Test application for LZMA compression
 2018-04-30 : Igor Pavlov : Public domain
 
-  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
 
 **/
@@ -23,6 +23,7 @@
 #include "Sdk/C/LzmaEnc.h"
 #include "Sdk/C/Bra.h"
 #include "CommonLib.h"
+#include "ParseInf.h"
 
 #define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
 
@@ -36,10 +37,14 @@ const char *kCantReadMessage = "Can not read input file";
 const char *kCantWriteMessage = "Can not write output file";
 const char *kCantAllocateMessage = "Can not allocate memory";
 const char *kDataErrorMessage = "Data error";
+const char *kInvalidParamValMessage = "Invalid parameter value";
 
 static Bool mQuietMode = False;
 static CONVERTER_TYPE mConType = NoConverter;
 
+UINT64 DictionarySize = 31;
+UINT64 CompressionMode = 2;
+
 #define UTILITY_NAME "LzmaCompress"
 #define UTILITY_MAJOR_VERSION 0
 #define UTILITY_MINOR_VERSION 2
@@ -58,6 +63,8 @@ void PrintHelp(char *buffer)
  "  -v, --verbose: increase output messages\n"
  "  -q, --quiet: reduce output messages\n"
  "  --debug [0-9]: set debug level\n"
+ "  -a: set compression mode 0 = fast, 1 = normal, default: 1 
(normal)\n"
+ "  d: sets Dictionary size - [0, 30], default: 23 (8MB)\n"
  "  --version: display the program version and exit\n"
  "  -h, --help: display this help text\n"
  );
@@ -87,7 +94,7 @@ void PrintVersion(char *buffer)
   sprintf (buffer, "%s Version %d.%d %s ", UTILITY_NAME, 
UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
 }
 
-static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 
fileSize)
+static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 
fileSize, CLzmaEncProps props)
 {
   SRes res;
   size_t inSize = (size_t)fileSize;
@@ -95,10 +102,6 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream 
*inStream, UInt64 file
   Byte *outBuffer = 0;
   Byte *filteredStream = 0;
   size_t outSize;
-  CLzmaEncProps props;
-
-  LzmaEncProps_Init();
-  LzmaEncProps_Normalize();
 
   if (inSize != 0) {
 inBuffer = (Byte *)MyAlloc(inSize);
@@ -246,6 +249,10 @@ int main2(int numArgs, const char *args[], char *rs)
   const char *outputFile = "file.tmp";
   int param;
   UInt64 fileSize;
+  CLzmaEncProps props;
+
+  LzmaEncProps_Init();
+  LzmaEncProps_Normalize();
 
   FileSeqInStream_CreateVTable();
   File_Construct();
@@ -280,6 +287,24 @@ int main2(int numArgs, const char *args[], char *rs)
   // parameter compatibility with other build tools.
   //
   param++;
+} else if (strcmp(args[param], "-a") == 0) {
+  AsciiStringToUint64(args[param + 1],FALSE,);
+  if ((CompressionMode == 0)||(CompressionMode == 1)){
+props.algo = (int)CompressionMode;
+   param++;
+continue;
+  } else {
+return PrintError(rs, kInvalidParamValMessage);
+  }
+} else if (strcmp(args[param], "d") == 0) {
+  AsciiStringToUint64(args[param + 1],FALSE,);
+  if ((DictionarySize >= 0)&&(DictionarySize <= 30)){
+props.dictSize = (UINT32)DictionarySize;
+   param++;
+continue;
+  } else {
+return PrintError(rs, kInvalidParamValMessage);
+  }
 } else if (
 strcmp(args[param], "-h") == 0 ||
 strcmp(args[param], "--help") == 0
@@ -335,7 +360,7 @@ int main2(int numArgs, const char *args[], char *rs)
 if (!mQuietMode) {
   printf("Encoding\n");
 }
-res = Encode(, , fileSize);
+res = Encode(, , fileSize, props);
   }
   else
   {
diff --git a/BaseTools/Source/C/LzmaCompress/Makefile 
b/BaseTools/Source/C/LzmaCompress/Makefile
index 12be48de2940..055f5d3ac3ca 100644
--- a/BaseTools/Source/C/LzmaCompress/Makefile
+++ b/BaseTools/Source/C/LzmaCompress/Makefile
@@ -1,14 +1,14 @@
 ## @file
 # Windows makefile for 'LzmaCompress' module build.
 #
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 !INCLUDE ..\Makefiles\ms.common
 
 APPNAME = LzmaCompress
 

Re: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state may be unsupported

2019-09-11 Thread Eric Jin
Heinrich,

Could you please provide your company/organization info in copyright part?
I could help to add it when I push the patch.

With that - Reviewed by: Eric Jin 

Best Regards
Eric

-Original Message-
From: Heinrich Schuchardt  
Sent: Thursday, September 12, 2019 2:45 AM
To: EDK II Development 
Cc: Jin, Eric ; Supreeth Venkatesh 
; Stephano Cetola 
; Heinrich Schuchardt 
Subject: [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state 
may be unsupported

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

The UEFI specification allows EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState()
to return EFI_UNSUPPORTED if a state change is not supported. This for instance 
may be the case when connecting via a serial connection.

Up to now the SCT has marked the conformance test as FAILED if SetState() was 
called with invalid parameters and EFI_UNSUPPORTED was returned which 
contradicts the specification.

Instead create a warning if SetState() returns EFI_UNSUPPORTED. This allows the 
user to check if the non-support is justified.

Signed-off-by: Heinrich Schuchardt 
---
v2:
Issue warning if EFI_UNSUPPORTED is returned when called with
invalid parameters.
---
 .../BlackBoxTest/SimpleTextInputExBBTestConformance.c   | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
index d997b651..946cb274 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestConformance.c
@@ -483,8 +483,10 @@ BBTestSetStateConformanceTestCheckpoint1 (
 ); }   }-  -  if ( EFI_INVALID_PARAMETER != 
Status) {++  if (Status == EFI_UNSUPPORTED) {+AssertionType = 
EFI_TEST_ASSERTION_WARNING;+  } else if (Status != EFI_INVALID_PARAMETER) { 
AssertionType = EFI_TEST_ASSERTION_FAILED;   } else { AssertionType = 
EFI_TEST_ASSERTION_PASSED;-- 
2.20.1


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

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



Re: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: buffer overflow in NotifyFunctionTplEx()

2019-09-11 Thread Eric Jin
Heinrich,

Could you please provide your company/organization info in copyright part?
I could help to add it when I push the patch.

With that - Reviewed by: Eric Jin 

Best Regards
Eric

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Heinrich 
Schuchardt
Sent: Thursday, September 12, 2019 3:41 AM
To: EDK II Development 
Cc: Jin, Eric ; Supreeth Venkatesh 
; Stephano Cetola 
; Heinrich Schuchardt 
Subject: [edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: buffer 
overflow in NotifyFunctionTplEx()

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

CreateEventEx() may lead to a change in the memory map causing an 
EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. So in BBTestCreateEventEx_Func_Sub3() we 
should only check for events triggered after the events have been set up.

Among other changes commit c093702f98ad (""uefi-sct/SctPkg:Fix flaw in
BBTestCreateEventEx_Func_Sub3) tried to adjust the event recording logic in
NotifyFunctionTplEx() to account for this.

The commit did not consider that CloseEvent() will release memory and equally 
lead to EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. NotifyFunctionTplEx() does not check 
the limits of the buffer. So a buffer overrun occurs in this case.

The easiest way to account for memory map changes by CreateEventEx() is to 
initialize the event invocation records after setting up the events.

Moving the check of the event sequence to before CloseEvent() ensures that we 
only measure the events we are interested in.

In function NotifyFunctionTplEx() check the index against the buffer limits. 
Stop recording after MAX_TEST_EVENT_NUM events.

Fixes: c093702f98ad (""uefi-sct/SctPkg:Fix flaw in 
BBTestCreateEventEx_Func_Sub3)
Signed-off-by: Heinrich Schuchardt 
---
v2:
Move closing and freeing of events after the assertion. This ensures
that memory changes resulting from CloseEvent() do not change the
test results.
---
 ...rTaskPriorityServicesBBTestCreateEventEx.c | 35 +++-
 .../BlackBoxTest/Support.c| 55 +--
 2 files changed, 35 insertions(+), 55 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index 4a8e44e2..2b119ff0 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPrior
+++ ityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateE
+++ ventEx.c
@@ -918,12 +918,11 @@ BBTestCreateEventEx_Func_Sub3 (
   UINTN   Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
//-  // Initialize Buffer as SIGNAL_CONTEXT+  // Initialize the event index. 
The event invocation records will be+  // initialized later.
   //   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) { 
Buffer[Index] = Index;-Buffer[Index + MAX_TEST_EVENT_NUM + Index] = 
(UINTN)(SIGNAL_CONTEXT);-Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = 
(UINTN)(SIGNAL_CONTEXT);   }//@@ -976,7 +975,17 @@ 
BBTestCreateEventEx_Func_Sub3 (
 gtBS->CloseEvent (Event[1]); return Status;   }-  ++  //+  // 
CreateEventEx() may lead to a change in the memory map and trigger+  // 
EFI_EVENT_GROUP_MEMORY_MAP_CHANGE itself. So initialize the event+  // 
invocation records after creating the events.+  //+  for (Index = 0; Index < 
MAX_TEST_EVENT_NUM; Index ++) {+Buffer[Index + MAX_TEST_EVENT_NUM + Index] 
= (UINTN)(SIGNAL_CONTEXT);+Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = 
(UINTN)(SIGNAL_CONTEXT);+  }+   //   // Call AllocatePage to change the 
memorymap   //@@ -998,14 +1007,6 @@ BBTestCreateEventEx_Func_Sub3 (
   gtBS->RestoreTPL (OldTpl); -  //-  // Close all the events created 
and Free the pages-  //-  gtBS->CloseEvent (Event[0]);-  gtBS->CloseEvent 
(Event[1]);-  gtBS->CloseEvent (Event[2]);-  gtBS->FreePages (Memory, 2);-   // 
  // Compare the notify order   //@@ -1030,9 +1031,17 @@ 
BBTestCreateEventEx_Func_Sub3 (
  Buffer[MAX_TEST_EVENT_NUM + 5]  ); +  //+  // 
Close all the events created and Free the pages+  //+  gtBS->CloseEvent 
(Event[0]);+  gtBS->CloseEvent (Event[1]);+  gtBS->CloseEvent (Event[2]);+  
gtBS->FreePages (Memory, 2);+   //   // Done   //   return EFI_SUCCESS; }-#endif
\ No newline at end of file
+#endif
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index c702f84d..0c900a3e 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ 

Re: [edk2-devel] [edk2-core] [PATCH v2 1/1] MdeModulePkg: Make retval in UninstallMultipleProtocol follow Spec

2019-09-11 Thread Dandan Bi
Hi ,

Thanks for the update. 
I don't know how you send this patch, the format and subject seems a little 
different from V1 patch. Anyway it doesn't block my review of this patch.

I have two minor comments for the function comments:
1. Per EDKII C Coding Spec, @retval for each unique return value, @return for a 
function's return values when those values aren't easily described by @retval 
commands.
So here I think we should use @retval instead of @return.
2. Per my understanding, the protocol interfaces uninstalled prior to the error 
seems not to be reinstalled in reverse order of uninstalling, the 
reinstallation seems in the same order of previous uninstalling (start from the 
first pair after the handle to next...). Please help double check this issue 
and update the comments if needed .

Since these are the comments update and with these addressed,  Reviewed-by: 
Dandan Bi 

Thanks,
Dandan
> -Original Message-
> From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de]
> Sent: Tuesday, September 10, 2019 4:12 PM
> To: EDK II Development ; Bi, Dandan
> 
> Cc: Wu, Hao A ; Wang, Jian J ;
> Gao, Liming ; Zeng, Star ; Yao,
> Jiewen ; Laszlo Ersek ; Jin, Eric
> ; Supreeth Venkatesh ;
> Stephano Cetola ; Heinrich Schuchardt
> 
> Subject: [edk2-core] [PATCH v2 1/1] MdeModulePkg: Make retval in
> UninstallMultipleProtocol follow Spec
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1869
> 
> The UEFI spec requires that if any error occurs in
> UninstallMultipleProtocolInterfaces(), EFI_INVALID_PARAMETER is returned
> and not the return code of UninstallProtocolInterface().
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
> v2
>   Adjust the subject line.
>   Adjust the function comments to clarify the behavior.
>   This replaces https://edk2.groups.io/g/devel/message/46974
> ---
>  MdeModulePkg/Core/Dxe/Hand/Handle.c | 21 +++--
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c
> b/MdeModulePkg/Core/Dxe/Hand/Handle.c
> index b2721b3ab2..719ba98261 100644
> --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c
> +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c
> @@ -802,20 +802,28 @@ Done:
>- /**   Uninstalls a list of protocol interface in the boot services
> environment.-  This function calls UnisatllProtocolInterface() in a loop. This
> is+  This function calls UninstallProtocolInterface() in a loop. This is   
> basically a
> lib function to save space. -  @param  Handle The handle to 
> uninstall
> the protocol+  If any errors are generated while the protocol interfaces are
> being+  uninstalled, then the protocol interfaces uninstalled prior to the 
> error
> will+  be reinstalled in reverse order of uninstalling and
> EFI_INVALID_PARAMETER is+  returned.++  @param  Handle The
> handle to uninstall the protocol interfaces+ 
> from.   @param  ...
> EFI_GUID followed by protocol instance. A NULL-   
>   terminates
> the  list. The pairs are the+ terminates the 
> list. The pairs are
> the  arguments to 
> UninstallProtocolInterface(). All
> the protocols are added to Handle. -  @return Status code-+  @return
> EFI_SUCCESSif all protocol interfaces where uninstalled.+  @return
> EFI_INVALID_PARAMETER  if any protocol interface could not be+
> uninstalled and an attempt was made to+ 
> reinstall previously
> uninstalled protocol+ interfaces. **/ 
> EFI_STATUS EFIAPI@@ -
> 864,6 +872,7 @@ CoreUninstallMultipleProtocolInterfaces (
>CoreInstallProtocolInterface (, Protocol, EFI_NATIVE_INTERFACE,
> Interface); } VA_END (Args);+Status = EFI_INVALID_PARAMETER;   }
> return Status;--
> 2.20.1


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

View/Reply Online (#47148): https://edk2.groups.io/g/devel/message/47148
Mute This Topic: https://groups.io/mt/34089787/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 1/1] MdePkg: Add STATIC_ASSERT macro

2019-09-11 Thread Liming Gao
Push @204ae9da230ecbf0910c21acac7aa5d5e8cbb8d0

>-Original Message-
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>Philippe Mathieu-Daudé
>Sent: Tuesday, September 10, 2019 2:30 PM
>To: devel@edk2.groups.io; vit9...@protonmail.com
>Subject: Re: [edk2-devel] [PATCH v3 1/1] MdePkg: Add STATIC_ASSERT macro
>
>On 8/17/19 1:28 AM, Vitaly Cheptsov via Groups.Io wrote:
>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2048
>>
>> Provide a macro for compile time assertions.
>> Equivalent to C11 static_assert macro from assert.h.
>>
>> Signed-off-by: Vitaly Cheptsov 
>> ---
>>  MdePkg/Include/Base.h | 14 ++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
>> index ce20b5f01d..ec096133ba 100644
>> --- a/MdePkg/Include/Base.h
>> +++ b/MdePkg/Include/Base.h
>> @@ -843,6 +843,20 @@ typedef UINTN  *BASE_LIST;
>>  #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
>>  #endif
>>
>> +/**
>> +  Portable definition for compile time assertions.
>> +  Equivalent to C11 static_assert macro from assert.h.
>> +
>> +  @param  Expression  Boolean expression.
>> +  @param  Message Raised compiler diagnostic message when
>expression is false.
>> +
>> +**/
>> +#ifdef _MSC_EXTENSIONS
>> +  #define STATIC_ASSERT static_assert
>> +#else
>> +  #define STATIC_ASSERT _Static_assert
>> +#endif
>> +
>>  /**
>>Macro that returns a pointer to the data structure that contains a 
>> specified
>field of
>>that data structure.  This is a lightweight method to hide information by
>placing a
>>
>
>Reviewed-by: Philippe Mathieu-Daude 
>
>


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

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



Re: [edk2-devel] Increase robustness of nmake BaseTools build for space also used by make

2019-09-11 Thread Liming Gao
push@5e5abfcab4c2962005be89c951a86f55db27555e

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming Gao
Sent: Tuesday, September 10, 2019 11:23 PM
To: devel@edk2.groups.io; bur...@gmail.com
Subject: Re: [edk2-devel] Increase robustness of nmake BaseTools build for 
space also used by make

Reviewed-by: Liming Gao mailto:liming@intel.com>>

From: devel@edk2.groups.io 
[mailto:devel@edk2.groups.io] On Behalf Of Burt Silverman
Sent: Sunday, September 8, 2019 6:10 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] Increase robustness of nmake BaseTools build for space 
also used by make

Author: Burt Silverman mailto:bur...@gmail.com>>
Date:   Sat Sep 7 16:33:53 2019 -0400

Improve robustness for multiple build environments

When building BaseTools, GNUmakefile builds create directory
BaseTools/Source/C/libs/. On the other hand, Makefile builds use libs
as an nmake pseudo target, so it either must NOT exist as a file or
directory, OR it must phony dependency like .PHONY. The latter
solution conflicts with NmakeSubdirs.py. Therefore, I make it go away
in the cleanall target. I could also add it to the clean target, but
it strikes me that cleanall should be more forceful.

Signed-off-by: Burt Silverman mailto:bur...@gmail.com>>


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

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



[edk2-devel] [PATCH 3/3] MdeModulePkg/BM_UI: Add the new terminal types to related menu

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

Add the new introduced terminal types to related setup menu to change
the terminal type from setup. Most platforms would have its own
configure setup menu and they need to change it to support these.
The new introduced terminal types are Linux, XtermR6, VT400 and SCO.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Zhichao Gao 
---
 .../BootMaintenanceManager.h  | 13 ---
 .../BootMaintenanceManagerStrings.uni | 10 +-
 .../ConsoleOption.c   | 35 ++-
 .../BootMaintenanceManagerUiLib/Data.c| 16 ++---
 4 files changed, 40 insertions(+), 34 deletions(-)

diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
index ea3cdce794..822401e68c 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
@@ -1,7 +1,7 @@
 /** @file
 Header file for boot maintenance module.
 
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "FormGuid.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,7 +93,11 @@ typedef enum _TYPE_OF_TERMINAL {
   TerminalTypeVt100,
   TerminalTypeVt100Plus,
   TerminalTypeVtUtf8,
-  TerminalTypeTtyTerm
+  TerminalTypeTtyTerm,
+  TerminalTypeLinux,
+  TerminalTypeXtermR6,
+  TerminalTypeVt400,
+  TerminalTypeSCO
 } TYPE_OF_TERMINAL;
 
 //
@@ -1301,12 +1306,12 @@ extern BM_MENU_OPTION ConsoleOutMenu;
 extern BM_MENU_OPTION ConsoleErrMenu;
 extern BM_MENU_OPTION DriverMenu;
 extern BM_MENU_OPTION TerminalMenu;
-extern UINT16 TerminalType[5];
+extern UINT16 TerminalType[9];
 extern COM_ATTR   BaudRateList[19];
 extern COM_ATTR   DataBitsList[4];
 extern COM_ATTR   ParityList[5];
 extern COM_ATTR   StopBitsList[3];
-extern EFI_GUID   TerminalTypeGuid[5];
+extern EFI_GUID   TerminalTypeGuid[9];
 extern EFI_DEVICE_PATH_PROTOCOL   EndDevicePath[];
 extern UINT16 mFlowControlType[2];
 extern UINT32 mFlowControlValue[2];
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
index 2e67d27bd0..3d47473e6c 100644
--- 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerStrings.uni
@@ -1,7 +1,7 @@
 ///** @file
 //  String definitions for Boot Maintenance Utility.
 //
-//  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
+//  Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
 //  SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 //**/
@@ -233,6 +233,14 @@
#language fr-FR  "VT_UTF8"
 #string STR_COM_TYPE_4 #language en-US  "TTY_TERM"
#language fr-FR  "TTY_TERM"
+#string STR_COM_TYPE_5 #language en-US  "LINUX"
+   #language fr-FR  "LINUX"
+#string STR_COM_TYPE_6 #language en-US  "XTERM_R6"
+   #language fr-FR  "XTERM_R6"
+#string STR_COM_TYPE_7 #language en-US  "VT_400"
+   #language fr-FR  "VT_400"
+#string STR_COM_TYPE_8 #language en-US  "SCO"
+   #language fr-FR  "SCO"
 #string STR_RESET  #language en-US  "Reset System"
#language fr-FR  "Reset System"
 #string STR_FORM_GOTO_MAIN #language en-US  "Go Back To Main Page"
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
index 7a53b58771..b0641c5ee9 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c
@@ -897,6 +897,7 @@ IsTerminalDevicePath (
   VENDOR_DEVICE_PATH*Vendor;
   UART_DEVICE_PATH  *Uart;
   ACPI_HID_DEVICE_PATH  *Acpi;
+  UINTN Index;
 
   IsTerminal = FALSE;
 
@@ -929,37 +930,21 @@ IsTerminalDevicePath (
   }
 
   //
-  // There are four kinds of Terminal types
+  // There are 9 kinds of Terminal types
   // check to see whether this devicepath
   // is one of that type
   //
-  if 

[edk2-devel] [PATCH 1/3] MdeModulePkg: Entend the support keyboard type of Terminal console

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

A common terminal console software Putty support various types of
keyboard type, such as normal mode, Linux mode, Xterm R6, Vt400,
VT100+ and SCO. Refer to the link:
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Zhichao Gao 
---
 .../Include/Guid/TerminalConExtendedType.h| 25 +++
 MdeModulePkg/MdeModulePkg.dec |  6 +
 2 files changed, 31 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/TerminalConExtendedType.h

diff --git a/MdeModulePkg/Include/Guid/TerminalConExtendedType.h 
b/MdeModulePkg/Include/Guid/TerminalConExtendedType.h
new file mode 100644
index 00..18667413e8
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/TerminalConExtendedType.h
@@ -0,0 +1,25 @@
+/** @file
+  GUID definition for Linux, XtermR6, Vt400 and SCO terminal type.
+
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __TERMINAL_CON_EXTENDED_TYPE_H__
+#define __TERMINAL_CON_EXTENDED_TYPE_H__
+
+#define EDKII_LINUX_MODE_GUID   \
+{ 0xe4364a7f, 0xf825, 0x430e, { 0x9d, 0x3a, 0x9c, 0x9b, 0xe6, 0x81, 0x7c, 
0xa5 } }
+
+#define EDKII_XTERM_R6_GUID \
+{ 0xfbfca56b, 0xbb36, 0x4b78, { 0xaa, 0xab, 0xbe, 0x1b, 0x97, 0xec, 0x7c, 
0xcb } }
+
+#define EDKII_VT400_GUID\
+{ 0x8e46, 0x3d49, 0x4a9d, { 0xb8, 0x75, 0x3c, 0x08, 0x6f, 0x6a, 0xa2, 
0xbd } }
+
+#define EDKII_SCO_GUID  \
+{ 0xfc7dd6e0, 0x813c, 0x434d, { 0xb4, 0xda, 0x3b, 0xd6, 0x49, 0xe9, 0xe1, 
0x5a } }
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 17beb45235..7528d52fcb 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -343,6 +343,12 @@
   ## Include/Guid/TtyTerm.h
   gEfiTtyTermGuid= { 0x7d916d80, 0x5bb1, 0x458c, {0xa4, 0x8f, 
0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94 }}
 
+  ## Include/Guid/TerminalConExtendedType.h
+  gEdkiiLinuxModeGuid   = { 0xe4364a7f, 0xf825, 0x430e, { 0x9d, 0x3a, 
0x9c, 0x9b, 0xe6, 0x81, 0x7c, 0xa5 } }
+  gEdkiiXtermR6Guid = { 0xfbfca56b, 0xbb36, 0x4b78, { 0xaa, 0xab, 
0xbe, 0x1b, 0x97, 0xec, 0x7c, 0xcb } }
+  gEdkiiVT400Guid   = { 0x8e46, 0x3d49, 0x4a9d, { 0xb8, 0x75, 
0x3c, 0x08, 0x6f, 0x6a, 0xa2, 0xbd } }
+  gEdkiiSCOGuid = { 0xfc7dd6e0, 0x813c, 0x434d, { 0xb4, 0xda, 
0x3b, 0xd6, 0x49, 0xe9, 0xe1, 0x5a } }
+
   ## Include/Guid/HiiBootMaintenanceFormset.h
   gEfiIfrBootMaintenanceGuid  = { 0xb2dedc91, 0xd59f, 0x48d2, { 0x89, 
0x8a, 0x12, 0x49, 0xc, 0x74, 0xa4, 0xe0 }}
 
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 2/3] MdeModulePkg/TerminalDxe: Extend the terminal console support types

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

Extend the support types of terminal console driver. New added types
are Linux, XtermR6, VT400 and SCO.

Refer to
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Add the missing VT100+ function keys map.

Add F1-F12 function keys map for Linux, XtermR6, VT400 and SCO.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Zhichao Gao 
---
 .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
 .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
 .../Console/TerminalDxe/TerminalConIn.c   | 281 --
 .../Console/TerminalDxe/TerminalConOut.c  |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf   |   6 +-
 5 files changed, 319 insertions(+), 26 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index c76b2c5100..526067d023 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -2,7 +2,7 @@
   Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and
   Simple Text Output Protocol upon Serial IO Protocol.
 
-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
 
 **/
@@ -28,7 +28,11 @@ EFI_GUID  *mTerminalType[] = {
   ,
   ,
   ,
-  
+  ,
+  ,
+  ,
+  ,
+  
 };
 
 
@@ -37,7 +41,11 @@ CHAR16 *mSerialConsoleNames[] = {
   L"VT-100 Serial Console",
   L"VT-100+ Serial Console",
   L"VT-UTF8 Serial Console",
-  L"Tty Terminal Serial Console"
+  L"Tty Terminal Serial Console",
+  L"Linux Mode Terminal Serial Console",
+  L"Xterm R6 Terminal Serial Console",
+  L"VT400 Terminal Serial Console",
+  L"SCO Terminal Serial Console"
 };
 
 TERMINAL_DEV  mTerminalDevTemplate = {
@@ -187,7 +195,8 @@ TerminalDriverBindingSupported (
 
   }
   //
-  // only supports PC ANSI, VT100, VT100+, VT-UTF8, and TtyTerm terminal 
types
+  // only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm
+  // Linux, XtermR6, VT400 and SCO terminal types
   //
   if (TerminalTypeFromGuid (>Guid) == ARRAY_SIZE (mTerminalType)) {
 return EFI_UNSUPPORTED;
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h 
b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
index b2f0901fc1..d683aa792f 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for Terminal driver.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 Copyright (C) 2016 Silicon Graphics, Inc. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -81,7 +81,11 @@ typedef enum {
   TerminalTypeVt100,
   TerminalTypeVt100Plus,
   TerminalTypeVtUtf8,
-  TerminalTypeTtyTerm
+  TerminalTypeTtyTerm,
+  TerminalTypeLinux,
+  TerminalTypeXtermR6,
+  TerminalTypeVt400,
+  TerminalTypeSCO
 } TERMINAL_TYPE;
 
 typedef struct {
@@ -126,7 +130,9 @@ typedef struct {
 #define INPUT_STATE_LEFTOPENBRACKET   0x04
 #define INPUT_STATE_O 0x08
 #define INPUT_STATE_2 0x10
-#define INPUT_STATE_LEFTOPENBRACKET_2 0x20
+#define INPUT_STATE_LEFTOPENBRACKET_TTY   0x20
+#define INPUT_STATE_1 0x40
+#define INPUT_STATE_LEFTOPENBRACKET_2ND   0x80
 
 #define RESET_STATE_DEFAULT   0x00
 #define RESET_STATE_ESC_R 0x01
@@ -848,7 +854,8 @@ TerminalRemoveConsoleDevVariable (
 /**
   Build termial device path according to terminal type.
 
-  @param  TerminalType   The terminal type is PC ANSI, VT100, VT100+ 
or VT-UTF8.
+  @param  TerminalType   The terminal type is PC ANSI, VT100, VT100+, 
VT-UTF8, TTY-Term,
+ Linux, XtermR6 or VT400.
   @param  ParentDevicePath   Parent device path.
   @param  TerminalDevicePath Returned terminal device path, if building 
successfully.
 
@@ -1209,6 +1216,28 @@ AnsiRawDataToUnicode (
   | F12 | 0x16 |   | ESC @|  |
   +=+==+===+==+==+
 
+Putty function key map:
+  
+=+==+===+=+=+=+=+
+  | | EFI  |   | | | | 
|
+  | | Scan |   | |  Normal | | 
|
+  |   KEY   | Code |  VT100+   | Xterm R6|  VT400  | Linux   | SCO 
|
+  
+=+==+===+=+=+=+=+
+  | F1  | 0x0B | ESC O P   | ESC O P | ESC [ 1 1 ~ | ESC [ [ A   | ESC 
[ M |
+  | F2  | 0x0C | ESC O Q   | ESC O Q | ESC [ 1 2 ~ | ESC [ [ B   | ESC 
[ N |
+  | F3  | 0x0D | ESC O R   | 

[edk2-devel] [PATCH 0/3] MdeModulePkg/TerminalConsole: Extend the support terminal types

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

Putty is a very popular terminal tool in windows. So add the whole support
terminal keyboard type for it. The new introduced type is Linux, XtermR6,
VT400 and SCO. And enhance the support for VT100+.
This patch set only add the support of function key. Refer to the link:
https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter4.html#config-funkeys

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-of-by: Zhichao Gao 

Zhichao Gao (3):
  MdeModulePkg: Entend the support keyboard type of Terminal console
  MdeModulePkg/TerminalDxe: Extend the terminal console support types
  MdeModulePkg/BM_UI: Add the new terminal types to related menu

 .../Include/Guid/TerminalConExtendedType.h|  25 ++
 .../BootMaintenanceManager.h  |  13 +-
 .../BootMaintenanceManagerStrings.uni |  10 +-
 .../ConsoleOption.c   |  35 +--
 .../BootMaintenanceManagerUiLib/Data.c|  16 +-
 MdeModulePkg/MdeModulePkg.dec |   6 +
 .../Universal/Console/TerminalDxe/Terminal.c  |  17 +-
 .../Universal/Console/TerminalDxe/Terminal.h  |  37 ++-
 .../Console/TerminalDxe/TerminalConIn.c   | 281 --
 .../Console/TerminalDxe/TerminalConOut.c  |   4 +
 .../Console/TerminalDxe/TerminalDxe.inf   |   6 +-
 11 files changed, 390 insertions(+), 60 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/TerminalConExtendedType.h

-- 
2.21.0.windows.1


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

View/Reply Online (#47142): https://edk2.groups.io/g/devel/message/47142
Mute This Topic: https://groups.io/mt/34110602/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 2/3] SimicsOpenBoardPkg: Fix GCC build issues

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

> -Original Message-
> From: Agyeman, Prince
> Sent: Wednesday, September 11, 2019 9:40 AM
> To: devel@edk2.groups.io
> Cc: phi...@redhat.com; Agyeman, Prince ;
> Wei, David Y ; Gao, Liming ;
> Sinha, Ankit ; Kubacki, Michael A
> ; Desimone, Nathaniel L
> 
> Subject: [edk2-devel] [PATCH v2 2/3] SimicsOpenBoardPkg: Fix GCC build
> issues
> 
> From: "Agyeman, Prince" 
> 
> Removed unused functions in secMain.c
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2162
> 
> Cc: David Wei  
> Cc: Liming Gao 
> Cc: Ankit Sinha 
> Cc: Agyeman Prince 
> Cc: Kubacki Michael A 
> Cc: Nate DeSimone 
> 
> Signed-off-by: Prince Agyeman 
> ---
>  .../PlatformBootManagerLib/BdsPlatform.c  | 38 ---
>  .../SimicsOpenBoardPkg/SecCore/SecMain.c  | 23 ---
>  2 files changed, 61 deletions(-)
> 
> diff --git
> a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/Bds
> Platform.c
> b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/Bd
> sPlatform.c
> index 117c72b35f..953a4a6c15 100644
> ---
> a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/Bds
> Platform.c
> +++
> b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/Bd
> sPlatform.c
> @@ -316,12 +316,6 @@ ConnectRootBridge (
>IN VOID*Context
>);
> 
> -STATIC
> -VOID
> -SaveS3BootScript (
> -  VOID
> -  );
> -
>  //
>  // BDS Platform Functions
>  //
> @@ -1296,38 +1290,6 @@ PlatformBdsConnectSequence (
>PciAcpiInitialization ();
>  }
> 
> -/**
> -  Save the S3 boot script.
> -
> -  Note that DxeSmmReadyToLock must be signaled after this function
> returns;
> -  otherwise the script wouldn't be saved actually.
> -**/
> -STATIC
> -VOID
> -SaveS3BootScript (
> -  VOID
> -  )
> -{
> -  EFI_STATUS Status;
> -  EFI_S3_SAVE_STATE_PROTOCOL *BootScript;
> -  STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };
> -
> -  Status = gBS->LocateProtocol (, NULL,
> -  (VOID **) );
> -  ASSERT_EFI_ERROR (Status);
> -
> -  //
> -  // Despite the opcode documentation in the PI spec, the protocol
> -  // implementation embeds a deep copy of the info in the boot script,
> rather
> -  // than storing just a pointer to runtime or NVS storage.
> -  //
> -  Status = BootScript->Write(BootScript,
> EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
> - (UINT32) sizeof Info,
> - (EFI_PHYSICAL_ADDRESS)(UINTN) );
> -  ASSERT_EFI_ERROR (Status);
> -}
> -
> -
>  /**
>Do the platform specific action after the console is ready
> 
> diff --git a/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
> b/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
> index 5cbb47687b..4514641b46 100644
> --- a/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
> +++ b/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
> @@ -495,29 +495,6 @@ FindPeiCoreImageBaseInFv (
>return EFI_SUCCESS;
>  }
> 
> -
> -/**
> -  Reads 8-bits of CMOS data.
> -
> -  Reads the 8-bits of CMOS data at the location specified by Index.
> -  The 8-bit read value is returned.
> -
> -  @param  Index  The CMOS location to read.
> -
> -  @return The value read.
> -
> -**/
> -STATIC
> -UINT8
> -CmosRead8 (
> -  IN UINTNIndex
> -  )
> -{
> -  IoWrite8 (0x70, (UINT8) Index);
> -  return IoRead8 (0x71);
> -}
> -
> -
>  STATIC
>  BOOLEAN
>  IsS3Resume (
> --
> 2.19.1.windows.1


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

View/Reply Online (#47140): https://edk2.groups.io/g/devel/message/47140
Mute This Topic: https://groups.io/mt/34105604/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 3/3] SimicsIch10Pkg: Fix GCC build issues

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

> -Original Message-
> From: Agyeman, Prince
> Sent: Wednesday, September 11, 2019 9:40 AM
> To: devel@edk2.groups.io
> Cc: phi...@redhat.com; Agyeman, Prince ;
> Wei, David Y ; Gao, Liming ;
> Sinha, Ankit ; Kubacki, Michael A
> ; Desimone, Nathaniel L
> 
> Subject: [edk2-devel] [PATCH v2 3/3] SimicsIch10Pkg: Fix GCC build issues
> 
> From: "Agyeman, Prince" 
> 
> Removed Status variable as the SmmClear
> function always returns EFI_SUCCESS.
> Refer to the Smmclear function for
> details
> 
> Removed SpiBaseAddress variable as this
> address was never used in the SendSpiCmd function.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2162
> 
> Cc: David Wei  
> Cc: Liming Gao 
> Cc: Ankit Sinha 
> Cc: Agyeman Prince 
> Cc: Kubacki Michael A 
> Cc: Nate DeSimone 
> 
> Signed-off-by: Prince Agyeman 
> ---
>  .../LibraryPrivate/BasePchSpiCommonLib/SpiCommon.c | 3 ---
>  .../SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c  | 7 ++-
>  2 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git
> a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCo
> mmon.c
> b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCo
> mmon.c
> index bd08b2453b..3e7dffedfb 100644
> ---
> a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCo
> mmon.c
> +++ b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/Sp
> +++ iCommon.c
> @@ -637,7 +637,6 @@ SendSpiCmd (
>EFI_STATUS  Status;
>UINT32  Index;
>SPI_INSTANCE*SpiInstance;
> -  UINTN   SpiBaseAddress;
>UINTN   PchSpiBar0;
>UINT32  HardwareSpiAddr;
>UINT32  FlashRegionSize;
> @@ -648,9 +647,7 @@ SendSpiCmd (
> 
>Status= EFI_SUCCESS;
>SpiInstance   = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
> -  SpiBaseAddress= SpiInstance->PchSpiBase;
>PchSpiBar0= AcquireSpiBar0 (SpiInstance);
> -  SpiBaseAddress= SpiInstance->PchSpiBase;
>ABase = SpiInstance->PchAcpiBase;
> 
>//
> diff --git
> a/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c
> b/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c
> index 268b04d25a..cc2d00b785 100644
> ---
> a/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c
> +++
> b/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.
> +++ c
> @@ -131,7 +131,6 @@ SmmControl2DxeTrigger (
>IN UINTNActivationInterval OPTIONAL
>)
>  {
> -  EFI_STATUS  Status;
>//
>// No support for queued or periodic activation.
>//
> @@ -141,7 +140,7 @@ SmmControl2DxeTrigger (
>///
>/// Clear any pending the APM SMI
>///
> -  Status = SmmClear();
> +  SmmClear();
>//
>// The so-called "Advanced Power Management Status Port Register" is in
> fact
>// a generic data passing register, between the caller and the SMI @@ -
> 181,8 +180,6 @@ SmmControl2DxeClear (
>IN BOOLEAN  Periodic OPTIONAL
>)
>  {
> -  EFI_STATUS  Status;
> -
>if (Periodic) {
>  return EFI_INVALID_PARAMETER;
>}
> @@ -201,7 +198,7 @@ SmmControl2DxeClear (
>//
>// So, nothing to do here.
>//
> -  Status = SmmClear();
> +  SmmClear();
> 
>return EFI_SUCCESS;
>  }
> --
> 2.19.1.windows.1


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

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



Re: [edk2-devel] [PATCH v2 1/3] AdvancedFeaturePkg: Fix GCC build

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

> -Original Message-
> From: Agyeman, Prince
> Sent: Wednesday, September 11, 2019 9:40 AM
> To: devel@edk2.groups.io
> Cc: phi...@redhat.com; Agyeman, Prince ;
> Wei, David Y ; Gao, Liming ;
> Sinha, Ankit ; Kubacki, Michael A
> ; Desimone, Nathaniel L
> 
> Subject: [edk2-devel] [PATCH v2 1/3] AdvancedFeaturePkg: Fix GCC build
> 
> From: "Agyeman, Prince" 
> 
> Changed include file name Smbios.h to
> SmBios.h to fix gcc file not found
> build issue, due to case sensitive
> file names in Linux
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2162
> 
> Cc: David Wei  
> Cc: Liming Gao 
> Cc: Ankit Sinha 
> Cc: Agyeman Prince 
> Cc: Kubacki Michael A 
> Cc: Nate DeSimone 
> 
> Signed-off-by: Prince Agyeman 
> ---
>  .../AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h  | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasi
> c.h
> b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasi
> c.h
> index e278a4ed18..944946b5b8 100644
> ---
> a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasi
> c.h
> +++
> b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasi
> c.h
> @@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 2.19.1.windows.1


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

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



Re: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

2019-09-11 Thread Kubacki, Michael A
Jiewen, you’re right, SetVariable ( ) will continue to go through SW SMI. I 
agree it should not be an issue for this work. Nate, can you please confirm we 
can close the open?

From: Yao, Jiewen
Sent: Tuesday, September 10, 2019 8:32 PM
To: Desimone, Nathaniel L ; 
devel@edk2.groups.io; Johnson, Michael ; Kubacki, 
Michael A 
Subject: RE: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

Nate
I believe this SMI reduction work only handle GetVariable.

VarCheckLib only handles SetVariable.
VarCheckLib does not handle GetVaraible.

Thank you
Yao Jiewen

From: Desimone, Nathaniel L
Sent: Wednesday, September 11, 2019 10:43 AM
To: devel@edk2.groups.io; Yao, Jiewen ; Johnson, Michael 
; Kubacki, Michael A 
Subject: RE: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

Hi All,

There is a security issue with regard to the way VarCheckLib works. There are 
plenty of usages of VarCheckLib that are intended to prevent ring0 from reading 
a variable after ReadyToBoot() is called. If we assume a malicious operating 
system, then having a ring0 buffered version of the variable that VarCheckLib 
is attempting to prevent the OS from reading would provide a backdoor for the 
OS to read that protected variable’s contents.

Thanks,
Nate

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Yao, Jiewen
Sent: Sunday, September 8, 2019 3:36 PM
To: devel@edk2.groups.io; Johnson, Michael 
mailto:michael.john...@intel.com>>; Kubacki, Michael 
A mailto:michael.a.kuba...@intel.com>>
Subject: Re: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

Hey, from security perspective, I am not clear what is difference on below 2 
scenario – TPM or read-modify-write.

Whenever we return some data from SMM, we are in ring0, any program in ring0 
may modify the variable content in the communication buffer.
If we assume ring0 is malicious, then the malicious code may let one AP keep 
looping to monitor the communication data, when BSP call get (authenticated) 
variable. Once communication buffer is updated and status is filled to 
EFI_SUCCESS, the AP may modify the communication buffer, then the BSP will 
return *modified* data to caller. Or an interrupt handler in BSP may also 
modify the communication buffer before the data is returned to caller. This 
race condition exists today.

I think putting cache buffer to SMM just raise the BAR, but *NOT* a security 
solution, because SMM communication buffer in reserved memory is same as cache 
buffer.

Thank you
Yao Jiewen

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Johnson, 
Michael
Sent: Saturday, September 7, 2019 5:52 AM
To: Kubacki, Michael A 
mailto:michael.a.kuba...@intel.com>>; 
devel@edk2.groups.io
Subject: Re: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

Yes - both things I bring up are just *different* ring 0 accesses than are 
(easily) allowed today, so are not fundamentally new.  Generally we either 
trust all of ring 0 or none of it, so neither is a showstopper.

Reading back from real varstore/SMM if the variable has the auth attribute 
removes any interesting vectors so all that changes is a bad ring 0 agent can 
go through memory instead of the RT API, which is not threatening.

I have no problems if write and auth-read come from SMM and all else comes from 
cache.

From: Kubacki, Michael A
Sent: Friday, September 6, 2019 2:48 PM
To: Johnson, Michael 
mailto:michael.john...@intel.com>>; 
devel@edk2.groups.io
Subject: RE: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

My understanding is both of your points return to the issue of a ring 0 entity 
potentially modifying the runtime cache. As the SetVariable ( ) API is already 
accessible to ring 0, the variables could similarly be updated today so that 
should not be an issue. You have a good point for authenticated variables where 
the update is authenticated in SMM so the variable data should continue to be 
returned from SMM.

How about if the variable has the authenticated attribute set, those are sent 
to GetVariable ( ) in SMM? This should be relatively rare with the most common 
case likely being secure boot related keys.

From: Johnson, Michael 
mailto:michael.john...@intel.com>>
Sent: Thursday, September 5, 2019 1:59 PM
To: Kubacki; Kubacki, Michael A 
mailto:michael.a.kuba...@intel.com>>; 
devel@edk2.groups.io
Subject: Re: [edk2-devel] [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

Your primary concern is my primary concern.  I can think of two scenarios where 
a runtime memory varstore would hurt.

The less severe one is that any variables measured into a TPM could appear to 
be modified when read back so that if/when some entity wants to verify or 
unseal something, they would be unable to match the TPM's PCR 

[edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: buffer overflow in NotifyFunctionTplEx()

2019-09-11 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1976

CreateEventEx() may lead to a change in the memory map causing an
EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. So in BBTestCreateEventEx_Func_Sub3() we
should only check for events triggered after the events have been set up.

Among other changes commit c093702f98ad (""uefi-sct/SctPkg:Fix flaw in
BBTestCreateEventEx_Func_Sub3) tried to adjust the event recording logic in
NotifyFunctionTplEx() to account for this.

The commit did not consider that CloseEvent() will release memory and
equally lead to EFI_EVENT_GROUP_MEMORY_MAP_CHANGE. NotifyFunctionTplEx()
does not check the limits of the buffer. So a buffer overrun occurs in this
case.

The easiest way to account for memory map changes by CreateEventEx() is to
initialize the event invocation records after setting up the events.

Moving the check of the event sequence to before CloseEvent() ensures that
we only measure the events we are interested in.

In function NotifyFunctionTplEx() check the index against the buffer
limits. Stop recording after MAX_TEST_EVENT_NUM events.

Fixes: c093702f98ad (""uefi-sct/SctPkg:Fix flaw in 
BBTestCreateEventEx_Func_Sub3)
Signed-off-by: Heinrich Schuchardt 
---
v2:
Move closing and freeing of events after the assertion. This ensures
that memory changes resulting from CloseEvent() do not change the
test results.
---
 ...rTaskPriorityServicesBBTestCreateEventEx.c | 35 +++-
 .../BlackBoxTest/Support.c| 55 +--
 2 files changed, 35 insertions(+), 55 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
index 4a8e44e2..2b119ff0 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/EventTimerTaskPriorityServicesBBTestCreateEventEx.c
@@ -918,12 +918,11 @@ BBTestCreateEventEx_Func_Sub3 (
   UINTN   Buffer[MAX_TEST_EVENT_NUM + MAX_TEST_EVENT_NUM*2];
 
   //
-  // Initialize Buffer as SIGNAL_CONTEXT
+  // Initialize the event index. The event invocation records will be
+  // initialized later.
   //
   for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
 Buffer[Index] = Index;
-Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(SIGNAL_CONTEXT);
-Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(SIGNAL_CONTEXT);
   }
 
   //
@@ -976,7 +975,17 @@ BBTestCreateEventEx_Func_Sub3 (
 gtBS->CloseEvent (Event[1]);
 return Status;
   }
-  
+
+  //
+  // CreateEventEx() may lead to a change in the memory map and trigger
+  // EFI_EVENT_GROUP_MEMORY_MAP_CHANGE itself. So initialize the event
+  // invocation records after creating the events.
+  //
+  for (Index = 0; Index < MAX_TEST_EVENT_NUM; Index ++) {
+Buffer[Index + MAX_TEST_EVENT_NUM + Index] = (UINTN)(SIGNAL_CONTEXT);
+Buffer[Index + MAX_TEST_EVENT_NUM + 1 + Index] = (UINTN)(SIGNAL_CONTEXT);
+  }
+
   //
   // Call AllocatePage to change the memorymap
   //
@@ -998,14 +1007,6 @@ BBTestCreateEventEx_Func_Sub3 (

   gtBS->RestoreTPL (OldTpl);
 
-  //
-  // Close all the events created and Free the pages
-  //
-  gtBS->CloseEvent (Event[0]);
-  gtBS->CloseEvent (Event[1]);
-  gtBS->CloseEvent (Event[2]);
-  gtBS->FreePages (Memory, 2);
-
   //
   // Compare the notify order
   //
@@ -1030,9 +1031,17 @@ BBTestCreateEventEx_Func_Sub3 (
  Buffer[MAX_TEST_EVENT_NUM + 5]
  );
 
+  //
+  // Close all the events created and Free the pages
+  //
+  gtBS->CloseEvent (Event[0]);
+  gtBS->CloseEvent (Event[1]);
+  gtBS->CloseEvent (Event[2]);
+  gtBS->FreePages (Memory, 2);
+
   //
   // Done
   //
   return EFI_SUCCESS;
 }
-#endif
\ No newline at end of file
+#endif
diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
index c702f84d..0c900a3e 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/BootServices/EventTimerTaskPriorityServices/BlackBoxTest/Support.c
@@ -58,58 +58,29 @@ NotifyFunctionTplEx(
   EFI_TPL   OldTpl;
   UINTN EventIndex;
   UINTN Index;
-  
+
   if (Context != NULL) {
 Buffer = Context;
 
 EventIndex = Buffer[0];
 
 //
-// The special code check for the BBTestCreateEventEx_Func_Sub3
-// Besides AllocatePages(), CreateEventEx() may trigger the memorymap
-// change when it is out of resource in memory pool
-// Use 

[edk2-devel] [edk2-test] [PATCH v2 1/1] uefi-sct/SctPkg: setting key toggle state may be unsupported

2019-09-11 Thread Heinrich Schuchardt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2169

The UEFI specification allows EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState()
to return EFI_UNSUPPORTED if a state change is not supported. This for
instance may be the case when connecting via a serial connection.

Up to now the SCT has marked the conformance test as FAILED if SetState()
was called with invalid parameters and EFI_UNSUPPORTED was returned which
contradicts the specification.

Instead create a warning if SetState() returns EFI_UNSUPPORTED. This allows
the user to check if the non-support is justified.

Signed-off-by: Heinrich Schuchardt 
---
v2:
Issue warning if EFI_UNSUPPORTED is returned when called with
invalid parameters.
---
 .../BlackBoxTest/SimpleTextInputExBBTestConformance.c   | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
index d997b651..946cb274 100644
--- 
a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
+++ 
b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestConformance.c
@@ -483,8 +483,10 @@ BBTestSetStateConformanceTestCheckpoint1 (
 );
 }
   }
-  
-  if ( EFI_INVALID_PARAMETER != Status) {
+
+  if (Status == EFI_UNSUPPORTED) {
+AssertionType = EFI_TEST_ASSERTION_WARNING;
+  } else if (Status != EFI_INVALID_PARAMETER) {
 AssertionType = EFI_TEST_ASSERTION_FAILED;
   } else {
 AssertionType = EFI_TEST_ASSERTION_PASSED;
-- 
2.20.1


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

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



Re: [edk2-devel] [PATCH edk2-CCSS 0/3] Coding Standards: add rule for documenting spurious variable assignments

2019-09-11 Thread Laszlo Ersek
On 09/10/19 17:44, Ryszard Knop wrote:
> On Tue, 2019-09-10 at 16:33 +0100, Leif Lindholm wrote:
>> On Mon, Sep 09, 2019 at 02:35:15PM +0200, Laszlo Ersek wrote:
>>> On 09/06/19 14:26, Leif Lindholm wrote:
 On Thu, Sep 05, 2019 at 08:38:17PM +0200, Laszlo Ersek wrote:
> Repo:   
> https://github.com/lersek/edk2-CCodingStandardsSpecification.git
> Branch: spurious_assign_bz_607
>
> HTML-rendered views of the modified pages:
> - 
> https://lersek.gitbooks.io/laszlo-s-fork-of-the-edk-ii-c-coding-standards-sp/content/v/spurious_assign_bz_607
> - 
> https://lersek.gitbooks.io/laszlo-s-fork-of-the-edk-ii-c-coding-standards-sp/content/v/spurious_assign_bz_607/6_documenting_software/62_comments.html
> - 
> https://lersek.gitbooks.io/laszlo-s-fork-of-the-edk-ii-c-coding-standards-sp/content/v/spurious_assign_bz_607/6_documenting_software/64_what_you_must_comment.html
>
> The first two patches are cleanups for things that popped up in
> the
> discussion in <
> https://bugzilla.tianocore.org/show_bug.cgi?id=607>;.
>
> The third patch is the one fixing the BZ.

 For 1 and 2,
 Reviewed-by: Leif Lindholm 

 For 3, I see no issue with it, but I do feel tempted by Phil's
 input
 of using explicit macros (obviating the need for specific
 comment).
 I seem to recall back in the mists of time we considered
 something
 similar.
>>>
>>> Yes, I remember similarly.
>>>
 Vaguely. Am I misremembering, or did we disount that option?
>>>
>>> Phil's current recommendation is what I would have preferred back
>>> then,
>>> but it was rejected, as far as I recall. If I remember correctly,
>>> most
>>> developers preferred naked NULLs / zeroes. I insisted on the
>>> comment as
>>> a fallback / compromise, so that we'd have at least some visual
>>> cue.
>>
>> I'm not even sure I wasn't one of the people opposed to it then.
>> But if I was, I would appear to have changed my mind.
>>
>>> I could be mis-remembering; we can restart that discussion if now
>>> the
>>> macros are preferred.
>>
>> I would be all for that.
> 
> If my 2 cents are worth anything, that'd be preferred by some folks in
> my team too. Although something shorter like "UNINITIALIZED_INT/PTR"
> would be nicer, IMO. Both work of course.

Thanks everyone for the feedback thus far on this series. It looks like
I could go ahead and push the patches, minimally for bringing the CCSS
in closer sync with reality -- and then we could improve incrementally,
for example with macros.

But, before I push the set, I'd really like hear Mike's opinion too -- I
vaguely recall he was active in the original discussion. I wouldn't like
to back out the patches in case Mike rejected them retroactively.

I believe Mike will have a bit of an email backlog to process ;) so I'll
wait some more in this thread.

Thanks!
Laszlo

>> However, I see no reason why we shouldn't document the current
>> process
>> in the meantime, so for 3/3 also:
>> Reviewed-by: Leif Lindholm 
>>
>> Best Regards,
>>
>> Leif
>>
>>> Thanks,
>>> Laszlo
>>>
 Regards,

 Leif

> Thanks,
> Laszlo
>
> Cc: Andrew Fish 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Rebecca Cran 
>
> Laszlo Ersek (3):
>   comments: remove "Horror Vacui" rule
>   comments: restrict and clarify applicability of "/*" comments
>   must comment: add rule for documenting spurious variable
> assignments
>
>  6_documenting_software/62_comments.md  | 20 +-
> 
>  6_documenting_software/64_what_you_must_comment.md | 39
> 
>  README.md  |  1 +
>  3 files changed, 42 insertions(+), 18 deletions(-)
>
> -- 
> 2.19.1.3.g30247aa5d201
>
>>
>>
>>
> 
> 
> 
> 


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

View/Reply Online (#47135): https://edk2.groups.io/g/devel/message/47135
Mute This Topic: https://groups.io/mt/33157541/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] UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp

2019-09-11 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: Nikodem, Damian
> Sent: Wednesday, September 11, 2019 1:23 AM
> To: devel@edk2.groups.io
> Cc: Nikodem, Damian ; Dong, Eric 
> ; Ni, Ray ; You,
> Benjamin ; Laszlo Ersek ; Rusocki, 
> Krzysztof 
> Subject: [PATCH v3] UefiCpuPkg: Fix potential spinLock issue in 
> SmmStartupThisAp
> 
> Due to needs a tackling the deficiency of the AP API, is necessary to ensure 
> that in non-blocking mode
> previous AP executed command is finished before start new one.
> 
> To remedy above:
>   1) execute AcquireSpinLock instead AcquireSpinLockOrFail - this will ensure 
> time "window" to eliminate potential
>  race condition beetwen BSP and AP spinLock release in non-blocking mode.
>  This also will eliminate possibility to start executing new AP function 
> before last is finished.
>   2) remove returns EFI_STATUS - EFI_NOT_READY - in new scenario returned 
> status is not necessary to caller.
> 
> Signed-off-by: Damian Nikodem 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Benjamin You 
> Cc: Laszlo Ersek 
> Cc: Krzysztof Rusocki 
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index d8d2b6f444..0685637c2b 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1235,14 +1235,9 @@ InternalSmmStartupThisAp (
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  if (Token == NULL) {
> -AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
> -  } else {
> -if (!AcquireSpinLockOrFail (mSmmMpSyncData->CpuData[CpuIndex].Busy)) {
> -  DEBUG((DEBUG_ERROR, "Can't acquire 
> mSmmMpSyncData->CpuData[%d].Busy\n", CpuIndex));
> -  return EFI_NOT_READY;
> -}
> +  AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
> 
> +  if (Token != NULL) {
>  *Token = (MM_COMPLETION) CreateToken ();
>}

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

View/Reply Online (#47134): https://edk2.groups.io/g/devel/message/47134
Mute This Topic: https://groups.io/mt/34101181/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/3] SimicsOpenBoardPkg: Fix GCC build issues

2019-09-11 Thread Agyeman, Prince
From: "Agyeman, Prince" 

Removed unused functions in secMain.c

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

Cc: David Wei  
Cc: Liming Gao 
Cc: Ankit Sinha 
Cc: Agyeman Prince 
Cc: Kubacki Michael A 
Cc: Nate DeSimone 

Signed-off-by: Prince Agyeman 
---
 .../PlatformBootManagerLib/BdsPlatform.c  | 38 ---
 .../SimicsOpenBoardPkg/SecCore/SecMain.c  | 23 ---
 2 files changed, 61 deletions(-)

diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 
b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 117c72b35f..953a4a6c15 100644
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ 
b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -316,12 +316,6 @@ ConnectRootBridge (
   IN VOID*Context
   );
 
-STATIC
-VOID
-SaveS3BootScript (
-  VOID
-  );
-
 //
 // BDS Platform Functions
 //
@@ -1296,38 +1290,6 @@ PlatformBdsConnectSequence (
   PciAcpiInitialization ();
 }
 
-/**
-  Save the S3 boot script.
-
-  Note that DxeSmmReadyToLock must be signaled after this function returns;
-  otherwise the script wouldn't be saved actually.
-**/
-STATIC
-VOID
-SaveS3BootScript (
-  VOID
-  )
-{
-  EFI_STATUS Status;
-  EFI_S3_SAVE_STATE_PROTOCOL *BootScript;
-  STATIC CONST UINT8 Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };
-
-  Status = gBS->LocateProtocol (, NULL,
-  (VOID **) );
-  ASSERT_EFI_ERROR (Status);
-
-  //
-  // Despite the opcode documentation in the PI spec, the protocol
-  // implementation embeds a deep copy of the info in the boot script, rather
-  // than storing just a pointer to runtime or NVS storage.
-  //
-  Status = BootScript->Write(BootScript, EFI_BOOT_SCRIPT_INFORMATION_OPCODE,
- (UINT32) sizeof Info,
- (EFI_PHYSICAL_ADDRESS)(UINTN) );
-  ASSERT_EFI_ERROR (Status);
-}
-
-
 /**
   Do the platform specific action after the console is ready
 
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c 
b/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
index 5cbb47687b..4514641b46 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SecCore/SecMain.c
@@ -495,29 +495,6 @@ FindPeiCoreImageBaseInFv (
   return EFI_SUCCESS;
 }
 
-
-/**
-  Reads 8-bits of CMOS data.
-
-  Reads the 8-bits of CMOS data at the location specified by Index.
-  The 8-bit read value is returned.
-
-  @param  Index  The CMOS location to read.
-
-  @return The value read.
-
-**/
-STATIC
-UINT8
-CmosRead8 (
-  IN UINTNIndex
-  )
-{
-  IoWrite8 (0x70, (UINT8) Index);
-  return IoRead8 (0x71);
-}
-
-
 STATIC
 BOOLEAN
 IsS3Resume (
-- 
2.19.1.windows.1


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

View/Reply Online (#47130): https://edk2.groups.io/g/devel/message/47130
Mute This Topic: https://groups.io/mt/34105604/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/3] SimicsIch10Pkg: Fix GCC build issues

2019-09-11 Thread Agyeman, Prince
From: "Agyeman, Prince" 

Removed Status variable as the SmmClear
function always returns EFI_SUCCESS.
Refer to the Smmclear function for
details

Removed SpiBaseAddress variable as this
address was never used in the SendSpiCmd function.

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

Cc: David Wei  
Cc: Liming Gao 
Cc: Ankit Sinha 
Cc: Agyeman Prince 
Cc: Kubacki Michael A 
Cc: Nate DeSimone 

Signed-off-by: Prince Agyeman 
---
 .../LibraryPrivate/BasePchSpiCommonLib/SpiCommon.c | 3 ---
 .../SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c  | 7 ++-
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git 
a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCommon.c 
b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCommon.c
index bd08b2453b..3e7dffedfb 100644
--- 
a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCommon.c
+++ 
b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCommon.c
@@ -637,7 +637,6 @@ SendSpiCmd (
   EFI_STATUS  Status;
   UINT32  Index;
   SPI_INSTANCE*SpiInstance;
-  UINTN   SpiBaseAddress;
   UINTN   PchSpiBar0;
   UINT32  HardwareSpiAddr;
   UINT32  FlashRegionSize;
@@ -648,9 +647,7 @@ SendSpiCmd (
 
   Status= EFI_SUCCESS;
   SpiInstance   = SPI_INSTANCE_FROM_SPIPROTOCOL (This);
-  SpiBaseAddress= SpiInstance->PchSpiBase;
   PchSpiBar0= AcquireSpiBar0 (SpiInstance);
-  SpiBaseAddress= SpiInstance->PchSpiBase;
   ABase = SpiInstance->PchAcpiBase;
 
   //
diff --git 
a/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c 
b/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c
index 268b04d25a..cc2d00b785 100644
--- a/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c
+++ b/Silicon/Intel/SimicsIch10Pkg/SmmControl/RuntimeDxe/SmmControl2Dxe.c
@@ -131,7 +131,6 @@ SmmControl2DxeTrigger (
   IN UINTNActivationInterval OPTIONAL
   )
 {
-  EFI_STATUS  Status;
   //
   // No support for queued or periodic activation.
   //
@@ -141,7 +140,7 @@ SmmControl2DxeTrigger (
   ///
   /// Clear any pending the APM SMI
   ///
-  Status = SmmClear();
+  SmmClear();
   //
   // The so-called "Advanced Power Management Status Port Register" is in fact
   // a generic data passing register, between the caller and the SMI
@@ -181,8 +180,6 @@ SmmControl2DxeClear (
   IN BOOLEAN  Periodic OPTIONAL
   )
 {
-  EFI_STATUS  Status;
-
   if (Periodic) {
 return EFI_INVALID_PARAMETER;
   }
@@ -201,7 +198,7 @@ SmmControl2DxeClear (
   //
   // So, nothing to do here.
   //
-  Status = SmmClear();
+  SmmClear();
 
   return EFI_SUCCESS;
 }
-- 
2.19.1.windows.1


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

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



[edk2-devel] [PATCH v2 1/3] AdvancedFeaturePkg: Fix GCC build

2019-09-11 Thread Agyeman, Prince
From: "Agyeman, Prince" 

Changed include file name Smbios.h to
SmBios.h to fix gcc file not found
build issue, due to case sensitive
file names in Linux

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

Cc: David Wei  
Cc: Liming Gao 
Cc: Ankit Sinha 
Cc: Agyeman Prince 
Cc: Kubacki Michael A 
Cc: Nate DeSimone 

Signed-off-by: Prince Agyeman 
---
 .../AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h 
b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
index e278a4ed18..944946b5b8 100644
--- a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.19.1.windows.1


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

View/Reply Online (#47131): https://edk2.groups.io/g/devel/message/47131
Mute This Topic: https://groups.io/mt/34105605/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/3] Fix SimicsOpenBoardPkg GCC Build

2019-09-11 Thread Agyeman, Prince
What changed from v1:
* Added detailed commit messages


This patch series fix gcc build issues seen
in SimicsOpenBoardPkg.
Patches were tested on GCC 5

Agyeman, Prince (3):
  AdvancedFeaturePkg: Fix GCC build
  SimicsOpenBoardPkg: Fix GCC build issues
  SimicsIch10Pkg: Fix GCC build issues

 .../Smbios/SmbiosBasicDxe/SmbiosBasic.h   |  2 +-
 .../PlatformBootManagerLib/BdsPlatform.c  | 38 ---
 .../SimicsOpenBoardPkg/SecCore/SecMain.c  | 23 ---
 .../BasePchSpiCommonLib/SpiCommon.c   |  3 --
 .../SmmControl/RuntimeDxe/SmmControl2Dxe.c|  7 +---
 5 files changed, 3 insertions(+), 70 deletions(-)

-- 
2.19.1.windows.1


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

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



[edk2-devel] [PATCH v2] ArmVirtPkg: increase FD/FV size for NOOPT builds

2019-09-11 Thread Ard Biesheuvel
After upgrading the CI system we use for building the ArmVirtPkg
targets, we started seeing failures due to the NOOPT build running
out of space when using the CLANG38 toolchain definition combined
with clang 7.

We really don't want to increase the FD/FV sizes in general to
accommodate this, so parameterize the relevant quantities and
increase them by 50% for NOOPT builds.

Signed-off-by: Ard Biesheuvel 
---
v2: implement suggestions by Laszlo on 1) how to parameterize this further,
and b) to avoid adding another .inc file
update kernel header field, as pointed out by Philippe

 ArmVirtPkg/ArmVirt.dsc.inc   | 28 
 ArmVirtPkg/ArmVirtQemu.fdf   | 14 +++---
 ArmVirtPkg/ArmVirtQemuKernel.fdf | 19 ++---
 ArmVirtPkg/ArmVirtXen.fdf| 14 +++---
 4 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index a4ae25d982a2..d6b58e5c018b 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -10,6 +10,34 @@
 [Defines]
   DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x804F
 
+  #
+  # Flash size selection. Setting FD_SIZE_IN_KB on the command line directly to
+  # one of the supported values, in place of any of the convenience macros, is
+  # permitted.
+  #
+!if $(TARGET) == NOOPT
+  DEFINE FD_SIZE_3MB  = TRUE
+!endif
+
+!ifdef $(FD_SIZE_2MB)
+  DEFINE FD_SIZE_IN_KB= 2048
+!else
+!ifdef $(FD_SIZE_3MB)
+  DEFINE FD_SIZE_IN_KB= 3072
+!else
+  DEFINE FD_SIZE_IN_KB= 2048
+!endif
+!endif
+
+!if $(FD_SIZE_IN_KB) == 2048
+  DEFINE FD_SIZE  = 0x20
+  DEFINE FD_NUM_BLOCKS= 0x200
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+  DEFINE FD_SIZE  = 0x30
+  DEFINE FD_NUM_BLOCKS= 0x300
+!endif
+
 
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index c2169cb7964b..d3950c8be05e 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -20,14 +20,22 @@
 #
 

 
+[Defines]
+!if $(FD_SIZE_IN_KB) == 2048
+  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000
+!endif
+
 [FD.QEMU_EFI]
 BaseAddress   = 0x|gArmTokenSpaceGuid.PcdFdBaseAddress  # QEMU assigns 
0 - 0x800 for a BootROM
-Size  = 0x0020|gArmTokenSpaceGuid.PcdFdSize # The size in 
bytes of the FLASH Device
+Size  = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in 
bytes of the FLASH Device
 ErasePolarity = 1
 
 # This one is tricky, it must be: BlockSize * NumBlocks = Size
 BlockSize = 0x1000
-NumBlocks = 0x200
+NumBlocks = $(FD_NUM_BLOCKS)
 
 

 #
@@ -59,7 +67,7 @@ DATA = {
 !endif
 }
 
-0x1000|0x001ff000
+0x1000|$(FVMAIN_COMPACT_SIZE)
 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
 FV = FVMAIN_COMPACT
 
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.fdf b/ArmVirtPkg/ArmVirtQemuKernel.fdf
index f675b6d65ee1..46ec967e1cc0 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.fdf
+++ b/ArmVirtPkg/ArmVirtQemuKernel.fdf
@@ -20,14 +20,22 @@
 #
 

 
+[Defines]
+!if $(FD_SIZE_IN_KB) == 2048
+  DEFINE FVMAIN_COMPACT_SIZE  = 0x1f8000
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+  DEFINE FVMAIN_COMPACT_SIZE  = 0x2f8000
+!endif
+
 [FD.QEMU_EFI]
 BaseAddress   = 0x|gArmTokenSpaceGuid.PcdFdBaseAddress  # QEMU assigns 
0 - 0x800 for a BootROM
-Size  = 0x0020|gArmTokenSpaceGuid.PcdFdSize # The size in 
bytes of the FLASH Device
+Size  = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize # The size in 
bytes of the FLASH Device
 ErasePolarity = 1
 
 # This one is tricky, it must be: BlockSize * NumBlocks = Size
 BlockSize = 0x1000
-NumBlocks = 0x200
+NumBlocks = $(FD_NUM_BLOCKS)
 
 

 #
@@ -56,7 +64,12 @@ DATA = {
   0x01, 0x00, 0x00, 0x10, # code0: adr x1, .
   0xff, 0x1f, 0x00, 0x14, # code1: b 0x8000
   0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, # text_offset: 512 KB
+!if $(FD_SIZE_IN_KB) == 2048
   0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 2 MB
+!endif
+!if $(FD_SIZE_IN_KB) == 3072
+  0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, # image_size: 3 MB
+!endif
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # flags
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res2
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # res3
@@ -81,7 +94,7 @@ DATA = {
 !endif
 }
 
-0x8000|0x001f8000

Re: [edk2-devel] [PATCH 1/2] Add VS2019 Toolchain def

2019-09-11 Thread Pete Batard

Hi Ching JenX,

Please see two comments inline.

On 2019.09.11 07:08, Cheng, Ching JenX wrote:

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

In order to support VS2019,
the first thing need to do is add 2019 toolchain on tools_def.template

Change-Id: Id52abdc9762cf06bb9a38bbfd1153608c878d839
Cc: Amy Chan 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Ching JenX Cheng 
---
  BaseTools/Conf/tools_def.template | 134 
++
  1 file changed, 122 insertions(+), 12 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 8f0e6cb6c2..7585a3e5db 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -63,27 +63,35 @@ DEFINE VS2017_BIN_X64 = 
DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x64
  DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm
  DEFINE VS2017_BIN_AARCH64 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm64
  
-DEFINE WINSDK_BIN   = ENV(WINSDK_PREFIX)

-DEFINE WINSDKx86_BIN= ENV(WINSDKx86_PREFIX)
+DEFINE VS2019_BIN = ENV(VS2019_PREFIX)bin
+DEFINE VS2019_HOST= x86
+DEFINE VS2019_BIN_HOST= 
DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\DEF(VS2019_HOST)
+DEFINE VS2019_BIN_IA32= DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\x86
+DEFINE VS2019_BIN_X64 = DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\x64
+DEFINE VS2019_BIN_ARM = DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\arm
+DEFINE VS2019_BIN_AARCH64 = DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\arm64
+
+DEFINE WINSDK_BIN   = ENV(WINSDK_PREFIX)
+DEFINE WINSDKx86_BIN= ENV(WINSDKx86_PREFIX)
  
  # Microsoft Visual Studio 2010

-DEFINE WINSDK7_BIN   = ENV(WINSDK7_PREFIX)
-DEFINE WINSDK7x86_BIN= ENV(WINSDK7x86_PREFIX)
+DEFINE WINSDK7_BIN  = ENV(WINSDK7_PREFIX)
+DEFINE WINSDK7x86_BIN   = ENV(WINSDK7x86_PREFIX)
  
  # Microsoft Visual Studio 2012 Update 1 (required for rc.exe that was not included in the initial release)

-DEFINE WINSDK71_BIN   = ENV(WINSDK71_PREFIX)
-DEFINE WINSDK71x86_BIN= ENV(WINSDK71x86_PREFIX)
+DEFINE WINSDK71_BIN = ENV(WINSDK71_PREFIX)
+DEFINE WINSDK71x86_BIN  = ENV(WINSDK71x86_PREFIX)
  
  # Microsoft Visual Studio 2013 Professional Edition

-DEFINE WINSDK8_BIN   = ENV(WINSDK8_PREFIX)x86\
-DEFINE WINSDK8x86_BIN= ENV(WINSDK8x86_PREFIX)x64
+DEFINE WINSDK8_BIN  = ENV(WINSDK8_PREFIX)x86\
+DEFINE WINSDK8x86_BIN   = ENV(WINSDK8x86_PREFIX)x64
  
  # Microsoft Visual Studio 2015 Professional Edition

-DEFINE WINSDK81_BIN   = ENV(WINSDK81_PREFIX)x86\
-DEFINE WINSDK81x86_BIN= ENV(WINSDK81x86_PREFIX)x64
+DEFINE WINSDK81_BIN = ENV(WINSDK81_PREFIX)x86\
+DEFINE WINSDK81x86_BIN  = ENV(WINSDK81x86_PREFIX)x64
  
-# Microsoft Visual Studio 2017 Professional Edition

-DEFINE WINSDK10_BIN   = ENV(WINSDK10_PREFIX)DEF(VS2017_HOST)
+# Microsoft Visual Studio 2017/2019 Professional Edition
+DEFINE WINSDK10_BIN = ENV(WINSDK10_PREFIX)DEF(VS2017_HOST)


The above line does not use the VS2019_HOST defined above, so I think we 
want to fix that.


I wouldn't expect many people to use both VS2017 and VS2019 toolchains 
with a different host platform (e.g. x64 for VS2019 and x86 for VS2017) 
so I'd suggest that we use a single "VS_HOST" that applies to both 
platforms.


  
  # These defines are needed for certain Microsoft Visual Studio tools that

  # are used by other toolchains.  An example is that ICC on Windows normally
@@ -218,6 +226,17 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
  #Note:
  # Building of XIP firmware images for ARM/ARM64 
is not currently supported (only applications).
  # /FILEALIGN:4096 and other changes are needed 
for ARM firmware builds.
+#   VS2019  -win32-  Requires:
+# Microsoft Visual Studio 2019 version 16.2 or 
later
+#Optional:
+# Required to build EBC drivers:
+#   Intel(r) Compiler for Efi Byte Code (Intel(r) 
EBC Compiler)
+# Required to build platforms or ACPI tables:
+#   Intel(r) ACPI Compiler (iasl.exe) from
+#   https://acpica.org/downloads
+#Note:
+# Building of XIP firmware images for ARM/ARM64 is 
not currently supported (only applications).
+# /FILEALIGN:4096 and other changes are needed for 
ARM firmware builds.
  #   GCC48   -Linux,Windows-  Requires:
  # GCC 4.8 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
  #Optional:
@@ -1691,6 +1710,97 @@ NOOPT_VS2017_AARCH64_DLINK_FLAGS   = /NOLOGO 
/NODEFAULTLIB /IGNORE:4001 /OPT:REF
  *_VS2017_EBC_SLINK_FLAGS 

Re: [edk2-devel] [Patch] UefiCpuPkg/CpuDxe: clean up PAGE_TABLE_LIB_PAGING_CONTEXT usage.

2019-09-11 Thread Laszlo Ersek
On 09/11/19 03:45, Eric Dong wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1039
> 
> Current implementation not checks system mode before using
> PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.X64 or
> PAGE_TABLE_LIB_PAGING_CONTEXT.ContextData.Ia32. This patch check
> the mode before using the correct one.
> 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Signed-off-by: Eric Dong 
> ---
>  UefiCpuPkg/CpuDxe/CpuPageTable.c | 52 +++-
>  1 file changed, 37 insertions(+), 15 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c 
> b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> index ec5cd424fc..308f93b1cd 100644
> --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c
> +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c
> @@ -155,6 +155,8 @@ GetCurrentPagingContext (
>MSR_IA32_EFER_REGISTER  MsrEfer;
>IA32_CR4Cr4;
>IA32_CR0Cr0;
> +  UINT32  *Attributes;
> +  UINTN   *PageTableBase;
>  
>//
>// Don't retrieve current paging context from processor if in SMM mode.
> @@ -163,29 +165,33 @@ GetCurrentPagingContext (
>  ZeroMem (, sizeof(mPagingContext));
>  if (sizeof(UINTN) == sizeof(UINT64)) {
>mPagingContext.MachineType = IMAGE_FILE_MACHINE_X64;
> +  Attributes = 
> +  PageTableBase = 
>  } else {
>mPagingContext.MachineType = IMAGE_FILE_MACHINE_I386;
> +  Attributes = 
> +  PageTableBase = (UINTN 
> *)

(1) This is quite unfortunate. I don't like the cast.

I understand why it is used here -- when we build for X64, then UINTN is
UINT64, and so PageTableBase points to a UINT64. But
"mPagingContext.ContextData.Ia32.PageTableBase" is a UINT32, so the
compiler will complain about the incompatible pointer assignment.
Therefore you use an explicit cast -- which would be wrong, if the code
ever ran, but then again, that code will never run.

I don't like this trick.

Furthermore, the same issue will exist on the *other* branch, if you
build the present code for IA32 -- you didn't use a cast there. When
building for IA32, PageTableBase points to a UINT32. But, on the first
branch, "mPagingContext.ContextData.X64.PageTableBase" is a UINT64.
Therefore, the compiler will warn the same (although the code will never
run).

Did you build the patch for IA32?


I think there are two ways to fix this.

(1a) The ugly (but correct) fix is to use "#ifdef MDE_CPU_IA32" and
"#ifdef MDE_CPU_X64" directives, and *no* casts. In other words, we
should never compile the code that we won't run.

(1b) The nice (and also correct) fix is to introduce a helper function:

VOID
GetPagingDetails (
  IN  PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData,
  OUT UINTN  **PageTableBase OPTIONAL,
  OUT UINT32 **AttributesOPTIONAL
  );

There would be two implementations:

- IA32 subdirectory:

  if (PageTableBase != NULL) {
*PageTableBase = >Ia32.PageTableBase;
  }
  if (Attributes != NULL) {
*Attributes = >Ia32.Attributes;
  }

- X64 subdirectory:

  if (PageTableBase != NULL) {
*PageTableBase = >X64.PageTableBase;
  }
  if (Attributes != NULL) {
*Attributes = >X64.Attributes;
  }

And here we'd do

  GetPagingDetails (
,
,

);

and the rest of the GetCurrentPagingContext() updates would be the same.


>  }
>  
>  Cr0.UintN = AsmReadCr0 ();
>  Cr4.UintN = AsmReadCr4 ();
>  
>  if (Cr0.Bits.PG != 0) {
> -  mPagingContext.ContextData.X64.PageTableBase = (AsmReadCr3 () & 
> PAGING_4K_ADDRESS_MASK_64);
> +  *PageTableBase = (AsmReadCr3 () & PAGING_4K_ADDRESS_MASK_64);
>  } else {
> -  mPagingContext.ContextData.X64.PageTableBase = 0;
> +  *PageTableBase = 0;
>  }
>  if (Cr0.Bits.WP  != 0) {
> -  mPagingContext.ContextData.Ia32.Attributes |= 
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE;
> +  *Attributes |= 
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_WP_ENABLE;
>  }
>  if (Cr4.Bits.PSE != 0) {
> -  mPagingContext.ContextData.Ia32.Attributes |= 
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE;
> +  *Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PSE;
>  }
>  if (Cr4.Bits.PAE != 0) {
> -  mPagingContext.ContextData.Ia32.Attributes |= 
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE;
> +  *Attributes |= PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE;
>  }
>  if (Cr4.Bits.LA57 != 0) {
> -  mPagingContext.ContextData.Ia32.Attributes |= 
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL;
> +  *Attributes |= 
> PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL;
>  }
>  
>  AsmCpuid (CPUID_EXTENDED_FUNCTION, , NULL, NULL, NULL);
> @@ -197,12 +203,12 @@ GetCurrentPagingContext (
>  MsrEfer.Uint64 = AsmReadMsr64(MSR_CORE_IA32_EFER);
>  if (MsrEfer.Bits.NXE != 0) {
>// XD activated
> 

Re: [edk2-devel] [PATCH v5 1/1] MdePkg: UefiLib: Add a function to check if a language is supported

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

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Tom Zhao
> Sent: Wednesday, September 11, 2019 10:40 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming 
> 
> Subject: [edk2-devel] [PATCH v5 1/1] MdePkg: UefiLib: Add a function to check 
> if a language is supported
> 
> Add a function that checks if a target language is in the supported
> languages list. Add some calls to this function where appropriate in
> UefiLib.c
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Signed-off-by: Tom Zhao 
> ---
> 
> Notes:
> v3:
> - Add comment about usage for RFC4646 and ISO-639
> v4:
> - Remove reference to CompareISO639Lang
> v5:
> - Change doxygen format to use @retval
> 
>  MdePkg/Include/Library/UefiLib.h | 17 ++
>  MdePkg/Library/UefiLib/UefiLib.c | 60 +---
>  2 files changed, 56 insertions(+), 21 deletions(-)
> 
> diff --git a/MdePkg/Include/Library/UefiLib.h
> b/MdePkg/Include/Library/UefiLib.h
> index 1650f30ddbc6..65e7c90eb94b 100644
> --- a/MdePkg/Include/Library/UefiLib.h
> +++ b/MdePkg/Include/Library/UefiLib.h
> @@ -461,6 +461,23 @@ EfiTestChildHandle (
>IN CONST EFI_GUID *ProtocolGuid
>);
>  +/**
> + * This function checks the supported languages list for a target language,
> + * This only supports RFC 4646 Languages.
> + *
> + * @param  SupportedLanguages  The supported languages
> + * @param  TargetLanguage  The target language
> + *
> + * @retval EFI_SUCCESS The target language is supported
> + * @retval EFI_UNSUPPORTED The target language is unsupported
> + */
> +EFI_STATUS
> +EFIAPI
> +IsLanguageSupported (
> +  IN CONST CHAR8 *SupportedLanguages,
> +  IN CONST CHAR8 *TargetLanguage
> +  );
> +
>  /**
>This function looks up a Unicode string in UnicodeStringTable.
>  diff --git a/MdePkg/Library/UefiLib/UefiLib.c
> b/MdePkg/Library/UefiLib/UefiLib.c
> index daa4af762e62..71eba51257f6 100644
> --- a/MdePkg/Library/UefiLib/UefiLib.c
> +++ b/MdePkg/Library/UefiLib/UefiLib.c
> @@ -640,6 +640,36 @@ EfiTestChildHandle (
>return Status;
>  }
>  +/**
> + * This function checks the supported languages list for a target language,
> + * This only supports RFC 4646 Languages.
> + *
> + * @param  SupportedLanguages  The supported languages
> + * @param  TargetLanguage  The target language
> + *
> + * @retval EFI_SUCCESS The target language is supported
> + * @retval EFI_UNSUPPORTED The target language is unsupported
> + */
> +EFI_STATUS
> +EFIAPI
> +IsLanguageSupported (
> +  IN CONST CHAR8 *SupportedLanguages,
> +  IN CONST CHAR8 *TargetLanguage
> +  )
> +{
> +  UINTN Index;
> +  while (*SupportedLanguages != 0) {
> +for (Index = 0; SupportedLanguages[Index] != 0 &&
> SupportedLanguages[Index] != ';'; Index++);
> +if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0)
> && (TargetLanguage[Index] == 0)) {
> +  return EFI_SUCCESS;
> +}
> +SupportedLanguages += Index;
> +for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
> SupportedLanguages++);
> +  }
> +
> +  return EFI_UNSUPPORTED;
> +}
> +
>  /**
>This function looks up a Unicode string in UnicodeStringTable.
>  @@ -800,24 +830,19 @@ LookupUnicodeString2 (
>// Make sure Language is in the set of Supported Languages
>//
>Found = FALSE;
> -  while (*SupportedLanguages != 0) {
> -if (Iso639Language) {
> +  if (Iso639Language) {
> +while (*SupportedLanguages != 0) {
>if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
>  Found = TRUE;
>  break;
>}
>SupportedLanguages += 3;
> -} else {
> -  for (Index = 0; SupportedLanguages[Index] != 0 &&
> SupportedLanguages[Index] != ';'; Index++);
> -  if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) &&
> (Language[Index] == 0)) {
> -Found = TRUE;
> -break;
> -  }
> -  SupportedLanguages += Index;
> -  for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
> SupportedLanguages++);
>  }
> +  } else {
> +Found = !IsLanguageSupported(Language, SupportedLanguages);
>}
>  +
>//
>// If Language is not a member of SupportedLanguages, then return
> EFI_UNSUPPORTED
>//
> @@ -1099,24 +1124,17 @@ AddUnicodeString2 (
>// Make sure Language is a member of SupportedLanguages
>//
>Found = FALSE;
> -  while (*SupportedLanguages != 0) {
> -if (Iso639Language) {
> +  if (Iso639Language) {
> +while (*SupportedLanguages != 0) {
>if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
>  Found = TRUE;
>  break;
>}
>SupportedLanguages += 3;
> -} else {
> -  for (Index = 0; SupportedLanguages[Index] != 0 &&
> SupportedLanguages[Index] != ';'; Index++);
> -  if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
> -Found = TRUE;
> -  

Re: [edk2-devel] [PATCH v3] UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp

2019-09-11 Thread Laszlo Ersek
On 09/11/19 10:23, Damian Nikodem wrote:
> Due to needs a tackling the deficiency of the AP API, is necessary to ensure 
> that in non-blocking mode
> previous AP executed command is finished before start new one. 
> 
> To remedy above: 
>   1) execute AcquireSpinLock instead AcquireSpinLockOrFail - this will ensure 
> time "window" to eliminate potential
>  race condition beetwen BSP and AP spinLock release in non-blocking mode.
>  This also will eliminate possibility to start executing new AP function 
> before last is finished.
>   2) remove returns EFI_STATUS - EFI_NOT_READY - in new scenario returned 
> status is not necessary to caller.
> 
> Signed-off-by: Damian Nikodem 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Benjamin You 
> Cc: Laszlo Ersek 
> Cc: Krzysztof Rusocki 

Eric, Ray, please don't wait for my feedback on this one. It would be
prudent for me to test this, but I got no time.

Thanks
Laszlo

> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index d8d2b6f444..0685637c2b 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1235,14 +1235,9 @@ InternalSmmStartupThisAp (
>  return EFI_INVALID_PARAMETER;
>}
>  
> -  if (Token == NULL) {
> -AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
> -  } else {
> -if (!AcquireSpinLockOrFail (mSmmMpSyncData->CpuData[CpuIndex].Busy)) {
> -  DEBUG((DEBUG_ERROR, "Can't acquire 
> mSmmMpSyncData->CpuData[%d].Busy\n", CpuIndex));
> -  return EFI_NOT_READY;
> -}
> +  AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
>  
> +  if (Token != NULL) {
>  *Token = (MM_COMPLETION) CreateToken ();
>}
> 
> 
> Intel Technology Poland sp. z o.o.
> ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII 
> Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 
> 957-07-52-316 | Kapital zakladowy 200.000 PLN.
> 
> Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
> moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
> wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
> jakiekolwiek
> przegladanie lub rozpowszechnianie jest zabronione.
> This e-mail and any attachments may contain confidential material for the 
> sole use of the intended recipient(s). If you are not the intended recipient, 
> please contact the sender and delete all copies; any review or distribution by
> others is strictly prohibited.
> 


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

View/Reply Online (#47124): https://edk2.groups.io/g/devel/message/47124
Mute This Topic: https://groups.io/mt/34101181/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/1] MdePkg: UefiLib: Add a function to check if a language is supported

2019-09-11 Thread Tom Zhao
Add a function that checks if a target language is in the supported
languages list. Add some calls to this function where appropriate in
UefiLib.c

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Tom Zhao 
---

Notes:
v3:
- Add comment about usage for RFC4646 and ISO-639
v4:
- Remove reference to CompareISO639Lang
v5:
- Change doxygen format to use @retval

 MdePkg/Include/Library/UefiLib.h | 17 ++
 MdePkg/Library/UefiLib/UefiLib.c | 60 +---
 2 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/MdePkg/Include/Library/UefiLib.h
b/MdePkg/Include/Library/UefiLib.h
index 1650f30ddbc6..65e7c90eb94b 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -461,6 +461,23 @@ EfiTestChildHandle (
   IN CONST EFI_GUID *ProtocolGuid
   );
 +/**
+ * This function checks the supported languages list for a target language,
+ * This only supports RFC 4646 Languages.
+ *
+ * @param  SupportedLanguages  The supported languages
+ * @param  TargetLanguage  The target language
+ *
+ * @retval EFI_SUCCESS The target language is supported
+ * @retval EFI_UNSUPPORTED The target language is unsupported
+ */
+EFI_STATUS
+EFIAPI
+IsLanguageSupported (
+  IN CONST CHAR8 *SupportedLanguages,
+  IN CONST CHAR8 *TargetLanguage
+  );
+
 /**
   This function looks up a Unicode string in UnicodeStringTable.
 diff --git a/MdePkg/Library/UefiLib/UefiLib.c
b/MdePkg/Library/UefiLib/UefiLib.c
index daa4af762e62..71eba51257f6 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -640,6 +640,36 @@ EfiTestChildHandle (
   return Status;
 }
 +/**
+ * This function checks the supported languages list for a target language,
+ * This only supports RFC 4646 Languages.
+ *
+ * @param  SupportedLanguages  The supported languages
+ * @param  TargetLanguage  The target language
+ *
+ * @retval EFI_SUCCESS The target language is supported
+ * @retval EFI_UNSUPPORTED The target language is unsupported
+ */
+EFI_STATUS
+EFIAPI
+IsLanguageSupported (
+  IN CONST CHAR8 *SupportedLanguages,
+  IN CONST CHAR8 *TargetLanguage
+  )
+{
+  UINTN Index;
+  while (*SupportedLanguages != 0) {
+for (Index = 0; SupportedLanguages[Index] != 0 &&
SupportedLanguages[Index] != ';'; Index++);
+if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0)
&& (TargetLanguage[Index] == 0)) {
+  return EFI_SUCCESS;
+}
+SupportedLanguages += Index;
+for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
SupportedLanguages++);
+  }
+
+  return EFI_UNSUPPORTED;
+}
+
 /**
   This function looks up a Unicode string in UnicodeStringTable.
 @@ -800,24 +830,19 @@ LookupUnicodeString2 (
   // Make sure Language is in the set of Supported Languages
   //
   Found = FALSE;
-  while (*SupportedLanguages != 0) {
-if (Iso639Language) {
+  if (Iso639Language) {
+while (*SupportedLanguages != 0) {
   if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
 Found = TRUE;
 break;
   }
   SupportedLanguages += 3;
-} else {
-  for (Index = 0; SupportedLanguages[Index] != 0 &&
SupportedLanguages[Index] != ';'; Index++);
-  if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) &&
(Language[Index] == 0)) {
-Found = TRUE;
-break;
-  }
-  SupportedLanguages += Index;
-  for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
SupportedLanguages++);
 }
+  } else {
+Found = !IsLanguageSupported(Language, SupportedLanguages);
   }
 +
   //
   // If Language is not a member of SupportedLanguages, then return
EFI_UNSUPPORTED
   //
@@ -1099,24 +1124,17 @@ AddUnicodeString2 (
   // Make sure Language is a member of SupportedLanguages
   //
   Found = FALSE;
-  while (*SupportedLanguages != 0) {
-if (Iso639Language) {
+  if (Iso639Language) {
+while (*SupportedLanguages != 0) {
   if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
 Found = TRUE;
 break;
   }
   SupportedLanguages += 3;
-} else {
-  for (Index = 0; SupportedLanguages[Index] != 0 &&
SupportedLanguages[Index] != ';'; Index++);
-  if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
-Found = TRUE;
-break;
-  }
-  SupportedLanguages += Index;
-  for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
SupportedLanguages++);
 }
+  } else {
+Found = !IsLanguageSupported(Language, SupportedLanguages);
   }
-
   //
   // If Language is not a member of SupportedLanguages, then return
EFI_UNSUPPORTED
   //
-- 
2.21.0


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

View/Reply Online (#47123): https://edk2.groups.io/g/devel/message/47123
Mute This Topic: https://groups.io/mt/34104181/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 

Re: [edk2-devel] [PATCH v4 1/1] MdePkg: UefiLib: Add a function to check if a language is supported

2019-09-11 Thread Liming Gao
Tom:
  I miss one minor comments on doxygen style in function header comments. 
Please see below. 
  The code logic is good to me. Reviewed-by: Liming Gao 

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Tom Zhao
> Sent: Wednesday, September 11, 2019 7:06 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming 
> 
> Subject: [edk2-devel] [PATCH v4 1/1] MdePkg: UefiLib: Add a function to check 
> if a language is supported
> 
> Add a function that checks if a target language is in the supported
> languages list. Add some calls to this function where appropriate in
> UefiLib.c
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Signed-off-by: Tom Zhao 
> ---
> 
> Notes:
> v3:
> - Add comment about usage for RFC4646 and ISO-639
> v4:
> - Remove reference to CompareISO639Lang
> 
>  MdePkg/Include/Library/UefiLib.h | 17 ++
>  MdePkg/Library/UefiLib/UefiLib.c | 60 +---
>  2 files changed, 56 insertions(+), 21 deletions(-)
> 
> diff --git a/MdePkg/Include/Library/UefiLib.h
> b/MdePkg/Include/Library/UefiLib.h
> index 1650f30ddbc6..67c6f96747ca 100644
> --- a/MdePkg/Include/Library/UefiLib.h
> +++ b/MdePkg/Include/Library/UefiLib.h
> @@ -461,6 +461,23 @@ EfiTestChildHandle (
>IN CONST EFI_GUID *ProtocolGuid
>);
>  +/**
> + * This function checks the supported languages list for a target language,
> + * This only supports RFC 4646 Languages.
> + *
> + * @param  SupportedLanguages  The supported languages
> + * @param  TargetLanguage  The target language
> + *
> + * @return Returns EFI_SUCCESS if the language is supported,
> + * EFI_UNSUPPORTED otherwise

Here should 
@retval EFI_SUCCESS   The target language is supported
@retval EFI_UNSUPPORTED  The target language is unsupported

> + */
> +EFI_STATUS
> +EFIAPI
> +IsLanguageSupported (
> +  IN CONST CHAR8 *SupportedLanguages,
> +  IN CONST CHAR8 *TargetLanguage
> +  );
> +
>  /**
>This function looks up a Unicode string in UnicodeStringTable.
>  diff --git a/MdePkg/Library/UefiLib/UefiLib.c
> b/MdePkg/Library/UefiLib/UefiLib.c
> index daa4af762e62..cc03be84c2d8 100644
> --- a/MdePkg/Library/UefiLib/UefiLib.c
> +++ b/MdePkg/Library/UefiLib/UefiLib.c
> @@ -640,6 +640,36 @@ EfiTestChildHandle (
>return Status;
>  }
>  +/**
> + * This function checks the supported languages list for a target language,
> + * This only supports RFC 4646 Languages.
> + *
> + * @param  SupportedLanguages  The supported languages
> + * @param  TargetLanguage  The target language
> + *
> + * @return Returns EFI_SUCCESS if the language is supported,
> + * EFI_UNSUPPORTED otherwise

Here should be
@retval EFI_SUCCESS   The target language is supported
@retval EFI_UNSUPPORTED  The target language is unsupported

Thanks
Liming
> + */
> +EFI_STATUS
> +EFIAPI
> +IsLanguageSupported (
> +  IN CONST CHAR8 *SupportedLanguages,
> +  IN CONST CHAR8 *TargetLanguage
> +  )
> +{
> +  UINTN Index;
> +  while (*SupportedLanguages != 0) {
> +for (Index = 0; SupportedLanguages[Index] != 0 &&
> SupportedLanguages[Index] != ';'; Index++);
> +if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0)
> && (TargetLanguage[Index] == 0)) {
> +  return EFI_SUCCESS;
> +}
> +SupportedLanguages += Index;
> +for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
> SupportedLanguages++);
> +  }
> +
> +  return EFI_UNSUPPORTED;
> +}
> +
>  /**
>This function looks up a Unicode string in UnicodeStringTable.
>  @@ -800,24 +830,19 @@ LookupUnicodeString2 (
>// Make sure Language is in the set of Supported Languages
>//
>Found = FALSE;
> -  while (*SupportedLanguages != 0) {
> -if (Iso639Language) {
> +  if (Iso639Language) {
> +while (*SupportedLanguages != 0) {
>if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
>  Found = TRUE;
>  break;
>}
>SupportedLanguages += 3;
> -} else {
> -  for (Index = 0; SupportedLanguages[Index] != 0 &&
> SupportedLanguages[Index] != ';'; Index++);
> -  if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) &&
> (Language[Index] == 0)) {
> -Found = TRUE;
> -break;
> -  }
> -  SupportedLanguages += Index;
> -  for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
> SupportedLanguages++);
>  }
> +  } else {
> +Found = !IsLanguageSupported(Language, SupportedLanguages);
>}
>  +
>//
>// If Language is not a member of SupportedLanguages, then return
> EFI_UNSUPPORTED
>//
> @@ -1099,24 +1124,17 @@ AddUnicodeString2 (
>// Make sure Language is a member of SupportedLanguages
>//
>Found = FALSE;
> -  while (*SupportedLanguages != 0) {
> -if (Iso639Language) {
> +  if (Iso639Language) {
> +while (*SupportedLanguages != 0) {
>if (CompareIso639LanguageCode (Language, 

Re: [edk2-rfc] [edk2-devel] UEFI Variable SMI Reduction

2019-09-11 Thread Laszlo Ersek
On 09/09/19 20:03, Kubacki, Michael A wrote:
> I completely understand the need for granular breakup of changes for code 
> review and future maintenance. I would not send this as a single patch on the 
> mailing list for formal code review. Due to the size of the change, the main 
> point here was to initially focus feedback on the high-level approach and 
> design sparing the review of implementation details for an actual code 
> review. Though I understand for those interested, it is much easier to digest 
> the code in a clean patch series so I will send that RFC series to the list 
> once I incorporate the feedback already received.

Thank you!

> I replied elsewhere inline.

For those answers as well.

Laszlo

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

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



[edk2-devel] [PATCH v4 1/1] MdePkg: UefiLib: Add a function to check if a language is supported

2019-09-11 Thread Tom Zhao
Add a function that checks if a target language is in the supported
languages list. Add some calls to this function where appropriate in
UefiLib.c

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Tom Zhao 
---

Notes:
v3:
- Add comment about usage for RFC4646 and ISO-639
v4:
- Remove reference to CompareISO639Lang

 MdePkg/Include/Library/UefiLib.h | 17 ++
 MdePkg/Library/UefiLib/UefiLib.c | 60 +---
 2 files changed, 56 insertions(+), 21 deletions(-)

diff --git a/MdePkg/Include/Library/UefiLib.h
b/MdePkg/Include/Library/UefiLib.h
index 1650f30ddbc6..67c6f96747ca 100644
--- a/MdePkg/Include/Library/UefiLib.h
+++ b/MdePkg/Include/Library/UefiLib.h
@@ -461,6 +461,23 @@ EfiTestChildHandle (
   IN CONST EFI_GUID *ProtocolGuid
   );
 +/**
+ * This function checks the supported languages list for a target language,
+ * This only supports RFC 4646 Languages.
+ *
+ * @param  SupportedLanguages  The supported languages
+ * @param  TargetLanguage  The target language
+ *
+ * @return Returns EFI_SUCCESS if the language is supported,
+ * EFI_UNSUPPORTED otherwise
+ */
+EFI_STATUS
+EFIAPI
+IsLanguageSupported (
+  IN CONST CHAR8 *SupportedLanguages,
+  IN CONST CHAR8 *TargetLanguage
+  );
+
 /**
   This function looks up a Unicode string in UnicodeStringTable.
 diff --git a/MdePkg/Library/UefiLib/UefiLib.c
b/MdePkg/Library/UefiLib/UefiLib.c
index daa4af762e62..cc03be84c2d8 100644
--- a/MdePkg/Library/UefiLib/UefiLib.c
+++ b/MdePkg/Library/UefiLib/UefiLib.c
@@ -640,6 +640,36 @@ EfiTestChildHandle (
   return Status;
 }
 +/**
+ * This function checks the supported languages list for a target language,
+ * This only supports RFC 4646 Languages.
+ *
+ * @param  SupportedLanguages  The supported languages
+ * @param  TargetLanguage  The target language
+ *
+ * @return Returns EFI_SUCCESS if the language is supported,
+ * EFI_UNSUPPORTED otherwise
+ */
+EFI_STATUS
+EFIAPI
+IsLanguageSupported (
+  IN CONST CHAR8 *SupportedLanguages,
+  IN CONST CHAR8 *TargetLanguage
+  )
+{
+  UINTN Index;
+  while (*SupportedLanguages != 0) {
+for (Index = 0; SupportedLanguages[Index] != 0 &&
SupportedLanguages[Index] != ';'; Index++);
+if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0)
&& (TargetLanguage[Index] == 0)) {
+  return EFI_SUCCESS;
+}
+SupportedLanguages += Index;
+for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
SupportedLanguages++);
+  }
+
+  return EFI_UNSUPPORTED;
+}
+
 /**
   This function looks up a Unicode string in UnicodeStringTable.
 @@ -800,24 +830,19 @@ LookupUnicodeString2 (
   // Make sure Language is in the set of Supported Languages
   //
   Found = FALSE;
-  while (*SupportedLanguages != 0) {
-if (Iso639Language) {
+  if (Iso639Language) {
+while (*SupportedLanguages != 0) {
   if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
 Found = TRUE;
 break;
   }
   SupportedLanguages += 3;
-} else {
-  for (Index = 0; SupportedLanguages[Index] != 0 &&
SupportedLanguages[Index] != ';'; Index++);
-  if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) &&
(Language[Index] == 0)) {
-Found = TRUE;
-break;
-  }
-  SupportedLanguages += Index;
-  for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
SupportedLanguages++);
 }
+  } else {
+Found = !IsLanguageSupported(Language, SupportedLanguages);
   }
 +
   //
   // If Language is not a member of SupportedLanguages, then return
EFI_UNSUPPORTED
   //
@@ -1099,24 +1124,17 @@ AddUnicodeString2 (
   // Make sure Language is a member of SupportedLanguages
   //
   Found = FALSE;
-  while (*SupportedLanguages != 0) {
-if (Iso639Language) {
+  if (Iso639Language) {
+while (*SupportedLanguages != 0) {
   if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
 Found = TRUE;
 break;
   }
   SupportedLanguages += 3;
-} else {
-  for (Index = 0; SupportedLanguages[Index] != 0 &&
SupportedLanguages[Index] != ';'; Index++);
-  if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {
-Found = TRUE;
-break;
-  }
-  SupportedLanguages += Index;
-  for (; *SupportedLanguages != 0 && *SupportedLanguages == ';';
SupportedLanguages++);
 }
+  } else {
+Found = !IsLanguageSupported(Language, SupportedLanguages);
   }
-
   //
   // If Language is not a member of SupportedLanguages, then return
EFI_UNSUPPORTED
   //
-- 
2.16.5


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

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



[edk2-devel] [Patch 1/1] BaseTools: Fixed a bug of IgnoreAutoGen

2019-09-11 Thread Bob Feng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2080
After checking that if the build can't
ignore Autogen due to there is no compelet autogen files, 
the build tool need to do a completely Autogen.

This patch is to fix a bug that if AutoGen
can't be skiped, the SkipAutoGen flag
need to set to False

Cc: Liming Gao 
Signed-off-by: Bob Feng 
---
 BaseTools/Source/Python/build/build.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 13be6c33ecd5..a034664dc388 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -2202,10 +2202,11 @@ class Build():
 ExitFlag = threading.Event()
 ExitFlag.clear()
 if self.SkipAutoGen:
 Wa = self.VerifyAutoGenFiles()
 if Wa is None:
+self.SkipAutoGen = False
 Wa, self.BuildModules = 
self.PerformAutoGen(BuildTarget,ToolChain)
 else:
 GlobalData.gAutoGenPhase = True
 self.BuildModules = self.SetupMakeSetting(Wa)
 else:
-- 
2.20.1.windows.1


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

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



[edk2-devel] [PATCH] BaseTools:Change the case rules for ECC check pointer names

2019-09-11 Thread Fan, ZhijuX
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2087

In CryptHkdf.c  line 42

  EVP_PKEY_CTX *pHkdfCtx;

Variable pHkdfCtx begins with lower case 'p',
which should be acceptable because it it is a pointer.
(Refer to CCS_2_1_Draft, 4.3.3.3)

So ECC tool should be improved to handle issues like this.

Cc: Liming Gao 
Cc: Bob Feng 
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Ecc/Check.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index 2180818609..f927d8e4d3 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1469,13 +1469,14 @@ class Check(object):
 EdkLogger.quiet("Checking naming convention of variable name ...")
 Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$')
 
-SqlCommand = """select ID, Name from %s where Model = %s""" % 
(FileTable, MODEL_IDENTIFIER_VARIABLE)
+SqlCommand = """select ID, Name, Modifier from %s where Model = 
%s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE)
 RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
 for Record in RecordSet:
 Var = Record[1]
+Modifier = Record[2]
 if Var.startswith('CONST'):
 Var = Var[5:].lstrip()
-if not Pattern.match(Var):
+if not Pattern.match(Var) and not Modifier.endswith('*'):
 if not 
EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME,
 Record[1]):
 
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 
OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), 
BelongsToTable=FileTable, BelongsToItem=Record[0])
 
-- 
2.14.1.windows.1


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

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

<>

[edk2-devel] [PATCH v3] UefiCpuPkg: Fix potential spinLock issue in SmmStartupThisAp

2019-09-11 Thread Damian Nikodem
Due to needs a tackling the deficiency of the AP API, is necessary to ensure 
that in non-blocking mode
previous AP executed command is finished before start new one. 

To remedy above: 
  1) execute AcquireSpinLock instead AcquireSpinLockOrFail - this will ensure 
time "window" to eliminate potential
 race condition beetwen BSP and AP spinLock release in non-blocking mode.
 This also will eliminate possibility to start executing new AP function 
before last is finished.
  2) remove returns EFI_STATUS - EFI_NOT_READY - in new scenario returned 
status is not necessary to caller.

Signed-off-by: Damian Nikodem 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Benjamin You 
Cc: Laszlo Ersek 
Cc: Krzysztof Rusocki 

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index d8d2b6f444..0685637c2b 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1235,14 +1235,9 @@ InternalSmmStartupThisAp (
 return EFI_INVALID_PARAMETER;
   }
 
-  if (Token == NULL) {
-AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
-  } else {
-if (!AcquireSpinLockOrFail (mSmmMpSyncData->CpuData[CpuIndex].Busy)) {
-  DEBUG((DEBUG_ERROR, "Can't acquire mSmmMpSyncData->CpuData[%d].Busy\n", 
CpuIndex));
-  return EFI_NOT_READY;
-}
+  AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
 
+  if (Token != NULL) {
 *Token = (MM_COMPLETION) CreateToken ();
   }


Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


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

View/Reply Online (#47117): https://edk2.groups.io/g/devel/message/47117
Mute This Topic: https://groups.io/mt/34101181/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: Fix potential spinLock issue in SmmStartupThisAp

2019-09-11 Thread Damian Nikodem
Due to needs a tackling the deficiency of the AP API, is necessary to ensure 
that in non-blocking mode
previous AP executed command is finished before start new one. 

To remedy above: 
  1) execute AcquireSpinLock instead AcquireSpinLockOrFail - this will ensure 
time "window" to eliminate potential
 race condition beetwen BSP and AP spinLock release in non-blocking mode.
 This also will eliminate possibility to start executing new AP function 
before last is finished.
  2) remove returns EFI_STATUS - EFI_INVALID_PARAMETER - in new scenario 
returned status is not necessary to caller.

Signed-off-by: Damian Nikodem 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Benjamin You 
Cc: Laszlo Ersek 
Cc: Krzysztof Rusocki 

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index d8d2b6f444..0685637c2b 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1235,14 +1235,9 @@ InternalSmmStartupThisAp (
 return EFI_INVALID_PARAMETER;
   }
 
-  if (Token == NULL) {
-AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
-  } else {
-if (!AcquireSpinLockOrFail (mSmmMpSyncData->CpuData[CpuIndex].Busy)) {
-  DEBUG((DEBUG_ERROR, "Can't acquire mSmmMpSyncData->CpuData[%d].Busy\n", 
CpuIndex));
-  return EFI_NOT_READY;
-}
+  AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
 
+  if (Token != NULL) {
 *Token = (MM_COMPLETION) CreateToken ();
   }


Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


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

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



[edk2-devel] [edk2-test][Patch 3/3] uefi-sct/SctPkg: Add FMP test to IHV SCT binary package

2019-09-11 Thread Eric Jin
From: shrishail patil 

Cc: Supreeth Venkatesh 
Cc: Eric Jin 
Signed-off-by: shrishail patil 
---
 uefi-sct/SctPkg/CommonGenFramework.bat | 3 ++-
 uefi-sct/SctPkg/CommonGenFramework.sh  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat 
b/uefi-sct/SctPkg/CommonGenFramework.bat
index 5c614eaa9a74..42aefa8fb479 100644
--- a/uefi-sct/SctPkg/CommonGenFramework.bat
+++ b/uefi-sct/SctPkg/CommonGenFramework.bat
@@ -2,6 +2,7 @@
 @REM  Copyright 2006 - 2017 Unified EFI, Inc.
 @REM  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
 @REM  (C) Copyright 2017 Hewlett Packard Enterprise Development LP
+@REM  Copyright (c) 2019,Microchip Technology Inc.
 @REM
 @REM  This program and the accompanying materials
 @REM  are licensed and made available under the terms and conditions of the 
BSD License
@@ -279,7 +280,7 @@ rem  copy %ProcessorType%\IhvUsbHcTest.efi  
   %Framework%\T
   copy %ProcessorType%\IhvUsb2HcTest.efi
%Framework%\Test\ > NUL
   copy %ProcessorType%\IhviScsiInitiatorNameBBTest.efi  
%Framework%\Test\ > NUL
   copy %ProcessorType%\IhvStorageSecurityCommandBBTest.efi  
%Framework%\Test\ > NUL
-  
+  copy %ProcessorType%\IhvFirmwareManagementBBTest.efi  
%Framework%\Test\ > NUL
   rem *
   rem Copy the UEFI 2.1 Test Cases for IHV
   rem *
diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh 
b/uefi-sct/SctPkg/CommonGenFramework.sh
index c422034a6457..ed2b36aec42a 100755
--- a/uefi-sct/SctPkg/CommonGenFramework.sh
+++ b/uefi-sct/SctPkg/CommonGenFramework.sh
@@ -4,6 +4,7 @@
 #  Copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.
 #  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
 #  (C) Copyright 2017 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2019,Microchip Technology Inc.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -312,7 +313,7 @@ then
   cp $ProcessorType/IhvUsb2HcTest.efi$Framework/Test/ 
> NUL
   cp $ProcessorType/IhviScsiInitiatorNameBBTest.efi  $Framework/Test/ 
> NUL
   cp $ProcessorType/IhvStorageSecurityCommandBBTest.efi  $Framework/Test/ 
> NUL
-
+..cp $ProcessorType/IhvFirmwareManagementBBTest.efi  $Framework/Test/ 
> NUL
   # *
   # Copy the UEFI 2.1 Test Cases for IHV
   # *
-- 
2.20.0.windows.1


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

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



[edk2-devel] [edk2-test][Patch 2/3] uefi-sct/SctPkg: Add Fmp test to IHVSCT build/configuration

2019-09-11 Thread Eric Jin
From: shrishail patil 

Cc: Supreeth Venkatesh 
Cc: Eric Jin 
Signed-off-by: shrishail patil 
---
 uefi-sct/SctPkg/UEFI/IHV_SCT.dsc | 2 ++
 uefi-sct/SctPkg/Config/Data/Category.ini | 8 
 2 files changed, 10 insertions(+)

diff --git a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
index 83396f1af0f5..2681f03ee216 100644
--- a/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/IHV_SCT.dsc
@@ -2,6 +2,7 @@
 #
 #  Copyright 2006 - 2016 Unified EFI, Inc.
 #  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019,Microchip Technology Inc.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -213,6 +214,7 @@ 
SctPkg/TestCase/UEFI/IHV/Protocol/ScsiIo/BlackBoxTest/IhvScsiIoBBTest.inf
 
SctPkg/TestCase/UEFI/IHV/Protocol/iScsiInitiatorName/BlackBoxTest/IhviScsiInitiatorNameBBTest.inf
 
 
SctPkg/TestCase/UEFI/IHV/Protocol/AbsolutePointer/BlackBoxTest/IhvAbsolutePointerBBTest.inf
+SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf
 
SctPkg/TestCase/UEFI/IHV/Protocol/StorageSecurityCommand/BlackBoxTest/IhvStorageSecurityCommandBBTest.inf
 
 
SctPkg/TestCase/UEFI/IHV/Protocol/AdapterInfo/BlackBoxTest/IhvAdapterInfoBBTest.inf
diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini 
b/uefi-sct/SctPkg/Config/Data/Category.ini
index 3e9f5e52078d..a49a23cf62f5 100644
--- a/uefi-sct/SctPkg/Config/Data/Category.ini
+++ b/uefi-sct/SctPkg/Config/Data/Category.ini
@@ -3,6 +3,7 @@
 #  Copyright 2006 - 2017 Unified EFI, Inc.
 #  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
 #  (C) Copyright 2017 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2019,Microchip Technology Inc.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -738,6 +739,13 @@ InterfaceGuid = 86C77A67-0B97-4633-A187-49104D0685C7
 Name  = FirmwareManagementTest\FirmwareManagementProtocol
 Description   = FirmwareManagement Protocol Test
 
+[Category Data]
+Revision  = 0x0001
+CategoryGuid  = 941D02A8-49AD-4BDA-9FAE-0A6924541C88
+InterfaceGuid = 86C77A67-0B97-4633-A187-49104D0685C7
+Name  = IHV\FirmwareManagementTest\FirmwareManagementProtocol
+Description   = FirmwareManagement Protocol Test
+
 [Category Data]
 Revision  = 0x0001
 CategoryGuid  = 3F10CFD2-6CB6-4A2B-919A-B63B839A0363
-- 
2.20.0.windows.1


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

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



[edk2-devel] [edk2-test][Patch 0/3] Add FMP test to IHV

2019-09-11 Thread Eric Jin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2185
It is a request to add FMP test to IHV

Eric Jin (3):
  uefi-sct/SctPkg: Add FMP test source to IHVSCT
  uefi-sct/SctPkg: Add Fmp test to IHVSCT build/configuration
  uefi-sct/SctPkg: Add FMP test to IHV SCT binary package

 uefi-sct/SctPkg/UEFI/IHV_SCT.dsc  |2 +
 .../IhvFirmwareManagementBBTest.inf   |   53 +
 .../FirmwareManagementBBTestMain.h|  206 +
 .../FirmwareManagement/BlackBoxTest/Guid.h|  154 +
 .../FirmwareManagementBBTestConformance.c | 3619 +
 .../FirmwareManagementBBTestFunction.c|  879 
 .../FirmwareManagementBBTestMain.c|  169 +
 .../FirmwareManagement/BlackBoxTest/Guid.c|   85 +
 uefi-sct/SctPkg/CommonGenFramework.bat|3 +-
 uefi-sct/SctPkg/CommonGenFramework.sh |3 +-
 uefi-sct/SctPkg/Config/Data/Category.ini  |8 +
 11 files changed, 5179 insertions(+), 2 deletions(-)
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/IhvFirmwareManagementBBTest.inf
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.h
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.h
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestConformance.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestFunction.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/FirmwareManagementBBTestMain.c
 create mode 100644 
uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/FirmwareManagement/BlackBoxTest/Guid.c

-- 
2.20.0.windows.1


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

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



[edk2-devel] [PATCH v1 0/1] DisplayLink GOP driver USB msg initialisation

2019-09-11 Thread Andy Hayes
Corrected initialisation of one of data structures used to transmit USB 
control messages. Mistake had no practical effects but fixing to be on safe 
side.

https://github.com/andy-hayes/edk2-platforms

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 


Andy Hayes (1):
  Drivers/DisplayLink/DisplayLinkPkg DisplayLinkGop

 Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkGop/UsbTransfer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.8.3.1


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

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



[edk2-devel] [PATCH v1 1/1] Drivers/DisplayLink/DisplayLinkPkg DisplayLinkGop

2019-09-11 Thread Andy Hayes
Corrected initialisation of one of data structures used to transmit USB
control messages. Mistake had no practical effects but fixing to be on safe
side.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Andy Hayes 
---
 Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkGop/UsbTransfer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkGop/UsbTransfer.c 
b/Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkGop/UsbTransfer.c
index 252293da39d4..9871ab0378ce 100644
--- a/Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkGop/UsbTransfer.c
+++ b/Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkGop/UsbTransfer.c
@@ -107,7 +107,7 @@ DlUsbSendControlWriteMessage (
   UINT32 UsbStatus;
   EFI_USB_DEVICE_REQUEST UsbRequest;
 
-  ZeroMem (, sizeof (Request));
+  ZeroMem (, sizeof (UsbRequest));
   UsbRequest.RequestType = USB_REQ_TYPE_VENDOR | USB_TARGET_INTERFACE;
   UsbRequest.Index = Device->InterfaceDescriptor.InterfaceNumber;
   UsbRequest.Request = Request;
-- 
1.8.3.1


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

View/Reply Online (#47110): https://edk2.groups.io/g/devel/message/47110
Mute This Topic: https://groups.io/mt/34092678/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] *** Add VS2019 Support ***

2019-09-11 Thread Cheng, Ching JenX
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Cheng, Ching JenX
Sent: Wednesday, September 11, 2019 2:08 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH 0/2] *** Add VS2019 Support ***

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

In order to support VS2019 on EDK2, the following patches was modified def and 
batch files

1. Add VS2019 x86/64 definitions on tools_def.template

2. Add VS2019 support on toolsetup batches, and add version check with command 
vswhere
 Because VS2019 and VS2017 using the same vswhere to get the 
InstallationPath

Ching JenX Cheng (2):
  Add VS2019 Toolchain def
  Add VS2019 Support on ToolSetup Batches

 BaseTools/Conf/tools_def.template | 134
++
++
++
 BaseTools/get_vsvars.bat  |  39
+++
 BaseTools/set_vsprefix_envs.bat   |  70
++
+++-
 BaseTools/toolsetup.bat   |  16 +---
 edksetup.bat  |   6 --
 5 files changed, 235 insertions(+), 30 deletions(-)

--
2.21.0.windows.1





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

View/Reply Online (#47109): https://edk2.groups.io/g/devel/message/47109
Mute This Topic: https://groups.io/mt/34100572/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] Add VS2019 Support on ToolSetup Batches

2019-09-11 Thread Cheng, Ching JenX
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2182

Inorder to support VS2019, we add VS2019 config process
in Setup Batch Files,
Because VS2019 and VS2017 could using same vswhere.exe
to detect the InstallationPath,
So we add the -version as the parameter of vswhere
to get the correct VS2017/VS2019's InstallationPath

Change-Id: I72d5ef66fd39d3d42b0b2ea57199b4fa27260ab6
Cc: Amy Chan 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Ching JenX Cheng 
---
 BaseTools/get_vsvars.bat| 39 +++
 BaseTools/set_vsprefix_envs.bat | 70 
+-
 BaseTools/toolsetup.bat | 16 +---
 edksetup.bat|  6 --
 4 files changed, 113 insertions(+), 18 deletions(-)

diff --git a/BaseTools/get_vsvars.bat b/BaseTools/get_vsvars.bat
index 9f3759b2a9..60c3a2c0b7 100644
--- a/BaseTools/get_vsvars.bat
+++ b/BaseTools/get_vsvars.bat
@@ -1,7 +1,7 @@
 @REM @file
 @REM   Windows batch file to find the Visual Studio set up script
 @REM
-@REM Copyright (c) 2013-2014, ARM Limited. All rights reserved.
+@REM Copyright (c) 2013-2019, ARM Limited. All rights reserved.
 
 @REM SPDX-License-Identifier: BSD-2-Clause-Patent
 @REM
@@ -10,15 +10,21 @@
 @echo off
 set SCRIPT_ERROR=0
 if "%1"=="" goto main
+if /I "%1"=="VS2019" goto VS2019Vars
 if /I "%1"=="VS2017" goto VS2017Vars
 if /I "%1"=="VS2015" goto VS2015Vars
 if /I "%1"=="VS2013" goto VS2013Vars
 if /I "%1"=="VS2012" goto VS2012Vars
 
 :set_vsvars
-for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do (
-  if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
-)
+if defined VCINSTALLDIR goto :EOF
+  call %* > vswhereInfo
+  for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+if /i "%%i"=="installationPath" (
+  call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+)
+  )
+  del vswhereInfo
 goto :EOF
 
 :read_vsvars
@@ -42,19 +48,36 @@ REM   (Or invoke the relevant vsvars32 file beforehand).
 
 :main
 if defined VCINSTALLDIR goto :done
+  :VS2019Vars
+  if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" 
(
+if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
+  call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual 
Studio\Installer\vswhere.exe" -products 
Microsoft.VisualStudio.Product.BuildTools -version 16,17
+) else (
+  call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual 
Studio\Installer\vswhere.exe" -version 16,17
+)
+  )
+  if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
+  call :set_vsvars "%ProgramFiles%\Microsoft Visual 
Studio\Installer\vswhere.exe" -products 
Microsoft.VisualStudio.Product.BuildTools -version 16,17
+) else (
+  call :set_vsvars "%ProgramFiles%\Microsoft Visual 
Studio\Installer\vswhere.exe" -version 16,17
+)
+  )
+  if /I "%1"=="VS2019" goto ToolNotInstall
+
   :VS2017Vars
   if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" 
(
 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
-  call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual 
Studio\Installer\vswhere.exe" -products 
Microsoft.VisualStudio.Product.BuildTools
+  call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual 
Studio\Installer\vswhere.exe" -products 
Microsoft.VisualStudio.Product.BuildTools -version 15,16
 ) else (
-  call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual 
Studio\Installer\vswhere.exe"
+  call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual 
Studio\Installer\vswhere.exe" -version 15,16
 )
   )
   if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
 if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
-  call :set_vsvars "%ProgramFiles%\Microsoft Visual 
Studio\Installer\vswhere.exe" -products 
Microsoft.VisualStudio.Product.BuildTools
+  call :set_vsvars "%ProgramFiles%\Microsoft Visual 
Studio\Installer\vswhere.exe" -products 
Microsoft.VisualStudio.Product.BuildTools -version 15,16
 ) else (
-  call :set_vsvars "%ProgramFiles%\Microsoft Visual 
Studio\Installer\vswhere.exe"
+  call :set_vsvars "%ProgramFiles%\Microsoft Visual 
Studio\Installer\vswhere.exe" -version 15,16
 )
   )
   if /I "%1"=="VS2017" goto ToolNotInstall
diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat
index 81686f5b63..46b84713a6 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -3,7 +3,7 @@
 @REM   however it may be executed directly from the BaseTools project folder
 @REM   if the file is not executed within a WORKSPACE\BaseTools folder.
 @REM
-@REM Copyright (c) 2016-2017, Intel Corporation. All rights reserved.
+@REM Copyright (c) 2016-2019, Intel Corporation. All rights reserved.
 @REM
 @REM SPDX-License-Identifier: 

[edk2-devel] [PATCH 1/2] Add VS2019 Toolchain def

2019-09-11 Thread Cheng, Ching JenX
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2182

In order to support VS2019,
the first thing need to do is add 2019 toolchain on tools_def.template

Change-Id: Id52abdc9762cf06bb9a38bbfd1153608c878d839
Cc: Amy Chan 
Cc: Bob Feng 
Cc: Liming Gao 
Signed-off-by: Ching JenX Cheng 
---
 BaseTools/Conf/tools_def.template | 134 
++
 1 file changed, 122 insertions(+), 12 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 8f0e6cb6c2..7585a3e5db 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -63,27 +63,35 @@ DEFINE VS2017_BIN_X64 = 
DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\x64
 DEFINE VS2017_BIN_ARM = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm
 DEFINE VS2017_BIN_AARCH64 = DEF(VS2017_BIN)\HostDEF(VS2017_HOST)\arm64
 
-DEFINE WINSDK_BIN   = ENV(WINSDK_PREFIX)
-DEFINE WINSDKx86_BIN= ENV(WINSDKx86_PREFIX)
+DEFINE VS2019_BIN = ENV(VS2019_PREFIX)bin
+DEFINE VS2019_HOST= x86
+DEFINE VS2019_BIN_HOST= 
DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\DEF(VS2019_HOST)
+DEFINE VS2019_BIN_IA32= DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\x86
+DEFINE VS2019_BIN_X64 = DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\x64
+DEFINE VS2019_BIN_ARM = DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\arm
+DEFINE VS2019_BIN_AARCH64 = DEF(VS2019_BIN)\HostDEF(VS2019_HOST)\arm64
+
+DEFINE WINSDK_BIN   = ENV(WINSDK_PREFIX)
+DEFINE WINSDKx86_BIN= ENV(WINSDKx86_PREFIX)
 
 # Microsoft Visual Studio 2010
-DEFINE WINSDK7_BIN   = ENV(WINSDK7_PREFIX)
-DEFINE WINSDK7x86_BIN= ENV(WINSDK7x86_PREFIX)
+DEFINE WINSDK7_BIN  = ENV(WINSDK7_PREFIX)
+DEFINE WINSDK7x86_BIN   = ENV(WINSDK7x86_PREFIX)
 
 # Microsoft Visual Studio 2012 Update 1 (required for rc.exe that was not 
included in the initial release)
-DEFINE WINSDK71_BIN   = ENV(WINSDK71_PREFIX)
-DEFINE WINSDK71x86_BIN= ENV(WINSDK71x86_PREFIX)
+DEFINE WINSDK71_BIN = ENV(WINSDK71_PREFIX)
+DEFINE WINSDK71x86_BIN  = ENV(WINSDK71x86_PREFIX)
 
 # Microsoft Visual Studio 2013 Professional Edition
-DEFINE WINSDK8_BIN   = ENV(WINSDK8_PREFIX)x86\
-DEFINE WINSDK8x86_BIN= ENV(WINSDK8x86_PREFIX)x64
+DEFINE WINSDK8_BIN  = ENV(WINSDK8_PREFIX)x86\
+DEFINE WINSDK8x86_BIN   = ENV(WINSDK8x86_PREFIX)x64
 
 # Microsoft Visual Studio 2015 Professional Edition
-DEFINE WINSDK81_BIN   = ENV(WINSDK81_PREFIX)x86\
-DEFINE WINSDK81x86_BIN= ENV(WINSDK81x86_PREFIX)x64
+DEFINE WINSDK81_BIN = ENV(WINSDK81_PREFIX)x86\
+DEFINE WINSDK81x86_BIN  = ENV(WINSDK81x86_PREFIX)x64
 
-# Microsoft Visual Studio 2017 Professional Edition
-DEFINE WINSDK10_BIN   = ENV(WINSDK10_PREFIX)DEF(VS2017_HOST)
+# Microsoft Visual Studio 2017/2019 Professional Edition
+DEFINE WINSDK10_BIN = ENV(WINSDK10_PREFIX)DEF(VS2017_HOST)
 
 # These defines are needed for certain Microsoft Visual Studio tools that
 # are used by other toolchains.  An example is that ICC on Windows normally
@@ -218,6 +226,17 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 #Note:
 # Building of XIP firmware images for ARM/ARM64 is 
not currently supported (only applications).
 # /FILEALIGN:4096 and other changes are needed for 
ARM firmware builds.
+#   VS2019  -win32-  Requires:
+# Microsoft Visual Studio 2019 version 16.2 or 
later
+#Optional:
+# Required to build EBC drivers:
+#   Intel(r) Compiler for Efi Byte Code (Intel(r) 
EBC Compiler)
+# Required to build platforms or ACPI tables:
+#   Intel(r) ACPI Compiler (iasl.exe) from
+#   https://acpica.org/downloads
+#Note:
+# Building of XIP firmware images for ARM/ARM64 is 
not currently supported (only applications).
+# /FILEALIGN:4096 and other changes are needed for 
ARM firmware builds.
 #   GCC48   -Linux,Windows-  Requires:
 # GCC 4.8 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
 #Optional:
@@ -1691,6 +1710,97 @@ NOOPT_VS2017_AARCH64_DLINK_FLAGS   = /NOLOGO 
/NODEFAULTLIB /IGNORE:4001 /OPT:REF
 *_VS2017_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
 *_VS2017_EBC_DLINK_FLAGS = "C:\Program Files 
(x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF 
/ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP /ALIGN:32 
/DRIVER
 
+
+#   VS2019   - Microsoft Visual Studio 2017 with Intel ASL
+#   ASL  - Intel ACPI Source 

[edk2-devel] [PATCH 0/2] *** Add VS2019 Support ***

2019-09-11 Thread Cheng, Ching JenX
*** BLURB HERE ***

Ching JenX Cheng (2):
  Add VS2019 Toolchain def
  Add VS2019 Support on ToolSetup Batches

 BaseTools/Conf/tools_def.template | 134 
++
 BaseTools/get_vsvars.bat  |  39 +++
 BaseTools/set_vsprefix_envs.bat   |  70 
+-
 BaseTools/toolsetup.bat   |  16 +---
 edksetup.bat  |   6 --
 5 files changed, 235 insertions(+), 30 deletions(-)

--
2.21.0.windows.1


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

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