Re: [edk2-devel] BaseTools --hash malfunction after migrate from stable201905 to stable201908

2019-10-20 Thread Steven Shi
Hi Derek,
I figure out a new solution for –hash cache as below. Please try it again.
https://github.com/shijunjing/edk2/tree/hashcache_v2

It is based on latest edk2 master branch, and what you need porting are below 
files. Let me know if you need me to create a patch based on edk2-stable201908.

$ git status
On branch hashcache_v2
$ git show HEAD --name-only
BaseTools/Conf/build_rule.template
BaseTools/Conf/tools_def.template
BaseTools/Source/Python/AutoGen/AutoGenWorker.py
BaseTools/Source/Python/AutoGen/DataPipe.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py
BaseTools/Source/Python/Common/GlobalData.py
BaseTools/Source/Python/build/build.py


Thanks

Steven Shi
Intel\SSG\SFE\FIE Firmware Infrastructure


From: Shi, Steven
Sent: Sunday, September 29, 2019 10:32 AM
To: Lin, Derek (HPS SW) ; devel@edk2.groups.io
Subject: RE: [edk2-devel] BaseTools --hash malfunction after migrate from 
stable201905 to stable201908

Hi Derek,
Thank you for the data. I will continue to enhance the –hash performance, and 
will let you know after I figure out new solution.


Thanks

Steven Shi
Intel\SSG\SFE\FIE Firmware Infrastructure


From: Lin, Derek (HPS SW) [mailto:derek.l...@hpe.com]
Sent: Friday, September 27, 2019 3:57 PM
To: Shi, Steven mailto:steven@intel.com>>; 
devel@edk2.groups.io
Subject: Re: [edk2-devel] BaseTools --hash malfunction after migrate from 
stable201905 to stable201908

Hi Steven,

Thanks for the fix!
I've tried your patch with a minor fix as attached.
   12   3   
 4
Build Duration:00:05:51  00:03:47  00:05:15  00:04:31
AutoGen Duration:  00:03:32  00:03:08  00:03:14  00:03:16
Make Duration:   00:01:50  00:00:16  00:01:29  00:00:50
GenFds Duration:   00:00:30  00:00:22  00:00:31  00:00:23

1: clean build with patch and --hash
2: incremental build
3. clean build without patch and without --hash
4. incremental build

BTW, this data cannot compare with previous data I provided because they are 
built in different environment.

In general, the result is as you said that it fix --hash functionality, but not 
as quick as before.
Also the cost of --hash in clean build is increased.

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

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



Re: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string constraint assertions

2019-10-20 Thread Yao, Jiewen
Hi Mike
I remember we have discussed it before.

The general concern is that: how many additional PCD we need introduce, to 
control different ASSERT in different modules ?

We may want to enable *some* assert in some modules, but disable *some other* 
assert.
E.g. the assert for linkedlist in base lib is another example...

What is your thought?

Thank you
Yao Jiewen

