[edk2-devel] [PATCH] CryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1j

2021-03-17 Thread Liu, WeiX C
From: Liu Wei 

Update openssl from 1.1.1g to 1.1.1j. Current OpenSSL version
1.1.1g contains the vulnerabilities of CVE-2021-23841 and
CVE-2021-23840. The related vulnerable API EVP_DecryptUpdate
are used in drivers.

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

Besides, the opensslconf.h automatically generated in UNIX
format by process_files.pl.

Cc: Jian J Wang 
Signed-off-by: Liu Wei 
---
 CryptoPkg/Library/Include/openssl/opensslconf.h | 7 ++-
 CryptoPkg/Library/OpensslLib/openssl| 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/CryptoPkg/Library/Include/openssl/opensslconf.h 
b/CryptoPkg/Library/Include/openssl/opensslconf.h
index 3a2544e..f9a73e9 100644
--- a/CryptoPkg/Library/Include/openssl/opensslconf.h
+++ b/CryptoPkg/Library/Include/openssl/opensslconf.h
@@ -2,7 +2,7 @@
  * WARNING: do not edit!
  * Generated from include/openssl/opensslconf.h.in
  *
- * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -268,6 +268,11 @@ extern "C" {
 #   undef DECLARE_DEPRECATED
 #   define DECLARE_DEPRECATED(f)f __attribute__ ((deprecated));
 #  endif
+# elif defined(__SUNPRO_C)
+#  if (__SUNPRO_C >= 0x5130)
+#   undef DECLARE_DEPRECATED
+#   define DECLARE_DEPRECATED(f)f __attribute__ ((deprecated));
+#  endif
 # endif
 #endif
 
diff --git a/CryptoPkg/Library/OpensslLib/openssl 
b/CryptoPkg/Library/OpensslLib/openssl
index e2e09d9..52c587d 16
--- a/CryptoPkg/Library/OpensslLib/openssl
+++ b/CryptoPkg/Library/OpensslLib/openssl
@@ -1 +1 @@
-Subproject commit e2e09d9fba1187f8d6aafaa34d4172f56f1ffb72
+Subproject commit 52c587d60be67c337364b830dd3fdc15404a2f04
-- 
2.7.4



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




Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg: CoreCommonLib: Added new library for VariableSmmRuntimeDxe

2021-03-17 Thread Zhiguang Liu
Thanks Liming. This helps a lot

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> gaoliming
> Sent: Thursday, March 18, 2021 1:01 PM
> To: Liu, Zhiguang ; 'Kun Qin' ;
> devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Dong, Eric 
> Subject: 回复: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> 
> Zhiguang:
>   Yes. I can merge part of the patch set, because each patch is for the
> different platform.
> 
>   I will wait for one more day for the patch review, and merge the patch
> tomorrow for those passed code review.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: Liu, Zhiguang 
> > 发送时间: 2021年3月17日 22:33
> > 收件人: Kun Qin ; devel@edk2.groups.io; Liming
> Gao
> > 
> > 抄送: Chiu, Chasel ; Desimone, Nathaniel L
> > ; Dong, Eric 
> > 主题: RE: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> > CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> >
> > Hi Liming,
> > Can you help merge the first two patches in this patch set?
> > If you need, I can provide the patch files.
> >
> > Hi Kun,
> > Thanks. Let's see if Liming can help.
> >
> > Thanks
> > Zhiguang
> >
> > > -Original Message-
> > > From: Kun Qin 
> > > Sent: Wednesday, March 17, 2021 4:11 PM
> > > To: Liu, Zhiguang ; devel@edk2.groups.io
> > > Cc: Chiu, Chasel ; Desimone, Nathaniel L
> > > ; Liming Gao
> > > ; Dong, Eric 
> > > Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5]
> MinPlatformPkg:
> > > CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> > >
> > > Hi Zhiguang,
> > >
> > > I do not mind check the reviewed patches (the first 3 changes,
> > > specifically) in first. I have not done this before. How you want to
> > > proceed in that case?
> > >
> > > Regards,
> > > Kun
> > >
> > > On 03/17/2021 00:52, Liu, Zhiguang wrote:
> > > > Reviewed-by: Zhiguang Liu 
> > > >
> > > > Hi Kun,
> > > > Since the first two changes about MinPlatformPkg already got
> > > > reviewed,
> > > can we first check them in?
> > > >
> > > > Thanks
> > > > Zhiguang
> > > >
> > > >> -Original Message-
> > > >> From: devel@edk2.groups.io  On Behalf Of
> > > >> Kun Qin
> > > >> Sent: Wednesday, March 17, 2021 2:11 AM
> > > >> To: devel@edk2.groups.io
> > > >> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> > > >> ; Liming Gao
> > > >> ; Dong, Eric 
> > > >> Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5]
> MinPlatformPkg:
> > > >> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> > > >>
> > > >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3250
> > > >>
> > > >> This change added NULL MmUnblockMemoryLib instance in dsc files
> > > >> of CoreCommonLib to resolve newly introduced dependency. The
> > > >> library interface is consumed by VariableSmmRuntimeDxe to better
> > > >> support variable runtime cache feature.
> > > >>
> > > >> Cc: Chasel Chiu 
> > > >> Cc: Nate DeSimone 
> > > >> Cc: Liming Gao 
> > > >> Cc: Eric Dong 
> > > >>
> > > >> Signed-off-by: Kun Qin 
> > > >> Reviewed-by: Liming Gao 
> > > >> ---
> > > >>
> > > >> Notes:
> > > >>  v2:
> > > >>  - Added reviewed-by tag [Liming]
> > > >>
> > > >>   Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1
> > +
> > > >>   1 file changed, 1 insertion(+)
> > > >>
> > > >> diff --git
> > > >> a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > > >> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > > >> index cb40e111b5dd..bcabb797e91a 100644
> > > >> ---
> a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > > >> +++
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > > >> @@ -159,6 +159,7 @@ [LibraryClasses.common]
> > > >>
> > LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
> > > >>
> > > >> SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
> > > >> +
> > > >> +
> > > >>
> > >
> >
> MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblo
> > > >> ckMemoryLi
> > > >> + bNull.inf
> > > >>
> > > >>
> > SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
> > > >>
> > > >> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/Variable
> > > >> VariablePolicyLib|Poli
> > > >> VariablePolicyLib|cyLi
> > > >> b.inf
> > > >> --
> > > >> 2.30.0.windows.1
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >
> 
> 
> 
> 
> 
> 



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




回复: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg: CoreCommonLib: Added new library for VariableSmmRuntimeDxe

2021-03-17 Thread gaoliming
Zhiguang:
  Yes. I can merge part of the patch set, because each patch is for the 
different platform. 

  I will wait for one more day for the patch review, and merge the patch 
tomorrow for those passed code review. 

Thanks
Liming
> -邮件原件-
> 发件人: Liu, Zhiguang 
> 发送时间: 2021年3月17日 22:33
> 收件人: Kun Qin ; devel@edk2.groups.io; Liming Gao
> 
> 抄送: Chiu, Chasel ; Desimone, Nathaniel L
> ; Dong, Eric 
> 主题: RE: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> 
> Hi Liming,
> Can you help merge the first two patches in this patch set?
> If you need, I can provide the patch files.
> 
> Hi Kun,
> Thanks. Let's see if Liming can help.
> 
> Thanks
> Zhiguang
> 
> > -Original Message-
> > From: Kun Qin 
> > Sent: Wednesday, March 17, 2021 4:11 PM
> > To: Liu, Zhiguang ; devel@edk2.groups.io
> > Cc: Chiu, Chasel ; Desimone, Nathaniel L
> > ; Liming Gao
> > ; Dong, Eric 
> > Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> > CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> >
> > Hi Zhiguang,
> >
> > I do not mind check the reviewed patches (the first 3 changes,
> > specifically) in first. I have not done this before. How you want to 
> > proceed in
> > that case?
> >
> > Regards,
> > Kun
> >
> > On 03/17/2021 00:52, Liu, Zhiguang wrote:
> > > Reviewed-by: Zhiguang Liu 
> > >
> > > Hi Kun,
> > > Since the first two changes about MinPlatformPkg already got reviewed,
> > can we first check them in?
> > >
> > > Thanks
> > > Zhiguang
> > >
> > >> -Original Message-
> > >> From: devel@edk2.groups.io  On Behalf Of Kun
> > >> Qin
> > >> Sent: Wednesday, March 17, 2021 2:11 AM
> > >> To: devel@edk2.groups.io
> > >> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> > >> ; Liming Gao
> > >> ; Dong, Eric 
> > >> Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> > >> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> > >>
> > >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3250
> > >>
> > >> This change added NULL MmUnblockMemoryLib instance in dsc files of
> > >> CoreCommonLib to resolve newly introduced dependency. The library
> > >> interface is consumed by VariableSmmRuntimeDxe to better support
> > >> variable runtime cache feature.
> > >>
> > >> Cc: Chasel Chiu 
> > >> Cc: Nate DeSimone 
> > >> Cc: Liming Gao 
> > >> Cc: Eric Dong 
> > >>
> > >> Signed-off-by: Kun Qin 
> > >> Reviewed-by: Liming Gao 
> > >> ---
> > >>
> > >> Notes:
> > >>  v2:
> > >>  - Added reviewed-by tag [Liming]
> > >>
> > >>   Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1
> +
> > >>   1 file changed, 1 insertion(+)
> > >>
> > >> diff --git
> > >> a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > >> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > >> index cb40e111b5dd..bcabb797e91a 100644
> > >> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > >> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> > >> @@ -159,6 +159,7 @@ [LibraryClasses.common]
> > >>
> LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
> > >>
> > >> SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
> > >> +
> > >> +
> > >>
> >
> MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblo
> > >> ckMemoryLi
> > >> + bNull.inf
> > >>
> > >>
> SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
> > >>
> > >> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePoli
> > >> VariablePolicyLib|cyLi
> > >> b.inf
> > >> --
> > >> 2.30.0.windows.1
> > >>
> > >>
> > >>
> > >> 
> > >>
> > >




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




[edk2-devel] [Patch v2] MdeModulePkg: Initialize local variable value before they are used

2021-03-17 Thread gaoliming
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3228
This change is to fix the false compiler error on GCC49 release build.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Liming Gao 
Reviewed-by: Hao A Wu 
---
 In V2, add the comments for the false compiler warning

 MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 5 +
 .../VariablePolicyHelperLib/VariablePolicyHelperLib.c| 5 +
 2 files changed, 10 insertions(+)

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c 
b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index e99a812a44..1053695b3b 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -1127,6 +1127,11 @@ AhciDmaTransfer (
 return EFI_INVALID_PARAMETER;
   }
 
+  //
+  // Set Status to suppress incorrect compiler/analyzer warnings
+  //
+  Status = EFI_SUCCESS;
+
   //
   // DMA buffer allocation. Needs to be done only once for both sync and async
   // DMA transfers irrespective of number of retries.
diff --git 
a/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c 
b/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c
index 0c9299c8b0..6bcb95247f 100644
--- a/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c
+++ b/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c
@@ -115,6 +115,11 @@ CreateBasicVariablePolicy (
 return EFI_INVALID_PARAMETER;
   }
 
+  //
+  // Set NameSize to suppress incorrect compiler/analyzer warnings
+  //
+  NameSize  = 0;
+
   // Now we've gotta determine the total size of the buffer required for
   // the VariablePolicy structure.
   TotalSize = sizeof( VARIABLE_POLICY_ENTRY );
-- 
2.27.0.windows.1




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




Re: [EXTERNAL] Re: [edk2-devel] [PATCH] SecurityPkg/Tcg2Config: hide PCR Bank SHA1 checkbox

2021-03-17 Thread Qi Zhang
Submit a new BZ https://bugzilla.tianocore.org/show_bug.cgi?id=3268 for this 
change.

Patch set V2 has been sent out for review.

Thanks!
Qi Zhang
From: Bret Barkelew 
Sent: Thursday, March 18, 2021 4:45 AM
To: devel@edk2.groups.io; ler...@redhat.com; Yao, Jiewen 
; Zhang, Qi1 
Cc: Wang, Jian J ; Kumar, Rahul1 
Subject: RE: [EXTERNAL] Re: [edk2-devel] [PATCH] SecurityPkg/Tcg2Config: hide 
PCR Bank SHA1 checkbox

+1

- Bret


From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Laszlo Ersek 
via groups.io mailto:lersek=redhat@groups.io>>
Sent: Wednesday, March 17, 2021 11:28:07 AM
To: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>; Yao, Jiewen 
mailto:jiewen@intel.com>>; Zhang, Qi1 
mailto:qi1.zh...@intel.com>>
Cc: Wang, Jian J mailto:jian.j.w...@intel.com>>; Kumar, 
Rahul1 mailto:rahul1.ku...@intel.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] SecurityPkg/Tcg2Config: hide PCR 
Bank SHA1 checkbox

On 03/17/21 05:19, Yao, Jiewen wrote:
> Thank you Qi.
>
> i recommend we file a bugzilla on the scope of the problem

I agree.

We already have a number of BZs related to the disablement of SHA1 and MD5:

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1682data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca9f46449e57d4642ab4608d8e9727545%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637516025103613890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=Bxq4fGkZUA91NNncp%2F68zbcXSYBQcIfGbgcT4CYktKs%3Dreserved=0
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2943data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca9f46449e57d4642ab4608d8e9727545%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637516025103613890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=eh9ef1WSF1DuepEkiXg1x%2BmmWs77eNrkSObOS5SVB94%3Dreserved=0
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3003data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca9f46449e57d4642ab4608d8e9727545%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637516025103613890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=YJTXNb2GnPkkc9Y6GI%2BI9WYy8MdeujtSvpah5mWhrp0%3Dreserved=0
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3021data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca9f46449e57d4642ab4608d8e9727545%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637516025103613890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=pcAqk46YRGn9jS0ra5sl7Gg7i8PvqZbdewsH6hMq5YM%3Dreserved=0
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3027data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca9f46449e57d4642ab4608d8e9727545%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637516025103613890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=4sOMDQitxKwFfXmYFJ9ooF7hovK4vfMww0ppsHz5vjk%3Dreserved=0
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3079data=04%7C01%7Cbret.barkelew%40microsoft.com%7Ca9f46449e57d4642ab4608d8e9727545%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637516025103613890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=8is%2FUsgRy71E%2F9ui%2BkMwoTmp4jiw0vKlsUwJ%2BxEqfO0%3Dreserved=0

We should certainly track the change for Tcg2Config too, in a new BZ.

Thanks
Laszlo

>
> After the scope is agreed, then you can send the patch.
>
> For example, I can ask why not remove the sha1supported field at all?
>
> I hope the community can reach consensus on the problem statement at first.
>
>
> thank you!
> Yao, Jiewen
>
>
>> 在 2021年3月17日,上午10:56,Zhang, Qi1 
>> mailto:qi1.zh...@intel.com>> 写道:
>>
>> wrap SHA1 related by DISABLE_SHA1_DEPRECATED_INTERFACES.
>>
>> Cc: Jiewen Yao mailto:jiewen@intel.com>>
>> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>
>> Cc: Qi Zhang mailto:qi1.zh...@intel.com>>
>> Cc: Rahul Kumar mailto:rahul1.ku...@intel.com>>
>> Signed-off-by: Qi Zhang mailto:qi1.zh...@intel.com>>
>> ---
>> SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c 
>> b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
>> index 2946f95db0..81a4d3fa6a 100644
>> --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
>> +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
>> @@ -710,9 +710,11 @@ SetConfigInfo (
>>   )
>> {
>>   switch (TpmAlgHash) {
>> +#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
>>   case TPM_ALG_SHA1:

回复: [edk2-devel] [edk2-platforms] [patch 00/35] Consume RegisterFilterLibNull instance

2021-03-17 Thread gaoliming
Laszlo and Dandan:

> -邮件原件-
> 发件人: Laszlo Ersek 
> 发送时间: 2021年3月18日 1:08
> 收件人: Bi, Dandan ; devel@edk2.groups.io;
> gaolim...@byosoft.com.cn; a...@kernel.org; 'Andrew Fish'
> 
> 抄送: 'Leif Lindholm' ; Kinney, Michael D
> 
> 主题: Re: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
> RegisterFilterLibNull instance
> 
> On 03/17/21 16:05, Bi, Dandan wrote:
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of
> >> gaoliming
> >> Sent: Wednesday, March 17, 2021 11:05 AM
> >> To: devel@edk2.groups.io; a...@kernel.org; Bi, Dandan
> >> ; 'Laszlo Ersek' ; 'Andrew
> Fish'
> >> 
> >> Cc: 'Leif Lindholm' ; Kinney, Michael D
> >> 
> >> Subject: 回复: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
> >> RegisterFilterLibNull instance
> >>
> >> Ard and Dandan:
> >>
> >>> -邮件原件-
> >>> 发件人: devel@edk2.groups.io  代表 Ard
> >> Biesheuvel
> >>> 发送时间: 2021年3月16日 23:01
> >>> 收件人: devel@edk2.groups.io; dandan...@intel.com; Laszlo Ersek
> >>> ; Andrew Fish 
> >>> 抄送: Leif Lindholm ; Michael D Kinney
> >>> ; Liming Gao 
> >>> 主题: Re: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
> >>> RegisterFilterLibNull instance
> >>>
> >>> On Tue, 16 Mar 2021 at 15:56, Dandan Bi  wrote:
> 
>  REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
>  RFC: https://edk2.groups.io/g/devel/message/72530
> 
> 
>  Add RegisterFilterLibNull in dsc files in edk2-platforms repo, which
>  will be consumed by IoLib and BaseLib.
> 
>  This is the following update in edk2-platforms repo for the change
>  in edk2, which will add RegisterFilterLib dependency for IoLib and
>  BaseLib to
> >>> filter/trace
>  port IO/MMIO/MSR access.
>  https://edk2.groups.io/g/devel/message/72754
> 
>  Cc: Leif Lindholm 
>  Cc: Michael D Kinney 
>  Cc: Liming Gao 
> 
> >>>
> >>> It is a bit disappointing that we have to update every platform in
> >>> existence again to apply a change to a core module.
> >>>
> >>
> >> I suggest to add MdePkg.dsc.inc file to include the default library 
> >> instance,
> >> and update all Platform DSC to include it. Then, for the future change, no
> >> change is required for platform DSC.
> >>
> >> Because this patch set updates every platform DSC, I suggest to introduce
> >> MdePkg.dsc.inc file in this patch set.
> >
> > Hi Liming,
> >
> > I agree that add MdePkg.dsc.inc file to include the default library instance
> and make it consumed by platform dsc will benefit future similar incompatible
> changes.
> > But I wonder to know whether we could do it in a separated task/topic,  as
> > 1.  It should be a code infrastructure design change/improvement in edk2.
> > 2.  Personally I don't hope the new solution will have much impact on my
> current schedule, but it seems have.
> > And we may need to:
> > 1). Clarify the default library instances which should be added in
> MdePkg.dsc.inc
> > The library instances in MdePkg.dsc.inc should be generic enough to
> be widely included in platform dsc files.
> > 2). Update dsc files in edk2 and edk2-platforms repo to include
> MdePkg.dsc.inc and cleanup the default Lib instance in dsc files.
> 
> (1) The file name should be "MdeLibs.dsc.inc", and it should be
> structured similarly "NetworkLibs.dsc.inc" -- no [LibraryClasses] header
> should be part of the file.
> 
I agree.

