[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/VariablePolicyLib: Remove status checking

2023-02-20 Thread wenyi,xie via groups.io
Main Changes :
1.Removing status checking as the status is always EFI_SUCCESS.

Wenyi Xie (1):
  MdeModulePkg/VariablePolicyLib: Remove status checking

 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100392): https://edk2.groups.io/g/devel/message/100392
Mute This Topic: https://groups.io/mt/97100306/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/VariablePolicyLib: Remove status checking

2023-02-20 Thread wenyi,xie via groups.io
Removing status checking as the status is always EFI_SUCCESS.
No functional change.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Hao A Wu 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c 
b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c
index 82dae67ef50f..fbc192c6ab26 100644
--- a/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c
+++ b/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.c
@@ -782,9 +782,7 @@ InitVariablePolicyLib (
 return EFI_ALREADY_STARTED;
   }
 
-  if (!EFI_ERROR (Status)) {
-Status = VariablePolicyExtraInit ();
-  }
+  Status = VariablePolicyExtraInit ();
 
   if (!EFI_ERROR (Status)) {
 // Save an internal pointer to the GetVariableHelper.
@@ -841,9 +839,7 @@ DeinitVariablePolicyLib (
 return EFI_NOT_READY;
   }
 
-  if (!EFI_ERROR (Status)) {
-Status = VariablePolicyExtraDeinit ();
-  }
+  Status = VariablePolicyExtraDeinit ();
 
   if (!EFI_ERROR (Status)) {
 mGetVariableHelper  = NULL;
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#100391): https://edk2.groups.io/g/devel/message/100391
Mute This Topic: https://groups.io/mt/97100305/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] NetworkPkg/Ip4Dxe:Null-checking before dereference

2023-01-28 Thread wenyi,xie via groups.io
Main Changes :
1.Null-checking first before a pointer is dereferenced.

Wenyi Xie (1):
  NetworkPkg/Ip4Dxe:Null-checking before dereference

 NetworkPkg/Ip4Dxe/Ip4Config2Nv.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99246): https://edk2.groups.io/g/devel/message/99246
Mute This Topic: https://groups.io/mt/96598977/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] NetworkPkg/Ip4Dxe:Null-checking before dereference

2023-01-28 Thread wenyi,xie via groups.io
Null-checking first before a pointer is dereferenced.

Cc: Maciej Rabeda 
Cc: Siyuan Fu 
Signed-off-by: Wenyi Xie 
---
 NetworkPkg/Ip4Dxe/Ip4Config2Nv.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
index e0b6a4d4a92f..b96e11bdabba 100644
--- a/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
+++ b/NetworkPkg/Ip4Dxe/Ip4Config2Nv.c
@@ -397,16 +397,16 @@ Ip4Config2ConvertConfigNvDataToIfrNvData (
   UINTN   DnsCount;
   EFI_IPv4_ADDRESS*DnsAddress;
 
+  if ((IfrNvData == NULL) || (Instance == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+
   Status  = EFI_SUCCESS;
   Ip4Config2  = >Ip4Config2;
   Ip4Info = NULL;
   DnsAddress  = NULL;
   GatewaySize = sizeof (EFI_IPv4_ADDRESS);
 
-  if ((IfrNvData == NULL) || (Instance == NULL)) {
-return EFI_INVALID_PARAMETER;
-  }
-
   NET_CHECK_SIGNATURE (Instance, IP4_CONFIG2_INSTANCE_SIGNATURE);
 
   IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
@@ -571,6 +571,10 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
   UINTN  DataSize;
   EFI_INPUT_KEY  Key;
 
+  if ((Instance == NULL) || (IfrFormNvData == NULL)) {
+return EFI_INVALID_PARAMETER;
+  }
+
   Status= EFI_SUCCESS;
   Ip4Cfg2   = >Ip4Config2;
   Ip4NvData = >Ip4NvData;
@@ -581,10 +585,6 @@ Ip4Config2ConvertIfrNvDataToConfigNvData (
   TimeoutEvent= NULL;
   SetAddressEvent = NULL;
 
-  if ((Instance == NULL) || (IfrFormNvData == NULL)) {
-return EFI_INVALID_PARAMETER;
-  }
-
   if (IfrFormNvData->Configure != TRUE) {
 return EFI_SUCCESS;
   }
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99247): https://edk2.groups.io/g/devel/message/99247
Mute This Topic: https://groups.io/mt/96598978/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-12-16 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.fix format issue found by Uncrustify 

Wenyi Xie (1):
  MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++
 1 file changed, 6 insertions(+)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97500): https://edk2.groups.io/g/devel/message/97500
Mute This Topic: https://groups.io/mt/95706956/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-12-16 Thread wenyi,xie via groups.io
When BitPerPixel is 1,4,8, there should be a color map in bmp file. But if
the format of bmp file is error, it maybe has no color map when BitPerPixel
is 1,4,8. The condition checking now can not catch this issue.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c 
b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index c5e885d7a6d5..1cdd857f48f8 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -236,6 +236,12 @@ TranslateBmpToGopBlt (
 return RETURN_UNSUPPORTED;
   }
 
+  if ((BmpHeader->ImageOffset == sizeof (BMP_IMAGE_HEADER)) &&
+  ((BmpHeader->BitPerPixel & 0x0D) != 0))
+  {
+return RETURN_UNSUPPORTED;
+  }
+
   if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
 switch (BmpHeader->BitPerPixel) {
   case 1:
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97501): https://edk2.groups.io/g/devel/message/97501
Mute This Topic: https://groups.io/mt/95706957/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 0/1] CryptoPkg/BaseCryptLib:time overflow

2022-12-01 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.fix code format 

Zihong Yi (1):
  CryptoPkg/BaseCryptLib:time overflow

 CryptoPkg/Library/Include/CrtLibSupport.h |  2 +-
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 51 ++--
 2 files changed, 38 insertions(+), 15 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96883): https://edk2.groups.io/g/devel/message/96883
Mute This Topic: https://groups.io/mt/95400942/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 1/1] CryptoPkg/BaseCryptLib:time overflow

2022-12-01 Thread wenyi,xie via groups.io
From: Zihong Yi 

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

In CrtLibSupport.h, time_t is defined as INT32, and its maximum value
is 2147483647. That is, the corresponding maximum timestamp is
2038-01-19 11:14:07. Therefore, overflow occurs when the test time
exceeds 2038-01-19 11:14:07. So change the type of time_t to INT64 and
also change the type of variables in function gmtime which calculated
with time_t.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Signed-off-by: Zihong Yi 
---
 CryptoPkg/Library/Include/CrtLibSupport.h |  2 +-
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 51 ++--
 2 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h 
b/CryptoPkg/Library/Include/CrtLibSupport.h
index 5072c343da57..94b0e6b6014f 100644
--- a/CryptoPkg/Library/Include/CrtLibSupport.h
+++ b/CryptoPkg/Library/Include/CrtLibSupport.h
@@ -109,7 +109,7 @@ typedef UINTN   off_t;
 typedef UINTN   u_int;
 typedef INTNptrdiff_t;
 typedef INTNssize_t;
-typedef INT32   time_t;
+typedef INT64   time_t;
 typedef UINT8   __uint8_t;
 typedef UINT8   sa_family_t;
 typedef UINT8   u_char;
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
index bf8a5325817f..2dfc6fe6c593 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
@@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // -- Time Management Routines --
 //
 
-#define IsLeap(y)  (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
 #define SECSPERMIN   (60)
 #define SECSPERHOUR  (60 * 60)
 #define SECSPERDAY   (24 * SECSPERHOUR)
@@ -60,6 +59,26 @@ UINTN  CumulativeDays[2][14] = {
   }
 };
 
+/* Check the year is leap or not. */
+// BOOLEAN IsLeap(
+//  INTN timer
+//  )
+BOOLEAN
+IsLeap (
+  time_t  timer
+  )
+{
+  INT64  Remainder1;
+  INT64  Remainder2;
+  INT64  Remainder3;
+
+  DivS64x64Remainder (timer, 4, );
+  DivS64x64Remainder (timer, 100, );
+  DivS64x64Remainder (timer, 400, );
+
+  return (Remainder1 == 0 && (Remainder2 != 0 || Remainder3 == 0));
+}
+
 /* Get the system time as seconds elapsed since midnight, January 1, 1970. */
 // INTN time(
 //  INTN *timer
@@ -117,12 +136,13 @@ gmtime (
   )
 {
   struct tm  *GmTime;
-  UINT16 DayNo;
-  UINT32 DayRemainder;
+  UINT64 DayNo;
+  UINT64 DayRemainder;
   time_t Year;
   time_t YearNo;
-  UINT16 TotalDays;
-  UINT16 MonthNo;
+  UINT32 TotalDays;
+  UINT32 MonthNo;
+  INT64  Remainder;
 
   if (timer == NULL) {
 return NULL;
@@ -135,18 +155,21 @@ gmtime (
 
   ZeroMem ((VOID *)GmTime, (UINTN)sizeof (struct tm));
 
-  DayNo= (UINT16)(*timer / SECSPERDAY);
-  DayRemainder = (UINT32)(*timer % SECSPERDAY);
+  DayNo= (UINT64)DivS64x64Remainder (*timer, SECSPERDAY, );
+  DayRemainder = (UINT64)Remainder;
 
-  GmTime->tm_sec  = (int)(DayRemainder % SECSPERMIN);
-  GmTime->tm_min  = (int)((DayRemainder % SECSPERHOUR) / SECSPERMIN);
-  GmTime->tm_hour = (int)(DayRemainder / SECSPERHOUR);
-  GmTime->tm_wday = (int)((DayNo + 4) % 7);
+  DivS64x64Remainder (DayRemainder, SECSPERMIN, );
+  GmTime->tm_sec = (int)Remainder;
+  DivS64x64Remainder (DayRemainder, SECSPERHOUR, );
+  GmTime->tm_min  = (int)DivS64x64Remainder (Remainder, SECSPERMIN, NULL);
+  GmTime->tm_hour = (int)DivS64x64Remainder (DayRemainder, SECSPERHOUR, NULL);
+  DivS64x64Remainder ((DayNo + 4), 7, );
+  GmTime->tm_wday = (int)Remainder;
 
   for (Year = 1970, YearNo = 0; DayNo > 0; Year++) {
-TotalDays = (UINT16)(IsLeap (Year) ? 366 : 365);
+TotalDays = (UINT32)(IsLeap (Year) ? 366 : 365);
 if (DayNo >= TotalDays) {
-  DayNo = (UINT16)(DayNo - TotalDays);
+  DayNo = (UINT64)(DayNo - TotalDays);
   YearNo++;
 } else {
   break;
@@ -158,7 +181,7 @@ gmtime (
 
   for (MonthNo = 12; MonthNo > 1; MonthNo--) {
 if (DayNo >= CumulativeDays[IsLeap (Year)][MonthNo]) {
-  DayNo = (UINT16)(DayNo - (UINT16)(CumulativeDays[IsLeap 
(Year)][MonthNo]));
+  DayNo = (UINT64)(DayNo - (UINT32)(CumulativeDays[IsLeap 
(Year)][MonthNo]));
   break;
 }
   }
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96884): https://edk2.groups.io/g/devel/message/96884
Mute This Topic: https://groups.io/mt/95400943/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 v1 1/1] CryptoPkg/BaseCryptLib:time overflow

2022-12-01 Thread wenyi,xie via groups.io



On 2022/12/1 16:34, Yao, Jiewen wrote:
> Thank you!
> 
> Would you please share what test you have run for this patch, such as UEFI 
> secure boot? HTTPS boot?
> 
Hi, Jiewen

We found this problem when importing certification and verifying the expiration 
date(the verifying code is customed), so we only using a X64 board to do the 
test like below:
1. Entering setup page
2. Setting system time to 2038.9.27 19:23
3. Importing a X509 certification, which is valid from 2022.9.27 1:59 to 
2023.9.27 1:59

before merging the patch
the certification can be imported successfully.

after merging the patch
importing failed.
> 
> 
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of
>> wenyi,xie via groups.io
>> Sent: Friday, November 25, 2022 5:12 PM
>> To: devel@edk2.groups.io; Yao, Jiewen ; Wang, Jian
>> J ; Lu, Xiaoyu1 ; Jiang,
>> Guomin 
>> Cc: songdongku...@huawei.com; xiewen...@huawei.com;
>> yizih...@huawei.com
>> Subject: [edk2-devel] [PATCH EDK2 v1 1/1] CryptoPkg/BaseCryptLib:time
>> overflow
>>
>> From: Zihong Yi 
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4167
>>
>> In CrtLibSupport.h, time_t is defined as INT32, and its maximum value
>> is 2147483647. That is, the corresponding maximum timestamp is
>> 2038-01-19 11:14:07. Therefore, overflow occurs when the test time
>> exceeds 2038-01-19 11:14:07. So change the type of time_t to INT64 and
>> also change the type of variables in function gmtime which calculated
>> with time_t.
>>
>> Cc: Jiewen Yao 
>> Cc: Jian J Wang 
>> Cc: Xiaoyu Lu 
>> Cc: Guomin Jiang 
>> Signed-off-by: Zihong Yi 
>> ---
>>  CryptoPkg/Library/Include/CrtLibSupport.h |  2 +-
>>  CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 51
>> ++--
>>  2 files changed, 38 insertions(+), 15 deletions(-)
>>
>> diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h
>> b/CryptoPkg/Library/Include/CrtLibSupport.h
>> index 5072c343da57..94b0e6b6014f 100644
>> --- a/CryptoPkg/Library/Include/CrtLibSupport.h
>> +++ b/CryptoPkg/Library/Include/CrtLibSupport.h
>> @@ -109,7 +109,7 @@ typedef UINTN   off_t;
>>  typedef UINTN   u_int;
>>  typedef INTNptrdiff_t;
>>  typedef INTNssize_t;
>> -typedef INT32   time_t;
>> +typedef INT64   time_t;
>>  typedef UINT8   __uint8_t;
>>  typedef UINT8   sa_family_t;
>>  typedef UINT8   u_char;
>> diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
>> b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
>> index bf8a5325817f..3ed64375d0ff 100644
>> --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
>> +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
>> @@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>>  // -- Time Management Routines --
>>  //
>>
>> -#define IsLeap(y)  (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 
>> 0))
>>  #define SECSPERMIN   (60)
>>  #define SECSPERHOUR  (60 * 60)
>>  #define SECSPERDAY   (24 * SECSPERHOUR)
>> @@ -60,6 +59,26 @@ UINTN  CumulativeDays[2][14] = {
>>}
>>  };
>>
>> +/* Check the year is leap or not. */
>> +// BOOLEAN IsLeap(
>> +//  INTN timer
>> +//  )
>> +BOOLEAN
>> +IsLeap (
>> +  time_t  timer
>> +  )
>> +{
>> +  INT64  Remainder1;
>> +  INT64  Remainder2;
>> +  INT64  Remainder3;
>> +
>> +  DivS64x64Remainder (timer, 4, );
>> +  DivS64x64Remainder (timer, 100, );
>> +  DivS64x64Remainder (timer, 400, );
>> +
>> +  return (Remainder1 == 0 && (Remainder2 != 0 || Remainder3 == 0));
>> +}
>> +
>>  /* Get the system time as seconds elapsed since midnight, January 1, 1970.
>> */
>>  // INTN time(
>>  //  INTN *timer
>> @@ -117,12 +136,13 @@ gmtime (
>>)
>>  {
>>struct tm  *GmTime;
>> -  UINT16 DayNo;
>> -  UINT32 DayRemainder;
>> +  UINT64 DayNo;
>> +  UINT64 DayRemainder;
>>time_t Year;
>>time_t YearNo;
>> -  UINT16 TotalDays;
>> -  UINT16 MonthNo;
>> +  UINT32 TotalDays;
>> +  UINT32 MonthNo;
>> +  INT64  Remainder;
>>
>>if (timer == NULL) {
>>  return NULL;
>> @@ -135,18 +155,21 @@ gmtime (
>>
>>ZeroMem ((VOID *)GmTime, (UINTN)sizeof (struct tm));
>>
>> -  DayNo= (UINT16)(*timer / SECSPERDAY);
>> -  DayRemainder = (UINT32)(*timer % SECSPERDAY);
>> +  DayNo= (UINT64)DivS64

[edk2-devel] [PATCH EDK2 v1 1/1] CryptoPkg/BaseCryptLib:time overflow

2022-11-25 Thread wenyi,xie via groups.io
From: Zihong Yi 

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

In CrtLibSupport.h, time_t is defined as INT32, and its maximum value
is 2147483647. That is, the corresponding maximum timestamp is
2038-01-19 11:14:07. Therefore, overflow occurs when the test time
exceeds 2038-01-19 11:14:07. So change the type of time_t to INT64 and
also change the type of variables in function gmtime which calculated
with time_t.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Signed-off-by: Zihong Yi 
---
 CryptoPkg/Library/Include/CrtLibSupport.h |  2 +-
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 51 ++--
 2 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h 
b/CryptoPkg/Library/Include/CrtLibSupport.h
index 5072c343da57..94b0e6b6014f 100644
--- a/CryptoPkg/Library/Include/CrtLibSupport.h
+++ b/CryptoPkg/Library/Include/CrtLibSupport.h
@@ -109,7 +109,7 @@ typedef UINTN   off_t;
 typedef UINTN   u_int;
 typedef INTNptrdiff_t;
 typedef INTNssize_t;
-typedef INT32   time_t;
+typedef INT64   time_t;
 typedef UINT8   __uint8_t;
 typedef UINT8   sa_family_t;
 typedef UINT8   u_char;
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
index bf8a5325817f..3ed64375d0ff 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
@@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // -- Time Management Routines --
 //
 
-#define IsLeap(y)  (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
 #define SECSPERMIN   (60)
 #define SECSPERHOUR  (60 * 60)
 #define SECSPERDAY   (24 * SECSPERHOUR)
@@ -60,6 +59,26 @@ UINTN  CumulativeDays[2][14] = {
   }
 };
 
+/* Check the year is leap or not. */
+// BOOLEAN IsLeap(
+//  INTN timer
+//  )
+BOOLEAN
+IsLeap (
+  time_t  timer
+  )
+{
+  INT64  Remainder1;
+  INT64  Remainder2;
+  INT64  Remainder3;
+
+  DivS64x64Remainder (timer, 4, );
+  DivS64x64Remainder (timer, 100, );
+  DivS64x64Remainder (timer, 400, );
+
+  return (Remainder1 == 0 && (Remainder2 != 0 || Remainder3 == 0));
+}
+
 /* Get the system time as seconds elapsed since midnight, January 1, 1970. */
 // INTN time(
 //  INTN *timer
@@ -117,12 +136,13 @@ gmtime (
   )
 {
   struct tm  *GmTime;
-  UINT16 DayNo;
-  UINT32 DayRemainder;
+  UINT64 DayNo;
+  UINT64 DayRemainder;
   time_t Year;
   time_t YearNo;
-  UINT16 TotalDays;
-  UINT16 MonthNo;
+  UINT32 TotalDays;
+  UINT32 MonthNo;
+  INT64  Remainder;
 
   if (timer == NULL) {
 return NULL;
@@ -135,18 +155,21 @@ gmtime (
 
   ZeroMem ((VOID *)GmTime, (UINTN)sizeof (struct tm));
 
-  DayNo= (UINT16)(*timer / SECSPERDAY);
-  DayRemainder = (UINT32)(*timer % SECSPERDAY);
+  DayNo= (UINT64)DivS64x64Remainder (*timer, SECSPERDAY, );
+  DayRemainder = (UINT64)Remainder;
 
-  GmTime->tm_sec  = (int)(DayRemainder % SECSPERMIN);
-  GmTime->tm_min  = (int)((DayRemainder % SECSPERHOUR) / SECSPERMIN);
-  GmTime->tm_hour = (int)(DayRemainder / SECSPERHOUR);
-  GmTime->tm_wday = (int)((DayNo + 4) % 7);
+  DivS64x64Remainder (DayRemainder, SECSPERMIN, );
+  GmTime->tm_sec  = (int)Remainder;
+  DivS64x64Remainder (DayRemainder, SECSPERHOUR, );
+  GmTime->tm_min  = (int)DivS64x64Remainder (Remainder, SECSPERMIN, NULL);
+  GmTime->tm_hour = (int)DivS64x64Remainder (DayRemainder, SECSPERHOUR, NULL);
+  DivS64x64Remainder ((DayNo + 4), 7, );
+  GmTime->tm_wday = (int)Remainder;
 
   for (Year = 1970, YearNo = 0; DayNo > 0; Year++) {
-TotalDays = (UINT16)(IsLeap (Year) ? 366 : 365);
+TotalDays = (UINT32)(IsLeap (Year) ? 366 : 365);
 if (DayNo >= TotalDays) {
-  DayNo = (UINT16)(DayNo - TotalDays);
+  DayNo = (UINT64)(DayNo - TotalDays);
   YearNo++;
 } else {
   break;
@@ -158,7 +181,7 @@ gmtime (
 
   for (MonthNo = 12; MonthNo > 1; MonthNo--) {
 if (DayNo >= CumulativeDays[IsLeap (Year)][MonthNo]) {
-  DayNo = (UINT16)(DayNo - (UINT16)(CumulativeDays[IsLeap 
(Year)][MonthNo]));
+  DayNo = (UINT64)(DayNo - (UINT32)(CumulativeDays[IsLeap 
(Year)][MonthNo]));
   break;
 }
   }
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96625): https://edk2.groups.io/g/devel/message/96625
Mute This Topic: https://groups.io/mt/95251049/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] CryptoPkg/BaseCryptLib:time overflow

2022-11-25 Thread wenyi,xie via groups.io
Main Changes :
1.Change type of time_t to INT64.
2.Using function DivS64x64Remainder to deal with INT64 divide.

Zihong Yi (1):
  CryptoPkg/BaseCryptLib:time overflow

 CryptoPkg/Library/Include/CrtLibSupport.h |  2 +-
 CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 51 ++--
 2 files changed, 38 insertions(+), 15 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96626): https://edk2.groups.io/g/devel/message/96626
Mute This Topic: https://groups.io/mt/95251050/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/BaseBmpSupportLib:Add unit test

2022-11-14 Thread wenyi,xie via groups.io
Add unit test for function TranslateBmpToGopBlt in
BaseBmpSupportLib. As the translation will fail when
color map size is zero and this problem is not solved
yet, temporarily mask the fail case check.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc
|   5 +
 MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf 
|  33 ++
 MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.c   
| 345 
 MdeModulePkg/MdeModulePkg.ci.yaml 
|   1 +
 4 files changed, 384 insertions(+)

diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index c9ec835df65d..4ca54dcca5c7 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -47,3 +47,8 @@ [Components]
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  
MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf {
+
+  
BaseBmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  }
diff --git 
a/MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf 
b/MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf
new file mode 100644
index ..d4eb6732d2fb
--- /dev/null
+++ 
b/MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf
@@ -0,0 +1,33 @@
+## @file
+# This is a unit test for the BaseBmpSupportLib.
+#
+# Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION = 0x00010017
+  BASE_NAME   = BaseBmpSupportLibUnitTest
+  FILE_GUID   = EA3E37BF-CA48-6816-406C-B10CFB1DDAD4
+  VERSION_STRING  = 1.0
+  MODULE_TYPE = HOST_APPLICATION
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  BaseBmpSupportLibUnitTest.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]
+  UnitTestLib
+  DebugLib
+  BaseMemoryLib
+  BaseBmpSupportLib
diff --git 
a/MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.c 
b/MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.c
new file mode 100644
index ..dd3520cb97a9
--- /dev/null
+++ 
b/MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.c
@@ -0,0 +1,345 @@
+/** @file
+  Unit tests of the BaseBmpSupportLib
+
+  Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define UNIT_TEST_APP_NAME "BaseBmpSupportLib Unit Tests"
+#define UNIT_TEST_APP_VERSION  "1.0"
+
+// Bmp file header template
+static BMP_IMAGE_HEADER  mBmpHeader = {
+  'B',  // 
CharB
+  'M',  // 
CharM
+  0,// 
Image Size
+  { 0, 0 }, // 
Reserved
+  sizeof (BMP_IMAGE_HEADER),// 
ImageOffset
+  sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize), // 
HeaderSize
+  4,// 
PixelWidth
+  4,// 
PixelHeight
+  1,// 
Planes
+  8,// 
BitPerPixel
+  0,// 
CompressionType
+  0,// 
DataSize
+  0,// 
XPixelsPerMeter
+  0,// 
YPixelsPerMeter
+  0,// 
NumberOfColors
+  0 // 
ImportantColors
+};
+
+/**
+  Create the bmp file.
+
+  @param BmpImage Bmp file image.
+  @param PixelHeight  Bmp file Height.
+  @param PixelWidth   Bmp file Width.
+  @param BitPerPixel  Bit per pixel.
+  @param ColorMap Color map.
+  @param ColorMapSize 

[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/BaseBmpSupportLib:Add unit test

2022-11-14 Thread wenyi,xie via groups.io
Main Changes :
1.Adding two unit test case for TranslateBmpToGopBlt.

Wenyi Xie (1):
  MdeModulePkg/BaseBmpSupportLib:Add unit test

 MdeModulePkg/Test/MdeModulePkgHostTest.dsc
|   5 +
 MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf 
|  33 ++
 MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.c   
| 345 
 MdeModulePkg/MdeModulePkg.ci.yaml 
|   1 +
 4 files changed, 384 insertions(+)
 create mode 100644 
MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.inf
 create mode 100644 
MdeModulePkg/Library/BaseBmpSupportLib/UnitTest/BaseBmpSupportLibUnitTest.c

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96345): https://edk2.groups.io/g/devel/message/96345
Mute This Topic: https://groups.io/mt/95017175/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 v1 1/1] ArmPlatformPkg/Drivers/NorFlashDxe:avoid index out of bound

2022-10-30 Thread wenyi,xie via groups.io



On 2022/10/30 18:06, Ard Biesheuvel wrote:
> On Sat, 29 Oct 2022 at 11:29, Wenyi Xie  wrote:
>>
>> The size of array BlockMap is 1 in struct FirmwareVolumeHeader, but in
>> function InitializeFvAndVariableStoreHeaders, BlockMap[1] is been written.
> 
> The size of BlockMap[] is not 1. BlockMap is a flexible array declared
> in an old fashioned way, and because the type definition is covered by
> the spec, we can not change it. Given that this is established idiom,
> compilers don't tend to warn about this.
> 
>> The memory of BlockMap[1] is already allocated, so the code is OK. But
>> it is better to use a new point to assign this memory.
>>
>> Cc: Leif Lindholm 
>> Cc: Ard Biesheuvel 
>> Signed-off-by: Wenyi Xie 
> 
> Thanks for the patch but this driver is going to be deleted soon so no point.
> 
> There is new version of this driver in OvmfPkg/ but given the above, I
> don't think there is anything that needs fixing here.

Thank you for your answering, I got your point and so it seems no necessary to 
change.

Best Regards
Wenyi
> 
>> ---
>>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c | 10 --
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c 
>> b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c
>> index 0767581308d2..2130e2e76344 100644
>> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c
>> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c
>> @@ -47,6 +47,7 @@ InitializeFvAndVariableStoreHeaders (
>>VOID*Headers;
>>UINTN   HeadersLength;
>>EFI_FIRMWARE_VOLUME_HEADER  *FirmwareVolumeHeader;
>> +  EFI_FV_BLOCK_MAP_ENTRY  *BlockMapEntry;
>>VARIABLE_STORE_HEADER   *VariableStoreHeader;
>>UINT32  NvStorageFtwSpareSize;
>>UINT32  NvStorageFtwWorkingSize;
>> @@ -151,10 +152,15 @@ InitializeFvAndVariableStoreHeaders (
>>FirmwareVolumeHeader->Revision  = EFI_FVH_REVISION;
>>FirmwareVolumeHeader->BlockMap[0].NumBlocks = Instance->Media.LastBlock + 
>> 1;
>>FirmwareVolumeHeader->BlockMap[0].Length= Instance->Media.BlockSize;
>> -  FirmwareVolumeHeader->BlockMap[1].NumBlocks = 0;
>> -  FirmwareVolumeHeader->BlockMap[1].Length= 0;
>>FirmwareVolumeHeader->Checksum  = CalculateCheckSum16 
>> ((UINT16 *)FirmwareVolumeHeader, FirmwareVolumeHeader->HeaderLength);
>>
>> +  //
>> +  // EFI_FV_BLOCK_MAP_ENTRY
>> +  //
>> +  BlockMapEntry= (EFI_FV_BLOCK_MAP_ENTRY *)((UINTN)Headers + 
>> sizeof (EFI_FIRMWARE_VOLUME_HEADER));
>> +  BlockMapEntry->NumBlocks = 0;
>> +  BlockMapEntry->Length= 0;
>> +
>>//
>>// VARIABLE_STORE_HEADER
>>//
>> --
>> 2.20.1.windows.1
>>
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95760): https://edk2.groups.io/g/devel/message/95760
Mute This Topic: https://groups.io/mt/94644092/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] ArmPlatformPkg/Drivers/NorFlashDxe:avoid index out of bound

2022-10-29 Thread wenyi,xie via groups.io
The size of array BlockMap is 1 in struct FirmwareVolumeHeader, but in
function InitializeFvAndVariableStoreHeaders, BlockMap[1] is been written.
The memory of BlockMap[1] is already allocated, so the code is OK. But
it is better to use a new point to assign this memory.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Wenyi Xie 
---
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c
index 0767581308d2..2130e2e76344 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c
@@ -47,6 +47,7 @@ InitializeFvAndVariableStoreHeaders (
   VOID*Headers;
   UINTN   HeadersLength;
   EFI_FIRMWARE_VOLUME_HEADER  *FirmwareVolumeHeader;
+  EFI_FV_BLOCK_MAP_ENTRY  *BlockMapEntry;
   VARIABLE_STORE_HEADER   *VariableStoreHeader;
   UINT32  NvStorageFtwSpareSize;
   UINT32  NvStorageFtwWorkingSize;
@@ -151,10 +152,15 @@ InitializeFvAndVariableStoreHeaders (
   FirmwareVolumeHeader->Revision  = EFI_FVH_REVISION;
   FirmwareVolumeHeader->BlockMap[0].NumBlocks = Instance->Media.LastBlock + 1;
   FirmwareVolumeHeader->BlockMap[0].Length= Instance->Media.BlockSize;
-  FirmwareVolumeHeader->BlockMap[1].NumBlocks = 0;
-  FirmwareVolumeHeader->BlockMap[1].Length= 0;
   FirmwareVolumeHeader->Checksum  = CalculateCheckSum16 ((UINT16 
*)FirmwareVolumeHeader, FirmwareVolumeHeader->HeaderLength);
 
+  //
+  // EFI_FV_BLOCK_MAP_ENTRY
+  //
+  BlockMapEntry= (EFI_FV_BLOCK_MAP_ENTRY *)((UINTN)Headers + 
sizeof (EFI_FIRMWARE_VOLUME_HEADER));
+  BlockMapEntry->NumBlocks = 0;
+  BlockMapEntry->Length= 0;
+
   //
   // VARIABLE_STORE_HEADER
   //
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95718): https://edk2.groups.io/g/devel/message/95718
Mute This Topic: https://groups.io/mt/94644092/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] ArmPlatformPkg/Drivers/NorFlashDxe:avoid index out of bound

2022-10-29 Thread wenyi,xie via groups.io
Main Changes :
1.Adding new point to assign the value of struct EFI_FV_BLOCK_MAP_ENTRY.

Wenyi Xie (1):
  ArmPlatformPkg/Drivers/NorFlashDxe:avoid index out of bound

 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvb.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95719): https://edk2.groups.io/g/devel/message/95719
Mute This Topic: https://groups.io/mt/94644093/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 v1 0/1] MdeModulePkg/TerminalDxe:Adding a switch for Terminal

2022-10-12 Thread wenyi,xie via groups.io
Hi, Mike

Thank you for your reply. We add a PCD because we want to dynamic disable the 
terminal through setupbrowser.
But as you said, the standard way is using console variables to manage it. We 
did not think about it before, we will have a try.

Thanks
Wenyi


On 2022/10/11 21:58, Kinney, Michael D wrote:
> Hi,
> 
> Why is this new PCD and new behavior required?
> 
> There are standard ways from the UEFI Spec to manage
> the set of active console output devices using console
> variables.
> 
> Thanks,
> 
> Mike
> 
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of wenyi,xie via 
>> groups.io
>> Sent: Tuesday, October 11, 2022 4:13 AM
>> To: devel@edk2.groups.io; Wang, Jian J ; Gao, Liming 
>> ; Gao, Zhichao
>> ; Ni, Ray 
>> Cc: songdongku...@huawei.com; xiewen...@huawei.com
>> Subject: [edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/TerminalDxe:Adding a 
>> switch for Terminal
>>
>> Main Changes :
>> 1.Adding a new PCD to control ternimal.
>>
>> Wenyi Xie (1):
>>   MdeModulePkg/TerminalDxe:Adding a switch for Terminal
>>
>>  MdeModulePkg/MdeModulePkg.dec  | 4 
>>  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf | 1 +
>>  MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c  | 4 
>>  3 files changed, 9 insertions(+)
>>
>> --
>> 2.20.1.windows.1
>>
>>
>>
>> 
>>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95061): https://edk2.groups.io/g/devel/message/95061
Mute This Topic: https://groups.io/mt/94256049/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/TerminalDxe:Adding a switch for Terminal

2022-10-11 Thread wenyi,xie via groups.io
Adding a new PCD as switch to control Trlminal.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/MdeModulePkg.dec  | 4 
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf | 1 +
 MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c  | 4 
 3 files changed, 9 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 58e6ab004882..c4cf7f474a43 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2161,6 +2161,10 @@ [PcdsDynamic, PcdsDynamicEx]
   # @Prompt GHCB Pool Size
   gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize|0|UINT64|0x00030008
 
+  ## This dynamic PCD holds the Switch which decide whether to using Terminal 
or not.
+  # @Prompt Terminal Switch
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTerminalSwitch|TRUE|BOOLEAN|0x0112
+
 [PcdsDynamicEx]
   ## This dynamic PCD enables the default variable setting.
   #  Its value is the default store ID value. The default value is zero as 
Standard default.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf 
b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
index b2a8aeba8510..36f6875de61b 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@@ -87,6 +87,7 @@ [Protocols]
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType   ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTerminalSwitch  ## CONSUMES
 
 # [Event]
 # # Relative timer event set by UnicodeToEfiKey(), used to be one 2 seconds 
input timeout.
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index e2d779c78378..c861eb00d6d2 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -1344,6 +1344,10 @@ InitializeTerminal (
 {
   EFI_STATUS  Status;
 
+  if (!PcdGetBool(PcdTerminalSwitch)) {
+return EFI_UNSUPPORTED;
+  }
+
   //
   // Install driver model protocol(s).
   //
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94990): https://edk2.groups.io/g/devel/message/94990
Mute This Topic: https://groups.io/mt/94256050/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/TerminalDxe:Adding a switch for Terminal

2022-10-11 Thread wenyi,xie via groups.io
Main Changes :
1.Adding a new PCD to control ternimal.

Wenyi Xie (1):
  MdeModulePkg/TerminalDxe:Adding a switch for Terminal

 MdeModulePkg/MdeModulePkg.dec  | 4 
 MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf | 1 +
 MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c  | 4 
 3 files changed, 9 insertions(+)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94989): https://edk2.groups.io/g/devel/message/94989
Mute This Topic: https://groups.io/mt/94256049/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdePkg/UefiDevicePathLib:Add NULL point check

2022-10-09 Thread wenyi,xie via groups.io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4060

Function CreateDeviceNode may return NULL point when NodeLength is
smaller than a device path header or there is not enough
memory to allocate. But after calling CreateDeviceNode, the
pointer is dereferenced without checking its value.
So is it nessary to check the value of point before using.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: Wenyi Xie 
---
 MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 240 

 1 file changed, 240 insertions(+)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index 1aaa968d6fb5..702b4ad74b30 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -388,6 +388,10 @@ DevPathFromTextGenericPath (
(UINT16)(sizeof (EFI_DEVICE_PATH_PROTOCOL) + DataLength)
);
 
+  if (Node == NULL) {
+return NULL;
+  }
+
   StrHexToBytes (DataStr, DataLength * 2, (UINT8 *)(Node + 1), DataLength);
   return Node;
 }
@@ -453,6 +457,10 @@ DevPathFromTextPci (
  (UINT16)sizeof (PCI_DEVICE_PATH)
  );
 
+  if (Pci == NULL) {
+return NULL;
+  }
+
   Pci->Function = (UINT8)Strtoi (FunctionStr);
   Pci->Device   = (UINT8)Strtoi (DeviceStr);
 
@@ -482,6 +490,10 @@ DevPathFromTextPcCard (
   (UINT16)sizeof 
(PCCARD_DEVICE_PATH)
   );
 
+  if (Pccard == NULL) {
+return NULL;
+  }
+
   Pccard->FunctionNumber = (UINT8)Strtoi (FunctionNumberStr);
 
   return (EFI_DEVICE_PATH_PROTOCOL *)Pccard;
@@ -514,6 +526,10 @@ DevPathFromTextMemoryMapped (
(UINT16)sizeof 
(MEMMAP_DEVICE_PATH)
);
 
+  if (MemMap == NULL) {
+return NULL;
+  }
+
   MemMap->MemoryType = (UINT32)Strtoi (MemoryTypeStr);
   Strtoi64 (StartingAddressStr, >StartingAddress);
   Strtoi64 (EndingAddressStr, >EndingAddress);
@@ -559,6 +575,10 @@ ConvertFromTextVendor (
(UINT16)(sizeof (VENDOR_DEVICE_PATH) + 
Length)
);
 
+  if (Vendor == NULL) {
+return NULL;
+  }
+
   StrToGuid (GuidStr, >Guid);
   StrHexToBytes (DataStr, Length * 2, (UINT8 *)(Vendor + 1), Length);
 
@@ -607,6 +627,11 @@ DevPathFromTextCtrl (
   HW_CONTROLLER_DP,
   (UINT16)sizeof 
(CONTROLLER_DEVICE_PATH)
   );
+
+  if (Controller == NULL) {
+return NULL;
+  }
+
   Controller->ControllerNumber = (UINT32)Strtoi (ControllerStr);
 
   return (EFI_DEVICE_PATH_PROTOCOL *)Controller;
@@ -637,6 +662,10 @@ DevPathFromTextBmc (
   (UINT16)sizeof (BMC_DEVICE_PATH)
   );
 
+  if (BmcDp == NULL) {
+return NULL;
+  }
+
   BmcDp->InterfaceType = (UINT8)Strtoi (InterfaceTypeStr);
   WriteUnaligned64 (
 (UINT64 *)(>BaseAddress),
@@ -706,6 +735,10 @@ DevPathFromTextAcpi (
  (UINT16)sizeof (ACPI_HID_DEVICE_PATH)
  );
 
+  if (Acpi == NULL) {
+return NULL;
+  }
+
   Acpi->HID = EisaIdFromText (HIDStr);
   Acpi->UID = (UINT32)Strtoi (UIDStr);
 
@@ -737,6 +770,10 @@ ConvertFromTextAcpi (
  (UINT16)sizeof (ACPI_HID_DEVICE_PATH)
  );
 
+  if (Acpi == NULL) {
+return NULL;
+  }
+
   Acpi->HID = EFI_PNP_ID (PnPId);
   Acpi->UID = (UINT32)Strtoi (UIDStr);
 
@@ -878,6 +915,10 @@ DevPathFromTextAcpiEx (
   Length
   );
 
+  if (AcpiEx == NULL) {
+return NULL;
+  }
+
   AcpiEx->HID = EisaIdFromText (HIDStr);
   AcpiEx->CID = EisaIdFromText (CIDStr);
   AcpiEx->UID = (UINT32)Strtoi (UIDStr);
@@ -920,6 +961,10 @@ DevPathFromTextAcpiExp (
  Length
  );
 
+  if (AcpiEx == NULL) {
+return NULL;
+  }
+
   AcpiEx->HID = EisaIdFromText (HIDStr);
   //
   // According to UEFI spec, the CID parametr is optional and has a default 
value of 0.
@@ -1040,6 +1085,10 @@ DevPathFromTextAta (
  (UINT16)sizeof (ATAPI_DEVICE_PATH)
  );
 
+  if (Atapi == NULL) {
+return NULL;
+  }
+
   PrimarySecondaryStr = GetNextParamStr ();
   SlaveMasterStr  = GetNextParamStr ();
   LunStr  = GetNextParamStr ();
@@ -1090,6 +1139,10 @@ DevPathFromTextScsi (
  (UINT16)sizeof (SCSI_DEVICE_PATH)
  );
 
+  if (Scsi == NULL) {
+

[edk2-devel] [PATCH EDK2 v1 0/1] MdePkg/UefiDevicePathLib:Add NULL point check

2022-10-09 Thread wenyi,xie via groups.io
Main Changes :
1.Adding null point check before pointer is dereferenced.

Wenyi Xie (1):
  MdePkg/UefiDevicePathLib:Add NULL point check

 MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 240 

 1 file changed, 240 insertions(+)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94846): https://edk2.groups.io/g/devel/message/94846
Mute This Topic: https://groups.io/mt/94213462/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] NetworkPkg/Dhcp6Dxe:Generate real time stamp

2022-09-28 Thread wenyi,xie via groups.io
The stamp used to be generated is assumed 30day/month. Now adding a
new function which calculates time stamp with the correct days.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: Wenyi Xie 
---
 NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 71 +---
 1 file changed, 63 insertions(+), 8 deletions(-)

diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c 
b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
index e6368b5b1c6c..bff8b809090f 100644
--- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
+++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
@@ -10,6 +10,62 @@
 
 #include "Dhcp6Impl.h"
 
+CONST UINT32  MonthDays[] = {
+  0,
+  31,
+  31 + 28,
+  31 + 28 + 31,
+  31 + 28 + 31 + 30,
+  31 + 28 + 31 + 30 + 31,
+  31 + 28 + 31 + 30 + 31 + 30,
+  31 + 28 + 31 + 30 + 31 + 30 + 31,
+  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
+  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
+  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
+  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30
+};
+
+/**
+  Generate time stamp with current system time.
+
+  @param[in]  Time  The pointer to the system time.
+
+  @retval NULL  .
+  @retval others.
+
+**/
+UINT32
+Dhcp6GenerateTimeStamp (
+  IN EFI_TIME  Time
+  )
+{
+  UINT32  Stamp;
+  UINT32  Days;
+
+  if (Time.Year < 2000) {
+DEBUG ((DEBUG_ERROR, "[%a][%dL] Time before 2000!\n", __FUNCTION__, 
__LINE__));
+return (UINT32) ~(0);
+  }
+
+  Days  = 0;
+  Days += ((Time.Year - 2000) * 365) + ((Time.Year - 2000) / 4);
+  Days += MonthDays[(Time.Month - 1)];
+  if (((Time.Year - 2000) % 4 == 0) && (Time.Month >= 3)) {
+Days++;
+  }
+
+  Stamp = (UINT32)Days + Time.Day;
+  Stamp = Stamp * 24 + Time.Hour;
+  Stamp = Stamp * 60 + Time.Minute;
+  if (Time.TimeZone != 0x7ff) {
+Stamp -= Time.TimeZone;
+  }
+
+  Stamp = Stamp * 60 + Time.Second;
+
+  return Stamp;
+}
+
 /**
   Generate client Duid in the format of Duid-llt.
 
@@ -108,15 +164,14 @@ Dhcp6GenerateClientId (
 //
 
 //
-// Generate a time stamp of the seconds from 2000/1/1, assume 30day/month.
+// Generate a time stamp of the seconds from 2000/1/1.
 //
-gRT->GetTime (, NULL);
-Stamp = (UINT32)
-(
- UINT32)(Time.Year - 2000) * 360 + (Time.Month - 1) * 30 + 
(Time.Day - 1)) * 24 + Time.Hour) * 60 + Time.Minute) *
- 60 +
- Time.Second
-);
+Status = gRT->GetTime (, NULL);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "[%a][%dL] Get time failed. \n", __FUNCTION__, 
__LINE__));
+}
+
+Stamp = Dhcp6GenerateTimeStamp (Time);
 
 //
 // sizeof (option-len + Duid-type + hardware-type + time) = 10 bytes
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94456): https://edk2.groups.io/g/devel/message/94456
Mute This Topic: https://groups.io/mt/93967207/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] NetworkPkg/Dhcp6Dxe:Generate real time stamp

2022-09-28 Thread wenyi,xie via groups.io
Main Changes :
1.Adding a new function to calculate time stamp.

Wenyi Xie (1):
  NetworkPkg/Dhcp6Dxe:Generate real time stamp

 NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 71 +---
 1 file changed, 63 insertions(+), 8 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94455): https://edk2.groups.io/g/devel/message/94455
Mute This Topic: https://groups.io/mt/93967206/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] CryptoPkg/BaseCryptLib:Remove redundant init

2022-09-15 Thread wenyi,xie via groups.io
Main Changes :
1.Remove redundant memory init.

Wenyi Xie (1):
  CryptoPkg/BaseCryptLib:Remove redundant init

 CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c | 2 --
 1 file changed, 2 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93817): https://edk2.groups.io/g/devel/message/93817
Mute This Topic: https://groups.io/mt/93696297/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] CryptoPkg/BaseCryptLib:Remove redundant init

2022-09-15 Thread wenyi,xie via groups.io
CertCtx is used to be defined as a struct and ZeroMem is called to
init this struct. But now CertCtx is defined as a point, so use
ZeroMem (, sizeof (CertCtx)) is not correct any more.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Signed-off-by: Wenyi Xie 
---
 CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c 
b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c
index 3336d2f60a6a..f8028181e47f 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyCommon.c
@@ -502,8 +502,6 @@ Pkcs7GetCertificatesList (
   OldBuf   = NULL;
   Signers  = NULL;
 
-  ZeroMem (, sizeof (CertCtx));
-
   //
   // Parameter Checking
   //
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93818): https://edk2.groups.io/g/devel/message/93818
Mute This Topic: https://groups.io/mt/93696298/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 v1 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-08-31 Thread wenyi,xie via groups.io
Hi, Liming:

  This patch didn't pass CI because it had a format problem. I had run 
Uncrustify locally to fixed it and sent a new patch in 8/18.

Thanks
Wenyi

On 2022/8/17 15:34, gaoliming wrote:
> Weiyi:
>   This patch doesn't pass CI. Please check
> https://github.com/tianocore/edk2/pull/3208
> 
>> -邮件原件-
>> 发件人: devel@edk2.groups.io  代表 gaoliming via
>> groups.io
>> 发送时间: 2022年8月12日 12:53
>> 收件人: 'Wenyi Xie' ; devel@edk2.groups.io;
>> jian.j.w...@intel.com; zhichao@intel.com; ray...@intel.com
>> 抄送: songdongku...@huawei.com
>> 主题: [edk2-devel] 回复: [PATCH EDK2 v1 1/1]
>> MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue
>>
>> Agree this fix to add the check for this case. Reviewed-by: Liming Gao
>> 
>>
>> Thanks
>> Liming
>>> -邮件原件-
>>> 发件人: Wenyi Xie 
>>> 发送时间: 2022年8月11日 16:32
>>> 收件人: devel@edk2.groups.io; jian.j.w...@intel.com;
>>> gaolim...@byosoft.com.cn; zhichao@intel.com; ray...@intel.com
>>> 抄送: songdongku...@huawei.com; xiewen...@huawei.com
>>> 主题: [PATCH EDK2 v1 1/1] MdeModulePkg/BaseBmpSupportLib: Fix
>>> ColorMap issue
>>>
>>> When BitPerPixel is 1,4,8, there should be a color map in bmp file. But
> if
>>> the format of bmp file is error, it maybe has no color map when
>> BitPerPixel
>>> is 1,4,8. The condition checking now can not catch this issue.
>>>
>>> Cc: Jian J Wang 
>>> Cc: Liming Gao 
>>> Cc: Zhichao Gao 
>>> Cc: Ray Ni 
>>> Signed-off-by: Wenyi Xie 
>>> ---
>>>  MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 5 +
>>>  1 file changed, 5 insertions(+)
>>>
>>> diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
>>> b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
>>> index c5e885d7a6d5..bea89d530de6 100644
>>> --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
>>> +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
>>> @@ -236,6 +236,11 @@ TranslateBmpToGopBlt (
>>>  return RETURN_UNSUPPORTED;
>>>}
>>>
>>> +  if ((BmpHeader->ImageOffset == sizeof (BMP_IMAGE_HEADER)) &&
>>> +  ((BmpHeader->BitPerPixel & 0x0D) != 0)) {
>>> +return RETURN_UNSUPPORTED;
>>> +  }
>>> +
>>>if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
>>>  switch (BmpHeader->BitPerPixel) {
>>>case 1:
>>> --
>>> 2.20.1.windows.1
>>
>>
>>
>>
>>
>> 
>>
> 
> 
> 
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93005): https://edk2.groups.io/g/devel/message/93005
Mute This Topic: https://groups.io/mt/93076276/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 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-08-18 Thread wenyi,xie via groups.io


On 2022/8/18 12:23, Sean Brogan wrote:
> These seem like perfect examples to write host based unit tests for the 
> bmpsupportlib. Then you could run all sorts of different bmp contents thru 
> the lib routines. 
> 
> Have you thought about adding that

I think it's a good idea to add unit tests for the bmpsupportlib, I will try to 
add it later.

Thanks
Wenyi
> 
> Thanks
> Sean
> --
> *From:* devel@edk2.groups.io  on behalf of wenyi,xie 
> via groups.io 
> *Sent:* Wednesday, August 17, 2022 7:26:07 PM
> *To:* devel@edk2.groups.io ; jian.j.w...@intel.com 
> ; gaolim...@byosoft.com.cn ; 
> zhichao@intel.com ; ray...@intel.com 
> 
> *Cc:* songdongku...@huawei.com ; 
> xiewen...@huawei.com 
> *Subject:* [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: 
> Fix ColorMap issue
>  
> When BitPerPixel is 1,4,8, there should be a color map in bmp file. But if
> the format of bmp file is error, it maybe has no color map when BitPerPixel
> is 1,4,8. The condition checking now can not catch this issue.
> 
> Cc: Jian J Wang 
> Cc: Liming Gao 
> Cc: Zhichao Gao 
> Cc: Ray Ni 
> Signed-off-by: Wenyi Xie 
> Reviewed-by: Liming Gao 
> ---
>  MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c 
> b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> index c5e885d7a6d5..1cdd857f48f8 100644
> --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
> @@ -236,6 +236,12 @@ TranslateBmpToGopBlt (
>  return RETURN_UNSUPPORTED;
>    }
>  
> +  if ((BmpHeader->ImageOffset == sizeof (BMP_IMAGE_HEADER)) &&
> +  ((BmpHeader->BitPerPixel & 0x0D) != 0))
> +  {
> +    return RETURN_UNSUPPORTED;
> +  }
> +
>    if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
>  switch (BmpHeader->BitPerPixel) {
>    case 1:
> -- 
> 2.20.1.windows.1
> 
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92547): https://edk2.groups.io/g/devel/message/92547
Mute This Topic: https://groups.io/mt/93096647/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 0/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-18 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.add comments for overflow check;
2.move condition check to if-clause.

Wenyi Xie (1):
  MdeModulePkg/PiSmmCore:Avoid overflow risk

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 10 +-
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  4 
 2 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92545): https://edk2.groups.io/g/devel/message/92545
Mute This Topic: https://groups.io/mt/9317/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-18 Thread wenyi,xie via groups.io
As the CommunicationBuffer plus BufferSize may overflow, check the
value first before using.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 10 +-
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  4 
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 9e5c6cbe33dd..003db3b85802 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -621,6 +621,14 @@ InternalIsBufferOverlapped (
   IN UINTN  Size2
   )
 {
+  //
+  // If integer overflow when adding Buff1 to Size1, treat it as Overlap.
+  // Also, if integer overflow when adding Buff2 to Size2, treat it as Overlap.
+  //
+  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN - 
Size2)) {
+return TRUE;
+  }
+
   //
   // If buff1's end is less than the start of buff2, then it's ok.
   // Also, if buff1's start is beyond buff2's end, then it's ok.
@@ -703,7 +711,7 @@ SmmEntryPoint (
 //
 // If CommunicationBuffer is not in valid address scope,
 // or there is overlap between gSmmCorePrivate and CommunicationBuffer,
-// return EFI_INVALID_PARAMETER
+// return EFI_ACCESS_DENIED
 //
 gSmmCorePrivate->CommunicationBuffer = NULL;
 gSmmCorePrivate->ReturnStatus= EFI_ACCESS_DENIED;
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 4f00cebaf5ed..78df802fe748 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -526,6 +526,10 @@ SmmCommunicationCommunicate (
   CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommBuffer;
 
   if (CommSize == NULL) {
+if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data)) {
+  return EFI_INVALID_PARAMETER;
+}
+
 TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
CommunicateHeader->MessageLength;
   } else {
 TempCommSize = *CommSize;
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92544): https://edk2.groups.io/g/devel/message/92544
Mute This Topic: https://groups.io/mt/93034134/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-08-17 Thread wenyi,xie via groups.io
When BitPerPixel is 1,4,8, there should be a color map in bmp file. But if
the format of bmp file is error, it maybe has no color map when BitPerPixel
is 1,4,8. The condition checking now can not catch this issue.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c 
b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index c5e885d7a6d5..1cdd857f48f8 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -236,6 +236,12 @@ TranslateBmpToGopBlt (
 return RETURN_UNSUPPORTED;
   }
 
+  if ((BmpHeader->ImageOffset == sizeof (BMP_IMAGE_HEADER)) &&
+  ((BmpHeader->BitPerPixel & 0x0D) != 0))
+  {
+return RETURN_UNSUPPORTED;
+  }
+
   if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
 switch (BmpHeader->BitPerPixel) {
   case 1:
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92536): https://edk2.groups.io/g/devel/message/92536
Mute This Topic: https://groups.io/mt/93096647/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-08-17 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.fix format issue found by Uncrustify 

Wenyi Xie (1):
  MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 6 ++
 1 file changed, 6 insertions(+)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92535): https://edk2.groups.io/g/devel/message/92535
Mute This Topic: https://groups.io/mt/93096645/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 v2 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-17 Thread wenyi,xie via groups.io



On 2022/8/16 9:49, Ni, Ray wrote:
>> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
>> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
>> @@ -621,6 +621,9 @@ InternalIsBufferOverlapped (
>>IN UINTN  Size2
>>)
>>  {
>> +  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN -
>> Size2)) {
>> +return TRUE;
>> +  }
> 1. The change looks good because it avoids integer overflow in below code 
> that adds Size1 to Buff1 and
> adds Size2 to Buff2.
> Can you please add comments to explain the logic?
> 
OK, I will add comments.
> 
>>
>> +  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF
>> (EFI_SMM_COMMUNICATE_HEADER, Data)) {
>> +return EFI_INVALID_PARAMETER;
>> +  }
> 2. Above check avoids integer overflow in below code that adds 
> CommunicateHeader->MessageLength
> to OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data).
> Can it be moved to inside the below if-clause?
> 
> 
>> +
>>if (CommSize == NULL) {
>>  TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)
>> + CommunicateHeader->MessageLength;
>>} else {
> 3.  I further reviewed the else-clause logic. When CommSize is not NULL, is 
> that needed to make sure
> that *CommSize >= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
> CommunicateHeader->MessageLength?
> Or is the check already in the code somewhere?
> If we think the check is needed, I agree with the change #2 to have a common 
> logic to check integer overflow.
> .When CommSize is not NULL, it seems only CommSize is been used, 
> CommunicateHeader->MessageLength is been ignored, and value of CommSize will 
> been verified before used by SmiHandler.
So I think it's no need  make sure that *CommSize >= OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data) + CommunicateHeader->MessageLength.
I will move it to inside if-clause.

Thanks
Wenyi
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92504): https://edk2.groups.io/g/devel/message/92504
Mute This Topic: https://groups.io/mt/93034134/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-15 Thread wenyi,xie via groups.io
As the CommunicationBuffer plus BufferSize may overflow, check the
value first before using.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 5 -
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  | 4 
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 9e5c6cbe33dd..a2a97a4056ee 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -621,6 +621,9 @@ InternalIsBufferOverlapped (
   IN UINTN  Size2
   )
 {
+  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN - 
Size2)) {
+return TRUE;
+  }
   //
   // If buff1's end is less than the start of buff2, then it's ok.
   // Also, if buff1's start is beyond buff2's end, then it's ok.
@@ -703,7 +706,7 @@ SmmEntryPoint (
 //
 // If CommunicationBuffer is not in valid address scope,
 // or there is overlap between gSmmCorePrivate and CommunicationBuffer,
-// return EFI_INVALID_PARAMETER
+// return EFI_ACCESS_DENIED
 //
 gSmmCorePrivate->CommunicationBuffer = NULL;
 gSmmCorePrivate->ReturnStatus= EFI_ACCESS_DENIED;
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 4f00cebaf5ed..fe3e6ba54281 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -525,6 +525,10 @@ SmmCommunicationCommunicate (
 
   CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommBuffer;
 
+  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data)) {
+return EFI_INVALID_PARAMETER;
+  }
+
   if (CommSize == NULL) {
 TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
CommunicateHeader->MessageLength;
   } else {
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92424): https://edk2.groups.io/g/devel/message/92424
Mute This Topic: https://groups.io/mt/93034134/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 0/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-15 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.treate overflow as overlap

Wenyi Xie (1):
  MdeModulePkg/PiSmmCore:Avoid overflow risk

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 5 -
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  | 4 
 2 files changed, 8 insertions(+), 1 deletion(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92425): https://edk2.groups.io/g/devel/message/92425
Mute This Topic: https://groups.io/mt/93034135/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 v1 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-14 Thread wenyi,xie via groups.io



On 2022/8/15 9:12, gaoliming wrote:
> Wenyi:
>   I add my comments below. 

Thank you for your comments. I agree with you that overflow can be treated as 
overlap. I will update the patch and send it later.

Thanks
Wenyi
> 
>> -邮件原件-
>> 发件人: devel@edk2.groups.io  代表 wenyi,xie via
>> groups.io
>> 发送时间: 2022年8月5日 15:21
>> 收件人: devel@edk2.groups.io; jian.j.w...@intel.com;
>> gaolim...@byosoft.com.cn; eric.d...@intel.com; ray...@intel.com
>> 抄送: songdongku...@huawei.com; xiewen...@huawei.com
>> 主题: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/PiSmmCore:Avoid
>> overflow risk
>>
>> As the CommunicationBuffer plus BufferSize may overflow, check the
>> value first before using.
>>
>> Cc: Jian J Wang 
>> Cc: Liming Gao 
>> Cc: Eric Dong 
>> Cc: Ray Ni 
>> Signed-off-by: Wenyi Xie 
>> ---
>>  MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 +---
>>  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  5 +
>>  2 files changed, 19 insertions(+), 8 deletions(-)
>>
>> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
>> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
>> index 9e5c6cbe33dd..fcf8c61d7f1b 100644
>> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
>> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
>> @@ -613,23 +613,28 @@ SmmEndOfS3ResumeHandler (
>>@retval FALSE Buffer doesn't overlap.
>>
>>  **/
>> -BOOLEAN
>> +EFI_STATUS
>>  InternalIsBufferOverlapped (
>>IN UINT8  *Buff1,
>>IN UINTN  Size1,
>>IN UINT8  *Buff2,
>> -  IN UINTN  Size2
>> +  IN UINTN  Size2,
>> +  IN BOOLEAN *IsOverlapped
>>)
>>  {
>> +  *IsOverlapped = TRUE;
>> +  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN -
>> Size2)) {
>> +return EFI_INVALID_PARAMETER;
>> +  }
>>//
>>// If buff1's end is less than the start of buff2, then it's ok.
>>// Also, if buff1's start is beyond buff2's end, then it's ok.
>>//
>>if (((Buff1 + Size1) <= Buff2) || (Buff1 >= (Buff2 + Size2))) {
>> -return FALSE;
>> +*IsOverlapped = FALSE;
>>}
>>
>> -  return TRUE;
>> +  return EFI_SUCCESS;
>>  }
>>
> If Buff1 + Size1 overflows MAX_UINTN, it can be also regarded as overlap,
> return TRUE. 
> 
> If you think overflow is not overlap, please also update function
> InternalIsBufferOverlapped name and description to avoid confuse. 
> 
> Thanks
> Liming
> 
>>  /**
>> @@ -693,17 +698,18 @@ SmmEntryPoint (
>>//
>>// Synchronous SMI for SMM Core or request from Communicate
>> protocol
>>//
>> -  IsOverlapped = InternalIsBufferOverlapped (
>> +  Status = InternalIsBufferOverlapped (
>> (UINT8 *)CommunicationBuffer,
>> BufferSize,
>> (UINT8 *)gSmmCorePrivate,
>> -   sizeof (*gSmmCorePrivate)
>> +   sizeof (*gSmmCorePrivate),
>> +   
>> );
>> -  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer,
>> BufferSize) || IsOverlapped) {
>> +  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer,
>> BufferSize) || EFI_ERROR(Status) || IsOverlapped) {
>>  //
>>  // If CommunicationBuffer is not in valid address scope,
>>  // or there is overlap between gSmmCorePrivate and
>> CommunicationBuffer,
>> -// return EFI_INVALID_PARAMETER
>> +// return EFI_ACCESS_DENIED
>>  //
>>  gSmmCorePrivate->CommunicationBuffer = NULL;
>>  gSmmCorePrivate->ReturnStatus= EFI_ACCESS_DENIED;
>> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
>> b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
>> index 4f00cebaf5ed..bd13cf97ec93 100644
>> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
>> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
>> @@ -525,6 +525,11 @@ SmmCommunicationCommunicate (
>>
>>CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER
>> *)CommBuffer;
>>
>> +  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF
>> (EFI_SMM_COMMUNICATE_HEADER, Data)) {
>> +DEBUG ((DEBUG_ERROR, "MessageLength is invalid!\n"));
>> +return EFI_INVALID_PARAMETER;
>> +  }
>> +
>>if (CommSize == NULL) {
>>  TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER,
>> Data) + CommunicateHeader->MessageLength;
>>} else {
>> --
>> 2.20.1.windows.1
>>
>>
>>
>> 
>>
> 
> 
> 
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92407): https://edk2.groups.io/g/devel/message/92407
Mute This Topic: https://groups.io/mt/93027797/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-08-11 Thread wenyi,xie via groups.io
When BitPerPixel is 1,4,8, there should be a color map in bmp file. But if
the format of bmp file is error, it maybe has no color map when BitPerPixel
is 1,4,8. The condition checking now can not catch this issue.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c 
b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
index c5e885d7a6d5..bea89d530de6 100644
--- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -236,6 +236,11 @@ TranslateBmpToGopBlt (
 return RETURN_UNSUPPORTED;
   }
 
+  if ((BmpHeader->ImageOffset == sizeof (BMP_IMAGE_HEADER)) &&
+  ((BmpHeader->BitPerPixel & 0x0D) != 0)) {
+return RETURN_UNSUPPORTED;
+  }
+
   if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
 switch (BmpHeader->BitPerPixel) {
   case 1:
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92375): https://edk2.groups.io/g/devel/message/92375
Mute This Topic: https://groups.io/mt/92954452/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

2022-08-11 Thread wenyi,xie via groups.io
Main Changes :
1.Add check to catch the issue when format of bmp file is error.

Wenyi Xie (1):
  MdeModulePkg/BaseBmpSupportLib: Fix ColorMap issue

 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c | 5 +
 1 file changed, 5 insertions(+)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92376): https://edk2.groups.io/g/devel/message/92376
Mute This Topic: https://groups.io/mt/92954453/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-05 Thread wenyi,xie via groups.io
As the CommunicationBuffer plus BufferSize may overflow, check the
value first before using.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 +---
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  5 +
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 9e5c6cbe33dd..fcf8c61d7f1b 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -613,23 +613,28 @@ SmmEndOfS3ResumeHandler (
   @retval FALSE Buffer doesn't overlap.
 
 **/
-BOOLEAN
+EFI_STATUS
 InternalIsBufferOverlapped (
   IN UINT8  *Buff1,
   IN UINTN  Size1,
   IN UINT8  *Buff2,
-  IN UINTN  Size2
+  IN UINTN  Size2,
+  IN BOOLEAN *IsOverlapped
   )
 {
+  *IsOverlapped = TRUE;
+  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN - 
Size2)) {
+return EFI_INVALID_PARAMETER;
+  }
   //
   // If buff1's end is less than the start of buff2, then it's ok.
   // Also, if buff1's start is beyond buff2's end, then it's ok.
   //
   if (((Buff1 + Size1) <= Buff2) || (Buff1 >= (Buff2 + Size2))) {
-return FALSE;
+*IsOverlapped = FALSE;
   }
 
-  return TRUE;
+  return EFI_SUCCESS;
 }
 
 /**
@@ -693,17 +698,18 @@ SmmEntryPoint (
   //
   // Synchronous SMI for SMM Core or request from Communicate protocol
   //
-  IsOverlapped = InternalIsBufferOverlapped (
+  Status = InternalIsBufferOverlapped (
(UINT8 *)CommunicationBuffer,
BufferSize,
(UINT8 *)gSmmCorePrivate,
-   sizeof (*gSmmCorePrivate)
+   sizeof (*gSmmCorePrivate),
+   
);
-  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer, BufferSize) 
|| IsOverlapped) {
+  if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer, BufferSize) 
|| EFI_ERROR(Status) || IsOverlapped) {
 //
 // If CommunicationBuffer is not in valid address scope,
 // or there is overlap between gSmmCorePrivate and CommunicationBuffer,
-// return EFI_INVALID_PARAMETER
+// return EFI_ACCESS_DENIED
 //
 gSmmCorePrivate->CommunicationBuffer = NULL;
 gSmmCorePrivate->ReturnStatus= EFI_ACCESS_DENIED;
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 4f00cebaf5ed..bd13cf97ec93 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -525,6 +525,11 @@ SmmCommunicationCommunicate (
 
   CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommBuffer;
 
+  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data)) {
+DEBUG ((DEBUG_ERROR, "MessageLength is invalid!\n"));
+return EFI_INVALID_PARAMETER;
+  }
+
   if (CommSize == NULL) {
 TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
CommunicateHeader->MessageLength;
   } else {
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92157): https://edk2.groups.io/g/devel/message/92157
Mute This Topic: https://groups.io/mt/92830802/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-05 Thread wenyi,xie via groups.io
Main Changes :
1.Add check to avoid overflow.

Wenyi Xie (1):
  MdeModulePkg/PiSmmCore:Avoid overflow risk

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 +---
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  |  5 +
 2 files changed, 19 insertions(+), 8 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92156): https://edk2.groups.io/g/devel/message/92156
Mute This Topic: https://groups.io/mt/92830801/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] EmbeddedPkg/GdbSerialDebugPortLib:fix compile warning

2022-08-03 Thread wenyi,xie via groups.io
Main Changes :
1.Change the type of gTimeOut to UINT32.

Wenyi Xie (1):
  EmbeddedPkg/GdbSerialDebugPortLib:fix compile warning

 EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92080): https://edk2.groups.io/g/devel/message/92080
Mute This Topic: https://groups.io/mt/92788832/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] EmbeddedPkg/GdbSerialDebugPortLib:fix compile warning

2022-08-03 Thread wenyi,xie via groups.io
The value of gTimeOut is from PcdGdbMaxPacketRetryCount, and this
PCD is UINT32. So change the declaratrion of gTimeOut to UINT32
to fix compile warning.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Abner Chang 
Cc: Daniel Schaefer 
Signed-off-by: Wenyi Xie 
---
 EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c 
b/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c
index d53a5fe47f18..d54e1cf7e094 100644
--- a/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c
+++ b/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c
@@ -17,7 +17,7 @@
 #include 
 
 EFI_DEBUGPORT_PROTOCOL  *gDebugPort = NULL;
-UINTN   gTimeOut= 0;
+UINT32  gTimeOut= 0;
 
 /**
   The constructor function initializes the UART.
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92081): https://edk2.groups.io/g/devel/message/92081
Mute This Topic: https://groups.io/mt/92788833/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] edksetup.sh:The version compare issue in shell script

2022-06-13 Thread wenyi,xie via groups.io
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3948

In function of SetupPython3, the version of python will be
compared to get the new one. When python 3.10 is compared with
python 3.4, the result is not right. Because the version number
is treated as a float and 3.10 is smaller than 3.4.
So using sort to arrange the version from old to new in order
to get the new one.

Cc: Andrew Fish 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Signed-off-by: Wenyi Xie 
---
 edksetup.sh | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/edksetup.sh b/edksetup.sh
index 06d2f041e635..b9da62440f71 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -20,6 +20,11 @@
 SCRIPTNAME="edksetup.sh"
 RECONFIG=FALSE
 
+function IsVersionGreaterThan()
+{
+  test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1";
+}
+
 function HelpMsg()
 {
   echo "Usage: $SCRIPTNAME [Options]"
@@ -122,7 +127,7 @@ function SetupPython3()
   export PYTHON_COMMAND=$python
   continue
 fi
-  if [[ "$origin_version" < "$python_version" ]]; then
+if IsVersionGreaterThan $python_version $origin_version; then
   origin_version=$python_version
   export PYTHON_COMMAND=$python
 fi
@@ -164,7 +169,7 @@ function SetupPython()
 export PYTHON_COMMAND=$python
 continue
   fi
-  if [[ "$origin_version" < "$python_version" ]]; then
+  if IsVersionGreaterThan $python_version $origin_version; then
 origin_version=$python_version
 export PYTHON_COMMAND=$python
   fi
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90513): https://edk2.groups.io/g/devel/message/90513
Mute This Topic: https://groups.io/mt/91742510/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] edksetup.sh:The version compare issue in shell script

2022-06-13 Thread wenyi,xie via groups.io
Main Changes :
1.Using sort command to get the new version.

Wenyi Xie (1):
  edksetup.sh:The version compare issue in shell script

 edksetup.sh | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90512): https://edk2.groups.io/g/devel/message/90512
Mute This Topic: https://groups.io/mt/91742508/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] BaseTools:Support decimal version number in ECC check

2022-03-18 Thread wenyi,xie via groups.io
Main Changes :
1.support decimal type version number when running ecc check.

Wenyi Xie (1):
  BaseTools:Support decimal version number in ECC check

 BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 18 
+++---
 1 file changed, 15 insertions(+), 3 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87731): https://edk2.groups.io/g/devel/message/87731
Mute This Topic: https://groups.io/mt/89862755/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] BaseTools:Support decimal version number in ECC check

2022-03-18 Thread wenyi,xie via groups.io
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3872

When doing ecc inf version check, the decimal type version number
like 1.27 is treated as invalid version.
So the code should be updated to support decimal type version number.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Wenyi Xie 
---
 BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 18 
+++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py 
b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 9c27c8e16a05..2d98ac5eadb2 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -31,6 +31,10 @@ from GenFds.FdfParser import FdfParser
 from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.LongFilePathSupport import CodecOpenLongFilePath
 
+## RegEx for finding file versions
+hexVersionPattern = re.compile(r'0[xX][\da-f-A-F]{5,8}')
+decVersionPattern = re.compile(r'\d+\.\d+')
+
 ## A decorator used to parse macro definition
 def ParseMacro(Parser):
 def MacroParser(self):
@@ -331,11 +335,19 @@ class MetaFileParser(object):
 Name, Value = self._ValueList[1], self._ValueList[2]
 # Sometimes, we need to make differences between EDK and EDK2 modules
 if Name == 'INF_VERSION':
-try:
+if hexVersionPattern.match(Value):
 self._Version = int(Value, 0)
-except:
+elif decVersionPattern.match(Value):
+ValueList = Value.split('.')
+Major = int(ValueList[0], 0)
+Minor = int(ValueList[1], 0)
+if Major > 0x or Minor > 0x:
+EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version 
number",
+ExtraData=self._CurrentLine, 
File=self.MetaFile, Line=self._LineIndex + 1)
+self._Version = int('0x{0:04x}{1:04x}'.format(Major, Minor), 0)
+else:
 EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version 
number",
-ExtraData=self._CurrentLine, 
File=self.MetaFile, Line=self._LineIndex+1)
+ExtraData=self._CurrentLine, 
File=self.MetaFile, Line=self._LineIndex + 1)
 elif Name == 'MODULE_UNI_FILE':
 UniFile = os.path.join(os.path.dirname(self.MetaFile), Value)
 if os.path.exists(UniFile):
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87732): https://edk2.groups.io/g/devel/message/87732
Mute This Topic: https://groups.io/mt/89862756/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 v1 1/1] ArmPlatformPkg: Fix ECC issues

2022-03-17 Thread wenyi,xie via groups.io
Hi, Sami

Thank you for your reviewing, I have created a PR an here is the link.
https://github.com/tianocore/edk2/pull/2619

Regards
Wenyi

On 2022/3/14 18:13, Sami Mujawar wrote:
> Hi Wenyi,
> 
> Thank you for this patch. These changes look good to me.
> 
> Reviewed-by: Sami Mujawar 
> 
> Regards,
> 
> Sami Mujawar
> 
> On 14/03/2022, 09:26, "devel@edk2.groups.io on behalf of wenyi,xie via 
> groups.io"  
> wrote:
> 
> Fix header files on #ifdef.
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> 
> Signed-off-by: Wenyi Xie 
> ---
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h | 6 
> +++---
>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h   | 6 
> +++---
>  ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h   | 6 
> +++---
>  ArmPlatformPkg/Include/Library/ArmPlatformLib.h   | 4 
> ++--
>  ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h  | 6 
> +++---
>  ArmPlatformPkg/Include/Library/PL011UartClockLib.h| 4 
> ++--
>  ArmPlatformPkg/Include/Library/PL011UartLib.h | 4 
> ++--
>  ArmPlatformPkg/Library/PL011UartLib/PL011Uart.h   | 4 
> ++--
>  ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClock.h | 4 
> ++--
>  ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.h| 6 
> +++---
>  ArmPlatformPkg/PrePeiCore/PrePeiCore.h| 4 
> ++--
>  ArmPlatformPkg/PrePi/PrePi.h  | 6 
> +++---
>  12 files changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h 
> b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h
> index c83032e87d9c..c8b567d0c413 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h
> @@ -6,8 +6,8 @@
> 
>  **/
> 
> -#ifndef __NOR_FLASH_H__
> -#define __NOR_FLASH_H__
> +#ifndef NOR_FLASH_H_
> +#define NOR_FLASH_H_
> 
>  #include 
>  #include 
> @@ -419,4 +419,4 @@ NorFlashVirtualNotifyEvent (
>IN VOID   *Context
>);
> 
> -#endif /* __NOR_FLASH_H__ */
> +#endif // NOR_FLASH_H_
> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h 
> b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
> index 42d87a16a3dd..3117f0abe2b3 100644
> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
> @@ -6,8 +6,8 @@
> 
>  **/
> 
> -#ifndef __PL061_GPIO_H__
> -#define __PL061_GPIO_H__
> +#ifndef PL061_GPIO_H_
> +#define PL061_GPIO_H_
> 
>  #include 
> 
> @@ -39,4 +39,4 @@
>  // All bits low except one bit high, native bit length
>  #define GPIO_PIN_MASK(Pin)  (1UL << ((UINTN)(Pin)))
> 
> -#endif // __PL061_GPIO_H__
> +#endif // PL061_GPIO_H_
> diff --git a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h 
> b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h
> index 597d6911fa10..f6a332fda247 100644
> --- a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h
> +++ b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h
> @@ -6,8 +6,8 @@
> 
>  **/
> 
> -#ifndef __SP805_WATCHDOG_H__
> -#define __SP805_WATCHDOG_H__
> +#ifndef SP805_WATCHDOG_H_
> +#define SP805_WATCHDOG_H_
> 
>  // SP805 Watchdog Registers
>  #define SP805_WDOG_LOAD_REG ((UINT32)PcdGet32 
> (PcdSP805WatchdogBase) + 0x000)
> @@ -38,4 +38,4 @@
>  #define SP805_WDOG_LOCK_IS_LOCKED   0x0001
>  #define SP805_WDOG_SPECIAL_UNLOCK_CODE  0x1ACCE551
> 
> -#endif // __SP805_WATCHDOG_H__
> +#endif // SP805_WATCHDOG_H_
> diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h 
> b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
> index cd87743eba52..cf056808fedf 100644
> --- a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
> +++ b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
> @@ -6,8 +6,8 @@
> 
>  **/
> 
> -#ifndef _ARMPLATFORMLIB_H_
> -#define _ARMPLATFORMLIB_H_
> +#ifndef ARMPLATFORMLIB_H_
> +#define ARMPLATFORMLIB_H_
> 
>  //
>  // The package level header files this module uses
> diff --git a/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h 
> b/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h
> index 6ef5b70e9948..37c0a69a6d07 100644
> --- a/ArmPlatformPkg/Include/Library/NorFla

[edk2-devel] [PATCH EDK2 v1 0/1] ArmPlatformPkg: Fix ECC issues

2022-03-14 Thread wenyi,xie via groups.io
Main Changes :
1.fix the ifdef variable.

Wenyi Xie (1):
  ArmPlatformPkg: Fix ECC issues

 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h | 6 +++---
 ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h   | 6 +++---
 ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h   | 6 +++---
 ArmPlatformPkg/Include/Library/ArmPlatformLib.h   | 4 ++--
 ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h  | 6 +++---
 ArmPlatformPkg/Include/Library/PL011UartClockLib.h| 4 ++--
 ArmPlatformPkg/Include/Library/PL011UartLib.h | 4 ++--
 ArmPlatformPkg/Library/PL011UartLib/PL011Uart.h   | 4 ++--
 ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClock.h | 4 ++--
 ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.h| 6 +++---
 ArmPlatformPkg/PrePeiCore/PrePeiCore.h| 4 ++--
 ArmPlatformPkg/PrePi/PrePi.h  | 6 +++---
 12 files changed, 30 insertions(+), 30 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87533): https://edk2.groups.io/g/devel/message/87533
Mute This Topic: https://groups.io/mt/89769610/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] ArmPlatformPkg: Fix ECC issues

2022-03-14 Thread wenyi,xie via groups.io
Fix header files on #ifdef.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 

Signed-off-by: Wenyi Xie 
---
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h | 6 +++---
 ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h   | 6 +++---
 ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h   | 6 +++---
 ArmPlatformPkg/Include/Library/ArmPlatformLib.h   | 4 ++--
 ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h  | 6 +++---
 ArmPlatformPkg/Include/Library/PL011UartClockLib.h| 4 ++--
 ArmPlatformPkg/Include/Library/PL011UartLib.h | 4 ++--
 ArmPlatformPkg/Library/PL011UartLib/PL011Uart.h   | 4 ++--
 ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClock.h | 4 ++--
 ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.h| 6 +++---
 ArmPlatformPkg/PrePeiCore/PrePeiCore.h| 4 ++--
 ArmPlatformPkg/PrePi/PrePi.h  | 6 +++---
 12 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h
index c83032e87d9c..c8b567d0c413 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlash.h
@@ -6,8 +6,8 @@
 
 **/
 
-#ifndef __NOR_FLASH_H__
-#define __NOR_FLASH_H__
+#ifndef NOR_FLASH_H_
+#define NOR_FLASH_H_
 
 #include 
 #include 
@@ -419,4 +419,4 @@ NorFlashVirtualNotifyEvent (
   IN VOID   *Context
   );
 
-#endif /* __NOR_FLASH_H__ */
+#endif // NOR_FLASH_H_
diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h 
b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
index 42d87a16a3dd..3117f0abe2b3 100644
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
+++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h
@@ -6,8 +6,8 @@
 
 **/
 
-#ifndef __PL061_GPIO_H__
-#define __PL061_GPIO_H__
+#ifndef PL061_GPIO_H_
+#define PL061_GPIO_H_
 
 #include 
 
@@ -39,4 +39,4 @@
 // All bits low except one bit high, native bit length
 #define GPIO_PIN_MASK(Pin)  (1UL << ((UINTN)(Pin)))
 
-#endif // __PL061_GPIO_H__
+#endif // PL061_GPIO_H_
diff --git a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h 
b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h
index 597d6911fa10..f6a332fda247 100644
--- a/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h
+++ b/ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h
@@ -6,8 +6,8 @@
 
 **/
 
-#ifndef __SP805_WATCHDOG_H__
-#define __SP805_WATCHDOG_H__
+#ifndef SP805_WATCHDOG_H_
+#define SP805_WATCHDOG_H_
 
 // SP805 Watchdog Registers
 #define SP805_WDOG_LOAD_REG ((UINT32)PcdGet32 (PcdSP805WatchdogBase) + 
0x000)
@@ -38,4 +38,4 @@
 #define SP805_WDOG_LOCK_IS_LOCKED   0x0001
 #define SP805_WDOG_SPECIAL_UNLOCK_CODE  0x1ACCE551
 
-#endif // __SP805_WATCHDOG_H__
+#endif // SP805_WATCHDOG_H_
diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h 
b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
index cd87743eba52..cf056808fedf 100644
--- a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
+++ b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h
@@ -6,8 +6,8 @@
 
 **/
 
-#ifndef _ARMPLATFORMLIB_H_
-#define _ARMPLATFORMLIB_H_
+#ifndef ARMPLATFORMLIB_H_
+#define ARMPLATFORMLIB_H_
 
 //
 // The package level header files this module uses
diff --git a/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h 
b/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h
index 6ef5b70e9948..37c0a69a6d07 100644
--- a/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h
+++ b/ArmPlatformPkg/Include/Library/NorFlashPlatformLib.h
@@ -6,8 +6,8 @@
 
  **/
 
-#ifndef _NORFLASHPLATFORMLIB_H_
-#define _NORFLASHPLATFORMLIB_H_
+#ifndef NORFLASHPLATFORMLIB_H_
+#define NORFLASHPLATFORMLIB_H_
 
 typedef struct {
   UINTNDeviceBaseAddress;   // Start address of the Device Base 
Address (DBA)
@@ -27,4 +27,4 @@ NorFlashPlatformGetDevices (
   OUT UINT32 *Count
   );
 
-#endif /* _NORFLASHPLATFORMLIB_H_ */
+#endif // NORFLASHPLATFORMLIB_H_
diff --git a/ArmPlatformPkg/Include/Library/PL011UartClockLib.h 
b/ArmPlatformPkg/Include/Library/PL011UartClockLib.h
index 5814d960a663..0e279dda62ce 100644
--- a/ArmPlatformPkg/Include/Library/PL011UartClockLib.h
+++ b/ArmPlatformPkg/Include/Library/PL011UartClockLib.h
@@ -6,8 +6,8 @@
 
 **/
 
-#ifndef __PL011UARTCLOCKLIB_H__
-#define __PL011UARTCLOCKLIB_H__
+#ifndef PL011UARTCLOCKLIB_H_
+#define PL011UARTCLOCKLIB_H_
 
 /**
 
diff --git a/ArmPlatformPkg/Include/Library/PL011UartLib.h 
b/ArmPlatformPkg/Include/Library/PL011UartLib.h
index 964142ef64a3..18638ce9ef7d 100644
--- a/ArmPlatformPkg/Include/Library/PL011UartLib.h
+++ b/ArmPlatformPkg/Include/Library/PL011UartLib.h
@@ -6,8 +6,8 @@
 
 **/
 
-#ifndef __PL011_UART_LIB_H__
-#define __PL011_UART_LIB_H__
+#ifndef PL011_UART_LIB_H_
+#define PL011_UART_LIB_H_
 
 #include 
 
diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011Uart.h 

Re: [edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue

2022-03-11 Thread wenyi,xie via groups.io
Hi Abner,

Thank you for your reviewing, here is the link to the PR.
https://github.com/tianocore/edk2/pull/2612

Regards
Wenyi

On 2022/3/11 15:03, Chang, Abner (HPS SW/FW Technologist) wrote:
> Hi Wenyi,
> Please add my RB in the commit message and create the PR against edk2, let me 
> know the link to PR as well.
> 
> Thanks,
> Abner
> --
> *From:* Chang, Abner (HPS SW/FW Technologist)
> *Sent:* Friday, March 11, 2022 1:48 PM
> *To:* Wenyi Xie ; devel@edk2.groups.io 
> ; Wang, Nickle (Server BIOS) 
> *Cc:* songdongku...@huawei.com 
> *Subject:* RE: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
>  
> Thanks for catching this.
> 
> Reviewed-by: Abner Chang 
> 
>> -Original Message-
>> From: Wenyi Xie 
>> Sent: Thursday, March 10, 2022 7:26 PM
>> To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
>> ; Wang, Nickle (Server BIOS)
>> 
>> Cc: songdongku...@huawei.com; xiewen...@huawei.com
>> Subject: [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue
>> 
>> The calloc memory is not free when function collectionEvalOp
>> return in the halfway.
>> 
>> Cc: Abner Chang 
>> Cc: Nickle Wang 
>> Signed-off-by: Wenyi Xie 
>> ---
>>  RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16
>> +++-
>>  1 file changed, 7 insertions(+), 9 deletions(-)
>> 
>> diff --git
>> a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
>> b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
>> index 3f2b83e834d0..6c6e2246abe3 100644
>> --- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
>> +++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
>> @@ -620,6 +620,7 @@ collectionEvalOp (
>>    if (((*StatusCode == NULL) && (members == NULL)) ||
>>    ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) ||
>> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
>>    {
>> +    free (valid);
>>  return members;
>>    }
>> 
>> @@ -633,6 +634,7 @@ collectionEvalOp (
>>  if (((*StatusCode == NULL) && (tmp == NULL)) ||
>>  ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) ||
>> (**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
>>  {
>> +  free (valid);
>>    return tmp;
>>  }
>> 
>> @@ -658,19 +660,15 @@ collectionEvalOp (
>> 
>>    cleanupPayload (members);
>>    if (validCount == 0) {
>> -    free (valid);
>> -    return NULL;
>> -  }
>> -
>> -  if (validCount == 1) {
>> +    ret = NULL;
>> +  } else if (validCount == 1) {
>>  ret = valid[0];
>> -    free (valid);
>> -    return ret;
>>    } else {
>>  ret = createCollection (payload->service, validCount, valid);
>> -    free (valid);
>> -    return ret;
>>    }
>> +
>> +  free (valid);
>> +  return ret;
>>  }
>> 
>>  static redfishPayload *
>> --
>> 2.20.1.windows.1
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87461): https://edk2.groups.io/g/devel/message/87461
Mute This Topic: https://groups.io/mt/89683950/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] RedfishPkg: fix memory leak issue

2022-03-10 Thread wenyi,xie via groups.io
Main Changes :
1.free the allocated memory when function collectionEvalOp return.
2.optimeze the code, no functional change.

Wenyi Xie (1):
  RedfishPkg: fix memory leak issue

 RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 
+++-
 1 file changed, 7 insertions(+), 9 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87403): https://edk2.groups.io/g/devel/message/87403
Mute This Topic: https://groups.io/mt/89683949/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg: fix memory leak issue

2022-03-10 Thread wenyi,xie via groups.io
The calloc memory is not free when function collectionEvalOp
return in the halfway.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Wenyi Xie 
---
 RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c | 16 
+++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c 
b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
index 3f2b83e834d0..6c6e2246abe3 100644
--- a/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
+++ b/RedfishPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/payload.c
@@ -620,6 +620,7 @@ collectionEvalOp (
   if (((*StatusCode == NULL) && (members == NULL)) ||
   ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || 
(**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
   {
+free (valid);
 return members;
   }
 
@@ -633,6 +634,7 @@ collectionEvalOp (
 if (((*StatusCode == NULL) && (tmp == NULL)) ||
 ((*StatusCode != NULL) && ((**StatusCode < HTTP_STATUS_200_OK) || 
(**StatusCode > HTTP_STATUS_206_PARTIAL_CONTENT
 {
+  free (valid);
   return tmp;
 }
 
@@ -658,19 +660,15 @@ collectionEvalOp (
 
   cleanupPayload (members);
   if (validCount == 0) {
-free (valid);
-return NULL;
-  }
-
-  if (validCount == 1) {
+ret = NULL;
+  } else if (validCount == 1) {
 ret = valid[0];
-free (valid);
-return ret;
   } else {
 ret = createCollection (payload->service, validCount, valid);
-free (valid);
-return ret;
   }
+
+  free (valid);
+  return ret;
 }
 
 static redfishPayload *
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87404): https://edk2.groups.io/g/devel/message/87404
Mute This Topic: https://groups.io/mt/89683950/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] UefiCpuPkg/MpInitLib:remove optional in declaration

2022-03-10 Thread wenyi,xie via groups.io
To keep the declaration same with definition, remove the last optional
in declaration of WakeUpAP.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Wenyi Xie 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 7d84a56fbc51..f8c52426dd5f 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -477,7 +477,7 @@ WakeUpAP (
   IN UINTN ProcessorNumber,
   IN EFI_AP_PROCEDURE  Procedure   OPTIONAL,
   IN VOID  *ProcedureArgument  OPTIONAL,
-  IN BOOLEAN   WakeUpDisabledAps   OPTIONAL
+  IN BOOLEAN   WakeUpDisabledAps
   );
 
 /**
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87401): https://edk2.groups.io/g/devel/message/87401
Mute This Topic: https://groups.io/mt/89682107/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] UefiCpuPkg/MpInitLib:remove optional in declaration

2022-03-10 Thread wenyi,xie via groups.io
Main Changes :
1.Remove suffix optional in declaration of WakeUpAP to keep declaration same 
with definition.

Wenyi Xie (1):
  UefiCpuPkg/MpInitLib:remove optional in declaration

 UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87400): https://edk2.groups.io/g/devel/message/87400
Mute This Topic: https://groups.io/mt/89682106/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 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify status check

2022-01-20 Thread wenyi,xie via groups.io


On 2022/1/20 10:30, Chang, Abner (HPS SW/FW Technologist) wrote:
> Hi Wenyi,
> Could you please create PR for this change? So we can have core CI on this 
> patch and I can also merge this patch later when the core CI is finished 
> successfully.
> Just send me the link to PR once you create it.
> 

Sure, here's the link.
https://github.com/tianocore/edk2/pull/2429

Thanks
Wenyi

> Thanks
> Abner
> --
> *From:* xiewenyi (A) 
> *Sent:* Wednesday, January 19, 2022 3:39 PM
> *To:* Chang, Abner (HPS SW/FW Technologist) ; 
> devel@edk2.groups.io ; Wang, Nickle (Server BIOS) 
> 
> *Cc:* songdongku...@huawei.com 
> *Subject:* Re: [PATCH EDK2 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify 
> status check
>  
> 
> 
> On 2022/1/19 15:29, Chang, Abner (HPS SW/FW Technologist) wrote:
>> Hi Wenyi,
>> May I know what is the problem you encountered and what environment causes 
>> the issue? Is that under edk2 emulation or the real Redfish service?
>> 
> Hi Abner,
> I didn't encounter any issue and there's no functional change in this patch, 
> just try to simplify the code. Please review whether it's OK or not.
> 
> Thanks
> Wenyi
>> Thanks
>> Abner
>> --
>> *From:* Wenyi Xie 
>> *Sent:* Wednesday, January 19, 2022 2:12 PM
>> *To:* devel@edk2.groups.io ; Chang, Abner (HPS SW/FW 
>> Technologist) ; Wang, Nickle (Server BIOS) 
>> 
>> *Cc:* songdongku...@huawei.com ; 
>> xiewen...@huawei.com 
>> *Subject:* [PATCH EDK2 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify status 
>> check
>>  
>> Main Changes :
>> 1.Remove redundant if statement.
>> 
>> Wenyi Xie (1):
>>   RedfishPkg/RedfishRestExDxe:Simplify status check
>> 
>>  RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c | 38 +---
>>  1 file changed, 17 insertions(+), 21 deletions(-)
>> 
>> -- 
>> 2.20.1.windows.1
>> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85864): https://edk2.groups.io/g/devel/message/85864
Mute This Topic: https://groups.io/mt/88529321/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 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify status check

2022-01-18 Thread wenyi,xie via groups.io


On 2022/1/19 15:29, Chang, Abner (HPS SW/FW Technologist) wrote:
> Hi Wenyi,
> May I know what is the problem you encountered and what environment causes 
> the issue? Is that under edk2 emulation or the real Redfish service?
> 
Hi Abner,
I didn't encounter any issue and there's no functional change in this patch, 
just try to simplify the code. Please review whether it's OK or not.

Thanks
Wenyi
> Thanks
> Abner
> --
> *From:* Wenyi Xie 
> *Sent:* Wednesday, January 19, 2022 2:12 PM
> *To:* devel@edk2.groups.io ; Chang, Abner (HPS SW/FW 
> Technologist) ; Wang, Nickle (Server BIOS) 
> 
> *Cc:* songdongku...@huawei.com ; 
> xiewen...@huawei.com 
> *Subject:* [PATCH EDK2 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify status 
> check
>  
> Main Changes :
> 1.Remove redundant if statement.
> 
> Wenyi Xie (1):
>   RedfishPkg/RedfishRestExDxe:Simplify status check
> 
>  RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c | 38 +---
>  1 file changed, 17 insertions(+), 21 deletions(-)
> 
> -- 
> 2.20.1.windows.1
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85807): https://edk2.groups.io/g/devel/message/85807
Mute This Topic: https://groups.io/mt/88529321/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] RedfishPkg/RedfishRestExDxe:Simplify status check

2022-01-18 Thread wenyi,xie via groups.io
Main Changes :
1.Remove redundant if statement.

Wenyi Xie (1):
  RedfishPkg/RedfishRestExDxe:Simplify status check

 RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c | 38 +---
 1 file changed, 17 insertions(+), 21 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85803): https://edk2.groups.io/g/devel/message/85803
Mute This Topic: https://groups.io/mt/88529321/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] RedfishPkg/RedfishRestExDxe:Simplify status check

2022-01-18 Thread wenyi,xie via groups.io
Remove redundant determine statements.
No functional change.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Wenyi Xie 
---
 RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c | 38 +---
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c 
b/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c
index eb1d8b8fa236..ba0a42097b92 100644
--- a/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c
+++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c
@@ -44,7 +44,7 @@ ResetHttpTslSession (
 }
 
 /**
-  This function check
+  This function check Http receive status
 
   @param[in]  Instance Pointer to EFI_REST_EX_PROTOCOL instance 
for a particular
REST service.
@@ -67,37 +67,33 @@ RedfishCheckHttpReceiveStatus (
 
   if (!EFI_ERROR (HttpIoReceiveStatus)) {
 ReturnStatus = EFI_SUCCESS;
-  } else if (EFI_ERROR (HttpIoReceiveStatus) && (HttpIoReceiveStatus != 
EFI_CONNECTION_FIN)) {
+  } else if (HttpIoReceiveStatus != EFI_CONNECTION_FIN) {
 if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY) == 0) {
   DEBUG ((DEBUG_ERROR, "%a: TCP error, reset HTTP session.\n", 
__FUNCTION__));
   Instance->Flags |= RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY;
   gBS->Stall (500);
   Status = ResetHttpTslSession (Instance);
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));
-ReturnStatus = EFI_DEVICE_ERROR;
-  } else {
+  if (!EFI_ERROR (Status)) {
 return EFI_NOT_READY;
   }
-} else {
-  ReturnStatus = EFI_DEVICE_ERROR;
+  DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));
 }
+
+ReturnStatus = EFI_DEVICE_ERROR;
   } else {
-if (HttpIoReceiveStatus == EFI_CONNECTION_FIN) {
-  if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {
-DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a 
new TLS session.\n", __FUNCTION__));
-ReturnStatus = EFI_DEVICE_ERROR;
-  }
-
-  Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;
-  Status   = ResetHttpTslSession (Instance);
-  if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));
-ReturnStatus = EFI_DEVICE_ERROR;
-  }
+if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {
+  DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new 
TLS session.\n", __FUNCTION__));
+  ReturnStatus = EFI_DEVICE_ERROR;
+}
 
-  return EFI_NOT_READY;
+Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;
+Status   = ResetHttpTslSession (Instance);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__));
+  ReturnStatus = EFI_DEVICE_ERROR;
 }
+
+return EFI_NOT_READY;
   }
 
   //
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85802): https://edk2.groups.io/g/devel/message/85802
Mute This Topic: https://groups.io/mt/88529319/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/PciBucDxe:Fix issue when initial SR-IVO

2022-01-14 Thread wenyi,xie via groups.io
Reference:https://bugzilla.tianocore.org/show_bug.cgi?id=3804

When calculating SR-IOV reserve bus in function CreatePciIoDevice(),
there are two points may have problem.
LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
PciIoDevice->ReservedBusNum =
(UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus + 1);

The first is that if the value of PciIoDevice->InitialVFs is 0, it will
cause overflow, it's better to check InitialVFs before used.
The second is that if number of bus is not enough for all PF and still
allocate bus for VF, it will lead to PCI enumerating failure.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 9251388bc268..a4d1db534276 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -2402,12 +2402,12 @@ CreatePciIoDevice (
   // Calculate LastVF
   //
   PFRid  = EFI_PCI_RID (Bus, Device, Func);
-  LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * 
VFStride;
+  LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs == 0 ? 0 : 
PciIoDevice->InitialVFs - 1) * VFStride;
 
   //
   // Calculate ReservedBusNum for this PF
   //
-  PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus 
+ 1);
+  PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - 
Bus);
 
   DEBUG ((
 DEBUG_INFO,
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85712): https://edk2.groups.io/g/devel/message/85712
Mute This Topic: https://groups.io/mt/88417561/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/PciBucDxe:Fix issue when initial SR-IVO

2022-01-14 Thread wenyi,xie via groups.io
Main Changes :
1.Add check before using InitialVFs.
2.Don't allocate bus for VF.

Wenyi Xie (1):
  MdeModulePkg/PciBucDxe:Fix issue when initial SR-IVO

 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85711): https://edk2.groups.io/g/devel/message/85711
Mute This Topic: https://groups.io/mt/88417560/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH edk2-platforms v1 03/10] Platform/ARM: Modify duplicated GUID in ArmVExpressLibSec

2021-12-20 Thread wenyi,xie via groups.io



On 2021/12/18 0:39, Sami Mujawar wrote:
> Hi Ard,
> 
> 
> On 17/12/2021, 16:34, "Ard Biesheuvel"  wrote:
> 
> On Fri, 17 Dec 2021 at 17:30, Sami Mujawar  wrote:
> >
> > Hi Leif, Ard, Wenyi,
> >
> > Is it possible to review and provde feedback for this change, please?
> >

Sorry to reply late, it's OK to update the GUID in ArmPlatformLibSec.inf.

Regards
Wenyi
> 
> I agree that this should be resolved, and I don't think it matters
> which one we change. The INF GUIDs of libraries are never used anyway,
> as far as I know.
> In that case I will update this patch to modify the ArmVExpressLibRTSM 
> version.
> 
> Regards,
> 
> Sami Mujawar
> 
> >
> >
> > On 17/12/2021 02:15 PM, Pierre Gondois wrote:
> > > Hi Sami,
> > >
> > > You are correct, as stated in 
> Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf:
> > >
> > > "Based on the files under 
> ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/"
> > >
> > > Thanks for updating the commit,
> > >
> > > Regards,
> > >
> > > Pierre
> > >
> > >
> > >
> > > On 12/17/21 2:59 PM, Sami Mujawar wrote:
> > >> Hi Pierre,
> > >>
> > >> Please find my response inline marked [SAMI].
> > >>
> > >> Regards,
> > >>
> > >> Sami Mujawar
> > >>
> > >>
> > >> On 24/11/2021 04:23 PM, pierre.gond...@arm.com wrote:
> > >>> From: Pierre Gondois 
> > >>>
> > >>> The two following modules have the same GUID:
> > >>> - Platform/ARM/VExpressPkg/Library/
> > >>> ArmVExpressLibRTSM/ArmVExpressLibSec.inf
> > >>> - Silicon/Hisilicon/Library/
> > >>> ArmPlatformLibHisilicon/ArmPlatformLibSec.inf
> > >>>
> > >>> The inf file in the Platform/ARM/ folder is based
> > >>> on the one in Silicon/Hisilicon/. Modify the one
> > >> [SAMI] I believe you want to say the inf file in 
> Silicon/Hisilicon/is based on the one in Platform/ARM and therefore you are 
> modifying the inf file in Silicon/Hisilicon.
> > >> Please let me know if this is correct, and I will update this in the 
> commit message before merging the change.
> > >> [/SAMI]
> > >>> in the Silicon/Hisilicon/.
> > >>>
> > >>> Signed-off-by: Pierre Gondois 
> > >>> ---
> > >>>.../Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf   
> | 2 +-
> > >>>1 file changed, 1 insertion(+), 1 deletion(-)
> > >>>
> > >>> diff --git 
> a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf 
> b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf
> > >>> index ac587deedfd8..7fd7b5183e5b 100644
> > >>> --- 
> a/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf
> > >>> +++ 
> b/Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLibSec.inf
> > >>> @@ -12,7 +12,7 @@
> > >>>[Defines]
> > >>>  INF_VERSION= 0x00010005
> > >>>  BASE_NAME  = ArmPlatformLibSec
> > >>> -  FILE_GUID  = 
> a79eed97-4b98-4974-9690-37b32d6a5b56
> > >>> +  FILE_GUID  = 
> ABF3B82B-892F-438F-901F-F148C2DF89E6
> > >>>  MODULE_TYPE= BASE
> > >>>  VERSION_STRING = 1.0
> > >>>  LIBRARY_CLASS  = ArmPlatformLib
> > >>> --
> > >>> 2.25.1
> >
> > IMPORTANT NOTICE: The contents of this email and any attachments are 
> confidential and may also be privileged. If you are not the intended 
> recipient, please notify the sender immediately and do not disclose the 
> contents to any other person, use it for any purpose, or store or copy the 
> information in any medium. Thank you.
> >
> >
> > 
> >
> >
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#85105): https://edk2.groups.io/g/devel/message/85105
Mute This Topic: https://groups.io/mt/87284488/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FrameBufferBltLib:Add unit test

2021-12-01 Thread wenyi,xie via groups.io
Add unit test for FrameBufferBltLib.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Zhichao Gao 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc
|   5 +
 MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf 
|  32 
 MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.c   
| 174 
 MdeModulePkg/MdeModulePkg.ci.yaml 
|   1 +
 4 files changed, 212 insertions(+)

diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index c9ec835df65d..e08bf7d95fe7 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -47,3 +47,8 @@ [Components]
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  
MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf {
+
+  
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
+  }
diff --git 
a/MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf 
b/MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf
new file mode 100644
index ..de32f2d93ba6
--- /dev/null
+++ 
b/MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf
@@ -0,0 +1,32 @@
+## @file
+# This is a unit test for the FrameBufferBltLib.
+#
+# Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION = 0x00010017
+  BASE_NAME   = FrameBufferBltLibUnitTest
+  FILE_GUID   = E9E25A30-D34A-8E09-F9D1-40249AB39778
+  VERSION_STRING  = 1.0
+  MODULE_TYPE = HOST_APPLICATION
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  FrameBufferBltLibUnitTest.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]
+  UnitTestLib
+  DebugLib
+  FrameBufferBltLib
diff --git 
a/MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.c 
b/MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.c
new file mode 100644
index ..0d157f55cb69
--- /dev/null
+++ 
b/MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.c
@@ -0,0 +1,174 @@
+/** @file
+  Unit tests of the FrameBufferBltLib
+
+  Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define UNIT_TEST_APP_NAME"FrameBufferBltLib Unit Tests"
+#define UNIT_TEST_APP_VERSION "1.0"
+
+struct FRAME_BUFFER_CONFIGURE {
+  UINT32  PixelsPerScanLine;
+  UINT32  BytesPerPixel;
+  UINT32  Width;
+  UINT32  Height;
+  UINT8   *FrameBuffer;
+  EFI_GRAPHICS_PIXEL_FORMAT   PixelFormat;
+  EFI_PIXEL_BITMASK   PixelMasks;
+  INT8PixelShl[4]; // R-G-B-Rsvd
+  INT8PixelShr[4]; // R-G-B-Rsvd
+  UINT8   LineBuffer[0];
+};
+
+typedef struct {
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   Information;
+  RETURN_STATUS  ExpectedResult;
+} BASIC_TEST_CONTEXT;
+
+static BASIC_TEST_CONTEXT mBasicTestTrue1 = {
+  {0, 1920, 1080, PixelRedGreenBlueReserved8BitPerColor, {0, 0, 0, 0}, 1920},
+  RETURN_SUCCESS
+};
+
+static BASIC_TEST_CONTEXT mBasicTestFalse1 = {
+  {0, 1920, 1080, PixelRedGreenBlueReserved8BitPerColor, {0, 0, 0, 0}, 1080},
+  RETURN_UNSUPPORTED
+};
+
+/**
+  Unit test for FrameBufferBltConfigure () API of the FrameBufferBltLib.
+
+  @param[in]  Context[Optional] An optional parameter that enables:
+ 1) test-case reuse with varied parameters and
+ 2) test-case re-entry for Target tests that need a
+ reboot.  This parameter is a VOID* and it is the
+ responsibility of the test author to ensure that the
+ contents are well understood by all test cases that 
may
+ consume it.
+
+  @retval  UNIT_TEST_PASSED The Unit test has completed and the 
test
+case was successful.
+  @retval  UNIT_TEST_ERROR_TEST_FAILED  A test case assertion has failed.
+**/
+UNIT_TEST_STATUS
+EFIAPI
+FrameBufferBltConfigureTest (
+  IN UNIT_TEST_CONTEXT  Context
+  )
+{
+  RETURN_STATUS  Result;
+  

[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/FrameBufferBltLib:Add unit test

2021-12-01 Thread wenyi,xie via groups.io
Main Changes :
1.Add unit test for function FrameBufferBltConfigure.

Wenyi Xie (1):
  MdeModulePkg/FrameBufferBltLib:Add unit test

 MdeModulePkg/Test/MdeModulePkgHostTest.dsc
|   5 +
 MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf 
|  32 
 MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.c   
| 174 
 MdeModulePkg/MdeModulePkg.ci.yaml 
|   1 +
 4 files changed, 212 insertions(+)
 create mode 100644 
MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.inf
 create mode 100644 
MdeModulePkg/Library/FrameBufferBltLib/UnitTest/FrameBufferBltLibUnitTest.c

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84200): https://edk2.groups.io/g/devel/message/84200
Mute This Topic: https://groups.io/mt/87423992/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/DxeCorePerformanceLib:Variable Initial

2021-11-29 Thread wenyi,xie via groups.io
SmmBootRecordDataSize is initialized in InternalGetSmmPerData,
but this function may fail. so to avoid using SmmBootRecordDataSize
without intialization, set it to 0 at first.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 532b3f8c90e2..f8778c25188a 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -1373,6 +1373,8 @@ UpdateBootPerformanceTable (
   UINTNAppendSize;
   UINT8*FirmwarePerformanceTablePtr;
 
+  SmmBootRecordDataSize = 0;
+
   //
   // Get SMM performance data.
   //
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84144): https://edk2.groups.io/g/devel/message/84144
Mute This Topic: https://groups.io/mt/87393967/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/DxeCorePerformanceLib:Variable Initial

2021-11-29 Thread wenyi,xie via groups.io
Main Changes :
1.Initiallize SmmBootRecordDataSize to 0.

Wenyi Xie (1):
  MdeModulePkg/DxeCorePerformanceLib:Variable Initial

 MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84143): https://edk2.groups.io/g/devel/message/84143
Mute This Topic: https://groups.io/mt/87393966/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] CryptoPkg/BaseCryptLib: Support PEM certification

2021-11-09 Thread wenyi,xie via groups.io
Main Changes :
1.add support for PEM-encoded certificate.


Wenyi Xie (1):
  CryptoPkg/BaseCryptLib: Support PEM certification

 CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c | 33 ++--
 1 file changed, 31 insertions(+), 2 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83511): https://edk2.groups.io/g/devel/message/83511
Mute This Topic: https://groups.io/mt/86930150/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] CryptoPkg/BaseCryptLib: Support PEM certification

2021-11-09 Thread wenyi,xie via groups.io
As PEM-encoded certificate is also necessary, add
support for PEM-encoded certificate in
X509ConstructCertificate.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Xiaoyu Lu 
Cc: Guomin Jiang 
Signed-off-by: Jiaxia Xu 
Signed-off-by: Wenyi Xie 
---
 CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c | 33 ++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c 
b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
index b1393a89c5ab..db122cd574fa 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
@@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "InternalCryptLib.h"
 #include 
 #include 
+#include 
 
 /**
   Construct a X509 object from DER-encoded certificate data.
@@ -33,7 +34,12 @@ X509ConstructCertificate (
   )
 {
   X509 *X509Cert;
+  BIO  *BioCert;
   CONST UINT8  *Temp;
+  BOOLEAN  CertFlag;
+
+  BioCert   = NULL;
+  CertFlag  = TRUE;
 
   //
   // Check input parameters.
@@ -48,12 +54,35 @@ X509ConstructCertificate (
   Temp = Cert;
   X509Cert = d2i_X509 (NULL, , (long) CertSize);
   if (X509Cert == NULL) {
-return FALSE;
+BioCert = BIO_new (BIO_s_mem ());
+if (BioCert == NULL) {
+  CertFlag = FALSE;
+  goto ON_EXIT;
+}
+
+if (BIO_write (BioCert, Temp, (UINT32) CertSize) <= 0) {
+  CertFlag = FALSE;
+  goto ON_EXIT;
+}
+
+//
+// Read PEM-encoded X509 Certificate and Construct X509 object.
+//
+X509Cert = PEM_read_bio_X509 (BioCert, NULL, NULL, NULL);
+if (X509Cert == NULL) {
+  CertFlag = FALSE;
+  goto ON_EXIT;
+}
   }
 
   *SingleX509Cert = (UINT8 *) X509Cert;
 
-  return TRUE;
+ON_EXIT:
+  if (BioCert != NULL) {
+BIO_free (BioCert);
+  }
+
+  return CertFlag;
 }
 
 /**
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83510): https://edk2.groups.io/g/devel/message/83510
Mute This Topic: https://groups.io/mt/86930148/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] EmbeddedPkg:Fix compiler warning

2021-10-12 Thread wenyi,xie via groups.io
Fixes the following compiler warning in VS2019.

edk2\EmbeddedPkg\Library\GdbSerialDebugPortLib\GdbSerialDebugPortLib.c(127):
error C2220: the following warning is treated as an error
edk2\EmbeddedPkg\Library\GdbSerialDebugPortLib\GdbSerialDebugPortLib.c(127):
warning C4244: 'function': conversion from 'UINTN' to 'UINT32', possible
loss of data

edk2\EmbeddedPkg\Library\PrePiLib\FwVol.c(347): error C2220: the following
warning is treated as an error
edk2\EmbeddedPkg\Library\PrePiLib\FwVol.c(347): warning C4244: 'function':
conversion from 'UINTN' to 'UINT32', possible loss of data

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Abner Chang 
Cc: Daniel Schaefer 
Signed-off-by: Wenyi Xie 
---
 EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c | 2 +-
 EmbeddedPkg/Library/PrePiLib/FwVol.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c 
b/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c
index d2bafcf69b60..0f50a8b64191 100644
--- a/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c
+++ b/EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c
@@ -18,7 +18,7 @@
 
 
 EFI_DEBUGPORT_PROTOCOL  *gDebugPort = NULL;
-UINTN   gTimeOut = 0;
+UINT32  gTimeOut = 0;
 
 /**
   The constructor function initializes the UART.
diff --git a/EmbeddedPkg/Library/PrePiLib/FwVol.c 
b/EmbeddedPkg/Library/PrePiLib/FwVol.c
index 881506edddaf..46ea5f733f60 100644
--- a/EmbeddedPkg/Library/PrePiLib/FwVol.c
+++ b/EmbeddedPkg/Library/PrePiLib/FwVol.c
@@ -298,7 +298,7 @@ FfsProcessSection (
   UINT16  SectionAttribute;
   UINT32  AuthenticationStatus;
   CHAR8   *CompressedData;
-  UINTN   CompressedDataLength;
+  UINT32  CompressedDataLength;
 
 
   *OutputBuffer = NULL;
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81809): https://edk2.groups.io/g/devel/message/81809
Mute This Topic: https://groups.io/mt/86257559/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] EmbeddedPkg:Fix compiler warning

2021-10-12 Thread wenyi,xie via groups.io
Main Changes :
1.Changing definition of gTimeOut from UINTN to UINT32
2.Changing definition of CompressedDataLength from UINTN to UINT32

Wenyi Xie (1):
  EmbeddedPkg:Fix compiler warning

 EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.c | 2 +-
 EmbeddedPkg/Library/PrePiLib/FwVol.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81808): https://edk2.groups.io/g/devel/message/81808
Mute This Topic: https://groups.io/mt/86257558/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-discuss] a question about X509 flag

2021-09-27 Thread wenyi,xie via groups.io



On 2021/9/27 17:21, Marvin Häuser wrote:
> Hey Wenyi,
> 
> Sorry, I cannot help with the time one, but "partial chain" is how virtually 
> any other crypto-solution works out-of-the-box. Basically there is a 
> disagreement about what defines a root certificate, and while some think it 
> is the OpenSSL default of requiring a self-signed certificate for root, many 
> people including myself strongly disagree and do not believe it follows from 
> the RFCs. I'm not aware of any bad security implications of either model. So, 
> this merely allows any certificate in the chain (the top one may be 
> self-signed *if* it even is a certificate, it may just as well be a trusted 
> public key for all we know) to be eligible to be added to the trust store and 
> root a trust chain.
> 

Thank you for your explanation in detail, it helps a lot. 
X509_V_FLAG_PARTIAL_CHAIN is clear to me now.

Wenyi

> Further reading: https://github.com/openssl/openssl/issues/7871
> 
> Cc CryptoPkg maintainers and edk2-devel for further feedback
> 
> Best regards,
> Marvin
> 
> On 27/09/2021 10:53, wenyi,xie via groups.io wrote:
>> Hello,
>>
>> I have a question about flag set in X509_STORE. Does anyone know why need to 
>> set flags X509_V_FLAG_PARTIAL_CHAIN and X509_V_FLAG_NO_CHECK_TIME to 
>> X509Store in TlsNew() (CryptoPkg\Library\TlsLib\TlsInit.c)
>>
>> Thanks
>> Wenyi
>>
>>
>> 
>>
>>
> 
> .


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81170): https://edk2.groups.io/g/devel/message/81170
Mute This Topic: https://groups.io/mt/85896280/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] UefiCpuPkg/CpuMpPei: Remove MigrateGdt declaration

2021-09-22 Thread wenyi,xie via groups.io
The definition of MigrateGdt has been moved to SecMain since
commit f6ec1dd3, so also remove declaration of MigrateGdt left
in CpuMpPei.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: Wenyi Xie 
---
 UefiCpuPkg/CpuMpPei/CpuMpPei.h | 12 
 1 file changed, 12 deletions(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h b/UefiCpuPkg/CpuMpPei/CpuMpPei.h
index c6870656ca64..1dac4e2eb8b1 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h
+++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h
@@ -398,18 +398,6 @@ SecPlatformInformation2 (
  OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
   );
 
-/**
-  Migrates the Global Descriptor Table (GDT) to permanent memory.
-
-  @retval   EFI_SUCCESS   The GDT was migrated successfully.
-  @retval   EFI_OUT_OF_RESOURCES  The GDT could not be migrated due to lack of 
available memory.
-
-**/
-EFI_STATUS
-MigrateGdt (
-  VOID
-  );
-
 /**
   Initializes MP and exceptions handlers.
 
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81010): https://edk2.groups.io/g/devel/message/81010
Mute This Topic: https://groups.io/mt/85806713/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] UefiCpuPkg/CpuMpPei: Remove MigrateGdt declaration

2021-09-22 Thread wenyi,xie via groups.io
Main Changes :
1.remove declaration of MigrateGdt

Wenyi Xie (1):
  UefiCpuPkg/CpuMpPei: Remove MigrateGdt declaration

 UefiCpuPkg/CpuMpPei/CpuMpPei.h | 12 
 1 file changed, 12 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81011): https://edk2.groups.io/g/devel/message/81011
Mute This Topic: https://groups.io/mt/85806714/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/XhciDxe: Decreasing stuck time

2021-08-30 Thread wenyi,xie via groups.io
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3571

After entering setup browser, if frequently plug and unplug usb
device, the browser may be stuck for a few minutes, and user
can not do any operation during that time.
The root cause is that usually it needs 0.5s to create connection,
and this process will be possibly interrupted when frequently
plug and unplug the usb device. Then USBMassStorageDxe and
XhciDxe will retry and it made the browser stucked.

To decrease the stuck time, add a new flag DisConnect to
struct UsbDevContext, if the device is not connected, no need to
send XhcBulkTransfer, XhcAsyncInterruptTransfer or
XhcSyncInterruptTransfer.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Liming Gao 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h  |  46 
 MdeModulePkg/Bus/Pci/XhciDxe/XhciBus.h   | 229 
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c  | 130 ---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 111 ++
 4 files changed, 488 insertions(+), 28 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h 
b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
index 3285eb8798c0..43552cb7d470 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
@@ -191,6 +191,10 @@ struct _USB_DEV_CONTEXT {
   // Every interface has an active AlternateSetting.
   //
   UINT8 *ActiveAlternateSetting;
+  //
+  // Whether the usb device status is connected or not.
+  //
+  UINT8 DisConnect;
 };
 
 struct _USB_XHCI_INSTANCE {
@@ -508,6 +512,48 @@ XhcControlTransfer (
   OUTUINT32  *TransferResult
   );
 
+/**
+  Submits control transfer to a target USB device.
+
+  @param  This  This EFI_USB2_HC_PROTOCOL instance.
+  @param  DeviceAddress The target device address.
+  @param  DeviceSpeed   Target device speed.
+  @param  MaximumPacketLength   Maximum packet size the default control 
transfer
+endpoint is capable of sending or receiving.
+  @param  Request   USB device request to send.
+  @param  TransferDirection Specifies the data direction for the data stage
+  @param  Data  Data buffer to be transmitted or received from 
USB
+device.
+  @param  DataLengthThe size (in bytes) of the data buffer.
+  @param  Timeout   Indicates the maximum timeout, in millisecond.
+  @param  TranslatorTransaction translator to be used by this 
device.
+  @param  TransferResultReturn the result of this control transfer.
+  @param  IsClear   The flag used to determine whether clear the 
port or not
+
+  @retval EFI_SUCCESS   Transfer was completed successfully.
+  @retval EFI_OUT_OF_RESOURCES  The transfer failed due to lack of resources.
+  @retval EFI_INVALID_PARAMETER Some parameters are invalid.
+  @retval EFI_TIMEOUT   Transfer failed due to timeout.
+  @retval EFI_DEVICE_ERROR  Transfer failed due to host controller or 
device error.
+
+**/
+EFI_STATUS
+EFIAPI
+InnerXhcControlTransfer (
+  IN EFI_USB2_HC_PROTOCOL*This,
+  IN UINT8   DeviceAddress,
+  IN UINT8   DeviceSpeed,
+  IN UINTN   MaximumPacketLength,
+  IN EFI_USB_DEVICE_REQUEST  *Request,
+  IN EFI_USB_DATA_DIRECTION  TransferDirection,
+  IN OUT VOID*Data,
+  IN OUT UINTN   *DataLength,
+  IN UINTN   Timeout,
+  IN EFI_USB2_HC_TRANSACTION_TRANSLATOR  *Translator,
+  OUTUINT32  *TransferResult,
+  IN UINT8   IsClear
+  );
+
 /**
   Submits bulk transfer to a bulk endpoint of a USB device.
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciBus.h 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciBus.h
new file mode 100644
index ..8b2591b23bd7
--- /dev/null
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciBus.h
@@ -0,0 +1,229 @@
+/** @file
+  Only used by Xhc controller to avoid U disk plug-in/out delay
+Copyright (c) 2019 - 2021, Huawei Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#ifndef _EFI_XHCI_BUS_H_
+#define _EFI_XHCI_BUS_H_
+
+#include 
+#include 
+#include 
+#include 
+
+#define USB_MAX_LANG_ID16
+#define USB_MAX_INTERFACE  16
+#define USB_MAX_DEVICES255
+#define USB_MAX_INTERFACE_SETTING  256
+//
+// Hub class control transfer target
+//
+#define USB_HUB_TARGET_PORT3
+#define USB_HUB_REQ_GET_STATUS 0
+#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 500
+
+typedef struct _USB_DEVICE USB_DEVICE;
+typedef struct _USB_INTERFACE  USB_INTERFACE;
+typedef struct _USB_BUSUSB_BUS;
+typedef struct 

[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/XhciDxe: Decreasing stuck time

2021-08-30 Thread wenyi,xie via groups.io
Main Changes :
1.add a new flag DisConnect to struct UsbDevContext to determine whether the 
device is connected or not
2.add new function XhcGetHubDevice to check port status

Wenyi Xie (1):
  MdeModulePkg/XhciDxe: Decreasing stuck time

 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h  |  46 
 MdeModulePkg/Bus/Pci/XhciDxe/XhciBus.h   | 229 
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c  | 130 ---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 111 ++
 4 files changed, 488 insertions(+), 28 deletions(-)
 create mode 100644 MdeModulePkg/Bus/Pci/XhciDxe/XhciBus.h

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79949): https://edk2.groups.io/g/devel/message/79949
Mute This Topic: https://groups.io/mt/85248416/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] BaseTools: Remove GCC option -x

2021-08-27 Thread wenyi,xie via groups.io
It seems no need to add option -x c in GCC and it
will cause compiling warning "-x c after last input
file has no effect"

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Wenyi Xie 
---
 BaseTools/Conf/build_rule.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 3add1029f276..c1acd802cb14 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -485,7 +485,7 @@
 
 
 "$(ASLCC)" $(DEPS_FLAGS) -c -o 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) 
$(DEPS_FLAGS) $(INC) ${src}
-"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) 
$(ASLCC_FLAGS)
+"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(GENFW_FLAGS)
 
 
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79888): https://edk2.groups.io/g/devel/message/79888
Mute This Topic: https://groups.io/mt/85181777/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] BaseTools: Remove GCC option -x

2021-08-27 Thread wenyi,xie via groups.io
Main Changes :
1.remove GCC option -x c.

Wenyi Xie (1):
  BaseTools: Remove GCC option -x

 BaseTools/Conf/build_rule.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79887): https://edk2.groups.io/g/devel/message/79887
Mute This Topic: https://groups.io/mt/85181776/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/HiiDatabaseDxe:remove dead code block

2021-08-25 Thread wenyi,xie via groups.io
As the if statement outside has confirmed that
BlockData->Name == NULL, so the if statement inside
is always false.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Dandan Bi 
Cc: Eric Dong 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index d492b769d51c..17a914208c6d 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -2871,9 +2871,6 @@ ParseIfrData (
 //
 if ((BlockData->Name == NULL) && ((BlockData->Offset + 
BlockData->Width) > VarStorageData->Size)) {
   Status = EFI_INVALID_PARAMETER;
-  if (BlockData->Name != NULL) {
-FreePool (BlockData->Name);
-  }
   FreePool (BlockData);
   goto Done;
 }
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79816): https://edk2.groups.io/g/devel/message/79816
Mute This Topic: https://groups.io/mt/85151741/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/HiiDatabaseDxe:remove dead code

2021-08-25 Thread wenyi,xie via groups.io
Main Changes :
1.remove dead code block.

Wenyi Xie (1):
  MdeModulePkg/HiiDatabaseDxe:remove dead code block

 MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 3 ---
 1 file changed, 3 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79815): https://edk2.groups.io/g/devel/message/79815
Mute This Topic: https://groups.io/mt/85151738/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v3 0/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-08-11 Thread wenyi,xie via groups.io
Main Changes since v2:
1.Add define UefiSortLibUnitTestMain for main.
2.Add UefiSortLibUnitTestMain to ecc exception list to avoid ecc error.

Wenyi Xie (1):
  MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   6 +
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf |  32 +++
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c   | 207 

 MdeModulePkg/MdeModulePkg.ci.yaml |   1 +
 4 files changed, 246 insertions(+)
 create mode 100644 
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
 create mode 100644 
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79090): https://edk2.groups.io/g/devel/message/79090
Mute This Topic: https://groups.io/mt/84811246/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v3 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-08-11 Thread wenyi,xie via groups.io
Adding two unit test case for UefiSortLib. One is a test on
sorting an array of UINT32 by using PerformQuickSort, another
is a test on comparing the same buffer by using StringCompare.
Add 'main' function name to ECC exception list to avoid ECC
error.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   6 +
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf |  32 +++
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c   | 207 

 MdeModulePkg/MdeModulePkg.ci.yaml |   1 +
 4 files changed, 246 insertions(+)

diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index 4da4692c8451..c9ec835df65d 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -41,3 +41,9 @@ [Components]
 
   
gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|TRUE
   }
+
+  MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf {
+
+  UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  }
diff --git a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf 
b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
new file mode 100644
index ..85d8dcd69619
--- /dev/null
+++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
@@ -0,0 +1,32 @@
+## @file
+# This is a unit test for the UefiSortLib.
+#
+# Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION = 0x00010017
+  BASE_NAME   = UefiSortLibUnitTest
+  FILE_GUID   = 271337A3-0D79-BA3E-BC03-714E518E3B1B
+  VERSION_STRING  = 1.0
+  MODULE_TYPE = HOST_APPLICATION
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  UefiSortLibUnitTest.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]
+  UnitTestLib
+  DebugLib
+  UefiSortLib
diff --git a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c 
b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
new file mode 100644
index ..4f44a02c5b5d
--- /dev/null
+++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
@@ -0,0 +1,207 @@
+/** @file
+  Unit tests of the UefiSortLib
+
+  Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define UNIT_TEST_APP_NAME"UefiSortLib Unit Tests"
+#define UNIT_TEST_APP_VERSION "1.0"
+
+#define TEST_ARRAY_SIZE_9 9
+
+/**
+  The function is called by PerformQuickSort to compare int values.
+
+  @param[in] LeftThe pointer to first buffer.
+  @param[in] Right   The pointer to second buffer.
+
+  @retval 0  Buffer1 equal to Buffer2.
+  @return <0 Buffer1 is less than Buffer2.
+  @return >0 Buffer1 is greater than Buffer2.
+
+**/
+INTN
+EFIAPI
+TestCompareFunction (
+  IN CONST VOID *Left,
+  IN CONST VOID *Right
+  )
+{
+  if (*(UINT32*)Right > *(UINT32*)Left) {
+return 1;
+  } else if (*(UINT32*)Right < *(UINT32*)Left) {
+return -1;
+  }
+
+  return 0;
+}
+
+/**
+  Unit test for PerformQuickSort () API of the UefiSortLib.
+
+  @param[in]  Context[Optional] An optional parameter that enables:
+ 1) test-case reuse with varied parameters and
+ 2) test-case re-entry for Target tests that need a
+ reboot.  This parameter is a VOID* and it is the
+ responsibility of the test author to ensure that the
+ contents are well understood by all test cases that 
may
+ consume it.
+
+  @retval  UNIT_TEST_PASSED The Unit test has completed and the 
test
+case was successful.
+  @retval  UNIT_TEST_ERROR_TEST_FAILED  A test case assertion has failed.
+**/
+UNIT_TEST_STATUS
+EFIAPI
+SortUINT32ArrayShouldSucceed (
+  IN UNIT_TEST_CONTEXT  Context
+  )
+{
+  UINTN  TestCount;
+  UINT32 Index;
+  UINT32 TestBuffer[TEST_ARRAY_SIZE_9];
+  UINT32 TestResult[TEST_ARRAY_SIZE_9];
+
+  TestCount = TEST_ARRAY_SIZE_9;
+  for (Index = 0; Index < TEST_ARRAY_SIZE_9; Index++) {
+TestBuffer[Index] = Index + 1;
+TestResult[Index] = TEST_ARRAY_SIZE_9 - Index;
+  }
+
+  PerformQuickSort (TestBuffer, 

Re: [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-08-10 Thread wenyi,xie via groups.io
Hi Wu Hao,

Thank you for your help. I will have a try and send a V3 patch later.

Best Regards,
Wenyi

On 2021/8/11 9:50, Wu, Hao A wrote:
> Seems no help is received so far.
> The approach I can think of is to add this to the ECC exception list defined 
> in file MdeModulePkg.ci.yaml.
> 
> Hello Wenyi,
> 
> Could you help to check if the code changes in 
> https://github.com/tianocore/edk2/pull/1883 works for you?
> If so, could you update a V3 version of the patch? Thanks in advance.
> 
> Best Regards,
> Hao Wu
> 
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of Wu, Hao
>> A
>> Sent: Tuesday, August 10, 2021 12:12 PM
>> To: Kinney, Michael D ; devel@edk2.groups.io;
>> xiewenyi (A) 
>> Cc: songdongku...@huawei.com; Wang, Jian J 
>> Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1]
>> MdeModulePkg/UefiSortLib:Add UefiSortLib unit test
>>
>> Sorry Mike,
>>
>> Do you have advice on how to deal with ECC reporting function naming issue
>> on the 'main' function for unit test cases?
>> So far, I think Wenyi has tried following the same pattern in file
>> MdeModulePkg\Universal\Variable\RuntimeDxe\RuntimeDxeUnitTest\Vari
>> ableLockRequestToLockUnitTest.c:
>>
>> ///
>> /// Avoid ECC error for function name that starts with lower case letter ///
>> #define Main main
>>
>> /**
>>   Standard POSIX C entry point for host based unit test execution.
>>
>>   @param[in] Argc  Number of arguments
>>   @param[in] Argv  Array of pointers to arguments
>>
>>   @retval 0  Success
>>   @retval other  Error
>> **/
>> INT32
>> Main (
>>   IN INT32  Argc,
>>   IN CHAR8  *Argv[]
>>   )
>>
>> But it looks like the ECC checker in the merge test is still complaining.
>>
>> Best Regards,
>> Hao Wu
>>
>>> -Original Message-
>>> From: devel@edk2.groups.io  On Behalf Of Wu,
>> Hao
>>> A
>>> Sent: Wednesday, August 4, 2021 4:24 PM
>>> To: xiewenyi (A) ; Kinney, Michael D
>>> ; devel@edk2.groups.io
>>> Cc: songdongku...@huawei.com; Wang, Jian J 
>>> Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1]
>>> MdeModulePkg/UefiSortLib:Add UefiSortLib unit test
>>>
 -Original Message-
 From: xiewenyi (A) 
 Sent: Wednesday, August 4, 2021 4:05 PM
 To: Wu, Hao A ; devel@edk2.groups.io
 Cc: songdongku...@huawei.com; Wang, Jian J 
 Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1]
 MdeModulePkg/UefiSortLib:Add UefiSortLib unit test



 On 2021/8/2 9:56, Wu, Hao A wrote:
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of
>> Wu, Hao A
>> Sent: Thursday, July 29, 2021 4:26 PM
>> To: Wenyi Xie ; devel@edk2.groups.io;
>> Wang,
>> Jian J 
>> Cc: songdongku...@huawei.com
>> Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1]
>> MdeModulePkg/UefiSortLib:Add UefiSortLib unit test
>>
>>> -Original Message-
>>> From: Wenyi Xie 
>>> Sent: Thursday, July 29, 2021 4:01 PM
>>> To: devel@edk2.groups.io; Wang, Jian J ;
>>> Wu, Hao A 
>>> Cc: songdongku...@huawei.com; xiewen...@huawei.com
>>> Subject: [PATCH EDK2 v2 1/1] MdeModulePkg/UefiSortLib:Add
>>> UefiSortLib unit test
>>>
>>> Adding two unit test case for UefiSortLib. One is a test on
>>> sorting an array of
>>> UINT32 by using PerformQuickSort, another is a test on comparing
>>> the same buffer by using StringCompare.
>>
>>
>> Thanks.
>> Reviewed-by: Hao A Wu 
>
>
> Sorry, I found that there are a couple of coding format style
> check failures
 when merging the patch.
> Could you help to resolve them and then create a test pull request
> on the
 GitHub for verification? Thanks in advance.
> (I think you can take the case under
>
>> MdeModulePkg/Universal/Variable/RuntimeDxe/RuntimeDxeUnitTest/
>>> for
> reference.)
>

 Hi, Wu Hao

 I try to deal with the coding format style check failures, and meet
 a failure which I am not sure how to solve.
 I take the case you told for reference, but still there's a failure
 said the define should be capital letters.
 but if change it to capital letters, there will be another error
 Function name does not follow the rules: 1. First character should
 be upper case 2. Must contain lower case characters 3. No white
 space characters

 #define Main main

 INT32
 Main (
   IN INT32  Argc,
   IN CHAR8  *Argv[]
   )
 {
   UnitTestingEntry ();
   return 0;
 }
>>>
>>>
>>> Hello Mike,
>>>
>>> I saw the below commit:
>>>   SHA-1: dcaa93936591883aa7826eb45ef00416ad82ef08
>>>   * MdeModulePkg/Variable/RuntimeDxe: Add Variable Lock Protocol Unit
>>> Tests has a similar case that should involve the naming of the 'main'
>>> function within the unit test codes.
>>>
>>> I am wondering how the open raised by Wenyi was handled back then.
>>> Do you have suggestions for this case? Thanks in advance.
>>>
>>> Best Regards,
>>> Hao Wu
>>>
>>>

 

Re: [edk2-devel] [PATCH edk2-Platform v1 1/1] Hisilicon:Fix header file issues

2021-08-09 Thread wenyi,xie via groups.io
Hi Leif,

According to your advice, I have changed the name of header to OemHisiMiscLib 
and snet the v2 patch to you. Please help reviewing it when you are free.

Thanks
Wenyi


On 2021/8/4 20:24, Leif Lindholm wrote:
> +Rebecca
> 
> Apologies for slow response, this arrived while I was on holiday.
> 
> On Tue, Jun 22, 2021 at 20:33:25 +0800, wenyi,xie via groups.io wrote:
>> EDK2 has removed header file ArmLibPrivate.h, so need to
>> use ArmLib.h instead. A new file OemMiscLib.h is added
>> to EDK2, its name is same with the header file in
>> Hisilicon\Include and it will being included first. So
>> some undefined issue occured and need to change the order
>> of header files.
> 
> Ugh, oops. Yes. So, we used the Hisilicon Smbios implementation to
> create what is intended to become a fully generic module,
> ArmPkg/Universal/Smbios/, and ended up keeping that header name.
> Sorry about that.
> 
> However, moving around packages to make one identically named file be
> picked over another is not the right solution. Could you possibly
> rename your existing header? OemMiscHisi.h?
> 
> Best Regards,
> 
> Leif
> 
>> Cc: Leif Lindholm 
>> Cc: Ard Biesheuvel 
>> Signed-off-by: Wenyi Xie 
>> ---
>>  Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf   
>>|  2 +-
>>  Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf  
>>|  2 +-
>>  Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf  
>>|  2 +-
>>  Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf  
>>|  2 +-
>>  
>> Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
>>  |  2 +-
>>  Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
>>|  2 +-
>>  Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitDxe.inf   
>>|  2 +-
>>  Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h   
>>| 13 -
>>  Silicon/Hisilicon/Hi1616/Pptt/Pptt.h
>>|  2 +-
>>  Silicon/Hisilicon/Hi1620/Pptt/Pptt.h
>>|  2 +-
>>  10 files changed, 9 insertions(+), 22 deletions(-)
>>
>> diff --git a/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf 
>> b/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
>> index 1f992024acc2..f1b21ae80f3c 100644
>> --- a/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
>> +++ b/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
>> @@ -20,12 +20,12 @@
>>EarlyConfigPeimD03.c
>>  
>>  [Packages]
>> +  Silicon/Hisilicon/HisiPkg.dec
>>MdePkg/MdePkg.dec
>>MdeModulePkg/MdeModulePkg.dec
>>  
>>ArmPkg/ArmPkg.dec
>>Silicon/Hisilicon/HisiliconNonOsi.dec
>> -  Silicon/Hisilicon/HisiPkg.dec
>>  
>>  [LibraryClasses]
>>PeimEntryPoint
>> diff --git 
>> a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf 
>> b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
>> index ab14597d8b75..728b33e85030 100644
>> --- a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
>> +++ b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
>> @@ -21,11 +21,11 @@
>>BoardFeature2PHi1610Strings.uni
>>  
>>  [Packages]
>> +  Silicon/Hisilicon/HisiPkg.dec
>>MdePkg/MdePkg.dec
>>MdeModulePkg/MdeModulePkg.dec
>>ArmPkg/ArmPkg.dec
>>Silicon/Hisilicon/HisiliconNonOsi.dec
>> -  Silicon/Hisilicon/HisiPkg.dec
>>  
>>  [LibraryClasses]
>>BaseMemoryLib
>> diff --git a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf 
>> b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
>> index d471102199ee..8a605b417be8 100644
>> --- a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
>> +++ b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
>> @@ -21,11 +21,11 @@
>>OemMiscLibD05.c
>>  
>>  [Packages]
>> +  Silicon/Hisilicon/HisiPkg.dec
>>ArmPkg/ArmPkg.dec
>>MdeModulePkg/MdeModulePkg.dec
>>MdePkg/MdePkg.dec
>>Silicon/Hisilicon/HisiliconNonOsi.dec
>> -  Silicon/Hisilicon/HisiPkg.dec
>>  
>>  [LibraryClasses]
>>BaseMemoryLib
>> diff --git a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf 
>> b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
>> index 59373a968523..1

[edk2-devel] [PATCH EDK2 v1 1/1] BaseTools: Remove dependence of libuuid

2021-08-06 Thread wenyi,xie via groups.io
The uuid.h only included in file GenFvInternalLib.c,
but no interface from libuuid is used in this file.
So remove this include and link to libuuid.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Wenyi Xie 
---
 BaseTools/Source/C/GenFv/GenFvInternalLib.c | 5 -
 BaseTools/Source/C/DevicePath/GNUmakefile   | 4 
 BaseTools/Source/C/GenFv/GNUmakefile| 4 
 BaseTools/Source/C/GenFw/GNUmakefile| 4 
 BaseTools/Source/C/GenSec/GNUmakefile   | 4 
 5 files changed, 21 deletions(-)

diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c 
b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index 6e296b8ad6b2..80bab7fb1381 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -13,11 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Include files
 //
 
-#if defined(__FreeBSD__)
-#include 
-#elif defined(__GNUC__)
-#include 
-#endif
 #ifdef __GNUC__
 #include 
 #endif
diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile 
b/BaseTools/Source/C/DevicePath/GNUmakefile
index 7ca08af9662d..1271555df8d5 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -18,7 +18,3 @@ ifeq ($(CYGWIN), CYGWIN)
   LIBS += -L/lib/e2fsprogs -luuid
 endif
 
-ifeq ($(LINUX), Linux)
-  LIBS += -luuid
-endif
-
diff --git a/BaseTools/Source/C/GenFv/GNUmakefile 
b/BaseTools/Source/C/GenFv/GNUmakefile
index 7c7b95ba1be2..fd8f16903ade 100644
--- a/BaseTools/Source/C/GenFv/GNUmakefile
+++ b/BaseTools/Source/C/GenFv/GNUmakefile
@@ -17,7 +17,3 @@ ifeq ($(CYGWIN), CYGWIN)
   LIBS += -L/lib/e2fsprogs -luuid
 endif
 
-ifeq ($(LINUX), Linux)
-  LIBS += -luuid
-endif
-
diff --git a/BaseTools/Source/C/GenFw/GNUmakefile 
b/BaseTools/Source/C/GenFw/GNUmakefile
index 76cda7e7a3f6..3b9a781b5cf6 100644
--- a/BaseTools/Source/C/GenFw/GNUmakefile
+++ b/BaseTools/Source/C/GenFw/GNUmakefile
@@ -17,7 +17,3 @@ ifeq ($(CYGWIN), CYGWIN)
   LIBS += -L/lib/e2fsprogs -luuid
 endif
 
-ifeq ($(LINUX), Linux)
-  LIBS += -luuid
-endif
-
diff --git a/BaseTools/Source/C/GenSec/GNUmakefile 
b/BaseTools/Source/C/GenSec/GNUmakefile
index 9f0844c1b8fe..c2f440f21ebf 100644
--- a/BaseTools/Source/C/GenSec/GNUmakefile
+++ b/BaseTools/Source/C/GenSec/GNUmakefile
@@ -17,7 +17,3 @@ ifeq ($(CYGWIN), CYGWIN)
   LIBS += -L/lib/e2fsprogs -luuid
 endif
 
-ifeq ($(LINUX), Linux)
-  LIBS += -luuid
-endif
-
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78795): https://edk2.groups.io/g/devel/message/78795
Mute This Topic: https://groups.io/mt/84704386/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] BaseTools: Remove dependence of libuuid

2021-08-06 Thread wenyi,xie via groups.io
Main Changes :
1.remove include uuid.h and link to libuuid. And try to build under linux, the 
building is sucessful.

Wenyi Xie (1):
  BaseTools: Remove dependence of libuuid

 BaseTools/Source/C/GenFv/GenFvInternalLib.c | 5 -
 BaseTools/Source/C/DevicePath/GNUmakefile   | 4 
 BaseTools/Source/C/GenFv/GNUmakefile| 4 
 BaseTools/Source/C/GenFw/GNUmakefile| 4 
 BaseTools/Source/C/GenSec/GNUmakefile   | 4 
 5 files changed, 21 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78794): https://edk2.groups.io/g/devel/message/78794
Mute This Topic: https://groups.io/mt/84704385/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH edk2-platform v2 1/1] Hisilicon:Fix header file issues

2021-08-05 Thread wenyi,xie via groups.io
EDK2 has removed header file ArmLibPrivate.h, so need to
use ArmLib.h instead. A new file OemMiscLib.h is added
to EDK2, its name is same with the header file in
Hisilicon\Include and it will being included first. So
changing the name of header file from OemMiscLib.h to
OemHisiMiscLib.h.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Wenyi Xie 
---
 Silicon/Hisilicon/HisiPkg.dec  
   |  2 +-
 Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.h   
   |  2 +-
 Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClass.h
   |  2 +-
 Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h  
   | 15 +--
 Silicon/Hisilicon/Hi1616/Pptt/Pptt.h   
   |  2 +-
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.h   
   |  2 +-
 Silicon/Hisilicon/Include/Library/{OemMiscLib.h => OemHisiMiscLib.h}   
   |  0
 Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.c
   |  2 +-
 Platform/Hisilicon/D03/Library/FdtUpdateLib/FdtUpdateLib.c 
   |  2 +-
 Platform/Hisilicon/D03/Library/OemMiscLib2P/BoardFeature2PHi1610.c 
   |  2 +-
 Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c   
   |  2 +-
 Platform/Hisilicon/D05/EarlyConfigPeim/EarlyConfigPeimD05.c
   |  2 +-
 Platform/Hisilicon/D05/Library/OemMiscLibD05/BoardFeatureD05.c 
   |  2 +-
 Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c   
   |  2 +-
 Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.c
   |  2 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06.c 
   |  2 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c   
   |  2 +-
 Platform/Hisilicon/Library/PciHostBridgeLib/PciHostBridgeLib.c 
   |  2 +-
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
   |  2 +-
 
Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/Type09/MiscSystemSlotDesignationFunction.c
 |  2 +-
 Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInit.c   
   |  2 +-
 Silicon/Hisilicon/Hi1610/Library/Hi161xPciPlatformLib/Hi161xPciPlatformLib.c   
   |  2 +-
 22 files changed, 21 insertions(+), 34 deletions(-)

diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec
index 051b5b8c3d88..e7ae01ffc750 100644
--- a/Silicon/Hisilicon/HisiPkg.dec
+++ b/Silicon/Hisilicon/HisiPkg.dec
@@ -49,7 +49,7 @@ [LibraryClasses]
   PlatformSysCtrlLib|Include/Library/PlatformSysCtrlLib.h
   CpldIoLib|Include/Library/CpldIoLib.h
   OemAddressMapLib|Include/Library/OemAddressMapLib.h
-  OemMiscLib|Include/Library/OemMiscLib.h
+  OemMiscLib|Include/Library/OemHisiMiscLib.h
   I2CLib|Include/Library/I2CLib.h
   PlatformPciLib|Include/Library/PlatformPciLib.h
   FdtUpdateLib|Include/Library/FdtUpdateLib.h
diff --git a/Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.h 
b/Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.h
index 7194ae589042..7f50c8ff317d 100644
--- a/Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.h
+++ b/Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.h
@@ -25,6 +25,6 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #endif
diff --git 
a/Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClass.h 
b/Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClass.h
index 22c7f6797168..d28f7095ef37 100644
--- a/Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClass.h
+++ b/Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClass.h
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 //
 // This is the generated header file which includes whatever needs to be 
exported (strings + IFR)
diff --git 
a/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h 
b/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h
index 3ce180d21df3..14a1b44d8db4 100644
--- a/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h
+++ b/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 //
@@ -68,19 +68,6 @@ typedef union {
   UINT16 Data;
 }CACHE_CONFIGURATION;
 
-//
-// Processor Status
-//
-typedef union {
-  struct {
-UINT8 CpuStatus   :3; // Indicates the status of the processor.
-UINT8 Reserved1   :3; // Reserved for future use. Should be set to 
zero.
-UINT8 SocketPopulated :1; // Indicates if the processor socket is 
populated or not.
-

[edk2-devel] [PATCH edk2-platform v2 0/1] Hisilicon:Fix header file issues

2021-08-05 Thread wenyi,xie via groups.io
Main Changes since v1:
1.change the name of header file.

Wenyi Xie (1):
  Hisilicon:Fix header file issues

 Silicon/Hisilicon/HisiPkg.dec  
   |  2 +-
 Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.h   
   |  2 +-
 Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClass.h
   |  2 +-
 Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h  
   | 15 +--
 Silicon/Hisilicon/Hi1616/Pptt/Pptt.h   
   |  2 +-
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.h   
   |  2 +-
 Silicon/Hisilicon/Include/Library/{OemMiscLib.h => OemHisiMiscLib.h}   
   |  0
 Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.c
   |  2 +-
 Platform/Hisilicon/D03/Library/FdtUpdateLib/FdtUpdateLib.c 
   |  2 +-
 Platform/Hisilicon/D03/Library/OemMiscLib2P/BoardFeature2PHi1610.c 
   |  2 +-
 Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.c   
   |  2 +-
 Platform/Hisilicon/D05/EarlyConfigPeim/EarlyConfigPeimD05.c
   |  2 +-
 Platform/Hisilicon/D05/Library/OemMiscLibD05/BoardFeatureD05.c 
   |  2 +-
 Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.c   
   |  2 +-
 Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.c
   |  2 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/BoardFeatureD06.c 
   |  2 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.c   
   |  2 +-
 Platform/Hisilicon/Library/PciHostBridgeLib/PciHostBridgeLib.c 
   |  2 +-
 Silicon/Hisilicon/Drivers/HisiAcpiPlatformDxe/UpdateAcpiTable.c
   |  2 +-
 
Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/Type09/MiscSystemSlotDesignationFunction.c
 |  2 +-
 Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInit.c   
   |  2 +-
 Silicon/Hisilicon/Hi1610/Library/Hi161xPciPlatformLib/Hi161xPciPlatformLib.c   
   |  2 +-
 22 files changed, 21 insertions(+), 34 deletions(-)
 rename Silicon/Hisilicon/Include/Library/{OemMiscLib.h => OemHisiMiscLib.h} 
(100%)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78702): https://edk2.groups.io/g/devel/message/78702
Mute This Topic: https://groups.io/mt/84679392/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 v2 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-08-04 Thread wenyi,xie via groups.io



On 2021/8/2 9:56, Wu, Hao A wrote:
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of Wu, Hao
>> A
>> Sent: Thursday, July 29, 2021 4:26 PM
>> To: Wenyi Xie ; devel@edk2.groups.io; Wang, Jian
>> J 
>> Cc: songdongku...@huawei.com
>> Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1]
>> MdeModulePkg/UefiSortLib:Add UefiSortLib unit test
>>
>>> -Original Message-
>>> From: Wenyi Xie 
>>> Sent: Thursday, July 29, 2021 4:01 PM
>>> To: devel@edk2.groups.io; Wang, Jian J ; Wu,
>>> Hao A 
>>> Cc: songdongku...@huawei.com; xiewen...@huawei.com
>>> Subject: [PATCH EDK2 v2 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib
>>> unit test
>>>
>>> Adding two unit test case for UefiSortLib. One is a test on sorting an
>>> array of
>>> UINT32 by using PerformQuickSort, another is a test on comparing the
>>> same buffer by using StringCompare.
>>
>>
>> Thanks.
>> Reviewed-by: Hao A Wu 
> 
> 
> Sorry, I found that there are a couple of coding format style check failures 
> when merging the patch.
> Could you help to resolve them and then create a test pull request on the 
> GitHub for verification? Thanks in advance.
> (I think you can take the case under 
> MdeModulePkg/Universal/Variable/RuntimeDxe/RuntimeDxeUnitTest/ for reference.)
> 

Hi, Wu Hao

I try to deal with the coding format style check failures, and meet a failure 
which I am not sure how to solve.
I take the case you told for reference, but still there's a failure said the 
define should be capital letters.
but if change it to capital letters, there will be another error
Function name does not follow the rules: 1. First character should be upper 
case 2. Must contain lower case characters 3. No white space characters

#define Main main

INT32
Main (
  IN INT32  Argc,
  IN CHAR8  *Argv[]
  )
{
  UnitTestingEntry ();
  return 0;
}

Thanks
Wenyi

> Error details:
> 2021-08-02T01:09:28.5955820Z ##[section]Starting: Build and Test MdeModulePkg 
> IA32,X64,ARM,AARCH64,RISCV64
> 2021-08-02T01:09:28.5960733Z 
> ==
> 2021-08-02T01:09:28.5961018Z Task : Command Line
> 2021-08-02T01:09:28.5961258Z Description  : Run a command line with arguments
> 2021-08-02T01:09:28.5961502Z Version  : 1.1.3
> 2021-08-02T01:09:28.5961897Z Author   : Microsoft Corporation
> 2021-08-02T01:09:28.5962259Z Help : [More 
> Information](https://go.microsoft.com/fwlink/?LinkID=613735)
> 2021-08-02T01:09:28.5962678Z 
> ==
> 2021-08-02T01:09:29.3504946Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3510020Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3511551Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3513605Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3516798Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3517536Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3518178Z (node:3659) Warning: Use Cipheriv for counter 
> mode of aes-256-ctr
> 2021-08-02T01:09:29.3545461Z 
> [command]/opt/hostedtoolcache/Python/3.8.11/x64/bin/stuart_ci_build -c 
> .pytool/CISettings.py -p MdeModulePkg -t RELEASE,NO-TARGET -a 
> IA32,X64,ARM,AARCH64,RISCV64 TOOL_CHAIN_TAG=GCC5
> 2021-08-02T01:09:29.3546707Z SECTION - Init SDE
> 2021-08-02T01:09:29.3547571Z WARNING - Using Pip Tools based BaseTools
> 2021-08-02T01:09:29.3548395Z SECTION - Loading Plugins
> 2021-08-02T01:09:29.3549212Z SECTION - Start Invocable Tool
> 2021-08-02T01:09:29.3550018Z SECTION - Getting Environment
> 2021-08-02T01:09:29.3550794Z SECTION - Loading plugins
> 2021-08-02T01:09:29.3551675Z SECTION - Building MdeModulePkg Package
> 2021-08-02T01:09:29.3552693Z PROGRESS - --Running MdeModulePkg: EccCheck Test 
> NO-TARGET --
> 2021-08-02T01:09:33.0697006Z ERROR - 
> 2021-08-02T01:09:33.0698018Z ERROR - EFI coding style error
> 2021-08-02T01:09:33.0698748Z ERROR - *Error code: 5007
> 2021-08-02T01:09:33.0700631Z ERROR - *There should be no initialization of a 
> variable as part of its declaration
> 2021-08-02T01:09:33.0702675Z ERROR - *file: 
> //home/vsts/work/1/s/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
> 2021-08-02T01:09:33.0703421Z ERROR - *Line number: 77
> 2021-08-02T01:09:33.0703929Z ERROR - *Variable Name: TestCount
> 2021-08-02T01:09:33.0715684Z ERROR - 
> 2021-08-02T01:09:33.0716634Z ERROR - EFI coding style error
> 2021-08-02T01:09:33.0717372Z ERROR - *Error code: 5007
> 2021-08-02T01:09:33.0718214Z ERROR - *There should be no initialization of a 
> variable as part of its declaration
> 2021-08-02T01:09:33.0719195Z ERROR - *file: 
> //home/vsts/work/1/s/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
> 

Re: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-07-29 Thread wenyi,xie via groups.io
Hi, Wu Hao

Thank you for your reviewing.
I have create the v2 patch according to your comments.

Thanks
Wenyi

On 2021/7/29 13:42, Wu, Hao A wrote:
> Thanks for the patch.
> Some inline comments below:
> 
> 
>> -Original Message-
>> From: Wenyi Xie 
>> Sent: Wednesday, July 28, 2021 1:58 PM
>> To: devel@edk2.groups.io; Wang, Jian J ; Wu, Hao A
>> 
>> Cc: songdongku...@huawei.com; xiewen...@huawei.com
>> Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit
>> test
>>
>> Adding unit test for UefiSortLib.
> 
> 
> Could you help to give a brief summary on what tests are added?
> 
> 
>>
>> Cc: Jian J Wang 
>> Cc: Hao A Wu 
>> Signed-off-by: Wenyi Xie 
>> ---
>>  MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   6 +
>>  MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf |  32 
>>  MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c   | 188
>> 
>>  3 files changed, 226 insertions(+)
>>
>> diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
>> b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
>> index 4da4692c8451..c9ec835df65d 100644
>> --- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
>> +++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
>> @@ -41,3 +41,9 @@ [Components]
>>  
>>
>> gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable
>> |TRUE
>>}
>> +
>> +  MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf {
>> +
>> +  UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>> +
>> + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
>> +  }
>> diff --git 
>> a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
>> b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
>> new file mode 100644
>> index ..d9dac307934e
>> --- /dev/null
>> +++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
>> @@ -0,0 +1,32 @@
>> +## @file
>> +# This is a unit test for the UefiSortLib.
>> +#
>> +# Copyright (c) Microsoft Corporation.
> 
> 
> Please help to use the 'copyright' information of Huawei like in file 
> UefiSortLibUnitTest.c.
> 
> 
>> +# SPDX-License-Identifier: BSD-2-Clause-Patent ##
>> +
>> +[Defines]
>> +  INF_VERSION = 0x00010017
>> +  BASE_NAME   = UefiSortLibUnitTest
>> +  FILE_GUID   = 271337A3-0D79-BA3E-BC03-714E518E3B1B
>> +  VERSION_STRING  = 1.0
>> +  MODULE_TYPE = HOST_APPLICATION
>> +
>> +#
>> +# The following information is for reference only and not required by the 
>> build
>> tools.
>> +#
>> +#  VALID_ARCHITECTURES   = IA32 X64
>> +#
>> +
>> +[Sources]
>> +  UefiSortLibUnitTest.c
>> +
>> +[Packages]
>> +  MdePkg/MdePkg.dec
>> +  MdeModulePkg/MdeModulePkg.dec
>> +  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
>> +
>> +[LibraryClasses]
>> +  UnitTestLib
>> +  DebugLib
>> +  UefiSortLib
>> diff --git a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
>> b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
>> new file mode 100644
>> index ..f2f89daef7ba
>> --- /dev/null
>> +++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
>> @@ -0,0 +1,188 @@
>> +/** @file
>> +  Unit tests of the UefiSortLib
>> +
>> +  Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
>> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> +**/
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +
>> +#define UNIT_TEST_APP_NAME"UefiSortLib Unit Tests"
>> +#define UNIT_TEST_APP_VERSION "1.0"
>> +
>> +#define TEST_ARRAY_SIZE_9 9
>> +
>> +/**
>> +  The function is called by PerformQuickSort to compare int values.
>> +
>> +  @param[in] LeftThe pointer to first buffer.
>> +  @param[in] Right   The pointer to second buffer.
>> +
>> +  @retval 0  Buffer1 equal to Buffer2.
>> +  @return <0 Buffer1 is less than Buffer2.
>> +  @return >0 Buffer1 is greater than Buffer2.
>> +
>> +**/
>> +INTN
>> +EFIAPI
>> +TestCompareFunction (
>> +  IN CONST VOID *Left,
>> +  IN CONST VOID *Right
>> +  )
>> +{
>> +  if (*(UINT32*)Right > *(UINT32*)Left) {
>> +return 1;
>> +  } else if (*(UINT32*)Right < *(UINT32*)Left) {
>> +return -1;
>> +  }
>> +
>> +  return 0;
>> +}
>> +
>> +/**
>> +  Unit test for PerformQuickSort () API of the UefiSortLib.
>> +
>> +  @param[in]  Context[Optional] An optional parameter that enables:
>> + 1) test-case reuse with varied parameters and
>> + 2) test-case re-entry for Target tests that need a
>> + reboot.  This parameter is a VOID* and it is the
>> + responsibility of the test author to ensure that 
>> the
>> +

[edk2-devel] [PATCH EDK2 v2 0/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-07-29 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.add brief summary in commit message
2.change the copyright in UefiSortLibUnitTest.inf
3.refine the indent in UnitTestingEntry

Wenyi Xie (1):
  MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   6 +
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf |  32 
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c   | 188 

 3 files changed, 226 insertions(+)
 create mode 100644 
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
 create mode 100644 
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78350): https://edk2.groups.io/g/devel/message/78350
Mute This Topic: https://groups.io/mt/84523898/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 v2 1/1] SecurityPkg/FvReportPei: remove redundant sizeof

2021-07-29 Thread wenyi,xie via groups.io
Execuse me, I made a mistake and sent the wrong patch. Please ignore it.

Thanks
Wenyi

On 2021/7/29 15:45, Wenyi Xie wrote:
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=
> 
> In function InstallPreHashFvPpi, when calculating the size
> of struct HASH_INFO,sizeof is used twice. This bug does
> not lead to buffer overflow, "sizeof (HASH_INFO)" is 4,
> whereas "sizeof (sizeof (HASH_INFO))" is 4 or 8.
> 
> Cc: Jiewen Yao 
> Cc: Jian J Wang 
> Cc: Laszlo Ersek 
> Signed-off-by: Wenyi Xie 
> Reviewed-by: Laszlo Ersek 
> ---
>  SecurityPkg/FvReportPei/FvReportPei.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/SecurityPkg/FvReportPei/FvReportPei.c 
> b/SecurityPkg/FvReportPei/FvReportPei.c
> index d709760ea3ce..e82413e090c0 100644
> --- a/SecurityPkg/FvReportPei/FvReportPei.c
> +++ b/SecurityPkg/FvReportPei/FvReportPei.c
> @@ -67,7 +67,7 @@ InstallPreHashFvPpi (
>HASH_INFO *HashInfo;
>
>PpiSize = sizeof (EDKII_PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_PPI)
> -+ sizeof (sizeof (HASH_INFO))
> ++ sizeof (HASH_INFO)
>  + HashSize;
>
>PreHashedFvPpi = AllocatePool (PpiSize);
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78349): https://edk2.groups.io/g/devel/message/78349
Mute This Topic: https://groups.io/mt/84523794/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 1/1] SecurityPkg/FvReportPei: remove redundant sizeof

2021-07-29 Thread wenyi,xie via groups.io
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=

In function InstallPreHashFvPpi, when calculating the size
of struct HASH_INFO,sizeof is used twice. This bug does
not lead to buffer overflow, "sizeof (HASH_INFO)" is 4,
whereas "sizeof (sizeof (HASH_INFO))" is 4 or 8.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Laszlo Ersek 
Signed-off-by: Wenyi Xie 
Reviewed-by: Laszlo Ersek 
---
 SecurityPkg/FvReportPei/FvReportPei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SecurityPkg/FvReportPei/FvReportPei.c 
b/SecurityPkg/FvReportPei/FvReportPei.c
index d709760ea3ce..e82413e090c0 100644
--- a/SecurityPkg/FvReportPei/FvReportPei.c
+++ b/SecurityPkg/FvReportPei/FvReportPei.c
@@ -67,7 +67,7 @@ InstallPreHashFvPpi (
   HASH_INFO *HashInfo;
 
   PpiSize = sizeof (EDKII_PEI_FIRMWARE_VOLUME_INFO_PREHASHED_FV_PPI)
-+ sizeof (sizeof (HASH_INFO))
++ sizeof (HASH_INFO)
 + HashSize;
 
   PreHashedFvPpi = AllocatePool (PpiSize);
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78348): https://edk2.groups.io/g/devel/message/78348
Mute This Topic: https://groups.io/mt/84523794/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v2 0/1] SecurityPkg/FvReportPei: remove redundant sizeof

2021-07-29 Thread wenyi,xie via groups.io
Main Changes since v1 :
Change commit message.

Wenyi Xie (1):
  SecurityPkg/FvReportPei: remove redundant sizeof

 SecurityPkg/FvReportPei/FvReportPei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78347): https://edk2.groups.io/g/devel/message/78347
Mute This Topic: https://groups.io/mt/84523793/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-07-28 Thread wenyi,xie via groups.io
Main Changes :
Adding unit test for UefiSortLib.

Wenyi Xie (1):
  MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   6 +
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf |  32 
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c   | 188 

 3 files changed, 226 insertions(+)
 create mode 100644 
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
 create mode 100644 
MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78266): https://edk2.groups.io/g/devel/message/78266
Mute This Topic: https://groups.io/mt/84499704/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test

2021-07-28 Thread wenyi,xie via groups.io
Adding unit test for UefiSortLib.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   6 +
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf |  32 
 MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c   | 188 

 3 files changed, 226 insertions(+)

diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index 4da4692c8451..c9ec835df65d 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -41,3 +41,9 @@ [Components]
 
   
gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|TRUE
   }
+
+  MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf {
+
+  UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  }
diff --git a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf 
b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
new file mode 100644
index ..d9dac307934e
--- /dev/null
+++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf
@@ -0,0 +1,32 @@
+## @file
+# This is a unit test for the UefiSortLib.
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION = 0x00010017
+  BASE_NAME   = UefiSortLibUnitTest
+  FILE_GUID   = 271337A3-0D79-BA3E-BC03-714E518E3B1B
+  VERSION_STRING  = 1.0
+  MODULE_TYPE = HOST_APPLICATION
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  UefiSortLibUnitTest.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]
+  UnitTestLib
+  DebugLib
+  UefiSortLib
diff --git a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c 
b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
new file mode 100644
index ..f2f89daef7ba
--- /dev/null
+++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c
@@ -0,0 +1,188 @@
+/** @file
+  Unit tests of the UefiSortLib
+
+  Copyright (C) Huawei Technologies Co., Ltd. All rights reserved
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define UNIT_TEST_APP_NAME"UefiSortLib Unit Tests"
+#define UNIT_TEST_APP_VERSION "1.0"
+
+#define TEST_ARRAY_SIZE_9 9
+
+/**
+  The function is called by PerformQuickSort to compare int values.
+
+  @param[in] LeftThe pointer to first buffer.
+  @param[in] Right   The pointer to second buffer.
+
+  @retval 0  Buffer1 equal to Buffer2.
+  @return <0 Buffer1 is less than Buffer2.
+  @return >0 Buffer1 is greater than Buffer2.
+
+**/
+INTN
+EFIAPI
+TestCompareFunction (
+  IN CONST VOID *Left,
+  IN CONST VOID *Right
+  )
+{
+  if (*(UINT32*)Right > *(UINT32*)Left) {
+return 1;
+  } else if (*(UINT32*)Right < *(UINT32*)Left) {
+return -1;
+  }
+
+  return 0;
+}
+
+/**
+  Unit test for PerformQuickSort () API of the UefiSortLib.
+
+  @param[in]  Context[Optional] An optional parameter that enables:
+ 1) test-case reuse with varied parameters and
+ 2) test-case re-entry for Target tests that need a
+ reboot.  This parameter is a VOID* and it is the
+ responsibility of the test author to ensure that the
+ contents are well understood by all test cases that 
may
+ consume it.
+
+  @retval  UNIT_TEST_PASSED The Unit test has completed and the 
test
+case was successful.
+  @retval  UNIT_TEST_ERROR_TEST_FAILED  A test case assertion has failed.
+**/
+UNIT_TEST_STATUS
+EFIAPI
+SortUINT32ArrayShouldSucceed (
+  IN UNIT_TEST_CONTEXT  Context
+  )
+{
+  UINTN TestCount = TEST_ARRAY_SIZE_9;
+  UINT32 TestBuffer[TEST_ARRAY_SIZE_9] = {1, 2, 3, 4, 5, 6, 7 ,8, 9};
+  UINT32 TestResult[TEST_ARRAY_SIZE_9] = {9, 8, 7, 6, 5, 4, 3, 2, 1};
+
+  PerformQuickSort (TestBuffer, TestCount, sizeof (UINT32), 
(SORT_COMPARE)TestCompareFunction);
+  UT_ASSERT_MEM_EQUAL (TestBuffer, TestResult, sizeof (UINT32) * 
TEST_ARRAY_SIZE_9);
+
+  return UNIT_TEST_PASSED;
+}
+
+/**
+  Unit test for StringCompare () API of the UefiSortLib.
+
+  @param[in]  Context[Optional] An optional parameter that enables:
+ 1) test-case reuse with varied parameters and
+ 2) test-case re-entry for 

[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg: Modify PCD default value

2021-07-15 Thread wenyi,xie via groups.io
From: "wenyi.xie" 

The default value of PcdSrIovSystemPageSize is 0x1, it means
the memory BAR is 4KB alignment. When page size of OS is set
to 64KB, as the resource partitions are different between OS
and BIOS, it will cause pcie failture. And if 52 bit physical
address need to be supported, page size should also be set to
64KB alignment.
So modify the default vaule of PcdSrIovSystemPageSize to 0x10
can meet the requirement above. And even if the OS is 4KB
alignment, new value of PCD is compatible for this situation.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/MdeModulePkg.dec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index ad84421cf3..426ea1b6cc 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1853,7 +1853,7 @@
   #  BIT0 set indicates 4KB alignment
   #  BIT1 set indicates 8KB alignment
   # @Prompt SRIOV system page size.
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize|0x1|UINT32|0x1047
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSystemPageSize|0x10|UINT32|0x1047
 
   ## SMBIOS version.
   # @Prompt SMBIOS version.
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77810): https://edk2.groups.io/g/devel/message/77810
Mute This Topic: https://groups.io/mt/84223844/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH edk2-Platform v1 1/1] Hisilicon:Fix header file issues

2021-06-22 Thread wenyi,xie via groups.io
EDK2 has removed header file ArmLibPrivate.h, so need to
use ArmLib.h instead. A new file OemMiscLib.h is added
to EDK2, its name is same with the header file in
Hisilicon\Include and it will being included first. So
some undefined issue occured and need to change the order
of header files.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Signed-off-by: Wenyi Xie 
---
 Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf  
|  2 +-
 Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf 
|  2 +-
 Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf 
|  2 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf 
|  2 +-
 Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf 
|  2 +-
 Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf   
|  2 +-
 Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitDxe.inf  
|  2 +-
 Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h  
| 13 -
 Silicon/Hisilicon/Hi1616/Pptt/Pptt.h   
|  2 +-
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.h   
|  2 +-
 10 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf 
b/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
index 1f992024acc2..f1b21ae80f3c 100644
--- a/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
+++ b/Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
@@ -20,12 +20,12 @@
   EarlyConfigPeimD03.c
 
 [Packages]
+  Silicon/Hisilicon/HisiPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
 
   ArmPkg/ArmPkg.dec
   Silicon/Hisilicon/HisiliconNonOsi.dec
-  Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
   PeimEntryPoint
diff --git a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf 
b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
index ab14597d8b75..728b33e85030 100644
--- a/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
+++ b/Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf
@@ -21,11 +21,11 @@
   BoardFeature2PHi1610Strings.uni
 
 [Packages]
+  Silicon/Hisilicon/HisiPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   ArmPkg/ArmPkg.dec
   Silicon/Hisilicon/HisiliconNonOsi.dec
-  Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
diff --git a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf 
b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
index d471102199ee..8a605b417be8 100644
--- a/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
+++ b/Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf
@@ -21,11 +21,11 @@
   OemMiscLibD05.c
 
 [Packages]
+  Silicon/Hisilicon/HisiPkg.dec
   ArmPkg/ArmPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   Silicon/Hisilicon/HisiliconNonOsi.dec
-  Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
diff --git a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf 
b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
index 59373a968523..1121550b40c4 100644
--- a/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
+++ b/Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf
@@ -21,12 +21,12 @@
   OemMiscLibD06.c
 
 [Packages]
+  Silicon/Hisilicon/HisiPkg.dec
   ArmPkg/ArmPkg.dec
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   Platform/Hisilicon/D06/D06.dec
   Silicon/Hisilicon/HisiliconNonOsi.dec
-  Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
   BaseMemoryLib
diff --git 
a/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
 
b/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
index 99eea93b7988..2c3c1ff51408 100644
--- 
a/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
+++ 
b/Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
@@ -21,12 +21,12 @@
   ProcessorSubClass.c
 
 [Packages]
+  Silicon/Hisilicon/HisiPkg.dec
   ArmPkg/ArmPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
 
   Silicon/Hisilicon/HisiliconNonOsi.dec
-  Silicon/Hisilicon/HisiPkg.dec
 
 [LibraryClasses]
   UefiDriverEntryPoint
diff --git a/Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf 
b/Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
index 9c795b5fd401..99cc8fc4c14e 100644
--- a/Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
+++ b/Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf
@@ -48,11 +48,11 @@
   ./Type09/MiscSystemSlotDesignationFunction.c
 
 [Packages]
+  Silicon/Hisilicon/HisiPkg.dec
   ArmPkg/ArmPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   Silicon/Hisilicon/HisiliconNonOsi.dec
-  

[edk2-devel] [PATCH edk2-Platform v1 0/1] Hisilicon:Fix header file issues

2021-06-22 Thread wenyi,xie via groups.io
Main Changes :
1.Replace ArmLibPrivate.h with ArmLib.h
2.Cahnge order of dec in some inf file since there are same name header files
3.Remove redundant declaration of union PROCESSOR_STATUS_DATA

Wenyi Xie (1):
  Hisilicon:Fix header file issues

 Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf  
|  2 +-
 Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf 
|  2 +-
 Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf 
|  2 +-
 Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf 
|  2 +-
 Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf 
|  2 +-
 Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf   
|  2 +-
 Silicon/Hisilicon/Hi1610/Drivers/PcieInit1610/PcieInitDxe.inf  
|  2 +-
 Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClass.h  
| 13 -
 Silicon/Hisilicon/Hi1616/Pptt/Pptt.h   
|  2 +-
 Silicon/Hisilicon/Hi1620/Pptt/Pptt.h   
|  2 +-
 10 files changed, 9 insertions(+), 22 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76834): https://edk2.groups.io/g/devel/message/76834
Mute This Topic: https://groups.io/mt/83712247/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] ArmPkg: Move cache defs used in Universal/Smbios into ArmCache.h

2021-06-20 Thread wenyi,xie via groups.io
OK,I will handle this later.

Thanks
Wenyi

On 2021/6/18 23:54, Leif Lindholm wrote:
> Agh. *Actually* cc Wenyi.
> 
> On Fri, Jun 18, 2021 at 16:53:38 +0100, Leif Lindholm wrote:
>> +Wenyi
>>
>> On Mon, Jun 14, 2021 at 12:57:49 -0600, Rebecca Cran wrote:
>>> Many of the cache definitions in ArmLibPrivate.h are being used outside
>>> of ArmLib, in Universal/Smbios. Move them into ArmCache.h to make them
>>> public, and remove the include of ArmLibPrivate.h from files in
>>> Universal/Smbios.
>>>
>>> Signed-off-by: Rebecca Cran 
>>
>> Reviewed-by: Leif Lindholm 
>> Pushed as a63914d3f603. Thanks!
>>
>> I will note that this change breaks Silicon/Hisilicon/Hi1616 and
>> Silicon/Hisilicon/Hi1620, which use some of the macros moved by this
>> patch.
>> However, I am unable to build these anyway with recent iasl/gcc.
>>
>> Wenyi: can you have a look at making these platforms build?
>> This will now also involve dropping use of
>> Library/ArmLib/ArmLibPrivate.h.
>>
>> /
>> Leif
>>
>>> ---
>>>  ArmPkg/Include/IndustryStandard/ArmCache.h  | 
>>> 112 ++
>>>  ArmPkg/Include/Library/ArmLib.h |  
>>> 36 +-
>>>  ArmPkg/Library/ArmLib/ArmLibPrivate.h   | 
>>> 123 
>>>  ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c|  
>>>  2 +-
>>>  ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorAArch64.c   |  
>>>  2 +-
>>>  ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArm.c   |  
>>>  2 +-
>>>  ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c |  
>>>  2 +-
>>>  7 files changed, 148 insertions(+), 131 deletions(-)
>>>
>>> diff --git a/ArmPkg/Include/IndustryStandard/ArmCache.h 
>>> b/ArmPkg/Include/IndustryStandard/ArmCache.h
>>> new file mode 100644
>>> index ..f9de46b5bffd
>>> --- /dev/null
>>> +++ b/ArmPkg/Include/IndustryStandard/ArmCache.h
>>> @@ -0,0 +1,112 @@
>>> +/** @file
>>> +
>>> +  Copyright (c) 2020 - 2021, NUVIA Inc. All rights reserved.
>>> +
>>> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>>> +
>>> +**/
>>> +
>>> +#ifndef ARM_CACHE_H_
>>> +#define ARM_CACHE_H_
>>> +
>>> +#include 
>>> +
>>> +// The ARM Architecture Reference Manual for ARMv8-A defines up
>>> +// to 7 levels of cache, L1 through L7.
>>> +#define MAX_ARM_CACHE_LEVEL   7
>>> +
>>> +/// Defines the structure of the CSSELR (Cache Size Selection) register
>>> +typedef union {
>>> +  struct {
>>> +UINT32InD   :1;  ///< Instruction not Data bit
>>> +UINT32Level :3;  ///< Cache level (zero based)
>>> +UINT32TnD   :1;  ///< Allocation not Data bit
>>> +UINT32Reserved  :27; ///< Reserved, RES0
>>> +  } Bits; ///< Bitfield definition of the register
>>> +  UINT32 Data; ///< The entire 32-bit value
>>> +} CSSELR_DATA;
>>> +
>>> +/// The cache type values for the InD field of the CSSELR register
>>> +typedef enum
>>> +{
>>> +  /// Select the data or unified cache
>>> +  CsselrCacheTypeDataOrUnified = 0,
>>> +  /// Select the instruction cache
>>> +  CsselrCacheTypeInstruction,
>>> +  CsselrCacheTypeMax
>>> +} CSSELR_CACHE_TYPE;
>>> +
>>> +/// Defines the structure of the CCSIDR (Current Cache Size ID) register
>>> +typedef union {
>>> +  struct {
>>> +UINT64LineSize   :3;  ///< Line size (Log2(Num bytes in 
>>> cache) - 4)
>>> +UINT64Associativity  :10; ///< Associativity - 1
>>> +UINT64NumSets:15; ///< Number of sets in the cache -1
>>> +UINT64Unknown:4;  ///< Reserved, UNKNOWN
>>> +UINT64Reserved   :32; ///< Reserved, RES0
>>> +  } BitsNonCcidx; ///< Bitfield definition of the register when FEAT_CCIDX 
>>> is not supported.
>>> +  struct {
>>> +UINT64LineSize   :3;  ///< Line size (Log2(Num bytes in 
>>> cache) - 4)
>>> +UINT64Associativity  :21; ///< Associativity - 1
>>> +UINT64Reserved1  :8;  ///< Reserved, RES0
>>> +UINT64NumSets:24; ///< Number of sets in the cache -1
>>> +UINT64Reserved2  :8;  ///< Reserved, RES0
>>> +  } BitsCcidxAA64; ///< Bitfield definition of the register when FEAT_IDX 
>>> is supported.
>>> +  struct {
>>> +UINT64LineSize   : 3;
>>> +UINT64Associativity  : 21;
>>> +UINT64Reserved   : 8;
>>> +UINT64Unallocated: 32;
>>> +  } BitsCcidxAA32;
>>> +  UINT64 Data; ///< The entire 64-bit value
>>> +} CCSIDR_DATA;
>>> +
>>> +/// Defines the structure of the AARCH32 CCSIDR2 register.
>>> +typedef union {
>>> +  struct {
>>> +UINT32 NumSets   :24; ///< Number of sets in the cache - 1
>>> +UINT32 Reserved  :8;  ///< Reserved, RES0
>>> +  } Bits; ///< Bitfield definition of the register
>>> +  UINT32 Data; ///< The entire 32-bit value
>>> +} CCSIDR2_DATA;
>>> +
>>> +/** Defines the structure of the CLIDR (Cache Level 

Re: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length is 0

2021-05-30 Thread wenyi,xie via groups.io



On 2021/5/31 9:44, Wu, Hao A wrote:
>> -Original Message-
>> From: Wenyi Xie 
>> Sent: Thursday, May 27, 2021 8:04 PM
>> To: devel@edk2.groups.io; Wang, Jian J ; Wu, Hao A
>> ; Ni, Ray 
>> Cc: songdongku...@huawei.com; xiewen...@huawei.com
>> Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length
>> is 0
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3418
>>
>> According to xhci spec, at USB packet level, a Control Transfer consists of
>> multiple transactions partitioned into stages: a setup stage, an optional 
>> data
>> stage, and a terminating status stage. If Data Stage does not exist, the
>> Transfer Type flag(TRT) should be No Data Stage.
>> So if data length equals to 0, TRT is set to 0.
> 
> 
> Thanks for the patch, the changes are good to me.
> Could you help to provide the information on what kind of test has been 
> performed for this patch?
> 
> Best Regards,
> Hao Wu
> 
Hi, Wu Hao

We use an AArch64 platform to test this patch. After merging this patch, during 
USB enumeration, Control Transfer with or without Data Stage
works well. Our platform dsc only include XhciDxe.

Thanks
Wenyi
> 
>>
>> Cc: Jian J Wang 
>> Cc: Hao A Wu 
>> Cc: Ray Ni 
>> Signed-off-by: Wenyi Xie 
>> ---
>>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 13 +
>> MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 13 +
>>  2 files changed, 18 insertions(+), 8 deletions(-)
>>
>> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> index dc36945962a0..7cbc9a8502ea 100644
>> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
>> @@ -298,10 +298,15 @@ XhcCreateTransferTrb (
>>TrbStart->TrbCtrSetup.IOC   = 1;
>>TrbStart->TrbCtrSetup.IDT   = 1;
>>TrbStart->TrbCtrSetup.Type  = TRB_TYPE_SETUP_STAGE;
>> -  if (Urb->Ep.Direction == EfiUsbDataIn) {
>> -TrbStart->TrbCtrSetup.TRT = 3;
>> -  } else if (Urb->Ep.Direction == EfiUsbDataOut) {
>> -TrbStart->TrbCtrSetup.TRT = 2;
>> +  if (Urb->DataLen > 0) {
>> +if (Urb->Ep.Direction == EfiUsbDataIn) {
>> +  TrbStart->TrbCtrSetup.TRT = 3;
>> +} else if (Urb->Ep.Direction == EfiUsbDataOut) {
>> +  TrbStart->TrbCtrSetup.TRT = 2;
>> +} else {
>> +  DEBUG ((DEBUG_ERROR, "XhcCreateTransferTrb: Direction sholud be
>> IN or OUT when Data exists!\n"));
>> +  ASSERT (FALSE);
>> +}
>>} else {
>>  TrbStart->TrbCtrSetup.TRT = 0;
>>}
>> diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
>> b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
>> index 32d72ef03c2d..5b9892a1cbbb 100644
>> --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
>> +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
>> @@ -291,10 +291,15 @@ XhcPeiCreateTransferTrb (
>>TrbStart->TrbCtrSetup.IOC   = 1;
>>TrbStart->TrbCtrSetup.IDT   = 1;
>>TrbStart->TrbCtrSetup.Type  = TRB_TYPE_SETUP_STAGE;
>> -  if (Urb->Ep.Direction == EfiUsbDataIn) {
>> -TrbStart->TrbCtrSetup.TRT = 3;
>> -  } else if (Urb->Ep.Direction == EfiUsbDataOut) {
>> -TrbStart->TrbCtrSetup.TRT = 2;
>> +  if (Urb->DataLen > 0) {
>> +if (Urb->Ep.Direction == EfiUsbDataIn) {
>> +  TrbStart->TrbCtrSetup.TRT = 3;
>> +} else if (Urb->Ep.Direction == EfiUsbDataOut) {
>> +  TrbStart->TrbCtrSetup.TRT = 2;
>> +} else {
>> +  DEBUG ((DEBUG_ERROR, "XhcPeiCreateTransferTrb: Direction sholud
>> be IN or OUT when Data exists!\n"));
>> +  ASSERT (FALSE);
>> +}
>>} else {
>>  TrbStart->TrbCtrSetup.TRT = 0;
>>}
>> --
>> 2.20.1.windows.1
> 
> .
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75859): https://edk2.groups.io/g/devel/message/75859
Mute This Topic: https://groups.io/mt/83122568/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 0/1] MdeModulePkg/Xhci: Fix TRT when data length is 0

2021-05-27 Thread wenyi,xie via groups.io
Main Changes :
Check data length first, if data length equals to 0, then set TRT to 0.

Wenyi Xie (1):
  MdeModulePkg/Xhci: Fix TRT when data length is 0

 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 13 +
 MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 13 +
 2 files changed, 18 insertions(+), 8 deletions(-)

-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75807): https://edk2.groups.io/g/devel/message/75807
Mute This Topic: https://groups.io/mt/83122567/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length is 0

2021-05-27 Thread wenyi,xie via groups.io
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3418

According to xhci spec, at USB packet level, a Control Transfer
consists of multiple transactions partitioned into stages: a
setup stage, an optional data stage, and a terminating status
stage. If Data Stage does not exist, the Transfer Type flag(TRT)
should be No Data Stage.
So if data length equals to 0, TRT is set to 0.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 13 +
 MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 13 +
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index dc36945962a0..7cbc9a8502ea 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -298,10 +298,15 @@ XhcCreateTransferTrb (
   TrbStart->TrbCtrSetup.IOC   = 1;
   TrbStart->TrbCtrSetup.IDT   = 1;
   TrbStart->TrbCtrSetup.Type  = TRB_TYPE_SETUP_STAGE;
-  if (Urb->Ep.Direction == EfiUsbDataIn) {
-TrbStart->TrbCtrSetup.TRT = 3;
-  } else if (Urb->Ep.Direction == EfiUsbDataOut) {
-TrbStart->TrbCtrSetup.TRT = 2;
+  if (Urb->DataLen > 0) {
+if (Urb->Ep.Direction == EfiUsbDataIn) {
+  TrbStart->TrbCtrSetup.TRT = 3;
+} else if (Urb->Ep.Direction == EfiUsbDataOut) {
+  TrbStart->TrbCtrSetup.TRT = 2;
+} else {
+  DEBUG ((DEBUG_ERROR, "XhcCreateTransferTrb: Direction sholud be IN 
or OUT when Data exists!\n"));
+  ASSERT (FALSE);
+}
   } else {
 TrbStart->TrbCtrSetup.TRT = 0;
   }
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c 
b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
index 32d72ef03c2d..5b9892a1cbbb 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
@@ -291,10 +291,15 @@ XhcPeiCreateTransferTrb (
   TrbStart->TrbCtrSetup.IOC   = 1;
   TrbStart->TrbCtrSetup.IDT   = 1;
   TrbStart->TrbCtrSetup.Type  = TRB_TYPE_SETUP_STAGE;
-  if (Urb->Ep.Direction == EfiUsbDataIn) {
-TrbStart->TrbCtrSetup.TRT = 3;
-  } else if (Urb->Ep.Direction == EfiUsbDataOut) {
-TrbStart->TrbCtrSetup.TRT = 2;
+  if (Urb->DataLen > 0) {
+if (Urb->Ep.Direction == EfiUsbDataIn) {
+  TrbStart->TrbCtrSetup.TRT = 3;
+} else if (Urb->Ep.Direction == EfiUsbDataOut) {
+  TrbStart->TrbCtrSetup.TRT = 2;
+} else {
+  DEBUG ((DEBUG_ERROR, "XhcPeiCreateTransferTrb: Direction sholud be 
IN or OUT when Data exists!\n"));
+  ASSERT (FALSE);
+}
   } else {
 TrbStart->TrbCtrSetup.TRT = 0;
   }
-- 
2.20.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75808): https://edk2.groups.io/g/devel/message/75808
Mute This Topic: https://groups.io/mt/83122568/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




  1   2   >