> -Original Message-
> From: Gao, Liming 
> Sent: Monday, October 21, 2019 11:17 AM
> To: devel@edk2.groups.io; vit9...@protonmail.com
> Cc: Yao, Jiewen ; Wang, Jian J ;
> Gao, Liming ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe 
> string
> constraint assertions
> 
> Include more people.
> 
> Basically, to keep the compatible behavior, PcdAssertOnSafeStringConstraints
> default value should be TRUE.
> The different platform can configure it.
> 
> Thanks
> Liming
> >-Original Message-
> >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> >Vitaly Cheptsov via Groups.Io
> >Sent: Sunday, October 20, 2019 9:06 PM
> >To: devel@edk2.groups.io
> >Subject: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string
> >constraint assertions
> >
> >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
> >
> >Runtime data checks are not meant to cause debug assertions
> >unless explicitly needed by some debug code (thus the PCD)
> >as this breaks debug builds validating data with BaseLib.
> >
> >Signed-off-by: Vitaly Cheptsov >
> >---
> > MdePkg/MdePkg.dec   |  6 ++
> > MdePkg/Library/BaseLib/BaseLib.inf  | 11 ++-
> > MdePkg/Library/BaseLib/SafeString.c |  4 +++-
> > MdePkg/MdePkg.uni   |  6 ++
> > 4 files changed, 21 insertions(+), 6 deletions(-)
> >
> >diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> >index 3fd7d1634c..dda2cdf401 100644
> >--- a/MdePkg/MdePkg.dec
> >+++ b/MdePkg/MdePkg.dec
> >@@ -2221,6 +2221,12 @@ [PcdsFixedAtBuild,PcdsPatchableInModule]
> >   # @Prompt Memory Address of GuidedExtractHandler Table.
> >
> >gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1
> >00|UINT64|0x30001015
> >
> >+  ## Indicates if safe string constraint violation should assert.
> >+  #   TRUE  - Safe string constraint violation causes assertion.
> >+  #   FALSE - Safe string constraint violation does not cause assertion.
> >+  # @Prompt Enable safe string constraint violation assertions.
> >+
> >gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints|FALSE|BOOL
> >EAN|0x002e
> >+
> > [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >   ## This value is used to set the base address of PCI express hierarchy.
> >   # @Prompt PCI Express Base Address.
> >diff --git a/MdePkg/Library/BaseLib/BaseLib.inf
> >b/MdePkg/Library/BaseLib/BaseLib.inf
> >index 3586beb0ab..bc98bc6134 100644
> >--- a/MdePkg/Library/BaseLib/BaseLib.inf
> >+++ b/MdePkg/Library/BaseLib/BaseLib.inf
> >@@ -390,11 +390,12 @@ [LibraryClasses]
> >   BaseMemoryLib
> >
> > [Pcd]
> >-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength  ##
> >SOMETIMES_CONSUMES
> >-  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ##
> >SOMETIMES_CONSUMES
> >-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength   ##
> >SOMETIMES_CONSUMES
> >-  gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask
> >## SOMETIMES_CONSUMES
> >-  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType   ##
> >SOMETIMES_CONSUMES
> >+  gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints   ##
> >SOMETIMES_CONSUMES
> >+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ##
> >SOMETIMES_CONSUMES
> >+  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength##
> >SOMETIMES_CONSUMES
> >+  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength  ##
> >SOMETIMES_CONSUMES
> >+  gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask
> >## SOMETIMES_CONSUMES
> >+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType  ##
> >SOMETIMES_CONSUMES
> >
> > [FeaturePcd]
> >   gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
> >diff --git a/MdePkg/Library/BaseLib/SafeString.c
> >b/MdePkg/Library/BaseLib/SafeString.c
> >index 7dc03d2caa..56b5e34a8d 100644
> >--- a/MdePkg/Library/BaseLib/SafeString.c
> >+++ b/MdePkg/Library/BaseLib/SafeString.c
> >@@ -14,7 +14,9 @@
> >
> > #define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status)  \
> >   do { \
> >-ASSERT (Expression); \
> >+if (PcdGetBool (PcdAssertOnSafeStringConstraints)) { \
> >+  ASSERT (Expression); \
> >+} \
> > if (!(Expression)) { \
> >   return Status; \
> > } \
> >diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
> >index 5c1fa24065..425b66bb43 100644
> >--- a/MdePkg/MdePkg.uni
> >+++ b/MdePkg/MdePkg.uni
> >@@ -287,6 +287,12 @@
> >
> > #string
> >STR_gEfiMdePkgTokenSpaceGuid_PcdGuidedExtractHandlerTableAddress_H
> >ELP  #language en-US "This value is used to set the available memory 

Re: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string constraint assertions

2019-10-20 Thread Liming Gao
Include more people. 

Basically, to keep the compatible behavior, PcdAssertOnSafeStringConstraints 
default value should be TRUE. 
The different platform can configure it. 

Thanks
Liming
>-Original Message-
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>Vitaly Cheptsov via Groups.Io
>Sent: Sunday, October 20, 2019 9:06 PM
>To: devel@edk2.groups.io
>Subject: [edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string
>constraint assertions
>
>REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
>Runtime data checks are not meant to cause debug assertions
>unless explicitly needed by some debug code (thus the PCD)
>as this breaks debug builds validating data with BaseLib.
>
>Signed-off-by: Vitaly Cheptsov >
>---
> MdePkg/MdePkg.dec   |  6 ++
> MdePkg/Library/BaseLib/BaseLib.inf  | 11 ++-
> MdePkg/Library/BaseLib/SafeString.c |  4 +++-
> MdePkg/MdePkg.uni   |  6 ++
> 4 files changed, 21 insertions(+), 6 deletions(-)
>
>diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
>index 3fd7d1634c..dda2cdf401 100644
>--- a/MdePkg/MdePkg.dec
>+++ b/MdePkg/MdePkg.dec
>@@ -2221,6 +2221,12 @@ [PcdsFixedAtBuild,PcdsPatchableInModule]
>   # @Prompt Memory Address of GuidedExtractHandler Table.
>
>gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x1
>00|UINT64|0x30001015
>
>+  ## Indicates if safe string constraint violation should assert.
>+  #   TRUE  - Safe string constraint violation causes assertion.
>+  #   FALSE - Safe string constraint violation does not cause assertion.
>+  # @Prompt Enable safe string constraint violation assertions.
>+
>gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints|FALSE|BOOL
>EAN|0x002e
>+
> [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>   ## This value is used to set the base address of PCI express hierarchy.
>   # @Prompt PCI Express Base Address.
>diff --git a/MdePkg/Library/BaseLib/BaseLib.inf
>b/MdePkg/Library/BaseLib/BaseLib.inf
>index 3586beb0ab..bc98bc6134 100644
>--- a/MdePkg/Library/BaseLib/BaseLib.inf
>+++ b/MdePkg/Library/BaseLib/BaseLib.inf
>@@ -390,11 +390,12 @@ [LibraryClasses]
>   BaseMemoryLib
>
> [Pcd]
>-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength  ##
>SOMETIMES_CONSUMES
>-  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ##
>SOMETIMES_CONSUMES
>-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength   ##
>SOMETIMES_CONSUMES
>-  gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask
>## SOMETIMES_CONSUMES
>-  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType   ##
>SOMETIMES_CONSUMES
>+  gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints   ##
>SOMETIMES_CONSUMES
>+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ##
>SOMETIMES_CONSUMES
>+  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength##
>SOMETIMES_CONSUMES
>+  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength  ##
>SOMETIMES_CONSUMES
>+  gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask
>## SOMETIMES_CONSUMES
>+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType  ##
>SOMETIMES_CONSUMES
>
> [FeaturePcd]
>   gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
>diff --git a/MdePkg/Library/BaseLib/SafeString.c
>b/MdePkg/Library/BaseLib/SafeString.c
>index 7dc03d2caa..56b5e34a8d 100644
>--- a/MdePkg/Library/BaseLib/SafeString.c
>+++ b/MdePkg/Library/BaseLib/SafeString.c
>@@ -14,7 +14,9 @@
>
> #define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status)  \
>   do { \
>-ASSERT (Expression); \
>+if (PcdGetBool (PcdAssertOnSafeStringConstraints)) { \
>+  ASSERT (Expression); \
>+} \
> if (!(Expression)) { \
>   return Status; \
> } \
>diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
>index 5c1fa24065..425b66bb43 100644
>--- a/MdePkg/MdePkg.uni
>+++ b/MdePkg/MdePkg.uni
>@@ -287,6 +287,12 @@
>
> #string
>STR_gEfiMdePkgTokenSpaceGuid_PcdGuidedExtractHandlerTableAddress_H
>ELP  #language en-US "This value is used to set the available memory address
>to store Guided Extract Handlers. The required memory space is decided by
>the value of PcdMaximumGuidedExtractHandler."
>
>+#string
>STR_gEfiMdePkgTokenSpaceGuid_PcdAssertOnSafeStringConstraints_PROM
>PT  #language en-US "Enable safe string constraint violation assertions"
>+
>+#string
>STR_gEfiMdePkgTokenSpaceGuid_PcdAssertOnSafeStringConstraints_HELP
>#language en-US "Indicates if safe string constraint violation should
>assert.\n"
>+  
> "TRUE  - Safe string constraint
>violation causes assertion.\n"
>+  
> "FALSE - Safe string constraint
>violation does not cause assertion."
>+
> #string
>STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_PROMPT
>#language en-US "PCI Express Base Address"
>
> #string 

Re: [edk2-devel] [PATCH] MdePkg/UefiFileHandleLib: Fix potential NULL dereference

2019-10-20 Thread Liming Gao
Reviewed-by: Liming Gao 

>-Original Message-
>From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
>Sent: Sunday, October 20, 2019 8:09 PM
>To: devel@edk2.groups.io
>Cc: vit9...@protonmail.com; Kinney, Michael D
>; Gao, Liming 
>Subject: [PATCH] MdePkg/UefiFileHandleLib: Fix potential NULL dereference
>
>From: Marvin Haeuser 
>
>REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2293
>
>Move the NULL check in FileHandleGetInfo() to directly after the
>allocation to prevent potential NULL dereferences.
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Signed-off-by: Marvin Haeuser 
>---
> MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c | 28 +++
>-
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
>diff --git a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
>b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
>index 96913c5c02b8..5dc893833a46 100644
>--- a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
>+++ b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
>@@ -68,19 +68,21 @@ FileHandleGetInfo (
> // error is expected.  getting size to allocate
>
> //
>
> FileInfo = AllocateZeroPool(FileInfoSize);
>
>-//
>
>-// now get the information
>
>-//
>
>-Status = FileHandle->GetInfo(FileHandle,
>
>- ,
>
>- ,
>
>- FileInfo);
>
>-//
>
>-// if we got an error free the memory and return NULL
>
>-//
>
>-if (EFI_ERROR(Status) && (FileInfo != NULL)) {
>
>-  FreePool(FileInfo);
>
>-  FileInfo = NULL;
>
>+if (FileInfo != NULL) {
>
>+  //
>
>+  // now get the information
>
>+  //
>
>+  Status = FileHandle->GetInfo(FileHandle,
>
>+   ,
>
>+   ,
>
>+   FileInfo);
>
>+  //
>
>+  // if we got an error free the memory and return NULL
>
>+  //
>
>+  if (EFI_ERROR(Status)) {
>
>+FreePool(FileInfo);
>
>+FileInfo = NULL;
>
>+  }
>
> }
>
>   }
>
>   return (FileInfo);
>
>--
>2.23.0.windows.1


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

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



Re: [edk2-devel] [PATCH] MdePkg/UefiDebugLibStdErr: Pass the correct buffer size

2019-10-20 Thread Liming Gao
Reviewed-by: Liming Gao 

>-Original Message-
>From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
>Sent: Monday, October 21, 2019 1:28 AM
>To: devel@edk2.groups.io
>Cc: vit9...@protonmail.com; Kinney, Michael D
>; Gao, Liming 
>Subject: [PATCH] MdePkg/UefiDebugLibStdErr: Pass the correct buffer size
>
>From: Marvin Haeuser 
>
>REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2302
>
>The second argument of "UnicodeVSPrintAsciiFormat" is "BufferSize",
>which takes the size of the buffer in bytes. Replace the currently
>used MAX_DEBUG_MESSAGE_LENGTH usage, which is the buffer's length,
>with the actual buffer size.
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Signed-off-by: Marvin Haeuser 
>---
> MdePkg/Library/UefiDebugLibStdErr/DebugLib.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
>b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
>index 40eb697e7e2c..fcfdafede08f 100644
>--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
>+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
>@@ -106,9 +106,9 @@ DebugPrintMarker (
> // Convert the DEBUG() message to a Unicode String
>
> //
>
> if (BaseListMarker == NULL) {
>
>-  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,
>Format, VaListMarker);
>
>+  UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format,
>VaListMarker);
>
> } else {
>
>-  UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,
>Format, BaseListMarker);
>
>+  UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format,
>BaseListMarker);
>
> }
>
>
>
> //
>
>--
>2.23.0.windows.1


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

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



Re: [edk2-devel] [PATCH] MdePkg/UefiDebugLibConOut: Pass the correct buffer size

2019-10-20 Thread Liming Gao
Reviewed-by: Liming Gao 

>-Original Message-
>From: Marvin Häuser [mailto:marvin.haeu...@outlook.com]
>Sent: Sunday, October 20, 2019 8:09 PM
>To: devel@edk2.groups.io
>Cc: vit9...@protonmail.com; Kinney, Michael D
>; Gao, Liming 
>Subject: [PATCH] MdePkg/UefiDebugLibConOut: Pass the correct buffer size
>
>From: Marvin Haeuser 
>
>REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2302
>
>The second argument of "UnicodeVSPrintAsciiFormat" is "BufferSize",
>which takes the size of the buffer in bytes. Replace the currently
>used MAX_DEBUG_MESSAGE_LENGTH usage, which is the buffer's length,
>with the actual buffer size.
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Signed-off-by: Marvin Haeuser 
>---
> MdePkg/Library/UefiDebugLibConOut/DebugLib.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
>b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
>index cf168d05cf21..8ea38ea7cc7c 100644
>--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
>+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
>@@ -104,9 +104,9 @@ DebugPrintMarker (
> // Convert the DEBUG() message to a Unicode String
>
> //
>
> if (BaseListMarker == NULL) {
>
>-  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,
>Format, VaListMarker);
>
>+  UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format,
>VaListMarker);
>
> } else {
>
>-  UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,
>Format, BaseListMarker);
>
>+  UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format,
>BaseListMarker);
>
> }
>
>
>
>
>
>--
>2.23.0.windows.1


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

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



Re: [edk2-devel] [PATCH v2 1/1] NetworkPkg/SnpDxe: Remove ExitBootServices event

2019-10-20 Thread Siyuan, Fu
Reviewed-by: Siyuan Fu 