> (2) The introduction of "MdeLibs.dsc.inc" is a big task, in my opinion.
> 
The full MdeLibs.dsc.inc is a big task. But, it should be a separate task. 

For this patch set, the first version MdeLibs.dsc.inc can be added. It only 
includes RegisterFilterLibNull library instance.
And, this patch set will update every platform DSC to include MdeLibs.dsc.inc. 
The future incompatible change can update MdeLibs.dsc.inc only, and avoid the 
change in each platform DSC.
I would like to resolve the potential incompatible change by MdeLibs.dsc.inc on 
the first step.

Thanks
Liming
> As I stated earlier, I wouldn't like to review a patch for OvmfPkg that
> replaces (say) 50-100 lines of library class resolutions with a simple
> !include directive. Such a patch is unreviewable, as I'd have no way of
> carefully comparing the before-after state, let alone a way of *pointing
> out* (in comments) where exactly a problem was.
> 
> So I think such an include file would require a patch set, and the lib
> class resolutions should be migrated in small *topical* steps. Such as:
> 
> - introduce the DSC include file as empty
> - add the !include directive to platform DSCs
> - add a small set of libraries (with some topical coherence) to the
> include file,
> - remove the same set of resolutions from platform DSCs,
> - repeat the last two steps until all "topics" have been covered.
> 
> Thanks
> Laszlo
> 
> 
> >
> >
> > Thanks,
> > Dandan
> >>
> >> Thanks
> >> Liming
> >>> Is there really not a better way to provide a 'default' resolution for
> >>> a library class? Maybe a change to the .DEC format, so that the file
> >>> which 

[edk2-devel] [PATCH v2 1/1] SecurityPkg/Tcg2Config: hide PCR Bank SHA1 checkbox

2021-03-17 Thread Qi Zhang
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3268

wrap SHA1 related by DISABLE_SHA1_DEPRECATED_INTERFACES.

Cc: Jiewen Yao 
Cc: Jian J Wang 
Cc: Qi Zhang 
Cc: Rahul Kumar 
Signed-off-by: Qi Zhang 
---
 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c 