> -Original Message-
> From: Rabeda, Maciej 
> Sent: 2019年10月14日 20:37
> To: devel@edk2.groups.io
> Cc: Fu, Siyuan ; Wu, Jiaxin 
> Subject: [PATCH v2 1/1] NetworkPkg/SnpDxe: Remove ExitBootServices
> event
> 
> Patch addresses Bugzilla #1972.
> During ExitBootServices stage, drivers should not call any
> functions known to use Memory Allocation Services. One of such
> functions (as per UEFI spec) is UNDI->Shutdown().
> 
> Since UNDI drivers during ExitBootServices phase are expected
> to put the adapter to such a state that it will not perform any DMA
> operations, there is no need to interface UNDI by SNP driver during
> that phase.
> 
> Finally, since ExitBootServices event notification function in SNP
> only calls UNDI->Shutdown() and Stop() functions, there is no need
> to create this event at all. Adding PCD to control creation of event
> reacting to ExitBootServices() call so that systems with UNDIs relying
> on SNP to call their Shutdown() and Stop() can still work.
> 
> Signed-off-by: Maciej Rabeda 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> ---
> 
> Notes:
> v2:
> - modified commit message
> - added PCD to control ExitBootServices() creation event in SnpDxe
> 
>  NetworkPkg/SnpDxe/Snp.c  | 38 +++-
>  NetworkPkg/NetworkPkg.dec|  7 
>  NetworkPkg/SnpDxe/Snp.h  |  1 +
>  NetworkPkg/SnpDxe/SnpDxe.inf |  3 ++
>  4 files changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/NetworkPkg/SnpDxe/Snp.c b/NetworkPkg/SnpDxe/Snp.c
> index a23af05078bc..03317ffa26f1 100644
> --- a/NetworkPkg/SnpDxe/Snp.c
> +++ b/NetworkPkg/SnpDxe/Snp.c
> @@ -647,19 +647,21 @@ SimpleNetworkDriverStart (
>PxeShutdown (Snp);
>PxeStop (Snp);
> 
> -  //
> -  // Create EXIT_BOOT_SERIVES Event
> -  //
> -  Status = gBS->CreateEventEx (
> -  EVT_NOTIFY_SIGNAL,
> -  TPL_NOTIFY,
> -  SnpNotifyExitBootServices,
> -  Snp,
> -  ,
> -  >ExitBootServicesEvent
> -  );
> -  if (EFI_ERROR (Status)) {
> -goto Error_DeleteSNP;
> +  if (FixedPcdGetBool (PcdSnpCreateExitBootServicesEvent)) {
> +//
> +// Create EXIT_BOOT_SERIVES Event
> +//
> +Status = gBS->CreateEventEx (
> +EVT_NOTIFY_SIGNAL,
> +TPL_NOTIFY,
> +SnpNotifyExitBootServices,
> +Snp,
> +,
> +>ExitBootServicesEvent
> +);
> +if (EFI_ERROR (Status)) {
> +  goto Error_DeleteSNP;
> +}
>}
> 
>//
> @@ -778,10 +780,12 @@ SimpleNetworkDriverStop (
>  return Status;
>}
> 
> -  //
> -  // Close EXIT_BOOT_SERIVES Event
> -  //
> -  gBS->CloseEvent (Snp->ExitBootServicesEvent);
> +  if (FixedPcdGetBool (PcdSnpCreateExitBootServicesEvent)) {
> +//
> +// Close EXIT_BOOT_SERIVES Event
> +//
> +gBS->CloseEvent (Snp->ExitBootServicesEvent);
> +  }
> 
>Status = gBS->CloseProtocol (
>Controller,
> diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
> index 944b1d1501c0..66e500cbeaf7 100644
> --- a/NetworkPkg/NetworkPkg.dec
> +++ b/NetworkPkg/NetworkPkg.dec
> @@ -109,6 +109,13 @@
># @Prompt TFTP block size.
> 
> gEfiNetworkPkgTokenSpaceGuid.PcdTftpBlockSize|0x0|UINT64|0x100B
> 
> +  ## Indicates whether SnpDxe driver will create an event that will be
> notified
> +  # upon gBS->ExitBootServices() call.
> +  # TRUE - Event being triggered upon ExitBootServices call will be created
> +  # FALSE - Event being triggered upon ExitBootServices call will NOT be
> created
> +  # @Prompt Indicates whether SnpDxe creates event for ExitBootServices()
> call.
> +
> gEfiNetworkPkgTokenSpaceGuid.PcdSnpCreateExitBootServicesEvent|TRUE|
> BOOLEAN|0x100C
> +
>  [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>## IPv6 DHCP Unique Identifier (DUID) Type configuration (From RFCs 3315
> and 6355).
># 01 = DUID Based on Link-layer Address Plus Time [DUID-LLT]
> diff --git a/NetworkPkg/SnpDxe/Snp.h b/NetworkPkg/SnpDxe/Snp.h
> index e6b62930397d..4f64c525e357 100644
> --- a/NetworkPkg/SnpDxe/Snp.h
> +++ b/NetworkPkg/SnpDxe/Snp.h
> @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include 
>  #include 
>  #include 
> +#include 
> 
>  #include 
>  #include 
> diff --git a/NetworkPkg/SnpDxe/SnpDxe.inf
> b/NetworkPkg/SnpDxe/SnpDxe.inf
> index afeb1526cc10..79ea789c0837 100644
> --- a/NetworkPkg/SnpDxe/SnpDxe.inf
> +++ b/NetworkPkg/SnpDxe/SnpDxe.inf
> @@ -73,5 +73,8 @@
>gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## TO_START
>gEfiPciIoProtocolGuid ## TO_START
> 
> +[Pcd]
> +  gEfiNetworkPkgTokenSpaceGuid.PcdSnpCreateExitBootServicesEvent   ##
> CONSUMES
> +
>  [UserExtensions.TianoCore."ExtraFiles"]
>SnpDxeExtra.uni
> --
> 2.17.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages 

Re: [edk2-devel] [PATCH] WinHost: Add SimplePointer support

2019-10-20 Thread Ni, Ray
It was just pushed.

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Marvin
> H?user
> Sent: Sunday, October 20, 2019 5:31 PM
> To: Ni, Ray ; devel@edk2.groups.io
> Cc: Justen, Jordan L ; Andrew Fish
> 
> Subject: Re: [edk2-devel] [PATCH] WinHost: Add SimplePointer support
> 
> Good day,
> 
> Thank you for your review. I have not seen this patch pushed yet, could you
> please update me with the status?
> 
> Thanks,
> Marvin
> > Reviewed-by: Ray Ni 
> >
> >> -Original Message-
> >> From: Marvin Häuser 
> >> Sent: Thursday, September 26, 2019 9:38 AM
> >> To: Ni, Ray ; Marvin Häuser
> >> ; devel@edk2.groups.io
> >> Cc: Justen, Jordan L ; Andrew Fish
> >> 
> >> Subject: Re: [PATCH] WinHost: Add SimplePointer support
> >>
> >> Good day,
> >>
> >> I have tested cursor movement (including initial window entry)
> >> extensively and left mouse button functionality. As the right mouse
> >> button works analoguously, I expect it to work. This was all from the
> >> GetState() function of the SP protocol.
> >>
> >> Thanks,
> >> Marvin
> >>
> >> Am 26.09.2019 um 00:32 schrieb Ni, Ray:
> >>> Marvin,
> >>> Can you kindly share what unit test you've done?
> >>>
>  -Original Message-
>  From: Marvin Häuser 
>  Sent: Tuesday, September 24, 2019 5:46 AM
>  To: devel@edk2.groups.io
>  Cc: Justen, Jordan L ; Andrew Fish
>  ; Ni, Ray 
>  Subject: [PATCH] WinHost: Add SimplePointer support
> 
>  From: Marvin Haeuser 
> 
>  Catch WM mouse events and expose them via the SimplePointer
> protocol.
> 
>  Cc: Jordan Justen 
>  Cc: Andrew Fish 
>  Cc: Ray Ni 
>  Signed-off-by: Marvin Haeuser 
>  ---
> EmulatorPkg/Win/Host/WinGopInput.c  | 25 ++--
> EmulatorPkg/Win/Host/WinGopScreen.c | 41
> 
> EmulatorPkg/Win/Host/WinGop.h   |  5 +++
> EmulatorPkg/Win/Host/WinInclude.h   |  1 +
> 4 files changed, 69 insertions(+), 3 deletions(-)
> 
>  diff --git a/EmulatorPkg/Win/Host/WinGopInput.c
>  b/EmulatorPkg/Win/Host/WinGopInput.c
>  index 0e8d11fc57ac..312a549847c5 100644
>  --- a/EmulatorPkg/Win/Host/WinGopInput.c
>  +++ b/EmulatorPkg/Win/Host/WinGopInput.c
>  @@ -409,9 +409,12 @@ WinNtWndCheckPointer (
> 
> 
>   Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> 
> 
> 
>  -  return EFI_NOT_READY;
> 
>  -}
> 
>  +  if (!Private->PointerStateChanged) {
> 
>  +return EFI_NOT_READY;
> 
>  +  }
> 
> 
> 
>  +  return EFI_SUCCESS;
> 
>  +}
> 
> 
> 
> EFI_STATUS
> 
> EFIAPI
> 
>  @@ -424,5 +427,21 @@ WinNtWndGetPointerState (
> 
> 
>   Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);
> 
> 
> 
>  -  return EFI_NOT_READY;
> 
>  +  if (!Private->PointerStateChanged) {
> 
>  +return EFI_NOT_READY;
> 
>  +  }
> 
>  +
> 
>  +  State->RelativeMovementX =
>  + Private->PointerState.RelativeMovementX;
> 
>  +  State->RelativeMovementY =
>  + Private->PointerState.RelativeMovementY;
> 
>  +  State->RelativeMovementZ =
>  + Private->PointerState.RelativeMovementZ;
> 
>  +  State->LeftButton= Private->PointerState.LeftButton;
> 
>  +  State->RightButton   = Private->PointerState.RightButton;
> 
>  +
> 
>  +  Private->PointerState.RelativeMovementX = 0;
> 
>  +  Private->PointerState.RelativeMovementY = 0;
> 
>  +  Private->PointerState.RelativeMovementZ = 0;
> 
>  +
> 
>  +  Private->PointerStateChanged = FALSE;
> 
>  +
> 
>  +  return EFI_SUCCESS;
> 
> }
> 
>  diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c
>  b/EmulatorPkg/Win/Host/WinGopScreen.c
>  index 8f42606823f1..fa34596497f8 100644
>  --- a/EmulatorPkg/Win/Host/WinGopScreen.c
>  +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
>  @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
>   LPARAMIndex;
> 
>   EFI_INPUT_KEY Key;
> 
>   BOOLEAN   AltIsPress;
> 
>  +  INT32 PosX;
> 
>  +  INT32 PosY;
> 
> 
> 
>   //
> 
>   // Use mTlsIndex global to get a Thread Local Storage version of
> Private.
> 
>  @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
> WinNtGopConvertParamToEfiKeyShiftState (Private, ,
>  , FALSE);
> 
> return 0;
> 
> 
> 
>  +  case WM_MOUSEMOVE:
> 
>  +PosX = GET_X_LPARAM (lParam);
> 
>  +PosY = GET_Y_LPARAM (lParam);
> 
>  +
> 
>  +if (Private->PointerPreviousX != PosX) {
> 
>  +  Private->PointerState.RelativeMovementX += (PosX -
>  + Private->PointerPreviousX);
> 

[edk2-devel] [PATCH] MdeModulePkg/Oniguruma: Remove redundant IF statement

2019-10-20 Thread Zhang, Shenglei
The if statement is not necessary, so keep it to edk2 style.
And this change has been merged to onigruma.
REF:https://github.com/kkos/oniguruma/pull/158

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 .../Oniguruma/unicode_fold1_key.c  | 18 +++---
 .../Oniguruma/unicode_fold2_key.c  | 17 ++---
 .../Oniguruma/unicode_fold3_key.c  | 18 +++---
 .../Oniguruma/unicode_unfold_key.c | 17 ++---
 4 files changed, 26 insertions(+), 44 deletions(-)

diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1_key.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1_key.c
index 7dbd6a5995be..0aa54ee172b2 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1_key.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1_key.c
@@ -2983,17 +2983,13 @@ onigenc_unicode_fold1_key(OnigCodePoint codes[])
   4026
 };
 
-  if (0 == 0)
-{
-  int key = hash(codes);
-
-  if (key <= MAX_HASH_VALUE)
-{
-  int index = wordlist[key];
-
-  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds1 + index, 
1) == 0)
-return index;
-}
+int key = hash(codes);
+if (key <= MAX_HASH_VALUE) {
+  int index = wordlist[key];
+  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds1 + index, 1) == 
0) {
+return index;
+  }
 }