b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
index 2946f95db0..81a4d3fa6a 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
@@ -710,9 +710,11 @@ SetConfigInfo (
   )
 {
   switch (TpmAlgHash) {
+#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
   case TPM_ALG_SHA1:
 Tcg2ConfigInfo->Sha1Supported = TRUE;
 break;
+#endif
   case TPM_ALG_SHA256:
 Tcg2ConfigInfo->Sha256Supported = TRUE;
 break;
-- 
2.26.2.windows.1



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




[edk2-devel] [PATCH v2 0/1] SecurityPkg/Tcg2Config: hide PCR Bank SHA1 checkbox

2021-03-17 Thread Qi Zhang
v2: add bugzilla id

Qi Zhang (1):
  SecurityPkg/Tcg2Config: hide PCR Bank SHA1 checkbox

 SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.26.2.windows.1



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




[edk2-devel] [PATCH v4] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-17 Thread IanX Kuo
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

No need to print PCIe details while CapabilityId is 0x.
Limit the NextCapabilityOffset to PCI/PCIe configuration space.

Signed-off-by: VincentX Ke 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..1e5dc75e27 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2038,12 +2038,14 @@ LocatePciCapability (
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   );
 
@@ -2921,6 +2923,7 @@ ShellCommandRunPci (
 PciExplainPciExpress (
   (PCI_CAPABILITY_PCIEXP *) ((UINT8 *)  + 
PcieCapabilityPtr),
   ExtendedConfigSpace,
+  ExtendedConfigSize,
   ExtendedCapability
   );
   }
@@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   )
 {
@@ -5786,7 +5791,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
@@ -5800,7 +5805,8 @@ PciExplainPciExpress (
 //
 // Advance to the next item if it exists
 //
-if (ExtHdr->NextCapabilityOffset != 0) {
+if (ExtHdr->NextCapabilityOffset != 0 &&
+   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + 
EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
   ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
 } else {
   break;
-- 
2.18.0.windows.1



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




Re: [edk2-devel] [PATCH v3 1/1] BaseTools/Ecc: Make Ecc only check first include guard

2021-03-17 Thread Bob Feng
Create a PR https://github.com/tianocore/edk2/pull/1500

Thanks,
Bob

-Original Message-
From: pierre.gond...@arm.com  
Sent: Wednesday, March 17, 2021 6:00 PM
To: devel@edk2.groups.io; Feng, Bob C ; 
gaolim...@byosoft.com.cn; Chen, Christine 
Subject: [PATCH v3 1/1] BaseTools/Ecc: Make Ecc only check first include guard

From: Pierre Gondois 

The Ecc tool checks the format of the include guard. This check is currently 
done on all the names following the '#ifndef' statement.
It should only be done on the first include guard.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3252
Signed-off-by: Pierre Gondois 
Reviewed-by: Liming Gao 
Reviewed-by: Bob Feng 
---
The changes can be seen at: 
https://github.com/PierreARM/edk2/tree/1640_Ecc_tool_corrections_v3

Notes:
v2:
 - Remove duplicated copyright.
 - Add Bob Feng's reviewed-by.
 - Add Liming Gao's reviewed-by (resend).

v3:
 - Correct bad formatting of patch
   (not-possible to apply the patch). [Bob]

 BaseTools/Source/Python/Ecc/Check.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index 7a012617fd35..33060db5f27a 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1437,11 +1437,13 @@ class Check(object):
 
 SqlCommand = """select ID, Value from %s where Model = %s""" % 
(FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
 RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
-for Record in RecordSet:
-Name = Record[1].replace('#ifndef', '').strip()
+if RecordSet:
+# Only check the first ifndef statement of the file
+FirstDefine = sorted(RecordSet, key=lambda Record: 
Record[0])[0]
+Name = FirstDefine[1].replace('#ifndef', '').strip()
 if Name[0] == '_' or Name[-1] != '_' or Name[-2] == '_':
 if not 
EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 Name):
-
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), 
BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDE
+ F_STATEMENT, OtherMsg="The #ifndef name [%s] does not follow the 
+ rules" % (Name), BelongsToTable=FileTable, 
+ BelongsToItem=FirstDefine[0])
 
 # Rule for path name, variable name and function name
 # 1. First character should be upper case
--
2.17.1



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




[edk2-devel] File //Designs/2021/0319/New EFI Protocols for edk2 Redfish Implementation_v2.pdf updated #file-notice

2021-03-17 Thread devel@edk2.groups.io Notification


The following files have been updated in the Files area of the 
devel@edk2.groups.io group.

* //Designs/2021/0319/New EFI Protocols for edk2 Redfish Implementation_v2.pdf 
( https://edk2.groups.io/g/devel/files//Designs/2021/0319/New EFI Protocols for 
edk2 Redfish Implementation_v2.pdf )

*By:* Nickle Wang 





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




Re: [edk2-devel] [PATCH v2 1/2] UefiCpuPkg/CpuDxe: Rename variables to follow EDKII coding standard

2021-03-17 Thread Dong, Eric
Reviewed-by: Eric Dong 

-Original Message-
From: Ni, Ray  
Sent: Wednesday, March 17, 2021 7:07 PM
To: devel@edk2.groups.io
Cc: Dong, Eric ; Laszlo Ersek ; Kumar, 
Rahul1 
Subject: [PATCH v2 1/2] UefiCpuPkg/CpuDxe: Rename variables to follow EDKII 
coding standard

The change doesn't impact any functionality.

Signed-off-by: Ray Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Rahul Kumar 
---
 UefiCpuPkg/CpuDxe/CpuGdt.c | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c index 
a1ab543f2d..8847bc4819 100644
--- a/UefiCpuPkg/CpuDxe/CpuGdt.c
+++ b/UefiCpuPkg/CpuDxe/CpuGdt.c
@@ -2,7 +2,7 @@
   C based implementation of IA32 interrupt handling only   requiring a minimal 
assembly interrupt entry point. -  Copyright (c) 2006 - 2015, Intel 
Corporation. All rights reserved.+  Copyright (c) 2006 - 2021, Intel 
Corporation. All rights reserved.   SPDX-License-Identifier: 
BSD-2-Clause-Patent  **/@@ -13,7 +13,7 @@
 // // Global descriptor table (GDT) Template //-STATIC GDT_ENTRIES GdtTemplate 
= {+STATIC GDT_ENTRIES mGdtTemplate = {   //   // NULL_SEL   //@@ -124,27 
+124,27 @@ InitGlobalDescriptorTable (
   VOID   ) {-  GDT_ENTRIES *gdt;-  IA32_DESCRIPTOR gdtPtr;+  GDT_ENTRIES   
*Gdt;+  IA32_DESCRIPTOR   Gdtr;//   // Allocate Runtime Data for 
the GDT   //-  gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8);-  ASSERT 
(gdt != NULL);-  gdt = ALIGN_POINTER (gdt, 8);+  Gdt = AllocateRuntimePool 
(sizeof (mGdtTemplate) + 8);+  ASSERT (Gdt != NULL);+  Gdt = ALIGN_POINTER 
(Gdt, 8);//   // Initialize all GDT entries   //-  CopyMem (gdt, 
, sizeof (GdtTemplate));+  CopyMem (Gdt, , sizeof 
(mGdtTemplate));//   // Write GDT register   //-  gdtPtr.Base = 
(UINT32)(UINTN)(VOID*) gdt;-  gdtPtr.Limit = (UINT16) (sizeof (GdtTemplate) - 
1);-  AsmWriteGdtr ();+  Gdtr.Base  = (UINT32) (UINTN) Gdt;+  Gdtr.Limit 
= (UINT16) (sizeof (mGdtTemplate) - 1);+  AsmWriteGdtr ();//   // 
Update selector (segment) registers base on new GDT@@ -152,4 +152,3 @@ 
InitGlobalDescriptorTable (
   SetCodeSelector ((UINT16)CPU_CODE_SEL);   SetDataSelectors 
((UINT16)CPU_DATA_SEL); }--- 
2.27.0.windows.1



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




Re: [edk2-devel] [PATCH 0/2] Maintainers: create the "OvmfPkg: Confidential Computing" subsystem

2021-03-17 Thread Laszlo Ersek
(Top posting, maybe that way I'll have more luck.)

Min Xu -- it's not really trust-inspiring to not receive any feedback
(not even an out-of-office auto-response) from you, in a week, for a
Maintainers.txt patch that designates you as a reviewer for confidential
computing in OVMF. If we are to extrapolate from this responsiveness,
what should we expect for actual *patch* reviews?

Would you like me to drop your name & entry from patch#2?

Laszlo

On 03/11/21 18:13, Laszlo Ersek wrote:
> On 03/10/21 19:56, Laszlo Ersek wrote:
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2198
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3077
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3249
>>
>> Generalize the current OVMF SEV subsystem entry, so that we can use it
>> for Intel TDX in the future, ensuring proper patch circulation for
>> reviews.
>>
>> Cc: Andrew Fish 
>> Cc: Ard Biesheuvel 
>> Cc: Brijesh Singh 
>> Cc: James Bottomley 
>> Cc: Jiewen Yao 
>> Cc: Jordan Justen 
>> Cc: Leif Lindholm 
>> Cc: Michael D Kinney 
>> Cc: Min Xu 
>> Cc: Philippe Mathieu-Daudé 
>> Cc: Tom Lendacky 
>>
>> Thanks
>> Laszlo
>>
>> Laszlo Ersek (2):
>>   Maintainers: refresh the OVMF SEV subsystem after TianoCore #2198 and
>> #3077
>>   Maintainers: rename the OVMF SEV subsystem to "Confidential Computing"
>>
>>  Maintainers.txt | 28 +---
>>  1 file changed, 18 insertions(+), 10 deletions(-)
>>
>>
>> base-commit: edd46cd407ea4a0adaa8d6ca86f550c2a4d5c507
>>
> 
> For merging this series, I still need ACKs from James and Min Xu, please.
> 
> Thanks
> Laszlo
> 
> 
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-17 Thread IanX Kuo
Hi Laszlo

Thanks for the remind. I will take care the date and Patch v4 in our next patch.

Thanks,
Ian Kuo
-Original Message-
From: Laszlo Ersek  
Sent: Thursday, March 18, 2021 5:01 AM
To: devel@edk2.groups.io; Kuo, IanX 
Cc: Ke, VincentX 
Subject: Re: [edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI 
extended config space parser

Vincent, Ian:

something is seriously broken in your email setup. I have seen three messages 
from you guys on the list, and each one of those is "from the future". Here are 
the Date headers from the messages:

- Date: Thu,  8 Apr 2021 05:50:21 +0800
  https://edk2.groups.io/g/devel/message/72748

- Date: Sat, 10 Apr 2021 01:34:45 +0800
  https://edk2.groups.io/g/devel/message/72862

- Date: Sat, 10 Apr 2021 22:15:09 +0800
  https://edk2.groups.io/g/devel/message/72953

Please fix your clock setup, and post a new version.

This is why I am asking: the git-am manual says,

   --ignore-date
   By default the command records the date from the e-mail
   message as the commit author date, and uses the time of
   commit creation as the committer date. [...]

When we merge a patch using a github.com Pull Request, the "mergify bot"
preserves the Author Date field. That's a good thing in itself, but it means 
that the edk2 commit history would have a patch from the future -- a patch 
committed in March, but "authored" in April. That's bogus.

Whoever actually applies the patch (probably the ShellPkg maintainer) can work 
around the issue, by specifying the "--ignore-date" flag for "git-am". But 
that's easy to forget, and not the right thing anyway.

So please just fix your broken clock, and post a new version.

Also: you should have used v1, v2, v3 in the subject prefixes (just pass -v1, 
-v2, -v3 to git-format-patch). The next version that you post should be marked 
"v4".

Thanks
Laszlo


On 04/10/21 16:15, IanX Kuo wrote:
> From: VincentX Ke 
> 
> Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)
> 
> No need to print PCIe details while CapabilityId is 0x.
> Limit the NextCapabilityOffset to PCI configuration space.
> 
> Signed-off-by: VincentX Ke 
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> index a2f04d8db5..1e5dc75e27 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> @@ -2038,12 +2038,14 @@ LocatePciCapability (
>  
>@param[in] PciExpressCap   PCI Express capability buffer.
>@param[in] ExtendedConfigSpace PCI Express extended configuration space.
> +  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
>@param[in] ExtendedCapability  PCI Express extended capability ID to 
> explain.
>  **/
>  VOID
>  PciExplainPciExpress (
>IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
>IN  UINT8  *ExtendedConfigSpace,
> +  IN  UINTN  ExtendedConfigSize,
>IN CONST UINT16ExtendedCapability
>);
>  
> @@ -2921,6 +2923,7 @@ ShellCommandRunPci (
>  PciExplainPciExpress (
>(PCI_CAPABILITY_PCIEXP *) ((UINT8 *)  + 
> PcieCapabilityPtr),
>ExtendedConfigSpace,
> +  ExtendedConfigSize,
>ExtendedCapability
>);
>}
> @@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
>  
>@param[in] PciExpressCap   PCI Express capability buffer.
>@param[in] ExtendedConfigSpace PCI Express extended configuration space.
> +  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
>@param[in] ExtendedCapability  PCI Express extended capability ID to 
> explain.
>  **/
>  VOID
>  PciExplainPciExpress (
>IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
>IN  UINT8  *ExtendedConfigSpace,
> +  IN  UINTN  ExtendedConfigSize,
>IN CONST UINT16ExtendedCapability
>)
>  {
> @@ -5786,7 +5791,7 @@ PciExplainPciExpress (
>}
>  
>ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
> -  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) 
> {
> +  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 
> + && ExtHdr->CapabilityId != 0x) {
>  //
>  // Process this item
>  //
> @@ -5800,7 +5805,8 @@ PciExplainPciExpress (
>  //
>  // Advance to the next item if it exists
>  //
> -if (ExtHdr->NextCapabilityOffset != 0) {
> +if (ExtHdr->NextCapabilityOffset != 0 &&
> +   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize 
> + + EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
>ExtHdr = 

Re: [edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-17 Thread Laszlo Ersek
Vincent, Ian:

something is seriously broken in your email setup. I have seen three
messages from you guys on the list, and each one of those is "from the
future". Here are the Date headers from the messages:

- Date: Thu,  8 Apr 2021 05:50:21 +0800
  https://edk2.groups.io/g/devel/message/72748

- Date: Sat, 10 Apr 2021 01:34:45 +0800
  https://edk2.groups.io/g/devel/message/72862

- Date: Sat, 10 Apr 2021 22:15:09 +0800
  https://edk2.groups.io/g/devel/message/72953

Please fix your clock setup, and post a new version.

This is why I am asking: the git-am manual says,

   --ignore-date
   By default the command records the date from the e-mail
   message as the commit author date, and uses the time of
   commit creation as the committer date. [...]

When we merge a patch using a github.com Pull Request, the "mergify bot"
preserves the Author Date field. That's a good thing in itself, but it
means that the edk2 commit history would have a patch from the future --
a patch committed in March, but "authored" in April. That's bogus.

Whoever actually applies the patch (probably the ShellPkg maintainer)
can work around the issue, by specifying the "--ignore-date" flag for
"git-am". But that's easy to forget, and not the right thing anyway.

So please just fix your broken clock, and post a new version.

Also: you should have used v1, v2, v3 in the subject prefixes (just pass
-v1, -v2, -v3 to git-format-patch). The next version that you post
should be marked "v4".

Thanks
Laszlo


On 04/10/21 16:15, IanX Kuo wrote:
> From: VincentX Ke 
> 
> Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)
> 
> No need to print PCIe details while CapabilityId is 0x.
> Limit the NextCapabilityOffset to PCI configuration space.
> 
> Signed-off-by: VincentX Ke 
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> index a2f04d8db5..1e5dc75e27 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> @@ -2038,12 +2038,14 @@ LocatePciCapability (
>  
>@param[in] PciExpressCap   PCI Express capability buffer.
>@param[in] ExtendedConfigSpace PCI Express extended configuration space.
> +  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
>@param[in] ExtendedCapability  PCI Express extended capability ID to 
> explain.
>  **/
>  VOID
>  PciExplainPciExpress (
>IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
>IN  UINT8  *ExtendedConfigSpace,
> +  IN  UINTN  ExtendedConfigSize,
>IN CONST UINT16ExtendedCapability
>);
>  
> @@ -2921,6 +2923,7 @@ ShellCommandRunPci (
>  PciExplainPciExpress (
>(PCI_CAPABILITY_PCIEXP *) ((UINT8 *)  + 
> PcieCapabilityPtr),
>ExtendedConfigSpace,
> +  ExtendedConfigSize,
>ExtendedCapability
>);
>}
> @@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
>  
>@param[in] PciExpressCap   PCI Express capability buffer.
>@param[in] ExtendedConfigSpace PCI Express extended configuration space.
> +  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
>@param[in] ExtendedCapability  PCI Express extended capability ID to 
> explain.
>  **/
>  VOID
>  PciExplainPciExpress (
>IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
>IN  UINT8  *ExtendedConfigSpace,
> +  IN  UINTN  ExtendedConfigSize,
>IN CONST UINT16ExtendedCapability
>)
>  {
> @@ -5786,7 +5791,7 @@ PciExplainPciExpress (
>}
>  
>ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
> -  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
> +  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
> ExtHdr->CapabilityId != 0x) {
>  //
>  // Process this item
>  //
> @@ -5800,7 +5805,8 @@ PciExplainPciExpress (
>  //
>  // Advance to the next item if it exists
>  //
> -if (ExtHdr->NextCapabilityOffset != 0) {
> +if (ExtHdr->NextCapabilityOffset != 0 &&
> +   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + 
> EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
>ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
> ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
>  } else {
>break;
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72991): https://edk2.groups.io/g/devel/message/72991
Mute This Topic: https://groups.io/mt/81397147/21656
Group Owner: devel+ow...@edk2.groups.io

[edk2-devel] [PATCH] OvmfPkg: strip build paths in release builds

2021-03-17 Thread Ross Burton
GenFw will embed a NM10 section which contains the path to the input file,
which means the output files have build paths embedded in them.  To reduce
information leakage and ensure reproducible builds, pass --zero in release
builds to remove this information.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3256
Change-Id: Ie607893b979674e237cf04ead5c7690d7b1aedaf
Signed-off-by: Ross Burton 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 1 +
 OvmfPkg/Bhyve/BhyveX64.dsc   | 1 +
 OvmfPkg/OvmfPkgIa32.dsc  | 2 ++
 OvmfPkg/OvmfPkgIa32X64.dsc   | 1 +
 OvmfPkg/OvmfPkgX64.dsc   | 1 +
 OvmfPkg/OvmfXen.dsc  | 1 +
 6 files changed, 7 insertions(+)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 65c42284d9..69a05feea9 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -78,6 +78,7 @@
   GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
   INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
 !endif
+  RELEASE_*_*_GENFW_FLAGS = --zero
 
   #
   # Disable deprecated APIs.
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 4a1cdf5aca..132f55cf69 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -76,6 +76,7 @@
   GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
   INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
 !endif
+  RELEASE_*_*_GENFW_FLAGS = --zero
 
   #
   # Disable deprecated APIs.
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 1eaf3e99c6..ce20f09df8 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -90,6 +90,8 @@
 
 !include NetworkPkg/NetworkBuildOptions.dsc.inc
 
+  RELEASE_*_*_GENFW_FLAGS = --zero
+
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
   XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 4a5a430147..97cc438250 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -84,6 +84,7 @@
   GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
   INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
 !endif
+  RELEASE_*_*_GENFW_FLAGS = --zero
 
   #
   # Disable deprecated APIs.
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index d4d601b444..f544fb04bf 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -84,6 +84,7 @@
   GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
   INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
 !endif
+  RELEASE_*_*_GENFW_FLAGS = --zero
 
   #
   # Disable deprecated APIs.
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 507029404f..fcaa35acf1 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -74,6 +74,7 @@
   GCC:*_*_X64_GENFW_FLAGS   = --keepexceptiontable
   INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable
 !endif
+  RELEASE_*_*_GENFW_FLAGS = --zero
 
   #
   # Disable deprecated APIs.
-- 
2.25.1



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




Re: [edk2-devel] How does EDK2 detect virtio-blk-pci device as a boot device

2021-03-17 Thread Xiaohe Yang



在 2021/3/13 上午4:42, Laszlo Ersek 写道:

On 03/11/21 15:48, Xiaohe Yang wrote:

Hello, I am using EDK2  OvmfPkgX64 at commit 37568365, and have a
problem. The following is the detail.


The Image disk that I use has EFI system partition, and is configured as
a virtio-blk-pci device. Bootorder file-entry is not added in fw_cfg
device. The log of EDK2 shows that

(1)  VirtioBlkDxe.efi is successfully loaded at DXE stage.
BootScriptExecutorDxe drivers "was discovered but not loaded".

(2) PCI enumeration has finished at the start of BDS stage,
virtio-blk-pci device is discovered. And one Option Rom's address is 0/0.

(3) Before entering Shell, log shows "map: No mapping found".

(4) After entering Shell, I choose “Boot From File”, the virtio-blk-pci
device is not displayed.


So I wonder what are the requirements for UEFI to detect the
virtio-blk-pci device as a boot device, except having EFI system partition?

If you have a firmware log with DEBUG_VERBOSE enabled, I could take a look.

Assuming you are *not* on QEMU (e.g., you are developing a new
virtio-blk device, and running OVMF on your non-QEMU emulator), it could
be anything, really. Try to add DEBUG messages to the following drivers
/ functions:



Yes, I am developing a new virtio-blk device on my non-QEMU emulator.



- VirtioPciDeviceDxe
   - VirtioPciDeviceBindingSupported
   - VirtioPciDeviceBindingStart

- Virtio10Dxe
   - Virtio10BindingSupported
   - Virtio10BindingStart

- VirtioBlkDxe
   - VirtioBlkDriverBindingSupported
   - VirtioBlkDriverBindingStart

These drivers all follow the UEFI driver model. So, if you find no
mapping for the virtio-blk-pci device in the UEFI shell, then they fail
to bind your device implementation for some reason.

You mention that there is no "bootorder" fw_cfg file, so
PlatformBdsConnectSequence() will see ConnectDevicesFromQemu() fail, and
then EfiBootManagerConnectAll() will be called. If the virtio-blk-pci
devices are not connected under those circumstances, then they don't do
something that the virtio PCI transport drivers (0.9.5 or 1.0) expect,
or the virtio-blk device driver expects. There's no silver bullet, you
may have to add DEBUGs to various spots in these drivers, to see what fails.

Thanks
Laszlo


I follow your suggestions and add more debug infos, and the problem is 
fixed.



Thanks for your help.

Xiaohe Yang




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




[edk2-devel] [PATCH v3 06/10] Silicon/Phytium: Added Spi driver support to FT2000/4

2021-03-17 Thread Ling Jia
The SpiDxe is to provide Spi bus read-write interfaces.

v3:
Optimized the codes to conform to specifications.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec   |   9 +
 Platform/Phytium/DurianPkg/DurianPkg.dsc|   5 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf|   2 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf   |  44 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h |  64 +++
 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h |  51 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 198 

 7 files changed, 373 insertions(+)

diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec 
b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
index 48f430c88d..69842b89e0 100644
--- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
@@ -38,4 +38,13 @@
   gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002
   gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003
 
+  #
+  # SPI Flash Controller Register Base Address and Size
+  #
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007
+
 [Protocols]
+  gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 
0x9d, 0x80, 0xdd, 0x0b, 0x7c}}
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 3a9bc2289c..68698d613f 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -244,6 +244,11 @@
   #
   ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
 
+  #
+  # Spi driver
+  #
+  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
+
   #
   # Usb Support
   #
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index a443d0f3a4..1cf1927484 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -95,6 +95,8 @@ READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
 
+  INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
+
   INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
   INF 
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
 
diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
new file mode 100644
index 00..21d75f268d
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
@@ -0,0 +1,44 @@
+#/** @file
+#  Phytium Spi Master Drivers.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = SpiDxe
+  FILE_GUID  = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= SpiMasterDrvEntryPoint
+
+[Sources.common]
+  SpiDxe.c
+  SpiDxe.h
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
+  UefiLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Guids]
+
+[Protocols]
+  gSpiMasterProtocolGuid
+
+[FixedPcd]
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase
+
+[Depex]
+  TRUE
diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h
new file mode 100644
index 00..fbadd01921
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h
@@ -0,0 +1,64 @@
+/** @file
+  Phytium Spi Drivers Header
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef SPI_DXE_H_
+#define SPI_DXE_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I')
+#define REG_MODE_REG 0x02C
+
+EFI_STATUS
+EFIAPI
+SpiMasterGetConfig (
+  IN   UINT8CmdId,
+  OUT  UINT32   *Config,
+  IN   UINTNRegAddr
+  );
+
+EFI_STATUS
+EFIAPI
+SpiMasterSetConfig (
+  IN  UINT8 CmdId,
+  IN  UINT32Config,
+  IN  UINTN RegAddr
+  );
+
+EFI_STATUS
+EFIAPI
+SpiMasterSetMode (
+  IN  UINT32Config
+  );
+
+EFI_STATUS
+EFIAPI
+SpiMasterInit (
+  VOID
+  );
+
+typedef struct {
+  EFI_SPI_DRV_PROTOCOLSpiMasterProtocol;

[edk2-devel] [PATCH v3 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4

2021-03-17 Thread Ling Jia
The PlatformLib supported the system library for FT2000/4 chip.
Platform/Phytium: Added the dsc and fdf files of DurianPkg.

v3:
DurianPkg.dsc:Added OrderedCollectionLib to upstream changes in
edk2, and some parameters omitted in V2 version.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec  
 |  41 +++
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc  
 | 345 
 Platform/Phytium/DurianPkg/DurianPkg.dsc   
 | 298 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf   
 | 210 
 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf
 |  55 
 Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h  
 | 112 +++
 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c  
 | 137 
 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c   
 | 156 +
 
Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/AArch64/PhytiumPlatformHelper.S 
|  76 +
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.fdf.inc  
 | 119 +++
 10 files changed, 1549 insertions(+)

diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec 
b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
new file mode 100644
index 00..48f430c88d
--- /dev/null
+++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
@@ -0,0 +1,41 @@
+## @file
+# This package provides common Phytium silicon modules.
+#
+# Copyright (C) 2020, Phytium Technology Co,Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  DEC_SPECIFICATION  = 0x0001001b
+  PACKAGE_NAME   = PhytiumCommnonPkg
+  PACKAGE_GUID   = b34af0b4-3e7c-11eb-a9d0-0738806d2dec
+  PACKAGE_VERSION= 0.1
+
+
+#
+# Include Section - list of Include Paths that are provided by this package.
+#   Comments are used for Keywords and Module Types.
+#
+# Supported Module Types:
+#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
+#
+
+[Includes]
+  Include # Root include for the package
+
+[Guids.common]
+  gPhytiumPlatformTokenSpaceGuid = { 0x8c3abed4, 0x1fc8, 0x46d3, { 0xb4, 0x17, 
0xa3, 0x22, 0x38, 0x14, 0xde, 0x76 } }
+
+[PcdsFixedAtBuild.common]
+  gPhytiumPlatformTokenSpaceGuid.PcdSystemIoBase|0x0|UINT64|0x
+  gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001
+
+  #
+  # PCI configuration address space
+  #
+  gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002
+  gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003
+
+[Protocols]
diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc 
b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
new file mode 100644
index 00..121fe0e7c5
--- /dev/null
+++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
@@ -0,0 +1,345 @@
+## @file
+# This package provides common open source Phytium silicon modules.
+#
+# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+
+[LibraryClasses.common]
+  #
+  # ARM Architectural Libraries
+  #
+  ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
+  ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
+  ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
+  
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+  
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
+  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+
+  AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
+  
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+  CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
+  
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
+  

[edk2-devel] [PATCH v3 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4

2021-03-17 Thread Ling Jia
The PCI Segment Library for Phytium platform.
with multiple RCs.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +-
 Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf |   28 +
 Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c   | 1434 

 3 files changed, 1464 insertions(+), 7 deletions(-)

diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 28e52e15e3..093b2cd9db 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -35,7 +35,8 @@
   PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
-
+  # Pci dependencies
+  
PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf
 
 

 #
@@ -262,12 +263,6 @@
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 
-  #
-  # PCI Support
-  #
-  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
-  
MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
-
   #
   # The following 2 module perform the same work except one operate variable.
   # Only one of both should be put into fdf.
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf 
b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf
new file mode 100644
index 00..67360016ef
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf
@@ -0,0 +1,28 @@
+#/** @file
+#  PCI Segment Library for Phytium platform with multiple RCs.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = PciSegmentLib
+  FILE_GUID  = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciSegmentLib
+
+[Sources]
+  PciSegmentLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c 
b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c
new file mode 100644
index 00..c10b152e0d
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c
@@ -0,0 +1,1434 @@
+/** @file
+  PCI Segment Library for SoC with multiple RCs.
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PCI_SEG_CONFIG_BASE   0x4000
+#define PCIE_BIF_MODE 0x29100800
+
+typedef enum {
+  PciCfgWidthUint8 = 0,
+  PciCfgWidthUint16,
+  PciCfgWidthUint32,
+  PciCfgWidthMax
+} PCI_CFG_WIDTH;
+
+/**
+  Assert the validity of a PCI Segment address.
+  A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63
+
+  @param[in]  A The address to validate.
+  @param[in]  M Additional bits to assert to be zero.
+
+**/
+#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \
+ASSERT (((A) & (0xf000ULL | (M))) == 0)
+
+
+#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \
+{ \
+  (Bus)  = (((Address) >> 20) & 0xff);   \
+  (Device)   = (((Address) >> 15) & 0x1f);   \
+   (Function) = (((Address) >> 12) & 0x07);   \
+}
+
+
+/**
+  This function  geted the config base of PCI device.
+  @param[in]  Address  The address that encodes the PCI Bus, Device, Function 
and
+   Register.
+
+  @return The value of the config base of PCI device.
+
+**/
+STATIC
+UINT64
+PciSegmentLibGetConfigBase (
+  IN  UINT64  Address
+  )
+{
+  UINT8 Bus;
+  UINT8 Device;
+  UINT8 Function;
+  UINT8 RootPortCount;
+  UINT8 Peu0RootPortCount;
+  UINT8 Peu1RootPortCount;
+  UINT32 BifMode;
+  UINT32 Peu0BifMode;
+  UINT32 Peu1BifMode;
+
+  EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function);
+  BifMode = MmioRead32 (PCIE_BIF_MODE);
+  Peu0BifMode = BifMode & 0x3;
+  Peu1BifMode = (BifMode >> 2) & 0x3;
+
+  if ((Peu0BifMode == 1)) {
+Peu0RootPortCount = 3;
+  } else {
+Peu0RootPortCount = 2;
+  }
+
+  if ((Peu1BifMode == 1)) {
+Peu1RootPortCount = 3;
+  } else {
+Peu1RootPortCount = 2;
+  }
+  RootPortCount = Peu0RootPortCount + Peu1RootPortCount;
+  //ignore device > 0 or function > 0 on root port
+  if (RootPortCount == 4) {
+if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) {
+  if (Device != 0 || Function != 0) {
+return 0x;
+  }
+  return PCI_SEG_CONFIG_BASE;
+}
+  } else if 

[edk2-devel] [PATCH v3 02/10] Silicon/Phytium: Added Acpi support to FT2000/4

2021-03-17 Thread Ling Jia
Added Acpi driver and table to FT2000/4,
the ACPI Tables providing library AcpiTables.inf uses
a lot of information that is available in the form of PCDs
for differnt platforms.

v3:
Optimize code to conform to specifications.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Platform/Phytium/DurianPkg/DurianPkg.dsc | 
  6 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf | 
  7 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 
 56 +
 Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 
 53 +
 Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h  | 
 80 +++
 Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c  | 
250 
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl   | 
209 
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 
 80 +++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl  | 
 85 +++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 
 15 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 
 65 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 
 77 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 
 83 +++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 
 89 +++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 
 67 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 
 65 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 
219 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 
 73 ++
 18 files changed, 1579 insertions(+)

diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index b523ecd658..6f38acb636 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -279,6 +279,12 @@
   #
   MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
 
+  #
+  # ACPI Support
+  #
+  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf
+  Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
   #
   # Bds
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index 9d75b072c6..f435f7cb51 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -111,6 +111,13 @@ READ_LOCK_STATUS   = TRUE
 
   INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
 
+  #
+  # ACPI Support
+  #
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  INF RuleOverride=ACPITABLE 
Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf
+  INF 
Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
+
   #
   # Multiple Console IO support
   #
diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf
new file mode 100644
index 00..e3fd86f197
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf
@@ -0,0 +1,56 @@
+#/** @file
+#
+#  ACPI table data and ASL sources required to boot the platform.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = AcpiTables
+  FILE_GUID  = 7E374E25-8E01-4FEE-87F2-390C23C606CD
+  MODULE_TYPE= USER_DEFINED
+  VERSION_STRING = 1.0
+
+[Sources]
+  AcpiSsdtRootPci.asl
+  Dsdt/Dsdt.asl
+  Fadt.aslc
+  Iort.aslc
+  Gtdt.aslc
+  Madt.aslc
+  Mcfg.aslc
+  Pptt.aslc
+  Spcr.aslc
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdGicDistributorBase
+  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase
+
+  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
+
+  gArmTokenSpaceGuid.PcdGenericWatchdogControlBase
+  gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
+  gArmPlatformTokenSpaceGuid.PL011UartClkInHz
+  

[edk2-devel] [PATCH v3 07/10] Silicon/Phytium: Added flash driver support to Phytium Silicon

2021-03-17 Thread Ling Jia
The SpiNorFlashDxe provided norflash initialization,
read-write, erase and other interfaces.

v3:
Optimized the codes to conform to specifications.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec   |   1 +
 Platform/Phytium/DurianPkg/DurianPkg.dsc|   5 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf|   1 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf   |  48 
+++
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h |  99 
+
 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h |  74 

 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 424 

 7 files changed, 652 insertions(+)

diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec 
b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
index 69842b89e0..2686ba3cc3 100644
--- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
@@ -48,3 +48,4 @@
 
 [Protocols]
   gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 
0x9d, 0x80, 0xdd, 0x0b, 0x7c}}
+  gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 
0xea, 0x5e, 0x65, 0xe3, 0xf6}}
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 68698d613f..1c47051441 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -249,6 +249,11 @@
   #
   Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
 
+  #
+  # NOR Flash driver
+  #
+  Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf
+
   #
   # Usb Support
   #
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index 1cf1927484..831f7a6828 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -96,6 +96,7 @@ READ_LOCK_STATUS   = TRUE
   INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
 
   INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
+  INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf
 
   INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
   INF 
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf
new file mode 100644
index 00..2933dc502e
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf
@@ -0,0 +1,48 @@
+#/** @file
+#  Phytium NorFlash Drivers.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = SpiNorFlashDxe
+  FILE_GUID  = f37ef706-187c-48fd-9102-ddbf86f551be
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= NorFlashPlatformEntryPoint
+
+[Sources.common]
+  SpiNorFlashDxe.c
+  SpiNorFlashDxe.h
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
+  UefiLib
+  UefiBootServicesTableLib
+  UefiRuntimeLib
+  UefiDriverEntryPoint
+
+[FixedPcd]
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase
+[Guids]
+  gEfiEventVirtualAddressChangeGuid
+
+[Protocols]
+  gSpiMasterProtocolGuid
+  gSpiNorFlashProtocolGuid
+
+ [Depex]
+  TRUE
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h
new file mode 100644
index 00..55f5e8273f
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h
@@ -0,0 +1,99 @@
+/** @file
+  Phytium NorFlash Drivers Header.
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef SPI_NORFLASH_DXE_H_
+#define SPI_NORFLASH_DXE_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+//
+//  Norflash registers
+//
+#define REG_FLASH_CAP 0x000
+#define REG_RD_CFG0x004
+#define REG_WR_CFG0x008
+#define REG_FLUSH_REG 0x00C
+#define REG_CMD_PORT  0x010
+#define REG_ADDR_PORT 0x014
+#define REG_HD_PORT   0x018
+#define REG_LD_PORT   0x01C
+#define REG_CS_CFG0x020
+#define REG_WIP_CFG   0x024
+#define REG_WP_REG0x028
+
+#define NORFLASH_SIGNATURE SIGNATURE_32 ('F', 'T', 'S', 'F')
+
+extern EFI_GUID gSpiMasterProtocolGuid;
+extern 

[edk2-devel] [PATCH v3 03/10] Silicon/Phytium: Added SMBIOS support to FT2000/4

2021-03-17 Thread Ling Jia
This driver installs SMBIOS information for FT2000/4.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Platform/Phytium/DurianPkg/DurianPkg.dsc|  
 6 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf|  
 6 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf |  
47 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c   | 
943 
 4 files changed, 1002 insertions(+)

diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 6f38acb636..28e52e15e3 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -286,6 +286,12 @@
   Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf
   Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
 
+  #
+  # SMBIOS
+  #
+  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+  Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+
   #
   # Bds
   #
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index f435f7cb51..3106a43fb7 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -178,6 +178,12 @@ READ_LOCK_STATUS   = TRUE
   #
   INF ShellPkg/Application/Shell/Shell.inf
 
+  #
+  # SMBIOS
+  #
+  INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+  INF 
Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+
   #
   # Bds
   #
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
new file mode 100644
index 00..69a021e048
--- /dev/null
+++ 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -0,0 +1,47 @@
+#/** @file
+#  This driver installs SMBIOS information for Phytium.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = SmbiosPlatformDxe
+  FILE_GUID  = d64f09f8-40dc-11eb-9be6-f7a038f956ba
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  ENTRY_POINT= SmbiosTablePublishEntry
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+#  VALID_ARCHITECTURES   = AARCH64
+#
+[Sources]
+  SmbiosPlatformDxe.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  IoLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Guids]
+  gEfiGlobalVariableGuid
+
+[Protocols]
+  gEfiSmbiosProtocolGuid  # PROTOCOL ALWAYS_CONSUMED
+
+[Guids]
+
+[Depex]
+  gEfiSmbiosProtocolGuid
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c 
b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
new file mode 100644
index 00..4a1f77dfb2
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -0,0 +1,943 @@
+/** @file
+  This driver installs SMBIOS information for Phytium Durian platforms.
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// SMBIOS tables often reference each other using
+// fixed constants, define a list of these constants
+// for our hardcoded tables
+
+#define TYPE0_STRINGS \
+  "PHYTIUM LTD\0" /* Vendor */\
+  "V1.0\0"/* BiosVersion */   \
+  __DATE__"\0"/* BiosReleaseDate */
+
+#define TYPE1_STRINGS\
+  "PHYTIUM LTD\0" /* Manufacturer */ \
+  "Phytium Durian Development Platform\0" /* Product Name */ \
+  "None\0"/* Version */  \
+  "Not Set\0" /* SerialNumber */ \
+  "Not set\0" /* SKUNumber */\
+  "FT-2000/4\0"   /* Family */   \
+
+#define TYPE2_STRINGS\
+  "PHYTIUM LTD\0" /* Manufacturer */ \
+  "Phytium Durian Development Platform\0" /* Product Name */ \
+  "None\0"/* Version */\
+  "Not Set\0" /* Serial */ \
+  "Not Set\0" /* BaseBoardAssetTag */ \
+  "Not Set\0" /* BaseBoardChassisLocation */
+
+#define TYPE3_STRINGS  

[edk2-devel] [PATCH v3 08/10] Silicon/Phytium: Added fvb driver for norflash

2021-03-17 Thread Ling Jia
The FlashFvbDxe provided the fvb protocol,
which requested by the flash operators.

v3:
Optimized the codes to conform to specifications.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Platform/Phytium/DurianPkg/DurianPkg.dsc |1 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf |1 +
 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf |   61 +
 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h   |  104 ++
 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c   | 1304 

 5 files changed, 1471 insertions(+)

diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 1c47051441..99034365d3 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -253,6 +253,7 @@
   # NOR Flash driver
   #
   Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf
+  Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
 
   #
   # Usb Support
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index 831f7a6828..67458458dd 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -103,6 +103,7 @@ READ_LOCK_STATUS   = TRUE
 
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
   INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
   INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
   INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
 
diff --git 
a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf 
b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
new file mode 100644
index 00..ff23721d6e
--- /dev/null
+++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
@@ -0,0 +1,61 @@
+#/** @file
+#  Phytium NorFlash Fvb Drivers.
+#
+#  Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = FlashFvbDxe
+  FILE_GUID  = b8923820-3e7c-11eb-b12c-17525e90ecc8
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
+  VERSION_STRING = 0.1
+  ENTRY_POINT= FvbEntryPoint
+
+[Sources]
+  FlashFvbDxe.c
+  FlashFvbDxe.h
+
+[Packages]
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  DxeServicesTableLib
+  HobLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  UefiRuntimeLib
+  UefiDriverEntryPoint
+
+[Guids]
+  gEfiAuthenticatedVariableGuid
+  gEfiEventVirtualAddressChangeGuid
+  gEfiSystemNvDataFvGuid
+  gEfiVariableGuid
+
+[Protocols]
+  gEfiDevicePathProtocolGuid
+  gEfiFirmwareVolumeBlockProtocolGuid
+  gSpiNorFlashProtocolGuid
+
+[Pcd.common]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase
+  gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize
+
+[Depex]
+  gSpiNorFlashProtocolGuid
diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h 
b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h
new file mode 100644
index 00..e63ff9f220
--- /dev/null
+++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h
@@ -0,0 +1,104 @@
+/** @file
+  Phytium NorFlash Fvb Drivers Header.
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef FVB_FLASH_DXE_H_
+#define FVB_FLASH_DXE_H_
+
+#include 
+#include 
+#include 
+
+#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * 
(LbaSize)))
+#define FVB_FLASH_SIGNATURE   SIGNATURE_32('S', 'N', 'O', 
'R')
+#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, 
FvbProtocol, FVB_FLASH_SIGNATURE)
+
+typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE;
+
+#define NOR_FLASH_ERASE_RETRY 10
+
+typedef struct {
+  VENDOR_DEVICE_PATH  Vendor;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
+  } FT_FVB_DEVICE_PATH;
+
+struct _FT_FVB_DEVICE {
+  UINT32  Signature;
+  EFI_HANDLE  Handle;
+
+  UINTN   DeviceBaseAddress;
+  UINTN   

[edk2-devel] [PATCH v3 10/10] Maintainers.txt: Added maintainers and reviewers for the DurianPkg

2021-03-17 Thread Ling Jia
Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Maintainers.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index afbd2cff0e..b6cfe74e09 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -321,3 +321,11 @@ F: Silicon/SiFive/
 M: Abner Chang 
 M: Gilbert Chen 
 R: Daniel Schaefer 
+
+Phytium platforms and silicon
+F: Platform/Phytium/
+F: Silicon/silicon/
+M: Leif Lindholm 
+R: Peng Xie 
+R: Ling Jia 
+R: Yiqi Shu 
-- 
2.25.1



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




[edk2-devel] [PATCH v3 09/10] Silicon/Phytium: Added Rtc driver to FT2000/4

2021-03-17 Thread Ling Jia
The RealTimeClockLib implemented EFI RealTimeClock
runtime services via RTC Lib.

v3:
Optimized the codes to conform to specifications.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec |   
1 +
 Platform/Phytium/DurianPkg/DurianPkg.dsc  |   
6 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf  |   
2 +
 Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf |  
39 ++
 Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h   |  
24 +
 Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c   | 
462 
 6 files changed, 534 insertions(+)

diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec 
b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
index 2686ba3cc3..4c6c5c5f11 100644
--- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
@@ -45,6 +45,7 @@
   gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005
   gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006
   gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007
+  gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008
 
 [Protocols]
   gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 
0x9d, 0x80, 0xdd, 0x0b, 0x7c}}
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 99034365d3..9579f8e9b7 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -29,6 +29,10 @@
   # Phytium Platform library
   
ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf
 
+  #FT2000-4Pkg RTC Driver
+  
RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf
+  TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
+
   # PL011 UART Driver and Dependency Libraries
   
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
   
PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf
@@ -168,6 +172,8 @@
   NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
   }
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
 
   #
   # Common Arm Timer and Gic Components
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index 67458458dd..242f647ca1 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -93,6 +93,8 @@ READ_LOCK_STATUS   = TRUE
   #
   INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
   INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
   INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
 
   INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf 
b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf
new file mode 100644
index 00..09a06d53ae
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf
@@ -0,0 +1,39 @@
+#/** @file
+#  Phytium RealTime Clock Library file.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = RealTimeClockLib
+  FILE_GUID  = fb320c94-40fe-11eb-b990-171865af292c
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = RealTimeClockLib
+
+[Sources.common]
+  RealTimeClockLib.c
+  RealTimeClockLib.h
+
+[Packages]
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  DxeServicesTableLib
+  IoLib
+  TimeBaseLib
+  UefiRuntimeLib
+
+[Guids]
+  gEfiEventVirtualAddressChangeGuid
+
+[Pcd]
+  gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h 
b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h
new file mode 100644
index 00..41ce002dc3
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h
@@ -0,0 +1,24 @@
+/** @file
+  Phytium RealTime Clock Header.
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef 

[edk2-devel] [PATCH v3 00/10] Added support for FT2000/4 chip

2021-03-17 Thread Ling Jia
This series added packages to support FT2000/4 chip.
Platform/Phytium: Added DurianPkg, include DurianPkg.dsc and DurianPkg.fdf.
Silicon/Phytium: Added FT2000-4Pkg and PhytiumCommonPkg.

The modules could be runed at the silicon of FT2000/4.
They supported Acpi parameter configuration, Pci bus scaning,
flash read-write and erase abd operating system boot function.
Maintainers.txt: Added maintainers and reviewers for the DurianPkg.

The public git repository is :
https://github.com/jialing2020/edk2-platforms/tree/Phytium_Opensource_For_FT2000-4_v3

v3:
Optimized the codes to meet the edk2 coding  specification.

Ling Jia (10):
  Silicon/Phytium: Added PlatformLib to FT2000/4
  Silicon/Phytium: Added Acpi support to FT2000/4
  Silicon/Phytium: Added SMBIOS support to FT2000/4
  Silicon/Phytium: Added PciSegmentLib to FT2000/4
  Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
  Silicon/Phytium: Added Spi driver support to FT2000/4
  Silicon/Phytium: Added flash driver support to Phytium Silicon
  Silicon/Phytium: Added fvb driver for norflash
  Silicon/Phytium: Added Rtc driver to FT2000/4
  Maintainers.txt: Added maintainers and reviewers for the DurianPkg

 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec  
 |   52 +
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc  
 |  345 +
 Platform/Phytium/DurianPkg/DurianPkg.dsc   
 |  331 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf   
 |  235 
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf  
 |   56 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 |   47 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf  
 |   44 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf  
 |   48 +
 Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf  
 |   47 +
 Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf
 |   28 +
 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf
 |   55 +
 Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf  
 |   39 +
 Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf   
 |   53 +
 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf   
 |   61 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h
 |   64 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h
 |   99 ++
 Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h
 |   24 +
 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h 
 |  104 ++
 Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h
 |   80 ++
 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h
 |   74 +
 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h
 |   51 +
 Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h  
 |  112 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c  
 |  943 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c
 |  198 +++
 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c
 |  424 ++
 Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
 |  181 +++
 Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c  
 | 1434 
 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c  
 |  137 ++
 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c   
 |  156 +++
 Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c
 |  462 +++
 Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c
 |  250 
 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c 
 | 1304 ++
 Maintainers.txt
 |8 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl 
 |  209 +++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc   
 |   80 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl
 |   85 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl   
 |   15 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl   
 |   65 +
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc   
 |   77 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc   
 |   83 ++
 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc   
 |   89 

[edk2-devel] [PATCH v3 05/10] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4

2021-03-17 Thread Ling Jia
The Pci host bridge library is mainly
to get Pci bridge information.

v3:
Optimize the codes of PciHostBridgeLib.c to conform to specifications.

Signed-off-by: Ling Jia 
Reviewed-by: Leif Lindholm 
---
 Platform/Phytium/DurianPkg/DurianPkg.dsc  |   
9 +
 Platform/Phytium/DurianPkg/DurianPkg.fdf  |   
6 +
 Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  
47 +
 Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 
181 
 4 files changed, 243 insertions(+)

diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc 
b/Platform/Phytium/DurianPkg/DurianPkg.dsc
index 093b2cd9db..3a9bc2289c 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.dsc
+++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
@@ -37,6 +37,7 @@
 [LibraryClasses.common.DXE_DRIVER]
   # Pci dependencies
   
PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf
+  
PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
 
 

 #
@@ -263,6 +264,14 @@
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 
+  #
+  # PCI Support
+  #
+  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
+  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  
MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf
+
   #
   # The following 2 module perform the same work except one operate variable.
   # Only one of both should be put into fdf.
diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf 
b/Platform/Phytium/DurianPkg/DurianPkg.fdf
index 3106a43fb7..a443d0f3a4 100644
--- a/Platform/Phytium/DurianPkg/DurianPkg.fdf
+++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
@@ -135,6 +135,12 @@ READ_LOCK_STATUS   = TRUE
   INF FatPkg/EnhancedFatDxe/Fat.inf
   INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 
+  #
+  # PCI Support
+  #
+  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+
   #
   # SATA Controller
   #
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
new file mode 100644
index 00..0e6f0797b0
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -0,0 +1,47 @@
+#/** @file
+#  PCI Host Bridge Library instance for Phytium SOC.
+#
+#  Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x0001001b
+  BASE_NAME  = PciHostBridgeLib
+  FILE_GUID  = f965de0e-40fe-11eb-8290-3f9d1f895a80
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib|DXE_DRIVER
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES   = ARM AARCH64
+#
+
+[Sources]
+  PciHostBridgeLib.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
+
+[LibraryClasses]
+  DebugLib
+
+[Guids]
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdPciBusMin
+  gArmTokenSpaceGuid.PcdPciBusMax
+  gArmTokenSpaceGuid.PcdPciIoBase
+  gArmTokenSpaceGuid.PcdPciIoSize
+  gArmTokenSpaceGuid.PcdPciMmio32Base
+  gArmTokenSpaceGuid.PcdPciMmio32Size
+  gArmTokenSpaceGuid.PcdPciMmio64Base
+  gArmTokenSpaceGuid.PcdPciMmio64Size
diff --git 
a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
new file mode 100644
index 00..8ed3516749
--- /dev/null
+++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -0,0 +1,181 @@
+/** @file
+  PCI host bridge library instance for Phytium SOC.
+
+  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#pragma pack(1)
+
+typedef struct {
+  ACPI_HID_DEVICE_PATH AcpiDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
+} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
+
+#pragma pack ()
+
+#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \
+  END_ENTIRE_DEVICE_PATH_SUBTYPE, \
+  { END_DEVICE_PATH_LENGTH, 0 } \
+}
+
+#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \
+ { (UINT8) (sizeof 
(ACPI_HID_DEVICE_PATH)), \
+  

Re: [edk2-devel] [PATCH] MdePkg: use CpuPause() in CpuDeadLoop()

2021-03-17 Thread Laszlo Ersek
On 03/16/21 23:59, Ankur Arora wrote:
> Use CpuPause() to allow the CPU to go into a lower power state
> state while we spin wait.
> 
> Cc: Liming Gao 
> Signed-off-by: Ankur Arora 
> Reviewed-by: Michael D Kinney 
> ---
>  MdePkg/Library/BaseLib/CpuDeadLoop.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c 
> b/MdePkg/Library/BaseLib/CpuDeadLoop.c
> index 9e110cacbc96..3cd304351a65 100644
> --- a/MdePkg/Library/BaseLib/CpuDeadLoop.c
> +++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c
> @@ -28,5 +28,7 @@ CpuDeadLoop (
>  {
>volatile UINTN  Index;
>  
> -  for (Index = 0; Index == 0;);
> +  for (Index = 0; Index == 0;) {
> +CpuPause();
> +  }
>  }
> 

Reviewed-by: Laszlo Ersek 

(for RISC-V and ARM64, the implementations seem to be "nop" instructions)

Thanks
Laszlo



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




Re: [edk2-devel] [PATCH] SecurityPkg/Tcg2Config: hide PCR Bank SHA1 checkbox

2021-03-17 Thread Laszlo Ersek
On 03/17/21 05:19, Yao, Jiewen wrote:
> Thank you Qi. 
> 
> i recommend we file a bugzilla on the scope of the problem

I agree.

We already have a number of BZs related to the disablement of SHA1 and MD5:

https://bugzilla.tianocore.org/show_bug.cgi?id=1682
https://bugzilla.tianocore.org/show_bug.cgi?id=2943
https://bugzilla.tianocore.org/show_bug.cgi?id=3003
https://bugzilla.tianocore.org/show_bug.cgi?id=3021
https://bugzilla.tianocore.org/show_bug.cgi?id=3027
https://bugzilla.tianocore.org/show_bug.cgi?id=3079

We should certainly track the change for Tcg2Config too, in a new BZ.

Thanks
Laszlo

> 
> After the scope is agreed, then you can send the patch. 
> 
> For example, I can ask why not remove the sha1supported field at all?
> 
> I hope the community can reach consensus on the problem statement at first. 
> 
> 
> thank you!
> Yao, Jiewen
> 
> 
>> 在 2021年3月17日,上午10:56,Zhang, Qi1  写道:
>>
>> wrap SHA1 related by DISABLE_SHA1_DEPRECATED_INTERFACES.
>>
>> Cc: Jiewen Yao 
>> Cc: Jian J Wang 
>> Cc: Qi Zhang 
>> Cc: Rahul Kumar 
>> Signed-off-by: Qi Zhang 
>> ---
>> SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c 
>> b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
>> index 2946f95db0..81a4d3fa6a 100644
>> --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
>> +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
>> @@ -710,9 +710,11 @@ SetConfigInfo (
>>   )
>> {
>>   switch (TpmAlgHash) {
>> +#ifndef DISABLE_SHA1_DEPRECATED_INTERFACES
>>   case TPM_ALG_SHA1:
>> Tcg2ConfigInfo->Sha1Supported = TRUE;
>> break;
>> +#endif
>>   case TPM_ALG_SHA256:
>> Tcg2ConfigInfo->Sha256Supported = TRUE;
>> break;
>> -- 
>> 2.26.2.windows.1
>>
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72976): https://edk2.groups.io/g/devel/message/72976
Mute This Topic: https://groups.io/mt/81395026/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] Google Summer of Code Interested Student

2021-03-17 Thread Laszlo Ersek
On 03/17/21 00:25, Desimone, Nathaniel L wrote:

> The UEFI spec doesn't read on this at all, even though it describes
> VT100 and VT100+ as separate modes... it doesn't say how they differ.
> I agree with you that it seems reasonable for VT100 to keep character
> output to strict ASCII only... that way the "+" in VT100+ actually
> means something. I've updated the wiki accordingly.
> 
> I'd advocate for the default to be switched to VT_UTF8. I really
> don't think you will run into many terminal emulators that don't
> implement UTF-8 anymore, XTerm included. Those who want pure ASCII
> output can switch to VT100.

Hmmm, OK. As long as I can permanently switch my domains, one by one, to
VT100, I guess I'll be fine.

Thanks!
Laszlo



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




Re: [edk2-devel] [edk2-platforms] [patch 00/35] Consume RegisterFilterLibNull instance

2021-03-17 Thread Laszlo Ersek
On 03/17/21 16:05, Bi, Dandan wrote:
>> -Original Message-
>> From: devel@edk2.groups.io  On Behalf Of
>> gaoliming
>> Sent: Wednesday, March 17, 2021 11:05 AM
>> To: devel@edk2.groups.io; a...@kernel.org; Bi, Dandan
>> ; 'Laszlo Ersek' ; 'Andrew Fish'
>> 
>> Cc: 'Leif Lindholm' ; Kinney, Michael D
>> 
>> Subject: 回复: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
>> RegisterFilterLibNull instance
>>
>> Ard and Dandan:
>>
>>> -邮件原件-
>>> 发件人: devel@edk2.groups.io  代表 Ard
>> Biesheuvel
>>> 发送时间: 2021年3月16日 23:01
>>> 收件人: devel@edk2.groups.io; dandan...@intel.com; Laszlo Ersek
>>> ; Andrew Fish 
>>> 抄送: Leif Lindholm ; Michael D Kinney
>>> ; Liming Gao 
>>> 主题: Re: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
>>> RegisterFilterLibNull instance
>>>
>>> On Tue, 16 Mar 2021 at 15:56, Dandan Bi  wrote:

 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
 RFC: https://edk2.groups.io/g/devel/message/72530


 Add RegisterFilterLibNull in dsc files in edk2-platforms repo, which
 will be consumed by IoLib and BaseLib.

 This is the following update in edk2-platforms repo for the change
 in edk2, which will add RegisterFilterLib dependency for IoLib and
 BaseLib to
>>> filter/trace
 port IO/MMIO/MSR access.
 https://edk2.groups.io/g/devel/message/72754

 Cc: Leif Lindholm 
 Cc: Michael D Kinney 
 Cc: Liming Gao 

>>>
>>> It is a bit disappointing that we have to update every platform in
>>> existence again to apply a change to a core module.
>>>
>>
>> I suggest to add MdePkg.dsc.inc file to include the default library instance,
>> and update all Platform DSC to include it. Then, for the future change, no
>> change is required for platform DSC.
>>
>> Because this patch set updates every platform DSC, I suggest to introduce
>> MdePkg.dsc.inc file in this patch set.
> 
> Hi Liming,
> 
> I agree that add MdePkg.dsc.inc file to include the default library instance 
> and make it consumed by platform dsc will benefit future similar incompatible 
> changes.
> But I wonder to know whether we could do it in a separated task/topic,  as
> 1.  It should be a code infrastructure design change/improvement in edk2.
> 2.  Personally I don't hope the new solution will have much impact on my 
> current schedule, but it seems have.
> And we may need to:
> 1). Clarify the default library instances which should be added in 
> MdePkg.dsc.inc
> The library instances in MdePkg.dsc.inc should be generic enough to be 
> widely included in platform dsc files.
> 2). Update dsc files in edk2 and edk2-platforms repo to include 
> MdePkg.dsc.inc and cleanup the default Lib instance in dsc files.

(1) The file name should be "MdeLibs.dsc.inc", and it should be
structured similarly "NetworkLibs.dsc.inc" -- no [LibraryClasses] header
should be part of the file.

(2) The introduction of "MdeLibs.dsc.inc" is a big task, in my opinion.

As I stated earlier, I wouldn't like to review a patch for OvmfPkg that
replaces (say) 50-100 lines of library class resolutions with a simple
!include directive. Such a patch is unreviewable, as I'd have no way of
carefully comparing the before-after state, let alone a way of *pointing
out* (in comments) where exactly a problem was.

So I think such an include file would require a patch set, and the lib
class resolutions should be migrated in small *topical* steps. Such as:

- introduce the DSC include file as empty
- add the !include directive to platform DSCs
- add a small set of libraries (with some topical coherence) to the
include file,
- remove the same set of resolutions from platform DSCs,
- repeat the last two steps until all "topics" have been covered.

Thanks
Laszlo


> 
> 
> Thanks,
> Dandan
>>
>> Thanks
>> Liming
>>> Is there really not a better way to provide a 'default' resolution for
>>> a library class? Maybe a change to the .DEC format, so that the file
>>> which defines the library class can provide a resolution that is used
>>> if none is provided by the .DSC file?
>>>
>>>
>>>
 Dandan Bi (35):
   Drivers/ASIX: Consume RegisterFilterLibNull instance
   Drivers/DisplayLink: Consume RegisterFilterLibNull instance
   Drivers/OptionRomPkg: Consume RegisterFilterLibNull instance
   Features/Debugging: Consume RegisterFilterLibNull instance
   Features/Network: Consume RegisterFilterLibNull instance
   Features/OutOfBandManagement: Consume RegisterFilterLibNull
>>> instance
   Features/PowerManagement: Consume RegisterFilterLibNull instance
   Features/SystemInformation: Consume RegisterFilterLibNull instance
   Features/UserInterface: Consume RegisterFilterLibNull instance
   Platform/AMD: Consume RegisterFilterLibNull instance
   Platform/ARM: Consume RegisterFilterLibNull instance
   Platform/BeagleBoard: Consume RegisterFilterLibNull instance
   Platform/BoardModulePkg: Consume RegisterFilterLibNull instance
   Platform/MinPlatformPkg: 

Re: [edk2-devel] [PATCH v2 2/2] UefiCpuPkg/CpuDxe: Guarantee GDT is below 4GB

2021-03-17 Thread Laszlo Ersek
On 03/17/21 12:06, Ray Ni wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3233
> 
> GDT needs to be allocated below 4GB in 64bit environment
> because AP needs it for entering to protected mode.
> CPU running in big real mode cannot access above 4GB GDT.
> 
> But CpuDxe driver contains below code:
>   gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8);
>   .
>   gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt;
> 
> The AllocateRuntimePool() may allocate memory above 4GB.
> Thus, we cannot use AllocateRuntimePool (), instead,
> we should use AllocatePages() to make sure GDT is below 4GB space.
> 
> Signed-off-by: Ray Ni 
> Reviewed-by: Eric Dong 
> Reviewed-by: Laszlo Ersek 
> Cc: Rahul Kumar 
> ---
>  UefiCpuPkg/CpuDxe/CpuGdt.c | 21 -
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c
> index 8847bc4819..692402c55d 100644
> --- a/UefiCpuPkg/CpuDxe/CpuGdt.c
> +++ b/UefiCpuPkg/CpuDxe/CpuGdt.c
> @@ -124,15 +124,26 @@ InitGlobalDescriptorTable (
>VOID
>)
>  {
> +  EFI_STATUSStatus;
>GDT_ENTRIES   *Gdt;
>IA32_DESCRIPTOR   Gdtr;
> +  EFI_PHYSICAL_ADDRESS  Memory;
>  
>//
> -  // Allocate Runtime Data for the GDT
> -  //
> -  Gdt = AllocateRuntimePool (sizeof (mGdtTemplate) + 8);
> -  ASSERT (Gdt != NULL);
> -  Gdt = ALIGN_POINTER (Gdt, 8);
> +  // Allocate Runtime Data below 4GB for the GDT
> +  // AP uses the same GDT when it's waken up from real mode so
> +  // the GDT needs to be below 4GB.
> +  //
> +  Memory = SIZE_4GB - 1;
> +  Status = gBS->AllocatePages (
> +  AllocateMaxAddress,
> +  EfiRuntimeServicesData,
> +  EFI_SIZE_TO_PAGES (sizeof (mGdtTemplate)),
> +  
> +  );
> +  ASSERT_EFI_ERROR (Status);
> +  ASSERT ((Memory != 0) && (Memory < SIZE_4GB));
> +  Gdt = (GDT_ENTRIES *) (UINTN) Memory;
>  
>//
>// Initialize all GDT entries
> 

Reviewed-by: Laszlo Ersek 



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




Re: [edk2-devel] [PATCH v2 1/2] UefiCpuPkg/CpuDxe: Rename variables to follow EDKII coding standard

2021-03-17 Thread Laszlo Ersek
On 03/17/21 12:06, Ray Ni wrote:
> The change doesn't impact any functionality.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Cc: Rahul Kumar 
> ---
>  UefiCpuPkg/CpuDxe/CpuGdt.c | 23 +++
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c
> index a1ab543f2d..8847bc4819 100644
> --- a/UefiCpuPkg/CpuDxe/CpuGdt.c
> +++ b/UefiCpuPkg/CpuDxe/CpuGdt.c
> @@ -2,7 +2,7 @@
>C based implementation of IA32 interrupt handling only
>requiring a minimal assembly interrupt entry point.
>  
> -  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
> +  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
>  
>  **/
> @@ -13,7 +13,7 @@
>  //
>  // Global descriptor table (GDT) Template
>  //
> -STATIC GDT_ENTRIES GdtTemplate = {
> +STATIC GDT_ENTRIES mGdtTemplate = {
>//
>// NULL_SEL
>//
> @@ -124,27 +124,27 @@ InitGlobalDescriptorTable (
>VOID
>)
>  {
> -  GDT_ENTRIES *gdt;
> -  IA32_DESCRIPTOR gdtPtr;
> +  GDT_ENTRIES   *Gdt;
> +  IA32_DESCRIPTOR   Gdtr;
>  
>//
>// Allocate Runtime Data for the GDT
>//
> -  gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8);
> -  ASSERT (gdt != NULL);
> -  gdt = ALIGN_POINTER (gdt, 8);
> +  Gdt = AllocateRuntimePool (sizeof (mGdtTemplate) + 8);
> +  ASSERT (Gdt != NULL);
> +  Gdt = ALIGN_POINTER (Gdt, 8);
>  
>//
>// Initialize all GDT entries
>//
> -  CopyMem (gdt, , sizeof (GdtTemplate));
> +  CopyMem (Gdt, , sizeof (mGdtTemplate));
>  
>//
>// Write GDT register
>//
> -  gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt;
> -  gdtPtr.Limit = (UINT16) (sizeof (GdtTemplate) - 1);
> -  AsmWriteGdtr ();
> +  Gdtr.Base  = (UINT32) (UINTN) Gdt;
> +  Gdtr.Limit = (UINT16) (sizeof (mGdtTemplate) - 1);
> +  AsmWriteGdtr ();
>  
>//
>// Update selector (segment) registers base on new GDT
> @@ -152,4 +152,3 @@ InitGlobalDescriptorTable (
>SetCodeSelector ((UINT16)CPU_CODE_SEL);
>SetDataSelectors ((UINT16)CPU_DATA_SEL);
>  }
> -
> 

This patch does *slightly* more than what it says on the tin (empty line
removed from the end, also a useless (VOID*) cast is dropped), but I'm
fine with those.

Reviewed-by: Laszlo Ersek 

Thanks!
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72972): https://edk2.groups.io/g/devel/message/72972
Mute This Topic: https://groups.io/mt/81400141/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] Google Summer of Code Interested Student

2021-03-17 Thread Andrew Fish via groups.io
If we are mentioning terminal types the default terminal type on a Mac is 
xterm-256color. So that is going to be the default when people run OVMF on a 
Mac. So it would be nice if we can add that. I can help out with anything 
xterm-256color related. 

Thanks,

Andrew Fish

> On Mar 16, 2021, at 8:23 AM, Laszlo Ersek  wrote:
> 
> Hi Nate,
> 
> (adding Leif and Ard)
> 
> On 03/13/21 03:52, Desimone, Nathaniel L wrote:
>> I've created a new wiki page for this task with all the information I
>> have gathered thus far. I've done some more experimentation and found
>> that there are several newer terminal emulators that don't support
>> DEC Special Graphics so I've reduced the number of modes where DEC
>> Special Graphics should be preferred. Laszlo, if you could take a
>> look at the terminal type matrix I created that would be very
>> helpful.
>> 
>> https://github.com/tianocore/tianocore.github.io/wiki/Tasks-Terminal-driver-improvements
> 
> (
> 
> My background:
> 
> I settled on plain (non-UTF-8) xterm around 1998, and have been using it
> ever since. Whenever something was off, I always tried to hammer the
> application into conformance with my particular xterm setup, rather than
> the other way around. I also have some quirky terminal settings -- for
> me, "backspace" generates ^H / keycode 22 (stty sets erase to ^H),
> "delete" generates keycode 119, and there's no "rubout". I still don't
> use UTF-8 (I use latin2).
> 
> )
> 
> * Regarding ArmVirtPkg, I stick with the default TTY_TERMINAL=FALSE
>  setting (which means VT-100). Using that setting, I see the following
>  kind of "ASCII approximation" for box drawing:
> 
>  
> /--\
>  |Boot Manager
>   |
>  
> \--/
> 
>  I'm really happy with this, as I don't care much for nice-looking
>  boxes; instead I prefer portability.
> 
>  (NB: this seems to disagree with your "Current Behavior (Which is
>  wrong)" line for VT100, as it suggests CP437. That's not what I'm
>  seeing with VT100.)
> 
>  TTY_TERMINAL=TRUE would mainly affect backspace / delete I think -- as
>  far as I recall, that's why I asked Roy not to make TTY_TERMINAL=TRUE
>  the default, in 2015:
> 
>  http://mid.mail-archive.com/555458DB.3090602@redhat.com
>  
> http://mid.mail-archive.com/CAFECyb_E+bGZt5xv7QhRqyD0jX=AzoEMw7VW_tjZr+E=sqf...@mail.gmail.com
> 
>  (I'd like to CC Roy, but I can't tell if he's now working for Linaro,
>  Cavium, HPE, Marvell, or another company.)
> 
> * Regarding OvmfPkg, currently PC_ANSI is hard-coded, and for me it
>  looks like this:
> 
>  
> ÚÄÄż
>  łBoot Manager
>   ł
>  
> ŔÄÄŮ
> 
>  Obviously I'd much prefer if I got the simple ASCII approximation here
>  as well.
> 
> * Whether VT100 and/or PC_ANSI and/or TTY_TERM are *officially* supposed
>  to use DEC Special Graphics, I can't tell.
> 
>  I know what my preferences are:
> 
>  - the current BackSpace and Delete mappings (which work fine for me
>with both VT100 and PC_ANSI, but *not* with TTY_TERM),
> 
>  - and the most primitive ASCII mapping (no special graphics, no UTF-8
>sequences, etc). I really like a super dumb terminal, where taking
>simple "ASCII screenshots" (and pasting them into plaintext emails!)
>is *trivial*.
> 
>  ... Looking at your "Expected Behavior" table, there is only one line
>  left with "poor man's ASCII" -- namely, TTY_TERM. Unfortunately,
>  TTY_TERM breaks my BackSpace / Delete settings :(
> 
> * In summary, I'd prefer if (a) VT100 stayed as-is (using "poor man's
>  ASCII", as seen in ArmVirtPkg), and (b) if OVMF used *that* VT100,
>  rather than PC_ANSI, by default.
> 
> Thanks!
> Laszlo
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72971): https://edk2.groups.io/g/devel/message/72971
Mute This Topic: https://groups.io/mt/81273234/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-test 1/1] uefi-sct/SctPkg: typo Positoin

2021-03-17 Thread G Edhaya Chandran
Reviewed-by: G Edhaya Chandran

> -Original Message-
> From: Heinrich Schuchardt 
> Sent: 04 March 2021 09:02
> To: EDK II Development 
> Cc: Eric Jin ; G Edhaya Chandran
> ; Barton Gao ; Arvin
> Chen ; Samer El-Haj-Mahmoud  mahm...@arm.com>; Heinrich Schuchardt 
> Subject: [PATCH edk2-test 1/1] uefi-sct/SctPkg: typo Positoin
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3244
>
> %s/Positoin/Position/g
> %s/positoin/position/g
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  .../BlackBoxTest/SimpleTextOutBBTestConformance_efi.c | 4 ++--
>  .../BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c| 4 ++--
>  .../BlackBoxTest/SimpleTextOutBBTestFunction_efi.c| 4 ++--
>  .../BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c   | 4 ++--
>  .../BlackBoxTest/SimpleTextOutBBTestConformance_uefi.c| 4 ++--
>  .../BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c   | 4 ++--
>  .../SctPkg/TestInfrastructure/SCT/Framework/UI/KeyFunction.c  | 2 +-
>  7 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_efi.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_efi.c
> index 3b394f242434..8b8c3f86f3ca 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_efi.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_efi.c
> @@ -840,7 +840,7 @@ BBTestSetCursorPositionConformanceAutoTest (
>   AssertionType,
>   gSimpleTextOutputConformanceTestAssertionGuid009,
>   L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition -
> SetCursorPosition() with invalid position, mode position integrity",
> - L"%a:%d: Mode=%d, Positoin=(%d x %d) Current: Cursor
> Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d.
> "\
> + L"%a:%d: Mode=%d, Position=(%d x %d) Current: Cursor
> Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d.
> "\
>   L" Expected:Cursor Position(%d x %d), Mode=%d, 
> MaxMode=%d,
> Attribute=%d, CursorVisible=%d.",
>   __FILE__,
>   (UINTN)__LINE__,
> @@ -873,7 +873,7 @@ BBTestSetCursorPositionConformanceAutoTest (
>   StandardLib,
>   AssertionType,
>   gSimpleTextOutputConformanceTestAssertionGuid010,
> - L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition -
> SetCursorPositoin() with invalid Position",
> + L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition -
> SetCursorPosition() with invalid Position",
>   L"%a:%d: Status = %r, Mode = %d, Position = (%d x %d)",
>   __FILE__,
>   (UINTN)__LINE__,
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_uefi.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_uefi.c
> index 9afb3c0882b7..99e14d7b3bae 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_uefi.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestConformance_uefi.c
> @@ -838,7 +838,7 @@ BBTestSetCursorPositionConformanceAutoTest (
>   AssertionType,
>   gSimpleTextOutputConformanceTestAssertionGuid009,
>   L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition -
> SetCursorPosition() with invalid position, mode position integrity",
> - L"%a:%d: Mode=%d, Positoin=(%d x %d) Current: Cursor
> Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d.
> "\
> + L"%a:%d: Mode=%d, Position=(%d x %d) Current: Cursor
> Position(%d x %d), Mode=%d, MaxMode=%d, Attribute=%d, CursorVisible=%d.
> "\
>   L" Expected:Cursor Position(%d x %d), Mode=%d, 
> MaxMode=%d,
> Attribute=%d, CursorVisible=%d.",
>   __FILE__,
>   (UINTN)__LINE__,
> @@ -871,7 +871,7 @@ BBTestSetCursorPositionConformanceAutoTest (
>   StandardLib,
>   AssertionType,
>   gSimpleTextOutputConformanceTestAssertionGuid010,
> - L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition -
> SetCursorPositoin() with invalid Position",
> + L"EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition -
> SetCursorPosition() with invalid Position",
>   L"%a:%d: Status = %r, Mode = %d, Position = (%d x %d)",
>   __FILE__,
>

Re: [edk2-devel] [PATCH edk2-test 1/1] uefi-sct/SctPkg: type mismatch in SimpleTextOut test

2021-03-17 Thread G Edhaya Chandran
Reviewed-by: G Edhaya Chandran

> -Original Message-
> From: Heinrich Schuchardt 
> Sent: 09 March 2021 23:31
> To: EDK II Development 
> Cc: Eric Jin ; G Edhaya Chandran
> ; Barton Gao ; Arvin
> Chen ; Samer El-Haj-Mahmoud  mahm...@arm.com>; Heinrich Schuchardt 
> Subject: [PATCH edk2-test 1/1] uefi-sct/SctPkg: type mismatch in SimpleTextOut
> test
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3253
>
> SctPrint() requires that %d refers to an UINTN parameter.
>
> SimpleTextOutBBTestFunction_uefi.c has a lot of
> StandardLib->RecordAssertion() calls where an INT32 is passed
> as argument for a '%d' print code.
>
> This leads to incorrect output like:
>
> MaxMode=-549755813885,
>
> -549755813885 is 0x0xFF83. So MaxMode actually is an INT32
> with value 3 in this example.
>
> Convert the parameters to UINTN.
>
> Signed-off-by: Heinrich Schuchardt 
> ---
>  .../SimpleTextOutBBTestFunction_uefi.c| 624 +-
>  1 file changed, 312 insertions(+), 312 deletions(-)
>
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestFunction_uefi.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestFunction_uefi.c
> index 9b0ae233ce5f..bbe3f4e27077 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxTest/SimpleTex
> tOutBBTestFunction_uefi.c
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextOut/BlackBoxT
> +++ est/SimpleTextOutBBTestFunction_uefi.c
> @@ -176,12 +176,12 @@ BBTestResetFunctionManualTest (
>   L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
>   __FILE__,
>   (UINTN)__LINE__,
> - SimpleOut->Mode->CursorColumn,
> - SimpleOut->Mode->CursorRow,
> - SimpleOut->Mode->MaxMode,
> - ModeExpected.CursorColumn,
> - ModeExpected.CursorRow,
> - ModeExpected.MaxMode
> + (UINTN)SimpleOut->Mode->CursorColumn,
> + (UINTN)SimpleOut->Mode->CursorRow,
> + (UINTN)SimpleOut->Mode->MaxMode,
> + (UINTN)ModeExpected.CursorColumn,
> + (UINTN)ModeExpected.CursorRow,
> + (UINTN)ModeExpected.MaxMode
>   );
>
>//
> @@ -272,12 +272,12 @@ BBTestResetFunctionManualTest (
>   L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
>   __FILE__,
>   (UINTN)__LINE__,
> - SimpleOut->Mode->CursorColumn,
> - SimpleOut->Mode->CursorRow,
> - SimpleOut->Mode->MaxMode,
> - ModeExpected.CursorColumn,
> - ModeExpected.CursorRow,
> - ModeExpected.MaxMode
> + (UINTN)SimpleOut->Mode->CursorColumn,
> + (UINTN)SimpleOut->Mode->CursorRow,
> + (UINTN)SimpleOut->Mode->MaxMode,
> + (UINTN)ModeExpected.CursorColumn,
> + (UINTN)ModeExpected.CursorRow,
> + (UINTN)ModeExpected.MaxMode
>   );
>
>//
> @@ -505,12 +505,12 @@ BBTestResetFunctionAutoTest (
> L"Expected:Cursor Position(%d x %d), MaxMode=%d.",
> __FILE__,
> (UINTN)__LINE__,
> -   SimpleOut->Mode->CursorColumn,
> -   SimpleOut->Mode->CursorRow,
> -   SimpleOut->Mode->MaxMode,
> -   ModeExpected.CursorColumn,
> -   ModeExpected.CursorRow,
> -   ModeExpected.MaxMode
> +   (UINTN)SimpleOut->Mode->CursorColumn,
> +   (UINTN)SimpleOut->Mode->CursorRow,
> +   (UINTN)SimpleOut->Mode->MaxMode,
> +   (UINTN)ModeExpected.CursorColumn,
> +   (UINTN)ModeExpected.CursorRow,
> +   (UINTN)ModeExpected.MaxMode
> );
>
>  //
> @@ -582,12 +582,12 @@ BBTestResetFunctionAutoTest (
> L" Expected:Cursor Position(%d x %d), MaxMode=%d.",
> __FILE__,
> (UINTN)__LINE__,
> -   SimpleOut->Mode->CursorColumn,
> -   SimpleOut->Mode->CursorRow,
> -   SimpleOut->Mode->MaxMode,
> -   ModeExpected.CursorColumn,
> -   ModeExpected.CursorRow,
> -   ModeExpected.MaxMode
> +   (UINTN)SimpleOut->Mode->CursorColumn,
> +   (UINTN)SimpleOut->Mode->CursorRow,
> +   (UINTN)SimpleOut->Mode->MaxMode,
> +   (UINTN)ModeExpected.CursorColumn,
> +   (UINTN)ModeExpected.CursorRow,
> +   (UINTN)ModeExpected.MaxMode
> );
>
>  //
> @@ -850,18 +850,18 @@ BBTestOutputStringFunctionAutoTest (
>   L" 

Re: [edk2-devel] [RFC PATCH 00/14] Firmware Support for Fast Live Migration for AMD SEV

2021-03-17 Thread Yao, Jiewen
Thank you very much Tobin and Brijesh.

Yes, I agree that there are multiple ways to pass the transport key from source 
to destination.
I will wait for your final solution.


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Tobin
> Feldman-Fitzthum
> Sent: Wednesday, March 17, 2021 1:47 AM
> To: Yao, Jiewen ; devel@edk2.groups.io
> Cc: Dov Murik ; Tobin Feldman-Fitzthum
> ; James Bottomley ; Hubertus Franke
> ; Brijesh Singh ; Ashish Kalra
> ; Jon Grimm ; Tom Lendacky
> 
> Subject: Re: [edk2-devel] [RFC PATCH 00/14] Firmware Support for Fast Live
> Migration for AMD SEV
> 
> On 3/12/21 9:32 PM, Yao, Jiewen wrote:
> 
> > Hi
> > We discuss the patch internally. We do see PROs and CONs with this approach.
> > The advantage is that it is very simple. In-VM migration can save lots of 
> > effort
> on security context restore.
> > On the other hand, we feel not so comfortable to reserve a dedicate CPU to
> achieve that. Similar to the feedback in the community.
> >
> > Using Hot-Plug is not a solution for Intel TDX as well. It is unsupported 
> > now.
> >
> > I like the idea to diverge the migration boot mode v.s. normal boot mode in
> SEC phase.
> > We must be very carefully handle this migration boot mode, to avoid any
> touching on system memory.
> > Intel TDX Virtual Firmware skips the PEI phase directly. If we choose this
> approach, SEC-based migration is our preference.
> >
> > Besides this patch, we would like to understand a full picture.
> > 1) How the key is passed from source VM to destination?
> > I saw you mentions: "Key sharing is out of scope for this part of the RFC."
> > "This will probably be implemented via inject-launch-secret in the future"
> >
> > Does that mean two PSP will sync with each other and negotiate the key, 
> > after
> the Migration Agent (MA) checks the policy?
> 
> The source and destination migration handlers will need to share a key.
> If we only relied on the PSP for migration, we could use the existing
> secure channel between the PSP and the guest owner to transfer the
> pages. Unfortunately the throughput of this approach is far too low.
> Thus, we have some migration handler running on a guest vCPU with a
> transport key shared between the source and the target.
> 
> The main mechanism for getting a key to the migration handler is
> inject-launch-secret. Here the guest owner can provide a secret to the
> PSP via a secure channel and the PSP will inject it at some guest
> physical address. You use inject-launch-secret after the launch
> measurement of the guest has been generated to inject the secret
> conditionally. One approach would be to inject the transport key
> directly in the source and the target. This is pretty simple, but might
> have a few drawbacks. The injection has to happen at boot, meaning that
> the source machine would have to be provisioned with a transport key
> before a migration happens and that all migrations from that machine
> would have to use the same transport key. One way around this would be
> to inject asymmetric keys and use them to derive the transport key.
> 
> Another approach entirely is to use the PSP to migrate just a few pages,
> which might include a secret set by the source MH that the target MH
> could use to decrypt incoming pages. Using the PSP to migrate pages
> requires some extra kernel support.
> 
> For the RFC, we just assume that there is some shared key. We have
> talked some about the various options internally.
> 
> > 2) How the attestation is supported?
> > I read the whitepaper https://www.amd.com/system/files/TechDocs/SEV-
> SNP-strengthening-vm-isolation-with-integrity-protection-and-more.pdf.
> > It seems SEV and SEV-ES only support attestation during launch, I don't 
> > believe
> this migration feature will impact the attestation report. Am I right?
> > SEV-SNP supports more flexible attestation, does it include any information
> about the new migrated content?
> 
> Brijesh already addressed most of this. In our approach the MH is baked
> into the firmware, which can be attested prior to injecting the key. In
> other words there aren't any additional steps to attest the MH and it
> does not change the functionality of any existing attestation mechanisms.
> 
> -Tobin
> 
> >
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of Yao,
> Jiewen
> >> Sent: Thursday, March 4, 2021 9:49 AM
> >> To: devel@edk2.groups.io; to...@linux.ibm.com
> >> Cc: Dov Murik ; Tobin Feldman-Fitzthum
> >> ; James Bottomley ; Hubertus Franke
> >> ; Brijesh Singh ; Ashish
> Kalra
> >> ; Jon Grimm ; Tom
> Lendacky
> >> ; Yao, Jiewen 
> >> Subject: Re: [edk2-devel] [RFC PATCH 00/14] Firmware Support for Fast Live
> >> Migration for AMD SEV
> >>
> >> Hi Tobin
> >> Thanks for your patch.
> >> You may that Intel is working on TDX for the same live migration feature.
> >>
> >> Please give me some time (about 1 work week) to digest and evaluate the
> patch
> >> and impact.
> >> Then I will 

Re: [edk2-devel] [edk2-platforms] [patch 00/35] Consume RegisterFilterLibNull instance

2021-03-17 Thread Dandan Bi
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> gaoliming
> Sent: Wednesday, March 17, 2021 11:05 AM
> To: devel@edk2.groups.io; a...@kernel.org; Bi, Dandan
> ; 'Laszlo Ersek' ; 'Andrew Fish'
> 
> Cc: 'Leif Lindholm' ; Kinney, Michael D
> 
> Subject: 回复: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
> RegisterFilterLibNull instance
> 
> Ard and Dandan:
> 
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Ard
> Biesheuvel
> > 发送时间: 2021年3月16日 23:01
> > 收件人: devel@edk2.groups.io; dandan...@intel.com; Laszlo Ersek
> > ; Andrew Fish 
> > 抄送: Leif Lindholm ; Michael D Kinney
> > ; Liming Gao 
> > 主题: Re: [edk2-devel] [edk2-platforms] [patch 00/35] Consume
> > RegisterFilterLibNull instance
> >
> > On Tue, 16 Mar 2021 at 15:56, Dandan Bi  wrote:
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246
> > > RFC: https://edk2.groups.io/g/devel/message/72530
> > >
> > >
> > > Add RegisterFilterLibNull in dsc files in edk2-platforms repo, which
> > > will be consumed by IoLib and BaseLib.
> > >
> > > This is the following update in edk2-platforms repo for the change
> > > in edk2, which will add RegisterFilterLib dependency for IoLib and
> > > BaseLib to
> > filter/trace
> > > port IO/MMIO/MSR access.
> > > https://edk2.groups.io/g/devel/message/72754
> > >
> > > Cc: Leif Lindholm 
> > > Cc: Michael D Kinney 
> > > Cc: Liming Gao 
> > >
> >
> > It is a bit disappointing that we have to update every platform in
> > existence again to apply a change to a core module.
> >
> 
> I suggest to add MdePkg.dsc.inc file to include the default library instance,
> and update all Platform DSC to include it. Then, for the future change, no
> change is required for platform DSC.
> 
> Because this patch set updates every platform DSC, I suggest to introduce
> MdePkg.dsc.inc file in this patch set.

Hi Liming,

I agree that add MdePkg.dsc.inc file to include the default library instance 
and make it consumed by platform dsc will benefit future similar incompatible 
changes.
But I wonder to know whether we could do it in a separated task/topic,  as
1.  It should be a code infrastructure design change/improvement in edk2.
2.  Personally I don't hope the new solution will have much impact on my 
current schedule, but it seems have.
And we may need to:
1). Clarify the default library instances which should be added in 
MdePkg.dsc.inc
The library instances in MdePkg.dsc.inc should be generic enough to be 
widely included in platform dsc files.
2). Update dsc files in edk2 and edk2-platforms repo to include MdePkg.dsc.inc 
and cleanup the default Lib instance in dsc files.


Thanks,
Dandan
> 
> Thanks
> Liming
> > Is there really not a better way to provide a 'default' resolution for
> > a library class? Maybe a change to the .DEC format, so that the file
> > which defines the library class can provide a resolution that is used
> > if none is provided by the .DSC file?
> >
> >
> >
> > > Dandan Bi (35):
> > >   Drivers/ASIX: Consume RegisterFilterLibNull instance
> > >   Drivers/DisplayLink: Consume RegisterFilterLibNull instance
> > >   Drivers/OptionRomPkg: Consume RegisterFilterLibNull instance
> > >   Features/Debugging: Consume RegisterFilterLibNull instance
> > >   Features/Network: Consume RegisterFilterLibNull instance
> > >   Features/OutOfBandManagement: Consume RegisterFilterLibNull
> > instance
> > >   Features/PowerManagement: Consume RegisterFilterLibNull instance
> > >   Features/SystemInformation: Consume RegisterFilterLibNull instance
> > >   Features/UserInterface: Consume RegisterFilterLibNull instance
> > >   Platform/AMD: Consume RegisterFilterLibNull instance
> > >   Platform/ARM: Consume RegisterFilterLibNull instance
> > >   Platform/BeagleBoard: Consume RegisterFilterLibNull instance
> > >   Platform/BoardModulePkg: Consume RegisterFilterLibNull instance
> > >   Platform/MinPlatformPkg: Consume RegisterFilterLibNull instance
> > >   Platform/QuarkPlatformPkg: Consume RegisterFilterLibNull instance
> > >   Platform/Vlv2TbltDevicePkg: Consume RegisterFilterLibNull instance
> > >   Platform/LeMaker: Consume RegisterFilterLibNull instance
> > >   Platform/Qemu: Consume RegisterFilterLibNull instance
> > >   Platform/RaspberryPi: Consume RegisterFilterLibNull instance
> > >   Platform/RISC-V: Consume RegisterFilterLibNull instance
> > >   Platform/SiFive: Consume RegisterFilterLibNull instance
> > >   Platform/Socionext: Consume RegisterFilterLibNull instance
> > >   Platform/SoftIron: Consume RegisterFilterLibNull instance
> > >   Silicon/Hisilicon: Consume RegisterFilterLibNull instance
> > >   Silicon/CoffeelakeSiliconPkg: Consume RegisterFilterLibNull instance
> > >   Silicon/IntelSiliconPkg: Consume RegisterFilterLibNull instance
> > >   Silicon/KabylakeSiliconPkg: Consume RegisterFilterLibNull instance
> > >   Silicon/QuarkSocPkg: Consume RegisterFilterLibNull instance
> > >   Silicon/TigerlakeSiliconPkg: Consume RegisterFilterLibNull instance
> > >   

Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg: CoreCommonLib: Added new library for VariableSmmRuntimeDxe

2021-03-17 Thread Zhiguang Liu
Hi Liming, 
Can you help merge the first two patches in this patch set?
If you need, I can provide the patch files.

Hi Kun,
Thanks. Let's see if Liming can help.

Thanks
Zhiguang

> -Original Message-
> From: Kun Qin 
> Sent: Wednesday, March 17, 2021 4:11 PM
> To: Liu, Zhiguang ; devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Liming Gao
> ; Dong, Eric 
> Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> 
> Hi Zhiguang,
> 
> I do not mind check the reviewed patches (the first 3 changes,
> specifically) in first. I have not done this before. How you want to proceed 
> in
> that case?
> 
> Regards,
> Kun
> 
> On 03/17/2021 00:52, Liu, Zhiguang wrote:
> > Reviewed-by: Zhiguang Liu 
> >
> > Hi Kun,
> > Since the first two changes about MinPlatformPkg already got reviewed,
> can we first check them in?
> >
> > Thanks
> > Zhiguang
> >
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of Kun
> >> Qin
> >> Sent: Wednesday, March 17, 2021 2:11 AM
> >> To: devel@edk2.groups.io
> >> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> >> ; Liming Gao
> >> ; Dong, Eric 
> >> Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> >> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> >>
> >> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3250
> >>
> >> This change added NULL MmUnblockMemoryLib instance in dsc files of
> >> CoreCommonLib to resolve newly introduced dependency. The library
> >> interface is consumed by VariableSmmRuntimeDxe to better support
> >> variable runtime cache feature.
> >>
> >> Cc: Chasel Chiu 
> >> Cc: Nate DeSimone 
> >> Cc: Liming Gao 
> >> Cc: Eric Dong 
> >>
> >> Signed-off-by: Kun Qin 
> >> Reviewed-by: Liming Gao 
> >> ---
> >>
> >> Notes:
> >>  v2:
> >>  - Added reviewed-by tag [Liming]
> >>
> >>   Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git
> >> a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> >> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> >> index cb40e111b5dd..bcabb797e91a 100644
> >> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> >> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> >> @@ -159,6 +159,7 @@ [LibraryClasses.common]
> >> LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
> >>
> >> SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
> >> +
> >> +
> >>
> MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblo
> >> ckMemoryLi
> >> + bNull.inf
> >>
> >> SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
> >>
> >> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePoli
> >> VariablePolicyLib|cyLi
> >> b.inf
> >> --
> >> 2.30.0.windows.1
> >>
> >>
> >>
> >> 
> >>
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72966): https://edk2.groups.io/g/devel/message/72966
Mute This Topic: https://groups.io/mt/81383278/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] Google Summer of Code Interested Student

2021-03-17 Thread Leif Lindholm
+Roy (now at Marvell)

/
Leif (now at Qualcomm)

On Tue, Mar 16, 2021 at 16:23:45 +0100, Laszlo Ersek wrote:
> Hi Nate,
> 
> (adding Leif and Ard)
> 
> On 03/13/21 03:52, Desimone, Nathaniel L wrote:
> > I've created a new wiki page for this task with all the information I
> > have gathered thus far. I've done some more experimentation and found
> > that there are several newer terminal emulators that don't support
> > DEC Special Graphics so I've reduced the number of modes where DEC
> > Special Graphics should be preferred. Laszlo, if you could take a
> > look at the terminal type matrix I created that would be very
> > helpful.
> >
> > https://github.com/tianocore/tianocore.github.io/wiki/Tasks-Terminal-driver-improvements
> 
> (
> 
> My background:
> 
> I settled on plain (non-UTF-8) xterm around 1998, and have been using it
> ever since. Whenever something was off, I always tried to hammer the
> application into conformance with my particular xterm setup, rather than
> the other way around. I also have some quirky terminal settings -- for
> me, "backspace" generates ^H / keycode 22 (stty sets erase to ^H),
> "delete" generates keycode 119, and there's no "rubout". I still don't
> use UTF-8 (I use latin2).
> 
> )
> 
> * Regarding ArmVirtPkg, I stick with the default TTY_TERMINAL=FALSE
>   setting (which means VT-100). Using that setting, I see the following
>   kind of "ASCII approximation" for box drawing:
> 
>   
> /--\
>   |Boot Manager   
>|
>   
> \--/
> 
>   I'm really happy with this, as I don't care much for nice-looking
>   boxes; instead I prefer portability.
> 
>   (NB: this seems to disagree with your "Current Behavior (Which is
>   wrong)" line for VT100, as it suggests CP437. That's not what I'm
>   seeing with VT100.)
> 
>   TTY_TERMINAL=TRUE would mainly affect backspace / delete I think -- as
>   far as I recall, that's why I asked Roy not to make TTY_TERMINAL=TRUE
>   the default, in 2015:
> 
>   http://mid.mail-archive.com/555458DB.3090602@redhat.com
>   
> http://mid.mail-archive.com/CAFECyb_E+bGZt5xv7QhRqyD0jX=AzoEMw7VW_tjZr+E=sqf...@mail.gmail.com
> 
>   (I'd like to CC Roy, but I can't tell if he's now working for Linaro,
>   Cavium, HPE, Marvell, or another company.)
> 
> * Regarding OvmfPkg, currently PC_ANSI is hard-coded, and for me it
>   looks like this:
> 
>   
> ÚÄÄż
>   łBoot Manager   
>ł
>   
> ŔÄÄŮ
> 
>   Obviously I'd much prefer if I got the simple ASCII approximation here
>   as well.
> 
> * Whether VT100 and/or PC_ANSI and/or TTY_TERM are *officially* supposed
>   to use DEC Special Graphics, I can't tell.
> 
>   I know what my preferences are:
> 
>   - the current BackSpace and Delete mappings (which work fine for me
> with both VT100 and PC_ANSI, but *not* with TTY_TERM),
> 
>   - and the most primitive ASCII mapping (no special graphics, no UTF-8
> sequences, etc). I really like a super dumb terminal, where taking
> simple "ASCII screenshots" (and pasting them into plaintext emails!)
> is *trivial*.
> 
>   ... Looking at your "Expected Behavior" table, there is only one line
>   left with "poor man's ASCII" -- namely, TTY_TERM. Unfortunately,
>   TTY_TERM breaks my BackSpace / Delete settings :(
> 
> * In summary, I'd prefer if (a) VT100 stayed as-is (using "poor man's
>   ASCII", as seen in ArmVirtPkg), and (b) if OVMF used *that* VT100,
>   rather than PC_ANSI, by default.
> 
> Thanks!
> Laszlo
> 


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




[edk2-devel] [PATCH v2 2/2] UefiCpuPkg/CpuDxe: Guarantee GDT is below 4GB

2021-03-17 Thread Ni, Ray
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3233

GDT needs to be allocated below 4GB in 64bit environment
because AP needs it for entering to protected mode.
CPU running in big real mode cannot access above 4GB GDT.

But CpuDxe driver contains below code:
  gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8);
  .
  gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt;

The AllocateRuntimePool() may allocate memory above 4GB.
Thus, we cannot use AllocateRuntimePool (), instead,
we should use AllocatePages() to make sure GDT is below 4GB space.

Signed-off-by: Ray Ni 
Reviewed-by: Eric Dong 
Reviewed-by: Laszlo Ersek 
Cc: Rahul Kumar 
---
 UefiCpuPkg/CpuDxe/CpuGdt.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c
index 8847bc4819..692402c55d 100644
--- a/UefiCpuPkg/CpuDxe/CpuGdt.c
+++ b/UefiCpuPkg/CpuDxe/CpuGdt.c
@@ -124,15 +124,26 @@ InitGlobalDescriptorTable (
   VOID
   )
 {
+  EFI_STATUSStatus;
   GDT_ENTRIES   *Gdt;
   IA32_DESCRIPTOR   Gdtr;
+  EFI_PHYSICAL_ADDRESS  Memory;
 
   //
-  // Allocate Runtime Data for the GDT
-  //
-  Gdt = AllocateRuntimePool (sizeof (mGdtTemplate) + 8);
-  ASSERT (Gdt != NULL);
-  Gdt = ALIGN_POINTER (Gdt, 8);
+  // Allocate Runtime Data below 4GB for the GDT
+  // AP uses the same GDT when it's waken up from real mode so
+  // the GDT needs to be below 4GB.
+  //
+  Memory = SIZE_4GB - 1;
+  Status = gBS->AllocatePages (
+  AllocateMaxAddress,
+  EfiRuntimeServicesData,
+  EFI_SIZE_TO_PAGES (sizeof (mGdtTemplate)),
+  
+  );
+  ASSERT_EFI_ERROR (Status);
+  ASSERT ((Memory != 0) && (Memory < SIZE_4GB));
+  Gdt = (GDT_ENTRIES *) (UINTN) Memory;
 
   //
   // Initialize all GDT entries
-- 
2.27.0.windows.1



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




[edk2-devel] [PATCH v2 0/2] UefiCpuPkg/CpuDxe: Guarantee GDT is below 4GB

2021-03-17 Thread Ni, Ray


Ray Ni (2):
  UefiCpuPkg/CpuDxe: Rename variables to follow EDKII coding standard
  UefiCpuPkg/CpuDxe: Guarantee GDT is below 4GB

 UefiCpuPkg/CpuDxe/CpuGdt.c | 38 --
 1 file changed, 24 insertions(+), 14 deletions(-)

-- 
2.27.0.windows.1



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




[edk2-devel] [PATCH v2 1/2] UefiCpuPkg/CpuDxe: Rename variables to follow EDKII coding standard

2021-03-17 Thread Ni, Ray
The change doesn't impact any functionality.

Signed-off-by: Ray Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Rahul Kumar 
---
 UefiCpuPkg/CpuDxe/CpuGdt.c | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuGdt.c b/UefiCpuPkg/CpuDxe/CpuGdt.c
index a1ab543f2d..8847bc4819 100644
--- a/UefiCpuPkg/CpuDxe/CpuGdt.c
+++ b/UefiCpuPkg/CpuDxe/CpuGdt.c
@@ -2,7 +2,7 @@
   C based implementation of IA32 interrupt handling only
   requiring a minimal assembly interrupt entry point.
 
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -13,7 +13,7 @@
 //
 // Global descriptor table (GDT) Template
 //
-STATIC GDT_ENTRIES GdtTemplate = {
+STATIC GDT_ENTRIES mGdtTemplate = {
   //
   // NULL_SEL
   //
@@ -124,27 +124,27 @@ InitGlobalDescriptorTable (
   VOID
   )
 {
-  GDT_ENTRIES *gdt;
-  IA32_DESCRIPTOR gdtPtr;
+  GDT_ENTRIES   *Gdt;
+  IA32_DESCRIPTOR   Gdtr;
 
   //
   // Allocate Runtime Data for the GDT
   //
-  gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8);
-  ASSERT (gdt != NULL);
-  gdt = ALIGN_POINTER (gdt, 8);
+  Gdt = AllocateRuntimePool (sizeof (mGdtTemplate) + 8);
+  ASSERT (Gdt != NULL);
+  Gdt = ALIGN_POINTER (Gdt, 8);
 
   //
   // Initialize all GDT entries
   //
-  CopyMem (gdt, , sizeof (GdtTemplate));
+  CopyMem (Gdt, , sizeof (mGdtTemplate));
 
   //
   // Write GDT register
   //
-  gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt;
-  gdtPtr.Limit = (UINT16) (sizeof (GdtTemplate) - 1);
-  AsmWriteGdtr ();
+  Gdtr.Base  = (UINT32) (UINTN) Gdt;
+  Gdtr.Limit = (UINT16) (sizeof (mGdtTemplate) - 1);
+  AsmWriteGdtr ();
 
   //
   // Update selector (segment) registers base on new GDT
@@ -152,4 +152,3 @@ InitGlobalDescriptorTable (
   SetCodeSelector ((UINT16)CPU_CODE_SEL);
   SetDataSelectors ((UINT16)CPU_DATA_SEL);
 }
-
-- 
2.27.0.windows.1



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




[edk2-devel] [PATCH v3 1/1] BaseTools/Ecc: Make Ecc only check first include guard

2021-03-17 Thread PierreGondois
From: Pierre Gondois 

The Ecc tool checks the format of the include guard. This check is
currently done on all the names following the '#ifndef' statement.
It should only be done on the first include guard.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3252
Signed-off-by: Pierre Gondois 
Reviewed-by: Liming Gao 
Reviewed-by: Bob Feng 
---
The changes can be seen at: 
https://github.com/PierreARM/edk2/tree/1640_Ecc_tool_corrections_v3

Notes:
v2:
 - Remove duplicated copyright.
 - Add Bob Feng's reviewed-by.
 - Add Liming Gao's reviewed-by (resend).

v3:
 - Correct bad formatting of patch
   (not-possible to apply the patch). [Bob]

 BaseTools/Source/Python/Ecc/Check.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index 7a012617fd35..33060db5f27a 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1437,11 +1437,13 @@ class Check(object):
 
 SqlCommand = """select ID, Value from %s where Model = %s""" % 
(FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
 RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
-for Record in RecordSet:
-Name = Record[1].replace('#ifndef', '').strip()
+if RecordSet:
+# Only check the first ifndef statement of the file
+FirstDefine = sorted(RecordSet, key=lambda Record: 
Record[0])[0]
+Name = FirstDefine[1].replace('#ifndef', '').strip()
 if Name[0] == '_' or Name[-1] != '_' or Name[-2] == '_':
 if not 
EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 Name):
-
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), 
BelongsToTable=FileTable, BelongsToItem=Record[0])
+
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), 
BelongsToTable=FileTable, BelongsToItem=FirstDefine[0])
 
 # Rule for path name, variable name and function name
 # 1. First character should be upper case
-- 
2.17.1



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




Re: [edk2-devel] [edk2-platforms] [patch 20/35] Platform/RISC-V: Consume RegisterFilterLibNull instance

2021-03-17 Thread Abner Chang
Reviewed-by: Abner Chang 

> -Original Message-
> From: Dandan Bi [mailto:dandan...@intel.com]
> Sent: Tuesday, March 16, 2021 10:54 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner (HPS SW/FW Technologist) ;
> Schaefer, Daniel ; Chen, Gilbert
> 
> Subject: [edk2-platforms] [patch 20/35] Platform/RISC-V: Consume
> RegisterFilterLibNull instance
> 
> REF: INVALID URI REMOVED
> 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid-
> 3D3246=DwIBAg=C5b8zRQO1miGmBeVZ2LFWg=_SN6FZBN4Vgi4Ulks
> kz6qU3NYRO03nHp9P7Z5q59A3E=I7cqLnSi748oQzvkydupz45EAffDQMtiQ
> Y8tZnG9bVk=ANUyqJkcOsuNjfM8eYL5LwrUhVliwmLoIV76k4KIEqA=
> 
> Add RegisterFilterLibNull in dsc which will be consumed by IoLib and BaseLib.
> 
> Cc: Abner Chang 
> Cc: Daniel Schaefer 
> Cc: Gilbert Chen 
> Signed-off-by: Dandan Bi 
> ---
>  Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
> b/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
> index 092717d2ef..961e1234e9 100644
> --- a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
> +++ b/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
> @@ -53,10 +53,11 @@ [LibraryClasses.common]
>PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
>PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 
> SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in
> f
> 
> TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTem
> plate.inf
> 
> PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base
> PeCoffGetEntryPointLib.inf
> +
> RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.i
> nf
> 
>  [LibraryClasses.common.PEIM]
>FirmwareContextProcessorSpecificLib|Platform/RISC-
> V/PlatformPkg/Library/FirmwareContextProcessorSpecificLib/FirmwareCont
> extProcessorSpecificLib.inf
>HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
> 
> MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemory
> AllocationLib.inf
> --
> 2.18.0.windows.1



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




Re: [edk2-devel] [edk2-platforms] [patch 21/35] Platform/SiFive: Consume RegisterFilterLibNull instance

2021-03-17 Thread Abner Chang
Reviewed-by: Abner Chang 

> -Original Message-
> From: Dandan Bi [mailto:dandan...@intel.com]
> Sent: Tuesday, March 16, 2021 10:54 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner (HPS SW/FW Technologist) ;
> Schaefer, Daniel ; Chen, Gilbert
> 
> Subject: [edk2-platforms] [patch 21/35] Platform/SiFive: Consume
> RegisterFilterLibNull instance
> 
> REF: INVALID URI REMOVED
> 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid-
> 3D3246=DwIBAg=C5b8zRQO1miGmBeVZ2LFWg=_SN6FZBN4Vgi4Ulks
> kz6qU3NYRO03nHp9P7Z5q59A3E=Cb0wvC-JhDZlZpoJFTmLyTkS-
> M7F7MNmmwgIftctJKo=3tK0RQxCfxSaNAkQVhCZMm9tSQ8UFZ0u6IhZL6
> Oa4M4=
> 
> Add RegisterFilterLibNull in dsc which will be consumed by IoLib and BaseLib.
> 
> Cc: Abner Chang 
> Cc: Daniel Schaefer 
> Cc: Gilbert Chen 
> Signed-off-by: Dandan Bi 
> ---
>  Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc   | 1 +
>  .../SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
> b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
> index 2d652d215f..9610f0613a 100644
> --- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
> +++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
> @@ -94,10 +94,11 @@ [LibraryClasses]
>UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
> 
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
> mizedDisplayLib.inf
>SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
> 
> UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBoo
> tManagerLib.inf
>FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
> +
> RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.i
> nf
> 
>  # RISC-V Platform Library
>TimeBaseLib|EmbeddedPkg//Library/TimeBaseLib/TimeBaseLib.inf
> 
> RealTimeClockLib|EmbeddedPkg//Library/VirtualRealTimeClockLib/VirtualRe
> alTimeClockLib.inf
> 
> diff --git
> a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d
> sc
> b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.
> dsc
> index 9f60475189..b3d4427a8a 100644
> ---
> a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d
> sc
> +++
> b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.
> dsc
> @@ -94,10 +94,11 @@ [LibraryClasses]
>UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
> 
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
> mizedDisplayLib.inf
>SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
> 
> UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBoo
> tManagerLib.inf
>FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
> +
> RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.i
> nf
> 
>  # RISC-V Platform Library
>TimeBaseLib|EmbeddedPkg//Library/TimeBaseLib/TimeBaseLib.inf
> 
> RealTimeClockLib|EmbeddedPkg//Library/VirtualRealTimeClockLib/VirtualRe
> alTimeClockLib.inf
> 
> --
> 2.18.0.windows.1



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




Re: [edk2-devel] [edk2-platforms] [patch 33/35] Silicon/RISC_V: Consume RegisterFilterLibNull instance

2021-03-17 Thread Abner Chang
Reviewed-by: Abner Chang 

> -Original Message-
> From: Dandan Bi [mailto:dandan...@intel.com]
> Sent: Tuesday, March 16, 2021 10:54 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner (HPS SW/FW Technologist) ;
> Schaefer, Daniel ; Chen, Gilbert
> 
> Subject: [edk2-platforms] [patch 33/35] Silicon/RISC_V: Consume
> RegisterFilterLibNull instance
> 
> REF: INVALID URI REMOVED
> 3A__bugzilla.tianocore.org_show-5Fbug.cgi-3Fid-
> 3D3246=DwIBAg=C5b8zRQO1miGmBeVZ2LFWg=_SN6FZBN4Vgi4Ulks
> kz6qU3NYRO03nHp9P7Z5q59A3E=MklchPJamBAu-
> fvB7UrrVH7jj_O6dpn1jjV-
> fgZb8oQ=w0BZz0ZKe9CvaDHbl3roWRtJm4j_PstLMOzgsjbR_Vc=
> 
> Add RegisterFilterLibNull in dsc which will be consumed by IoLib and BaseLib.
> 
> Cc: Abner Chang 
> Cc: Daniel Schaefer 
> Cc: Gilbert Chen 
> Signed-off-by: Dandan Bi 
> ---
>  Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc
> b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc
> index 5f88f5e89f..da4083c81e 100644
> --- a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc
> +++ b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dsc
> @@ -62,10 +62,11 @@ [LibraryClasses.common]
> 
> UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA
> pplicationEntryPoint.inf
>UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
> 
> DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiD
> evicePathLibDevicePathProtocol.inf
>RiscVPlatformTimerLib|Silicon/RISC-
> V/ProcessorPkg/Library/RiscVPlatformTimerLibNull/RiscVPlatformTimerLib.in
> f
>PeiServicesTablePointerLib|Silicon/RISC-
> V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi/PeiServicesTabl
> ePointerLibOpenSbi.inf
> +
> RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.i
> nf
> 
>  [LibraryClasses.common.PEI_CORE]
>PeiServicesTablePointerLib|Silicon/RISC-
> V/ProcessorPkg/Library/PeiServicesTablePointerLibOpenSbi/PeiServicesTabl
> ePointerLibOpenSbi.inf
> 
>  [LibraryClasses.common.PEIM]
> --
> 2.18.0.windows.1



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




Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg: CoreCommonLib: Added new library for VariableSmmRuntimeDxe

2021-03-17 Thread Kun Qin

Hi Zhiguang,

I do not mind check the reviewed patches (the first 3 changes, 
specifically) in first. I have not done this before. How you want to 
proceed in that case?


Regards,
Kun

On 03/17/2021 00:52, Liu, Zhiguang wrote:

Reviewed-by: Zhiguang Liu 

Hi Kun,
Since the first two changes about MinPlatformPkg already got reviewed, can we 
first check them in?

Thanks
Zhiguang


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Kun Qin
Sent: Wednesday, March 17, 2021 2:11 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L
; Liming Gao
; Dong, Eric 
Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
CoreCommonLib: Added new library for VariableSmmRuntimeDxe

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

This change added NULL MmUnblockMemoryLib instance in dsc files of
CoreCommonLib to resolve newly introduced dependency. The library
interface is consumed by VariableSmmRuntimeDxe to better support
variable runtime cache feature.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 

Signed-off-by: Kun Qin 
Reviewed-by: Liming Gao 
---

Notes:
 v2:
 - Added reviewed-by tag [Liming]

  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
  1 file changed, 1 insertion(+)

diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
index cb40e111b5dd..bcabb797e91a 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
+++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
@@ -159,6 +159,7 @@ [LibraryClasses.common]
LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf

SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
+
+
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblo
ckMemoryLi
+ bNull.inf

SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi
b.inf
--
2.30.0.windows.1










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




Re: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg: CoreCommonLib: Added new library for VariableSmmRuntimeDxe

2021-03-17 Thread Zhiguang Liu
Reviewed-by: Zhiguang Liu 

Hi Kun,
Since the first two changes about MinPlatformPkg already got reviewed, can we 
first check them in?

Thanks
Zhiguang

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Kun Qin
> Sent: Wednesday, March 17, 2021 2:11 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Liming Gao
> ; Dong, Eric 
> Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] MinPlatformPkg:
> CoreCommonLib: Added new library for VariableSmmRuntimeDxe
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3250
> 
> This change added NULL MmUnblockMemoryLib instance in dsc files of
> CoreCommonLib to resolve newly introduced dependency. The library
> interface is consumed by VariableSmmRuntimeDxe to better support
> variable runtime cache feature.
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Cc: Eric Dong 
> 
> Signed-off-by: Kun Qin 
> Reviewed-by: Liming Gao 
> ---
> 
> Notes:
> v2:
> - Added reviewed-by tag [Liming]
> 
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> index cb40e111b5dd..bcabb797e91a 100644
> --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
> @@ -159,6 +159,7 @@ [LibraryClasses.common]
>LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf
> 
>SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf
> +
> +
> MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblo
> ckMemoryLi
> + bNull.inf
> 
>SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
> 
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi
> b.inf
> --
> 2.30.0.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72956): https://edk2.groups.io/g/devel/message/72956
Mute This Topic: https://groups.io/mt/81383278/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-resend 1/1] BaseTools/Ecc: Make Ecc only check first include guard

2021-03-17 Thread Bob Feng
Hi Pierre,

Could you recreate your patch and send again. On my machine, I can't apply this 
patch.

error: corrupt patch at line 33
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch

Thanks,
Bob

-Original Message-
From: pierre.gond...@arm.com  
Sent: Tuesday, March 16, 2021 4:34 AM
To: devel@edk2.groups.io; Feng, Bob C ; 
gaolim...@byosoft.com.cn; Chen, Christine 
Subject: [PATCH v2-resend 1/1] BaseTools/Ecc: Make Ecc only check first include 
guard

From: Pierre Gondois 

The Ecc tool checks the format of the include guard. This check is currently 
done on all the names following the '#ifndef' statement.
It should only be done on the first include guard.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3252
Signed-off-by: Pierre Gondois 
Reviewed-by: Liming Gao 
Reviewed-by: Bob Feng 
---
The changes can be seen at: 
https://github.com/PierreARM/edk2/tree/1640_Ecc_tool_corrections_v2

Notes:
v2:
 - Remove duplicated copyright.
 - Add Bob Feng's reviewed-by.
 - Add Liming Gao's reviewed-by (resend).

 BaseTools/Source/Python/Ecc/Check.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index 7a012617fd35..33060db5f27a 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1437,11 +1437,13 @@ class Check(object):

 SqlCommand = """select ID, Value from %s where Model = %s""" % 
(FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
 RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
-for Record in RecordSet:
-Name = Record[1].replace('#ifndef', '').strip()
+if RecordSet:
+# Only check the first ifndef statement of the file
+FirstDefine = sorted(RecordSet, key=lambda Record: 
Record[0])[0]
+Name = FirstDefine[1].replace('#ifndef', '').strip()
 if Name[0] == '_' or Name[-1] != '_' or Name[-2] == '_':
 if not 
EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 Name):
-
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), 
BelongsToTable=FileTable, BelongsToItem=Record[0])
+
+ EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDE
+ F_STATEMENT, OtherMsg="The #ifndef name [%s] does not follow the 
+ rules" % (Name), BelongsToTable=FileTable, 
+ BelongsToItem=FirstDefine[0])

 # Rule for path name, variable name and function name
 # 1. First character should be upper case
--
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72955): https://edk2.groups.io/g/devel/message/72955
Mute This Topic: https://groups.io/mt/81360608/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-staging] BaseTools/FMMT: Replace file failure when FV level over 2

2021-03-17 Thread Bob Feng
Pushed. 4bfc77a87b820cd585ba10ca28aa957ae315c3dc

-Original Message-
From: Yeh, GregX  
Sent: Tuesday, March 16, 2021 9:55 AM
To: Feng, Bob C ; devel@edk2.groups.io; Yunhua Feng 

Cc: Liming Gao 
Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when 
FV level over 2

Hi Bob,

I have created new patch file. PatchCheck is pass.
Using Git send-email  send to edk2.group.io 

Thanks,
Greg

-Original Message-
From: Feng, Bob C 
Sent: Monday, March 15, 2021 12:35 PM
To: Yeh, GregX ; devel@edk2.groups.io; Yunhua Feng 

Cc: Liming Gao 
Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when 
FV level over 2

Hi Greg,

Please use BaseTools\Scripts\PatchCheck.py to check this patch. There are some 
lines code format invalid.
The logic looks good to me.

Yunhua, could you please double check, I remember you have concerns about the 
previous version of this patch.

Thanks,
Bob

-Original Message-
From: Yeh, GregX 
Sent: Wednesday, March 10, 2021 10:05 AM
To: devel@edk2.groups.io
Cc: Feng, Bob C ; Liming Gao 
Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV 
level over 2