+
   return -1;
 }
diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c
index 3d93e2417a2c..44f8cb660071 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2_key.c
@@ -211,17 +211,12 @@ onigenc_unicode_fold2_key(OnigCodePoint codes[])
   129
 };
 
-  if (0 == 0)
-{
-  int key = hash(codes);
-
-  if (key <= MAX_HASH_VALUE)
-{
-  int index = wordlist[key];
-
-  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds2 + index, 
2) == 0)
-return index;
-}
+int key = hash(codes);
+if (key <= MAX_HASH_VALUE) {
+  int index = wordlist[key];
+  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds2 + index, 2) == 
0)
+return index;
 }
+
   return -1;
 }
diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c
index bdd5667c6ae2..b36500b135e6 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3_key.c
@@ -121,17 +121,13 @@ onigenc_unicode_fold3_key(OnigCodePoint codes[])
   0
 };
 
-  if (0 == 0)
-{
-  int key = hash(codes);
-
-  if (key <= MAX_HASH_VALUE)
-{
-  int index = wordlist[key];
-
-  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 
3) == 0)
-return index;
-}
+int key = hash(codes);
+if (key <= MAX_HASH_VALUE) {
+  int index = wordlist[key];
+  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 3) == 
0) {
+return index;
+  }
 }
+
   return -1;
 }
diff --git 
a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfold_key.c 
b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfold_key.c
index 10f7889ea372..1f03b21cfe54 100644
--- a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfold_key.c
+++ b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfold_key.c
@@ -3288,17 +3288,12 @@ onigenc_unicode_unfold_key(OnigCodePoint code)
   {0x1e907, 4005, 1}
 };
 
-  if (0 == 0)
-{
-  int key = hash();
-
-  if (key <= MAX_HASH_VALUE)
-{
-  OnigCodePoint gcode = wordlist[key].code;
-
-  if (code == gcode && wordlist[key].index >= 0)
-return [key];
-}
+int key = hash();
+if (key <= MAX_HASH_VALUE) {
+  OnigCodePoint gcode = wordlist[key].code;
+  if (code == gcode && wordlist[key].index >= 0) {
+return [key];
+  }
 }
   return 0;
 }
-- 
2.18.0.windows.1


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

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



Re: [edk2-devel] [Patch] PcAtChipsetPkg: Fix spelling errors