Fixed replace file failure when FFS in multiple level FV and FV level over 2

Signed-off-by: GregX Yeh 
Cc: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/C/FMMT/FmmtLib.c | 56 ++-
 1 file changed, 37 insertions(+), 19 deletions(-)

diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c 
b/BaseTools/Source/C/FMMT/FmmtLib.c
index b945e9b63d..26df0181c7 100644
--- a/BaseTools/Source/C/FMMT/FmmtLib.c
+++ b/BaseTools/Source/C/FMMT/FmmtLib.c
@@ -494,7 +494,7 @@ LibReadFvHeader (
 if ((FvLevel -1) == 0) {
   printf ("\n%s :\n", FvName);
 } else {
-  printf ("%sChild FV named FV%d of %s\n", BlankSpace, FvCount, FvName);
+  printf ("\n%sChild FV named FV%d of %s\n", BlankSpace, FvCount, 
+ FvName);
 }
   }
 
@@ -502,7 +502,7 @@ LibReadFvHeader (
   // Print FV header information
   //
   if (ViewFlag) {
-printf ("\n%sAttributes:%X\n", BlankSpace, (unsigned) 
VolumeHeader->Attributes);
+printf ("%sAttributes:%X\n", BlankSpace, (unsigned) 
VolumeHeader->Attributes);
 printf ("%sTotal Volume Size: 0x%08X\n", BlankSpace, (unsigned) 
VolumeHeader->FvLength);
 printf ("%sFree Volume Size:  0x%08X\n", BlankSpace, (unsigned) 
(VolumeHeader->FvLength - GetFreeOffset(InputFv)));
   }
@@ -789,7 +789,8 @@ LibParseSection (
   UINT8  *FvCount,
   BOOLEANViewFlag,
   BOOLEANErasePolarity,
-  BOOLEAN*IsFfsGenerated
+  BOOLEAN*IsFfsGenerated,
+  BOOLEANIsFfs
   )
 {
   UINT32  ParsedLength;
@@ -997,8 +998,12 @@ LibParseSection (
   break;
 
 case EFI_SECTION_COMPRESSION:
-  if (FirstInFlag) {
-Level ++;
+   if (IsFfs){
+ Level ++;
+   } else {
+if (FirstInFlag) {
+  Level ++;
+}
   }
   NumberOfSections ++;
 
@@ -1159,7 +1164,9 @@ LibParseSection (
   FvCount,
   ViewFlag,
   ErasePolarity,
-  IsFfsGenerated);
+  IsFfsGenerated,
+  FALSE
+  );
 
   if (CompressionType == EFI_STANDARD_COMPRESSION) {
 //
@@ -1181,8 +1188,12 @@ LibParseSection (
   // looks up the appropriate tool to use for extracting
   // a GUID defined FV section.
   //
-  if (FirstInFlag) {
+  if (IsFfs) {
 Level ++;
+  } else {
+if (FirstInFlag) {
+  Level ++;
+}
   }
   NumberOfSections++;
   EncapDataNeedUpdata = TRUE;
@@ -1216,7 +1227,8 @@ LibParseSection (
 FvCount,
 ViewFlag,
 ErasePolarity,
-IsFfsGenerated
+IsFfsGenerated,
+FALSE
 );
 if (EFI_ERROR(Status)) {
   Error(NULL, 0, 0003, "parse of decoded GUIDED section failed", 
NULL); @@ -1471,7 +1483,8 @@ LibParseSection (
   FvCount,
   ViewFlag,
   ErasePolarity,
-  IsFfsGenerated
+  IsFfsGenerated,
+  FALSE
   );
 if (EFI_ERROR (Status)) {
   Error (NULL, 0, 0003, "parse of decoded GUIDED section failed", 
NULL); @@ -1491,7 +1504,8 @@ LibParseSection (
 FvCount,
 ViewFlag,
 ErasePolarity,
-IsFfsGenerated
+IsFfsGenerated,
+FALSE
 );
   if (ExtractionTool != NULL) {
 free (ExtractionTool);
@@ -2016,7 +2030,7 @@ LibGetFileInfo (
 
   LocalEncapData->Level = Level;
   LocalEncapData->Type  = FMMT_ENCAP_TREE_FFS;
-

[edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-17 Thread IanX Kuo
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

No need to print PCIe details while CapabilityId is 0x.
Limit the NextCapabilityOffset to PCI configuration space.

Signed-off-by: VincentX Ke 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..1e5dc75e27 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2038,12 +2038,14 @@ LocatePciCapability (
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   );
 
@@ -2921,6 +2923,7 @@ ShellCommandRunPci (
 PciExplainPciExpress (
   (PCI_CAPABILITY_PCIEXP *) ((UINT8 *)  + 
PcieCapabilityPtr),
   ExtendedConfigSpace,
+  ExtendedConfigSize,
   ExtendedCapability
   );
   }
@@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   )
 {
@@ -5786,7 +5791,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
@@ -5800,7 +5805,8 @@ PciExplainPciExpress (
 //
 // Advance to the next item if it exists
 //
-if (ExtHdr->NextCapabilityOffset != 0) {
+if (ExtHdr->NextCapabilityOffset != 0 &&
+   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + 
EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
   ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
 } else {
   break;
-- 
2.18.0.windows.1



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