2019-10-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: Kinney, Michael D 
> Sent: Saturday, October 19, 2019 3:35 AM
> To: devel@edk2.groups.io
> Cc: Sean Brogan ; Ni, Ray 
> Subject: [Patch] PcAtChipsetPkg: Fix spelling errors
> 
> From: Sean Brogan 
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=2263
> 
> Cc: Ray Ni 
> Signed-off-by: Michael D Kinney 
> ---
>  PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c  | 12 ++--
>  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf |  2 +-
>  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.uni |  2 +-
>  PcAtChipsetPkg/Include/Library/IoApicLib.h   |  2 +-
>  PcAtChipsetPkg/Include/Register/Hpet.h   |  6 +++---
>  PcAtChipsetPkg/Library/BaseIoApicLib/IoApicLib.c |  2 +-
>  PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c   |  8 
>  PcAtChipsetPkg/PcAtChipsetPkg.dec|  2 +-
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c   |  4 ++--
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h   |  8 
>  .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c |  2 +-
>  11 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
> b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
> index ded3b53619..cbe986ebfd 100644
> --- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
> +++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
> @@ -1,5 +1,5 @@
>  /** @file
> -  Timer Architectural Protocol module using High Precesion Event Timer
> (HPET)
> +  Timer Architectural Protocol module using High Precision Event Timer
> (HPET)
> 
>Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -246,7 +246,7 @@ HpetRead (
>  /**
>Write a 64-bit HPET register.
> 
> -  @param  Offset  Specifies the ofsfert of the HPET register to write.
> +  @param  Offset  Specifies the offset of the HPET register to write.
>@param  Value   Specifies the value to write to the HPET register specified
> by Offset.
> 
>@return  The 64-bit value written to HPET register specified by Offset.
> @@ -530,7 +530,7 @@ TimerDriverSetTimerPeriod (
>  // If TimerPeriod is 0, then mask HPET Timer interrupts
>  //
> 
> -if (mTimerConfiguration.Bits.MsiInterruptCapablity != 0 &&
> FeaturePcdGet (PcdHpetMsiEnable)) {
> +if (mTimerConfiguration.Bits.MsiInterruptCapability != 0 &&
> FeaturePcdGet (PcdHpetMsiEnable)) {
>//
>// Disable HPET MSI interrupt generation
>//
> @@ -576,7 +576,7 @@ TimerDriverSetTimerPeriod (
>  //
>  // Enable HPET Timer interrupt generation
>  //
> -if (mTimerConfiguration.Bits.MsiInterruptCapablity != 0 &&
> FeaturePcdGet (PcdHpetMsiEnable)) {
> +if (mTimerConfiguration.Bits.MsiInterruptCapability != 0 &&
> FeaturePcdGet (PcdHpetMsiEnable)) {
>//
>// Program MSI Address and MSI Data values in the selected HPET Timer
>// Program HPET register with APIC ID of current BSP in case BSP has 
> been
> switched
> @@ -834,7 +834,7 @@ TimerDriverInitialize (
>  //
>  // Check to see if this HPET Timer supports MSI
>  //
> -if (mTimerConfiguration.Bits.MsiInterruptCapablity != 0) {
> +if (mTimerConfiguration.Bits.MsiInterruptCapability != 0) {
>//
>// Save the index of the first HPET Timer that supports MSI interrupts
>//
> @@ -959,7 +959,7 @@ TimerDriverInitialize (
>// Show state of enabled HPET timer
>//
>DEBUG_CODE (
> -if (mTimerConfiguration.Bits.MsiInterruptCapablity != 0 &&
> FeaturePcdGet (PcdHpetMsiEnable)) {
> +if (mTimerConfiguration.Bits.MsiInterruptCapability != 0 &&
> FeaturePcdGet (PcdHpetMsiEnable)) {
>DEBUG ((DEBUG_INFO, "HPET Interrupt Mode MSI\n"));
>  } else {
>DEBUG ((DEBUG_INFO, "HPET Interrupt Mode I/O APIC\n"));
> diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> b/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> index ba2e075118..125eea0aab 100644
> --- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> +++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
> @@ -1,5 +1,5 @@
>  ## @file
> -# Timer Architectural Protocol module using High Precesion Event Timer
> (HPET).
> +# Timer Architectural Protocol module using High Precision Event Timer
> (HPET).
>  #
>  # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
> diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.uni
> b/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.uni
> index e2320653b6..7d1797b1df 100644
> --- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.uni
> +++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.uni
> @@ -1,5 +1,5 @@
>  // /** @file
> -// Timer Architectural Protocol module using High Precesion Event Timer
> (HPET).
> +// Timer Architectural Protocol module using High Precision Event Timer
> (HPET).
>  //
>  // Timer Architectural Protocol module using High Precision Event Timer
> (HPET).
>  //
> 

Re: [edk2-devel] [Patch] FatPkg: Fix spelling errors

2019-10-20 Thread Ni, Ray
Reviewed-by: Ray Ni 

> -Original Message-
> From: Kinney, Michael D 
> Sent: Saturday, October 19, 2019 3:15 AM
> To: devel@edk2.groups.io
> Cc: Sean Brogan ; Ni, Ray 
> Subject: [Patch] FatPkg: Fix spelling errors
> 
> From: Sean Brogan 
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=2264
> 
> Cc: Ray Ni 
> Signed-off-by: Michael D Kinney 
> ---
>  FatPkg/EnhancedFatDxe/DirectoryManage.c |  8 
>  FatPkg/EnhancedFatDxe/DiskCache.c   |  2 +-
>  FatPkg/EnhancedFatDxe/Fat.h | 20 ++--
>  FatPkg/EnhancedFatDxe/FileName.c|  2 +-
>  FatPkg/EnhancedFatDxe/FileSpace.c   |  6 +++---
>  FatPkg/EnhancedFatDxe/Info.c|  2 +-
>  FatPkg/EnhancedFatDxe/Init.c|  2 +-
>  FatPkg/EnhancedFatDxe/Misc.c|  6 +++---
>  FatPkg/EnhancedFatDxe/Open.c|  2 +-
>  FatPkg/FatPei/FatLiteApi.c  |  6 +++---
>  FatPkg/FatPei/FatLitePeim.h |  4 ++--
>  FatPkg/FatPei/Gpt.c |  2 +-
>  FatPkg/FatPei/Mbr.c |  2 +-
>  13 files changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c
> b/FatPkg/EnhancedFatDxe/DirectoryManage.c
> index 21656883bd..93772dba09 100644
> --- a/FatPkg/EnhancedFatDxe/DirectoryManage.c
> +++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c
> @@ -17,7 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>@param  EntryPos  - The position of the directory entry to be
> accessed.
>@param  Entry - The directory entry read or written.
> 
> -  @retval EFI_SUCCESS   - Access the directory entry sucessfully.
> +  @retval EFI_SUCCESS   - Access the directory entry successfully.
>@return other - An error occurred when reading the 
> directory entry.
> 
>  **/
> @@ -896,7 +896,7 @@ FatNewEntryPos (
>@param  Volume- FAT file system volume.
>@param  Name  - The file name of the volume.
> 
> -  @retval EFI_SUCCESS   - Update the volume with the directory entry
> sucessfully.
> +  @retval EFI_SUCCESS   - Update the volume with the directory entry
> successfully.
>@return others- An error occurred when getting volume 
> label.
> 
>  **/
> @@ -927,7 +927,7 @@ FatGetVolumeEntry (
>@param  Volume  - FAT file system volume.
>@param  Name- The new file name of the volume.
> 
> -  @retval EFI_SUCCESS - Update the Volume sucessfully.
> +  @retval EFI_SUCCESS - Update the Volume successfully.
>@retval EFI_UNSUPPORTED - The input label is not a valid volume label.
>@return other   - An error occurred when setting volume label.
> 
> @@ -1246,7 +1246,7 @@ FatCloseDirEnt (
>not be created either).
>@retval EFI_INVALID_PARAMETER - The parameter is not valid.
>@retval EFI_SUCCESS   - Open the file successfully.
> -  @return other - An error occured when locating the OFile.
> +  @return other - An error occurred when locating the OFile.
> 
>  **/
>  EFI_STATUS
> diff --git a/FatPkg/EnhancedFatDxe/DiskCache.c
> b/FatPkg/EnhancedFatDxe/DiskCache.c
> index 2df0aa09f1..df587810fb 100644
> --- a/FatPkg/EnhancedFatDxe/DiskCache.c
> +++ b/FatPkg/EnhancedFatDxe/DiskCache.c
> @@ -16,7 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>are older than the contents in disk, so they are invalid; just mark them
> invalid.
> 
>When this function is called by read command, if any entry in this range
> -  is dirty, it means that the relative info directly readed from media is 
> older
> than
> +  is dirty, it means that the relative info directly read from media is
> + older than
>than the info in the cache; So need to update the relative info in the 
> Buffer.
> 
>@param  Volume- FAT file system volume.
> diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
> index 98ead5a0fb..46c185c3a9 100644
> --- a/FatPkg/EnhancedFatDxe/Fat.h
> +++ b/FatPkg/EnhancedFatDxe/Fat.h
> @@ -865,7 +865,7 @@ FatCleanupVolume (
> 
>@param  OFile - The open file.
> 
> -  @retval EFI_SUCCESS   - Shrinked sucessfully.
> +  @retval EFI_SUCCESS   - Shrinked successfully.
>@retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
> 
>  **/
> @@ -881,7 +881,7 @@ FatShrinkEof (
>@param  OFile - The open file.
>@param  NewSizeInBytes- The new size in bytes of the open file.
> 
> -  @retval EFI_SUCCESS   - The file is grown sucessfully.
> +  @retval EFI_SUCCESS   - The file is grown successfully.
>@retval EFI_UNSUPPORTED   - The file size is larger than 4GB.
>@retval EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
>@retval EFI_VOLUME_FULL   - The volume is full and can not grow the 
> file.
> @@ -969,7 

Re: [edk2-devel] [Patch] MdePkg: Add UefiFileHandleLib to DSC file

2019-10-20 Thread Liming Gao
Reviewed-by: Liming Gao 

>-Original Message-
>From: Kinney, Michael D
>Sent: Saturday, October 19, 2019 4:38 AM
>To: devel@edk2.groups.io
>Cc: Sean Brogan ; Gao, Liming
>
>Subject: [Patch] MdePkg: Add UefiFileHandleLib to DSC file
>
>From: Sean Brogan 
>
>https://bugzilla.tianocore.org/show_bug.cgi?id=2261
>
>Add the UefiFileHandleLib to the [Components] section of the
>MdePkg DSC file to support full build testing of the MdePkg.
>
>Cc: Michael D Kinney 
>Cc: Liming Gao 
>Signed-off-by: Michael D Kinney 
>---
> MdePkg/MdePkg.dsc | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
>index a2ff12fe75..c1278e7907 100644
>--- a/MdePkg/MdePkg.dsc
>+++ b/MdePkg/MdePkg.dsc
>@@ -27,6 +27,7 @@ [PcdsFixedAtBuild]
>   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xE000
>
> [Components]
>+  MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
>   MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
>   MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>   MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
>--
>2.21.0.windows.1


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

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



Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Do not call sys.setdefaultencoding with python 3

2019-10-20 Thread Bob Feng
Acked-by: Bob Feng 


-Original Message-
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Vitaly 
Cheptsov via Groups.Io
Sent: Sunday, October 20, 2019 6:26 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH v1 1/1] BaseTools: Do not call 
sys.setdefaultencoding with python 3

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

This interface was a originally a no-op in python 3, and now is fully removed 
causing a build warning on macOS (Darwin).

Signed-off-by: Vitaly Cheptsov >
---
 BaseTools/Source/Python/sitecustomize.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/sitecustomize.py 
b/BaseTools/Source/Python/sitecustomize.py
index 7dbbf8a232..50783e1b3a 100644
--- a/BaseTools/Source/Python/sitecustomize.py
+++ b/BaseTools/Source/Python/sitecustomize.py
@@ -7,7 +7,7 @@
 import sys
 import locale
 
-if sys.platform == "darwin":
+if sys.platform == "darwin" and sys.version_info[0] < 3:
   DefaultLocal = locale.getdefaultlocale()[1]
   if DefaultLocal is None:
 DefaultLocal = 'UTF8'
--
2.21.0 (Apple Git-122)


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

View/Reply Online (#49253): https://edk2.groups.io/g/devel/message/49253
Mute This Topic: https://groups.io/mt/35942396/1768742
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [bob.c.f...@intel.com]
-=-=-=-=-=-=


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

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



Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM

2019-10-20 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Agyeman,
> Prince
> Sent: Friday, October 18, 2019 8:02 AM
> To: devel@edk2.groups.io
> Cc: Sinha, Ankit ; Desimone, Nathaniel L
> ; Kubacki, Michael A
> 
> Subject: [edk2-devel] [edk2-platforms] [PATCH v3 2/4]
> KabylakeOpenBoardPkg: Add BIOS Info PEIM
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2210
> 
> Added BIOS Info PEIM to KabylakeRvp3 and GalagoPro3 to publish the BIOS
> info HOB. This PEIM currently publishes the board's microcode region
> information.
> 
> Cc: Ankit Sinha 
> Cc: Nate DeSimone 
> Cc: Kubacki Michael A 
> 
> Signed-off-by: Prince Agyeman 
> ---
>  .../KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c  | 93 +++
>  .../BiosInfo/BiosInfo.inf | 49 ++
>  .../GalagoPro3/OpenBoardPkg.dsc   |  1 +
>  .../GalagoPro3/OpenBoardPkg.fdf   |  1 +
>  .../KabylakeRvp3/OpenBoardPkg.dsc |  1 +
>  .../KabylakeRvp3/OpenBoardPkg.fdf |  1 +
>  6 files changed, 146 insertions(+)
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> 
> diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c
> b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c
> new file mode 100644
> index 00..578e66149e
> --- /dev/null
> +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c
> @@ -0,0 +1,93 @@
> +/** @file
> +  Driver for BIOS Info support.
> +
> +  Copyright (c) 2019, Intel Corporation. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define INDEXPORT_TO_ADDRESS(x) (x)
> +#define DATAPORT_TO_ADDRESS(x)  ((x) << 16)
> +#define PORTWIDTH_TO_ADDRESS(x) ((x) << 32)
> +#define PORTBITNUMBER_TO_ADDRESS(x) ((x) << 40)
> +#define PORTINDEXNUMBER_TO_ADDRESS(x)   ((x) << 48)
> +
> +//
> +// Internal
> +//
> +#pragma pack (1)
> +
> +typedef struct {
> +  BIOS_INFO_HEADER  Header;
> +  BIOS_INFO_STRUCT  Entry[1];
> +} BIOS_INFO;
> +#pragma pack ()
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
> +  {
> +BIOS_INFO_SIGNATURE,
> +1,
> +0,
> +  },
> +  {
> +{
> +  FIT_TYPE_01_MICROCODE,
> +  BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
> +  0x0100,
> +  FixedPcdGet32 (PcdFlashMicrocodeFvSize),
> +  FixedPcdGet32 (PcdFlashMicrocodeFvBase)
> +}
> +  }
> +};
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR
> mBiosInfoPpiList
> += {
> +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> +  ,
> +  
> +};
> +
> +/**
> +  Installs BiosInfo Ppi and builds BiosInfo HOB .
> +
> +  @param  FileHandle  Handle of the file being invoked.
> +  @param  PeiServices Describes the list of possible PEI Services.
> +
> +  @retval EFI_SUCCESS   Install the BiosInfo Ppi and HOB successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +BiosInfoEntryPoint (
> +  IN   EFI_PEI_FILE_HANDLE  FileHandle,
> +  IN CONST EFI_PEI_SERVICES **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status;
> +  VOID*HobData;
> +
> +  //
> +  // Install PPI, so that other PEI module can add dependency.
> +  //
> +  Status = PeiServicesInstallPpi ();  ASSERT_EFI_ERROR
> + (Status);
> +
> +  //
> +  // Build hob, so that DXE module can also get the data.
> +  //
> +  HobData = BuildGuidHob (, sizeof (mBiosInfo));  ASSERT
> + (HobData != NULL);  if (HobData == NULL) {
> +return EFI_OUT_OF_RESOURCES;
> +  }
> +  CopyMem (HobData, , sizeof (mBiosInfo));
> +
> +  return EFI_SUCCESS;
> +}
> diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> new file mode 100644
> index 00..e5e40144a6
> --- /dev/null
> +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> @@ -0,0 +1,49 @@
> +### @file
> +#  Module Information description file for BIOS Info Driver # #
> +Copyright (c) 2019, Intel Corporation. All rights reserved. #
> +SPDX-License-Identifier: BSD-2-Clause-Patent ###
> +
> +[Defines]
> +  INF_VERSION= 0x00010017
> +  BASE_NAME  = BiosInfo
> +  FILE_GUID  =
> C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
> +  VERSION_STRING = 1.0
> +  MODULE_TYPE= PEIM
> +  ENTRY_POINT= BiosInfoEntryPoint
> +#
> +# The following information is for reference only and not required by the
> build tools.
> +#
> +# VALID_ARCHITECTURES IA32 X64
> +#
> +
> +[LibraryClasses]
> +  PeimEntryPoint
> +  PeiServicesLib
> +  HobLib
> +  BaseMemoryLib
> +  DebugLib
> +  PcdLib
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  IntelSiliconPkg/IntelSiliconPkg.dec
> 

Re: [edk2-devel] [PATCH v4 0/2] Fix Aligned Page Allocation For XHCI

2019-10-20 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Ashish Singhal
> Sent: Wednesday, October 16, 2019 1:21 AM
> To: devel@edk2.groups.io; Wu, Hao A; Ni, Ray; jbra...@nvidia.com
> Cc: Ashish Singhal
> Subject: [edk2-devel] [PATCH v4 0/2] Fix Aligned Page Allocation For XHCI
> 
> This patch set is an attempt to fix the error where we allocate incorrectly
> aligned memory for XHCI PEI and DXE. The change for DXE phase has been
> verified
> already but change for PEI needs to be verified by Hao as I do not have a
> setup to be able to verify that.
> 
> The change in DXE just updates a parameter passed in to allocate aligned
> memory.
> The change in PEI adds a new function to allocate aligned memory. There was
> no
> need to add separate function to free aligned pages as unaligned pages have
> been
> already freed during allocation function and the aligned one can be freed
> using
> the existing function.
> 
> Ashish Singhal (2):
>   MdeModulePkg/XhciDxe: Fix Aligned Page Allocation
>   MdeModulePkg/XhciPei: Fix Aligned Page Allocation
> 
>  MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c |   2 +-
>  MdeModulePkg/Bus/Pci/XhciPei/DmaMem.c   | 128
> 
>  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c |  25 +--
>  MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.h  |  28 +++
>  4 files changed, 161 insertions(+), 22 deletions(-)


Thanks for resolving the issues.
Series pushed via commits 0f28c513d3..2bbbdeeea2.

Best Regards,
Hao Wu


> 
> --
> 2.7.4
> 
> 
> 


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

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



[edk2-devel] [PATCH] MdePkg/UefiFileHandleLib: Tolerate more Root handle FileNames

2019-10-20 Thread Marvin Häuser
From: Marvin Haeuser 

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

The current implementation of the FileHandleGetFileName() function
assumes that the Root directory always has the FileName '\0'.
However, the only requirement the UEFI specification defines is that
a prepended '\\' must be supported to access files and folders
relative to the Root directory.
This patch removes this assumption and supports constructing valid
paths for any value of FileName for the Root Directory.

In practice, this fixes compatibility issues with File System drivers
that report '\\' as the FileName of the Root directory, which
currently is both generating an invalid path ("") and resulting
in an EFI_NOT_FOUND result from the CurrentHandle->Open() call.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Marvin Haeuser 
---
 MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c | 25 ++--
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c 
b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
index 5dc893833a46..28e28e5f67d5 100644
--- a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
+++ b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
@@ -816,10 +816,25 @@ FileHandleGetFileName (
 Status = EFI_OUT_OF_RESOURCES;

 break;

   } else {

+//

+// Prepare to move to the parent directory.

+// Also determine whether CurrentHandle refers to the Root directory.

+//

+Status = CurrentHandle->Open (CurrentHandle, , L"..", 
EFI_FILE_MODE_READ, 0);

 //

 // We got info... do we have a name? if yes precede the current path 
with it...

 //

-if (StrLen (FileInfo->FileName) == 0) {

+if ((StrLen (FileInfo->FileName) == 0) || EFI_ERROR (Status)) {

+  //

+  // Both FileInfo->FileName being '\0' and EFI_ERROR() suggest that

+  // CurrentHandle refers to the Root directory.  As this loop ensures

+  // FullFileName is starting with '\\' at all times, signal success

+  // and exit the loop.

+  // While FileInfo->FileName could theoretically be a value other than

+  // '\0' or '\\', '\\' is guaranteed to be supported by the

+  // specification and hence its value can safely be ignored.

+  //

+  Status = EFI_SUCCESS;

   if (*FullFileName == NULL) {

 ASSERT((*FullFileName == NULL && Size == 0) || (*FullFileName != 
NULL));

 *FullFileName = StrnCatGrowLeft(FullFileName, , L"\\", 0);

@@ -837,15 +852,11 @@ FileHandleGetFileName (
   FreePool(FileInfo);

 }

   }

+

+  FileHandleClose(CurrentHandle);

   //

   // Move to the parent directory

   //

-  Status = CurrentHandle->Open (CurrentHandle, , L"..", 
EFI_FILE_MODE_READ, 0);

-  if (EFI_ERROR (Status)) {

-break;

-  }

-

-  FileHandleClose(CurrentHandle);

   CurrentHandle = NextHigherHandle;

 }

   } else if (Status == EFI_NOT_FOUND) {

-- 
2.23.0.windows.1


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

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



[edk2-devel] [PATCH] ShellPkg/Ls: Return empty content for all empty folders

2019-10-20 Thread Marvin Häuser
From: Marvin Haeuser 

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

Currently, when 'ls' is run on an entirely empty directory (this
includes not having '.' and '..'), the output is always 'File not
found'. For when not filtering its children, this patch rather
displays the usual header and footer.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Marvin Haeuser 
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 33 +---
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c 
b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index 1a65f60c3b44..da2b1acab47c 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -417,6 +417,8 @@ FileTimeToLocalTime (
   @param[in] Found  Set to TRUE, if anyone were found.

   @param[in] Count  The count of bits enabled in Attribs.

   @param[in] TimeZone   The current time zone offset.

+  @param[in] ListUnfiltered TRUE to request listing the directory contents

+unfiltered.

 

   @retval SHELL_SUCCESS the printing was sucessful.

 **/

@@ -429,7 +431,8 @@ PrintLsOutput(
   IN CONST CHAR16  *SearchString,

   IN   BOOLEAN *Found,

   IN CONST UINTN   Count,

-  IN CONST INT16   TimeZone

+  IN CONST INT16   TimeZone,

+  IN CONST BOOLEAN ListUnfiltered

   )

 {

   EFI_STATUSStatus;

@@ -555,7 +558,7 @@ PrintLsOutput(
   HeaderPrinted = TRUE;

 }

 

-if (!Sfo && ShellStatus != SHELL_ABORTED) {

+if (!Sfo && ShellStatus != SHELL_ABORTED && HeaderPrinted) {

   PrintNonSfoFooter(FileCount, FileSize, DirCount);

 }

   }

@@ -602,7 +605,8 @@ PrintLsOutput(
 SearchString,

 ,

 Count,

-TimeZone);

+TimeZone,

+FALSE);

 

   //

   // Since it's running recursively, we have to break immediately when 
returned SHELL_ABORTED

@@ -619,7 +623,21 @@ PrintLsOutput(
   ShellCloseFileMetaArg();

 

   if (Found == NULL && !FoundOne) {

-return (SHELL_NOT_FOUND);

+if (ListUnfiltered) {

+  //

+  // When running "ls" without any filtering request, avoid outputing

+  // "File not found" when the directory is entirely empty, but print

+  // header and footer stating "0 File(s), 0 Dir(s)".

+  //

+  if (!Sfo) {

+PrintNonSfoHeader (RootPath);

+if (ShellStatus != SHELL_ABORTED) {

+  PrintNonSfoFooter (FileCount, FileSize, DirCount);

+}

+  }

+} else {

+  return (SHELL_NOT_FOUND);

+}

   }

 

   if (Found != NULL) {

@@ -662,6 +680,7 @@ ShellCommandRunLs (
   UINTN Size;

   EFI_TIME  TheTime;

   CHAR16*SearchString;

+  BOOLEAN   ListUnfiltered;

 

   Size= 0;

   FullPath= NULL;

@@ -673,6 +692,7 @@ ShellCommandRunLs (
   SearchString= NULL;

   CurDir  = NULL;

   Count   = 0;

+  ListUnfiltered  = FALSE;

 

   //

   // initialize the shell lib (we must be in non-auto-init...)

@@ -768,6 +788,7 @@ ShellCommandRunLs (
 ShellStatus = SHELL_NOT_FOUND;

 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), 
gShellLevel2HiiHandle, L"ls");

   }

+  ListUnfiltered = TRUE;

   //

   // Copy to the 2 strings for starting path and file search string

   //

@@ -808,6 +829,7 @@ ShellCommandRunLs (
   //

   // is listing ends with a directory, then we list all files in 
that directory

   //

+  ListUnfiltered = TRUE;

   StrnCatGrow(, NULL, L"*", 0);

 } else {

   //

@@ -839,7 +861,8 @@ ShellCommandRunLs (
 SearchString,

 NULL,

 Count,

-TheTime.TimeZone

+TheTime.TimeZone,

+ListUnfiltered

);

   if (ShellStatus == SHELL_NOT_FOUND) {

 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN 
(STR_LS_FILE_NOT_FOUND), gShellLevel2HiiHandle, L"ls", FullPath);

-- 
2.23.0.windows.1


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

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



[edk2-devel] [PATCH] MdePkg/UefiDebugLibConOut: Pass the correct buffer size

2019-10-20 Thread Marvin Häuser
From: Marvin Haeuser 

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

The second argument of "UnicodeVSPrintAsciiFormat" is "BufferSize",
which takes the size of the buffer in bytes. Replace the currently
used MAX_DEBUG_MESSAGE_LENGTH usage, which is the buffer's length,
with the actual buffer size.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Marvin Haeuser 
---
 MdePkg/Library/UefiDebugLibConOut/DebugLib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c 
b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
index cf168d05cf21..8ea38ea7cc7c 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
@@ -104,9 +104,9 @@ DebugPrintMarker (
 // Convert the DEBUG() message to a Unicode String

 //

 if (BaseListMarker == NULL) {

-  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
VaListMarker);

+  UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, 
VaListMarker);

 } else {

-  UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
BaseListMarker);

+  UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, 
BaseListMarker);

 }

 

 

-- 
2.23.0.windows.1


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

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



[edk2-devel] [PATCH] ShellPkg/Ls: Consider UEFI timezone may not be set

2019-10-20 Thread Marvin Häuser
From: Marvin Haeuser 

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

EFI_RUNTIME_SERVICES.GetTime() might return an unspecified Timezone,
such as when SetTime() has not been called after the RTC was cut off
power. Consider this case by not attempting Timezone translations for
when it is invalid.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Marvin Haeuser 
---
 ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c 
b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index adeb987e6ecb..1a65f60c3b44 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -500,7 +500,7 @@ PrintLsOutput(
   // Change the file time to local time.

   //

   Status = gRT->GetTime(, NULL);

-  if (!EFI_ERROR (Status)) {

+  if (!EFI_ERROR (Status) && (LocalTime.TimeZone != 
EFI_UNSPECIFIED_TIMEZONE)) {

 if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&

 (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month 
<= 12)) {

   //

-- 
2.23.0.windows.1


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

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



[edk2-devel] [PATCH] UefiShellCommandLib: Default to first found UC for unsupported PlatformLang

2019-10-20 Thread Marvin Häuser
From: Marvin Haeuser 

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

On some firmwares PlatformLang is set to the local language (e.g. ru-RU),
however there is no Unicode Collation protocol instance that supports it.
As for missing PlatformLang, fall back to the first found instance.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: Marvin Haeuser 
---
 ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c 
b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index 4c48b65fbc1d..345808a1eac6 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -107,9 +107,13 @@ CommandInit(
 

   //

   // Without clue provided use the first Unicode Collation2 protocol.

+  // This may happen when PlatformLang is NULL or when no installed Unicode

+  // Collation2 protocol instance supports PlatformLang.

   //

-  if (PlatformLang == NULL) {

+  if (gUnicodeCollation == NULL) {

 gUnicodeCollation = Uc;

+  }

+  if (PlatformLang == NULL) {

 break;

   }

 

-- 
2.23.0.windows.1


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

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



[edk2-devel] [PATCH] MdePkg/UefiFileHandleLib: Fix potential NULL dereference

2019-10-20 Thread Marvin Häuser
From: Marvin Haeuser 

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

Move the NULL check in FileHandleGetInfo() to directly after the
allocation to prevent potential NULL dereferences.

Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Marvin Haeuser 
---
 MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c 
b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
index 96913c5c02b8..5dc893833a46 100644
--- a/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
+++ b/MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
@@ -68,19 +68,21 @@ FileHandleGetInfo (
 // error is expected.  getting size to allocate

 //

 FileInfo = AllocateZeroPool(FileInfoSize);

-//

-// now get the information

-//

-Status = FileHandle->GetInfo(FileHandle,

- ,

- ,

- FileInfo);

-//

-// if we got an error free the memory and return NULL

-//

-if (EFI_ERROR(Status) && (FileInfo != NULL)) {

-  FreePool(FileInfo);

-  FileInfo = NULL;

+if (FileInfo != NULL) {

+  //

+  // now get the information

+  //

+  Status = FileHandle->GetInfo(FileHandle,

+   ,

+   ,

+   FileInfo);

+  //

+  // if we got an error free the memory and return NULL

+  //

+  if (EFI_ERROR(Status)) {

+FreePool(FileInfo);

+FileInfo = NULL;

+  }

 }

   }

   return (FileInfo);

-- 
2.23.0.windows.1


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

View/Reply Online (#49256): https://edk2.groups.io/g/devel/message/49256
Mute This Topic: https://groups.io/mt/35954827/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] MdePkg: Add PCD to disable safe string constraint assertions

2019-10-20 Thread Vitaly Cheptsov via Groups.Io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054

Requesting for merge in edk2-stable2019011.

Vitaly Cheptsov (1):
  MdePkg: Add PCD to disable safe string constraint assertions

 MdePkg/MdePkg.dec   |  6 ++
 MdePkg/Library/BaseLib/BaseLib.inf  | 11 ++-
 MdePkg/Library/BaseLib/SafeString.c |  4 +++-
 MdePkg/MdePkg.uni   |  6 ++
 4 files changed, 21 insertions(+), 6 deletions(-)

-- 
2.21.0 (Apple Git-122)


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

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



signature.asc
Description: OpenPGP digital signature


[edk2-devel] [PATCH v1 1/1] MdePkg: Add PCD to disable safe string constraint assertions

2019-10-20 Thread Vitaly Cheptsov via Groups.Io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054

Runtime data checks are not meant to cause debug assertions
unless explicitly needed by some debug code (thus the PCD)
as this breaks debug builds validating data with BaseLib.

Signed-off-by: Vitaly Cheptsov >
---
 MdePkg/MdePkg.dec   |  6 ++
 MdePkg/Library/BaseLib/BaseLib.inf  | 11 ++-
 MdePkg/Library/BaseLib/SafeString.c |  4 +++-
 MdePkg/MdePkg.uni   |  6 ++
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 3fd7d1634c..dda2cdf401 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2221,6 +2221,12 @@ [PcdsFixedAtBuild,PcdsPatchableInModule]
   # @Prompt Memory Address of GuidedExtractHandler Table.
   
gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x100|UINT64|0x30001015
 
+  ## Indicates if safe string constraint violation should assert.
+  #   TRUE  - Safe string constraint violation causes assertion.
+  #   FALSE - Safe string constraint violation does not cause assertion.
+  # @Prompt Enable safe string constraint violation assertions.
+  
gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints|FALSE|BOOLEAN|0x002e
+
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   ## This value is used to set the base address of PCI express hierarchy.
   # @Prompt PCI Express Base Address.
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index 3586beb0ab..bc98bc6134 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -390,11 +390,12 @@ [LibraryClasses]
   BaseMemoryLib
 
 [Pcd]
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength  ## 
SOMETIMES_CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength ## 
SOMETIMES_CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength   ## 
SOMETIMES_CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask   ## 
SOMETIMES_CONSUMES
-  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType   ## 
SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdAssertOnSafeStringConstraints   ## 
SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength ## 
SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength## 
SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength  ## 
SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask  ## 
SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType  ## 
SOMETIMES_CONSUMES
 
 [FeaturePcd]
   gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
diff --git a/MdePkg/Library/BaseLib/SafeString.c 
b/MdePkg/Library/BaseLib/SafeString.c
index 7dc03d2caa..56b5e34a8d 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -14,7 +14,9 @@
 
 #define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status)  \
   do { \
-ASSERT (Expression); \
+if (PcdGetBool (PcdAssertOnSafeStringConstraints)) { \
+  ASSERT (Expression); \
+} \
 if (!(Expression)) { \
   return Status; \
 } \
diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
index 5c1fa24065..425b66bb43 100644
--- a/MdePkg/MdePkg.uni
+++ b/MdePkg/MdePkg.uni
@@ -287,6 +287,12 @@
 
 #string STR_gEfiMdePkgTokenSpaceGuid_PcdGuidedExtractHandlerTableAddress_HELP  
#language en-US "This value is used to set the available memory address to 
store Guided Extract Handlers. The required memory space is decided by the 
value of PcdMaximumGuidedExtractHandler."
 
+#string STR_gEfiMdePkgTokenSpaceGuid_PcdAssertOnSafeStringConstraints_PROMPT  
#language en-US "Enable safe string constraint violation assertions"
+
+#string STR_gEfiMdePkgTokenSpaceGuid_PcdAssertOnSafeStringConstraints_HELP  
#language en-US "Indicates if safe string constraint violation should 
assert.\n"
+   
"TRUE  - Safe string constraint violation causes assertion.\n"
+   
"FALSE - Safe string constraint violation does not cause assertion."
+
 #string STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_PROMPT  
#language en-US "PCI Express Base Address"
 
 #string STR_gEfiMdePkgTokenSpaceGuid_PcdPciExpressBaseAddress_HELP  #language 
en-US "This value is used to set the base address of PCI express hierarchy."
-- 
2.21.0 (Apple Git-122)


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

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



signature.asc
Description: OpenPGP digital signature


Re: [edk2-devel] [PATCH] WinHost: Add SimplePointer support

2019-10-20 Thread Marvin Häuser
Good day,

Thank you for your review. I have not seen this patch pushed yet, could 
you please update me with the status?

Thanks,
Marvin
> Reviewed-by: Ray Ni 
>
>> -Original Message-
>> From: Marvin Häuser 
>> Sent: Thursday, September 26, 2019 9:38 AM
>> To: Ni, Ray ; Marvin Häuser ; 
>> devel@edk2.groups.io
>> Cc: Justen, Jordan L ; Andrew Fish 
>> 
>> Subject: Re: [PATCH] WinHost: Add SimplePointer support
>>
>> Good day,
>>
>> I have tested cursor movement (including initial window entry)
>> extensively and left mouse button functionality. As the right mouse
>> button works analoguously, I expect it to work. This was all from the
>> GetState() function of the SP protocol.
>>
>> Thanks,
>> Marvin
>>
>> Am 26.09.2019 um 00:32 schrieb Ni, Ray:
>>> Marvin,
>>> Can you kindly share what unit test you've done?
>>>
 -Original Message-
 From: Marvin Häuser 
 Sent: Tuesday, September 24, 2019 5:46 AM
 To: devel@edk2.groups.io
 Cc: Justen, Jordan L ; Andrew Fish 
 ; Ni, Ray 
 Subject: [PATCH] WinHost: Add SimplePointer support

 From: Marvin Haeuser 

 Catch WM mouse events and expose them via the SimplePointer protocol.

 Cc: Jordan Justen 
 Cc: Andrew Fish 
 Cc: Ray Ni 
 Signed-off-by: Marvin Haeuser 
 ---
EmulatorPkg/Win/Host/WinGopInput.c  | 25 ++--
EmulatorPkg/Win/Host/WinGopScreen.c | 41 
EmulatorPkg/Win/Host/WinGop.h   |  5 +++
EmulatorPkg/Win/Host/WinInclude.h   |  1 +
4 files changed, 69 insertions(+), 3 deletions(-)

 diff --git a/EmulatorPkg/Win/Host/WinGopInput.c 
 b/EmulatorPkg/Win/Host/WinGopInput.c
 index 0e8d11fc57ac..312a549847c5 100644
 --- a/EmulatorPkg/Win/Host/WinGopInput.c
 +++ b/EmulatorPkg/Win/Host/WinGopInput.c
 @@ -409,9 +409,12 @@ WinNtWndCheckPointer (


  Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);



 -  return EFI_NOT_READY;

 -}

 +  if (!Private->PointerStateChanged) {

 +return EFI_NOT_READY;

 +  }



 +  return EFI_SUCCESS;

 +}



EFI_STATUS

EFIAPI

 @@ -424,5 +427,21 @@ WinNtWndGetPointerState (


  Private = GRAPHICS_PRIVATE_DATA_FROM_THIS (GraphicsIo);



 -  return EFI_NOT_READY;

 +  if (!Private->PointerStateChanged) {

 +return EFI_NOT_READY;

 +  }

 +

 +  State->RelativeMovementX = Private->PointerState.RelativeMovementX;

 +  State->RelativeMovementY = Private->PointerState.RelativeMovementY;

 +  State->RelativeMovementZ = Private->PointerState.RelativeMovementZ;

 +  State->LeftButton= Private->PointerState.LeftButton;

 +  State->RightButton   = Private->PointerState.RightButton;

 +

 +  Private->PointerState.RelativeMovementX = 0;

 +  Private->PointerState.RelativeMovementY = 0;

 +  Private->PointerState.RelativeMovementZ = 0;

 +

 +  Private->PointerStateChanged = FALSE;

 +

 +  return EFI_SUCCESS;

}

 diff --git a/EmulatorPkg/Win/Host/WinGopScreen.c 
 b/EmulatorPkg/Win/Host/WinGopScreen.c
 index 8f42606823f1..fa34596497f8 100644
 --- a/EmulatorPkg/Win/Host/WinGopScreen.c
 +++ b/EmulatorPkg/Win/Host/WinGopScreen.c
 @@ -399,6 +399,8 @@ WinNtGopThreadWindowProc (
  LPARAMIndex;

  EFI_INPUT_KEY Key;

  BOOLEAN   AltIsPress;

 +  INT32 PosX;

 +  INT32 PosY;



  //

  // Use mTlsIndex global to get a Thread Local Storage version of 
 Private.

 @@ -527,6 +529,45 @@ WinNtGopThreadWindowProc (
WinNtGopConvertParamToEfiKeyShiftState (Private, , , 
 FALSE);

return 0;



 +  case WM_MOUSEMOVE:

 +PosX = GET_X_LPARAM (lParam);

 +PosY = GET_Y_LPARAM (lParam);

 +

 +if (Private->PointerPreviousX != PosX) {

 +  Private->PointerState.RelativeMovementX += (PosX - 
 Private->PointerPreviousX);

 +  Private->PointerPreviousX= PosX;

 +  Private->PointerStateChanged = TRUE;

 +}

 +

 +if (Private->PointerPreviousY != PosY) {

 +  Private->PointerState.RelativeMovementY += (PosY - 
 Private->PointerPreviousY);

 +  Private->PointerPreviousY= PosY;

 +  Private->PointerStateChanged = TRUE;

 +}

 +

 +Private->PointerState.RelativeMovementZ  = 0;

 +return 0;

 +

 +  case WM_LBUTTONDOWN:

 +Private->PointerState.LeftButton = TRUE;