Re: [edk2-devel] [edk2-staging][PATCH 1/2] CryptoPkg: update openssl to 1.1.1t

2023-02-28 Thread Heng Luo
Reviewed-by: Heng Luo 

> -Original Message-
> From: Li, Yi1 
> Sent: Friday, February 24, 2023 2:49 PM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Gao, Zhichao ; Tan,
> Ming ; Luo, Heng 
> Subject: [edk2-staging][PATCH 1/2] CryptoPkg: update openssl to 1.1.1t
> 
> Pick up bugfixes from the latest openssl release.
> 
> Cc: Zhichao Gao 
> Cc: Ming Tan 
> Cc: Heng Luo 
> Signed-off-by: Yi Li 
> ---
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
>  CryptoPkg/Library/OpensslLib/openssl| 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> index 1d67ed55e1..c112b737ba 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf
> @@ -157,6 +157,7 @@
>$(OPENSSL_PATH)/crypto/bn/bn_srp.c
>$(OPENSSL_PATH)/crypto/bn/bn_word.c
>$(OPENSSL_PATH)/crypto/bn/bn_x931p.c
> +  $(OPENSSL_PATH)/crypto/bn/rsa_sup_mul.c
>$(OPENSSL_PATH)/crypto/buffer/buf_err.c
>$(OPENSSL_PATH)/crypto/buffer/buffer.c
>$(OPENSSL_PATH)/crypto/cmac/cm_ameth.c
> diff --git a/CryptoPkg/Library/OpensslLib/openssl
> b/CryptoPkg/Library/OpensslLib/openssl
> index 52c587d60b..830bf8e1e4 16
> --- a/CryptoPkg/Library/OpensslLib/openssl
> +++ b/CryptoPkg/Library/OpensslLib/openssl
> @@ -1 +1 @@
> -Subproject commit 52c587d60be67c337364b830dd3fdc15404a2f04
> +Subproject commit 830bf8e1e4749ad65c51b6a1d0d769ae689404ba
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [edk2-staging][PATCH 0/2] CryptoPkg: openssl submodule update

2023-02-28 Thread Heng Luo
For this series:
Reviewed-by: Heng Luo 

> -Original Message-
> From: Li, Yi1 
> Sent: Friday, February 24, 2023 2:49 PM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Gao, Zhichao ; Tan,
> Ming ; Luo, Heng 
> Subject: [edk2-staging][PATCH 0/2] CryptoPkg: openssl submodule update
> 
> Patch 1: update openssl to 1.1.1t
> Patch 2: fix wrong name in tls 1.2 cipher suite
> 
> Cc: Zhichao Gao 
> Cc: Ming Tan 
> Cc: Heng Luo 
> Signed-off-by: Yi Li 
> 
> Yi Li (2):
>   CryptoPkg: update openssl to 1.1.1t
>   CryptoPkg: fix wrong name in tls 1.2 cipher suite
> 
>  CryptoPkg/Library/OpensslLib/OpensslLib.inf | 1 +
>  CryptoPkg/Library/OpensslLib/openssl| 2 +-
>  CryptoPkg/Library/TlsLib/TlsConfig.c| 4 ++--
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [edk2-staging][PATCH 2/2] CryptoPkg: fix wrong name in tls 1.2 cipher suite

2023-02-28 Thread Heng Luo
Reviewed-by: Heng Luo 

> -Original Message-
> From: Li, Yi1 
> Sent: Friday, February 24, 2023 2:49 PM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 ; Gao, Zhichao ; Tan,
> Ming ; Luo, Heng 
> Subject: [edk2-staging][PATCH 2/2] CryptoPkg: fix wrong name in tls 1.2
> cipher suite
> 
> Keep cipher name consistent with openssl.
> 
> Cc: Zhichao Gao 
> Cc: Ming Tan 
> Cc: Heng Luo 
> Signed-off-by: Yi Li 
> ---
>  CryptoPkg/Library/TlsLib/TlsConfig.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c
> b/CryptoPkg/Library/TlsLib/TlsConfig.c
> index 3a3490c2ac..30247b931b 100644
> --- a/CryptoPkg/Library/TlsLib/TlsConfig.c
> +++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
> @@ -70,8 +70,8 @@ STATIC CONST TLS_CIPHER_MAPPING
> TlsCipherMappingTable[] = {
>MAP (0x1302, "TLS_AES_256_GCM_SHA384"),  ///
> TLS_AES_256_GCM_SHA384
>MAP (0x1303, "TLS_CHACHA20_POLY1305_SHA256"),///
> TLS_CHACHA20_POLY1305_SHA256
>MAP (0x1301, "TLS_AES_128_GCM_SHA256"),  ///
> TLS_AES_128_GCM_SHA256
> -  MAP (0xC02B, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"), ///
> TLS_ECDHE_ECDSA_AES128_GCM_SHA256
> -  MAP (0xC02C, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"), ///
> TLS_ECDHE_ECDSA_AES256_GCM_SHA384
> +  MAP (0xC02B, "ECDHE-ECDSA-AES128-GCM-SHA256"),   ///
> TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
> +  MAP (0xC02C, "ECDHE-ECDSA-AES256-GCM-SHA384"),   ///
> TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
>MAP (0xC030, "ECDHE-RSA-AES256-GCM-SHA384"), ///
> TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
>  };
> 
> --
> 2.31.1.windows.1



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




Re: [edk2-devel] [PATCH 1/1] SecurityPkg/DxeImageVerificationLib: Check result of GetEfiGlobalVariable2

2023-02-28 Thread Marvin Häuser

> On 28. Feb 2023, at 07:12, Gerd Hoffmann  wrote:
> 
>   Hi,
> 
>>> (a) the SecureBoot variable is not present (EFI_NOT_FOUND) according to
>>>the return value, or
>> 
>> @Maintainers Would there be any objection to drop this and skip the SB 
>> checks only when explicitly disabled?
>> Please explicitly respond even if not, so we don't end up with everyone 
>> silently agreeing, but forgetting about the patch after. Thanks! :)
> 
> I hold back v2, waiting for an answer here.
> 
>>> -  if (*SecureBoot == SECURE_BOOT_MODE_DISABLE) {
>>> -FreePool (SecureBoot);
>>> +  if ((VarStatus == EFI_SUCCESS) && (SecureBoot == 
>>> SECURE_BOOT_MODE_DISABLE)) {
>> 
>> I would check the attributes here as well. They should be BS | RT, but
>> explicitly not NV. This would force the SB checks in case a malicious
>> actor somehow managed to store a persistent disable-value variable (be
>> that a bug, physical access, or other means).
> 
> Like this (incremental fixup)?

Sorry, I formulated it a bit vague - what I meant is that the attributes should 
be exactly BS | RT (i.e., equal to), but I see how adding it must not be NV 
sounds like it should be just those three Bits checked. Otherwise, yes, thanks 
a lot!

It’s a read-only status reporting variable, so even with future changes, 
setting any of the other attributes wouldn’t make much sense. BS | RT is what 
the spec currently dictates (there is a table here: 
https://uefi.org/specs/UEFI/2.10/03_Boot_Manager.html).

> 
> Do we have macros for variable attribute checking?
> Havn't seen anything while skimming variable-related headers ...

Don’t think so. Not sure there is much attribute-checking done to begin with 
outside VarCheckLib. The only stack I’ve seen doing this extensively is 
recent-years Mac EFI.

Best regards,
Marvin

> 
> take care,
>  Gerd
> 
> diff --git 
> a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c 
> b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
> index f29a27e5a053..79c784f77ac8 100644
> --- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
> +++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
> @@ -1688,6 +1688,7 @@ DxeImageVerificationHandler (
>   EFI_STATUSHashStatus;
>   EFI_STATUSDbStatus;
>   EFI_STATUSVarStatus;
> +  UINT32VarAttr;
>   BOOLEAN   IsFound;
> 
>   SignatureList = NULL;
> @@ -1745,7 +1746,7 @@ DxeImageVerificationHandler (
>   }
> 
>   SecureBootSize = sizeof (SecureBoot);
> -  VarStatus  = gRT->GetVariable (EFI_SECURE_BOOT_MODE_NAME, 
> &gEfiGlobalVariableGuid, NULL, &SecureBootSize, &SecureBoot);
> +  VarStatus  = gRT->GetVariable (EFI_SECURE_BOOT_MODE_NAME, 
> &gEfiGlobalVariableGuid, &VarAttr, &SecureBootSize, &SecureBoot);
>   //
>   // Skip verification if SecureBoot variable doesn't exist.
>   //
> @@ -1756,7 +1757,12 @@ DxeImageVerificationHandler (
>   //
>   // Skip verification if SecureBoot is disabled but not AuditMode
>   //
> -  if ((VarStatus == EFI_SUCCESS) && (SecureBoot == 
> SECURE_BOOT_MODE_DISABLE)) {
> +  if ((VarStatus == EFI_SUCCESS) &&
> +  !(VarAttr & EFI_VARIABLE_NON_VOLATILE) &&
> +  (VarAttr & EFI_VARIABLE_BOOTSERVICE_ACCESS) &&
> +  (VarAttr & EFI_VARIABLE_RUNTIME_ACCESS) &&
> +  (SecureBoot == SECURE_BOOT_MODE_DISABLE))
> +  {
> return EFI_SUCCESS;
>   }
> 
> 


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




[edk2-devel] GetSectionFromAnyFv doesnt find file from FV

2023-02-28 Thread Alireza Banejad
Hi everyone,
I have this bmp file which I defined in the FV.FVMAIN_COMPACT section of
the OvmfPkgX64.fdf file. when I get the a hexdump on the built firmware
(OVMF.fd) I can see the file inside it. but whenever I call the
the GetSectionFromAnyFv() function from a Application it fails to find the
file.
This is how I defined the file in OvmfX64.fdf:

[FV.FVMAIN_COMPACT]
FvNameGuid = 48DB5E17-707C-472D-91CD-1613E7EF51B0
FvAlignment= 16
ERASE_POLARITY = 1
MEMORY_MAPPED  = TRUE
STICKY_WRITE   = TRUE
LOCK_CAP   = TRUE
LOCK_STATUS= TRUE
WRITE_DISABLED_CAP = TRUE
WRITE_ENABLED_CAP  = TRUE
WRITE_STATUS   = TRUE
WRITE_LOCK_CAP = TRUE
WRITE_LOCK_STATUS  = TRUE
READ_DISABLED_CAP  = TRUE
READ_ENABLED_CAP   = TRUE
READ_STATUS= TRUE
READ_LOCK_CAP  = TRUE
READ_LOCK_STATUS   = TRUE




FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
   SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED
= TRUE {
 #
 # These firmware volumes will have files placed in them uncompressed,
 # and then both firmware volumes will be compressed in a single
 # compression operation in order to achieve better overall compression.
 #
 SECTION FV_IMAGE = PEIFV
 SECTION FV_IMAGE = DXEFV
   }
 }
  FILE FREEFORM = AFDAEAB5-3F81-4E93-8EE3-228434BA283D {
SECTION RAW = OemPkg/FrontPage/Resources/FrontpageLogo.bmp
  }



!include FvmainCompactScratchEnd.fdf.inc
__

and this is how I am using the GetSectionFromAnyFv() function:
  Status = GetSectionFromAnyFv (
 FileGuid,
 EFI_SECTION_RAW,
 0,
 (VOID **)&BMPData,
 &BMPDataSize
 );
So there's nothing much to it, yet I still don't know why it fails to find
the file. I also must mention that I checked the GUID being passed to the
function and the GUID of the file, they are both the same. I still don't
know what's going on


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




Re: [edk2-devel] [PATCH v1 1/2] uefi-sct/SctPkg: Add LoongArch64 platform support

2023-02-28 Thread G Edhaya Chandran
Reviewed-by: G Edhaya Chandran 


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




Re: [edk2-devel] [PATCH v1 2/2] uefi-sct/SctPkg: Enable LoongArch64 building

2023-02-28 Thread G Edhaya Chandran
Reviewed-by: G Edhaya Chandran 


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




Re: [edk2-devel] [PATCH v1 1/1] ShellPkg: UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c

2023-02-28 Thread Samer El-Haj-Mahmoud
Looks good to me.

Reviewed-by Samer El-Haj-Mahmoud 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gao,
> Zhichao via groups.io
> Sent: Thursday, February 16, 2023 4:18 AM
> To: Sunny Wang ; devel@edk2.groups.io; Sam
> Kaynor 
> Cc: Ni, Ray 
> Subject: Re: [edk2-devel] [PATCH v1 1/1] ShellPkg:
> UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c
>
> Reviewed-by: Zhichao Gao 
>
> Thanks,
> Zhichao
>
> > -Original Message-
> > From: Sunny Wang 
> > Sent: Tuesday, February 14, 2023 11:57 PM
> > To: devel@edk2.groups.io; Sam Kaynor 
> > Cc: Ni, Ray ; Gao, Zhichao ;
> > Sunny Wang 
> > Subject: RE: [edk2-devel] [PATCH v1 1/1] ShellPkg:
> > UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c
> >
> > Looks good to me. Thanks for working on this, Sam.
> > Just for others' information, I also had an offline discussion with Sam.
> > - This is change is based on UEFI 2.10 section 4.6. EFI Configuration 
> > Table
> &
> > Properties Table
> > https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-
> > configuration-table-properties-table.
> > - The link of pull request is 
> > https://github.com/tianocore/edk2/pull/4038
> >
> > Reviewed-by: Sunny Wang 
> >
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Sam
> > Kaynor via groups.io
> > Sent: 07 February 2023 21:20
> > To: devel@edk2.groups.io
> > Cc: Sam Kaynor ; Ray Ni ;
> > Zhichao Gao 
> > Subject: [edk2-devel] [PATCH v1 1/1] ShellPkg:
> > UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c
> >
> > Added entries for UEFI Config Tables not present in current Dmem output.
> >
> > Cc: Ray Ni 
> > Cc: Zhichao Gao 
> > Signed-off-by: Sam Kaynor 
> > ---
> >
> >
> ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands
> > Lib.inf |  9 ++
> >  ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c 
> > | 89
> > ++--
> >
> >
> ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands
> > Lib.uni | 28 --
> >  3 files changed, 112 insertions(+), 14 deletions(-)
> >
> > diff --git
> >
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> > dsLib.inf
> >
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> > dsLib.inf
> > index 74ad5facf6b1..3741dac5d94c 100644
> > ---
> >
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> > dsLib.inf
> > +++
> >
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> > d
> > +++ sLib.inf
> > @@ -121,6 +121,7 @@ [Protocols]
> >gEfiBlockIoProtocolGuid ## SOMETIMES_CONSUMES
> >
> >gEfiSimplePointerProtocolGuid   ## SOMETIMES_CONSUMES
> >
> >gEfiCpuIo2ProtocolGuid  ## SOMETIMES_CONSUMES
> >
> > +  gEfiHiiDatabaseProtocolGuid ## SOMETIMES_CONSUMES
> >
> >
> >
> >  [Guids]
> >
> >gEfiGlobalVariableGuid  ## SOMETIMES_CONSUMES ## GUID
> >
> > @@ -130,3 +131,11 @@ [Guids]
> >gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable
> >
> >gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable
> >
> >gShellDebug1HiiGuid ## SOMETIMES_CONSUMES ## HII
> >
> > +  gEfiMemoryAttributesTableGuid   ## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > +  gEfiRtPropertiesTableGuid   ## SOMETIMES_CONSUMES ##
> SystemTable
> >
> > +  gEfiSystemResourceTableGuid ## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > +  gEfiDebugImageInfoTableGuid ## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > +  gEfiImageSecurityDatabaseGuid   ## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > +  gEfiJsonConfigDataTableGuid ## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > +  gEfiJsonCapsuleDataTableGuid## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > +  gEfiJsonCapsuleResultTableGuid  ## SOMETIMES_CONSUMES ##
> > SystemTable
> >
> > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
> > b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
> > index c52c212a56f8..e2aed306d466 100644
> > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
> > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
> > @@ -10,9 +10,16 @@
> >
> >
> >  #include "UefiShellDebug1CommandsLib.h"
> >
> >  #include 
> >
> > +#include 
> >
> >  #include 
> >
> >  #include 
> >
> >  #include 
> >
> > +#include 
> >
> > +#include 
> >
> > +#include 
> >
> > +#include 
> >
> > +#include 
> >
> > +#include 
> >
> >
> >
> >  /**
> >
> >Make a printable character.
> >
> > @@ -108,6 +115,18 @@ ShellCommandRunDmem (
> >UINT64SalTableAddress;
> >
> >UINT64SmbiosTableAddress;
> >
> >UINT64MpsTableAddress;
> >
> > +  UINT64DtbTableAddress;
> >
> > +  UINT64MemoryAttributesTableAddress;
> >
> > +  UINT64RtPropertiesTableAddress;
> >
> > +  UINT64SystemResourceTableAddress;
> >
> > +  UINT64DebugImageInfoTableAddress;
> >
> > +  UINT64ImageExe

[edk2-devel] [edk2-platform][PATCH 1/1] MdeModulePkg: SdMmcPciHcDxe: Support for Bayhub SD/eMMC host

2023-02-28 Thread Chevron Li
From: "Chevron Li (WH)" 

1.Implement override function for EdkiiSdMmcInitHostPre case to
configure bayhub host.
2.Implement override function for EdkiiSdMmcInitHostPost case to
configure bayhub host.

Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Chevron Li 
---
 .../Bus/Pci/SdMmcPciHcDxe/BayhubHost.c| 676 ++
 .../Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c |   3 +
 .../Bus/Pci/SdMmcPciHcDxe/BayhubHost.h|  95 +++
 .../Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf   |   2 +
 4 files changed, 776 insertions(+)
 create mode 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/BayhubHost.c
 create mode 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/BayhubHost.h

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/BayhubHost.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/BayhubHost.c
new file mode 100644
index 00..470838e37e
--- /dev/null
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/BayhubHost.c
@@ -0,0 +1,676 @@
+/** @file
+  This driver is used to manage SD/MMC PCI host controllers override function
+  for BayHub SD/eMMC host controller.
+
+  Copyright (c) 2018 - 2019, BayHub Tech inc. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BayhubHost.h"
+#include "SdMmcPciHcDxe.h"
+#include 
+
+/* Driver global variables*/
+UINT16  BhtDeviceId = 0;
+
+EDKII_SD_MMC_OVERRIDE  BhtOverride = {
+  EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION,
+  BhtHostOverrideCapability,
+  BhtHostOverrideNotifyPhase
+};
+
+/**
+  Judgement function for Host type
+
+  @param[in]  PciIo  The PCI IO protocol instance.
+
+  @retval UNSUPPORT  The host isn't Bayhub host.
+  @retval EMMC_HOST  The host is Bayhub eMMC host.
+  @retval SD_HOSTThe host is Bayhub SD host.
+
+**/
+UINT8
+BhtHostPciSupportType (
+  IN EFI_PCI_IO_PROTOCOL  *PciIo
+  )
+{
+  PCI_TYPE00  Pci;
+  UINT8   HostType;
+
+  PciIo->Pci.Read (
+   PciIo,
+   EfiPciIoWidthUint32,
+   0,
+   sizeof (PCI_TYPE00) / sizeof (UINT32),
+   &Pci
+   );
+  DEBUG ((DEBUG_INFO, "Check device %04x:%04x\n", Pci.Hdr.VendorId, 
Pci.Hdr.DeviceId));
+
+  // Judgement bayhub device or not
+  if (Pci.Hdr.VendorId != 0x1217) {
+HostType = UNSUPPORT;
+goto end;
+  }
+
+  BhtDeviceId = Pci.Hdr.DeviceId;
+
+  // Bayhub host only 0x8620 is eMMC host
+  switch (Pci.Hdr.DeviceId) {
+case PCI_DEV_ID_SB0:
+  HostType = EMMC_HOST;
+  break;
+case PCI_DEV_ID_SB1:
+default:
+  HostType = SD_HOST;
+  break;
+  }
+
+end:
+  return HostType;
+}
+
+/**
+  Read specified SD/MMC host controller mmio register
+
+  @param[in]  PciIoThe PCI IO protocol instance.
+  @param[in]  Offset   The Offset within the selected BAR to start the
+   memory operation.
+
+  @retval ValueThe value of specified SD/MMC host controller 
mmio register.
+
+**/
+UINT32
+BhtMmRead32 (
+  IN EFI_PCI_IO_PROTOCOL  *PciIo,
+  IN UINT32   Offset
+  )
+{
+  UINT32  Value;
+
+  PciIo->Mem.Read (PciIo, EfiPciIoWidthUint32, 1, Offset, 1, &Value);
+  return Value;
+}
+
+/**
+  Write specified SD/MMC host controller mmio register
+
+  @param[in]  PciIoThe PCI IO protocol instance.
+  @param[in]  Offset   The Offset within the selected BAR to start the
+   memory operation.
+  @param[in]  ValueThe value to write.
+
+**/
+VOID
+BhtMmWrite32 (
+  IN EFI_PCI_IO_PROTOCOL  *PciIo,
+  IN UINT32   Offset,
+  IN UINT32   Value
+  )
+{
+  PciIo->Mem.Write (PciIo, EfiPciIoWidthUint32, 1, Offset, 1, &Value);
+}
+
+/**
+  Read specified SD/MMC host controller PCIe configure register
+
+  @param[in]  PciIoThe PCI IO protocol instance.
+  @param[in]  Offset   The Offset within the selected BAR to start the
+   memory operation.
+
+  @retval ValueThe value of specified SD/MMC host controller 
PCIe configure register.
+
+**/
+UINT32
+BhtPciRead32 (
+  IN EFI_PCI_IO_PROTOCOL  *PciIo,
+  IN UINT32   Offset
+  )
+{
+  UINT32  Index;
+  UINT32  TmpBuff[2];
+
+  if ((BhtDeviceId == PCI_DEV_ID_SDS0) ||
+  (BhtDeviceId == PCI_DEV_ID_SDS1) ||
+  (BhtDeviceId == PCI_DEV_ID_FJ2) ||
+  (BhtDeviceId == PCI_DEV_ID_SB0) ||
+  (BhtDeviceId == PCI_DEV_ID_SB1))
+  {
+// For Sandstorm, HW implement a mapping method by memory space reg to 
access PCI reg.
+// Enable mapping
+
+// Check function conflict
+if ((BhtDeviceId == PCI_DEV_ID_SDS0) ||
+(BhtDeviceId == PCI_DEV_ID_FJ2) ||
+(BhtDeviceId == PCI_DEV_ID_SB0) ||
+(BhtDeviceId == PCI_DEV_ID_SB1))
+{
+  Index = 0;
+  BhtMmWrite32 (PciIo, BHT_PCR_MAP_EN, 0x4000);
+  while ((BhtMmRead32 (PciIo, BHT_PCR_MAP_EN) & 0x4000) == 0) {
+if (Index == 5) {
+  goto RD_DIS_MAPPING;
+}
+
+gBS->Stal

Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors basic formatting details

2023-02-28 Thread Rebecca Cran

Before I sent out an official v2 patch, does the following look good?


diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index ..587d5bbaa884
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,31 @@
+# EditorConfig file: https://EditorConfig.org
+
+root = true
+
+[*]
+charset = latin1
+end_of_line = crlf
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.py]
+charset = utf-8
+indent_style = space
+indent_size = 4
+
+[*.sh]
+end_of_line = lf
+
+[.gitattributes]
+end_of_line = lf
+
+[.mailmap]
+charset = utf-8
+
+[Maintainers.txt]
+charset = utf-8
+
+[Makefile,GNUmakefile]
+indent_style = tab


--
Rebecca Cran


On 2/27/23 11:23 AM, Kinney, Michael D wrote:

.gitmodules also must also use tabs.


-Original Message-
From: Kinney, Michael D 
Sent: Monday, February 27, 2023 10:22 AM
To: Ard Biesheuvel ; devel@edk2.groups.io; rebe...@bsdio.com
Cc: Andrew Fish ; Leif Lindholm ; Kinney, 
Michael D 
Subject: RE: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

.gitmodules must be lf.  Not sure about other git config files.

Mike


-Original Message-
From: Ard Biesheuvel 
Sent: Monday, February 27, 2023 10:18 AM
To: devel@edk2.groups.io; rebe...@bsdio.com
Cc: Kinney, Michael D ; Andrew Fish ; 
Leif Lindholm 
Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

On Mon, 27 Feb 2023 at 17:35, Rebecca Cran  wrote:

Is it just .sh files that need lf endings, or are there others?


I think this only applies to .sh files.



On 2/27/23 9:14 AM, Michael D Kinney wrote:

There are a few file types that must be lf instead of crlf.  Can those be added 
as well?

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
Sent: Monday, February 27, 2023 5:03 AM
To: Ard Biesheuvel ; devel@edk2.groups.io
Cc: Andrew Fish ; Leif Lindholm ; 
Kinney, Michael D



Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

On 2/27/23 1:04 AM, Ard Biesheuvel wrote:


On Mon, 27 Feb 2023 at 04:47, Rebecca Cran  wrote:

Add a .editorconfig file which editors can use for basic formatting
details of files, such as tabs/spaces, line endings etc.

Signed-off-by: Rebecca Cran 

Thank you very much for this - this is very useful.

Acked-by: Ard Biesheuvel 

Could we add .dsc/.inf/.dec/etc files as well?

I'll move the c/c++ indentation up to the [*] section so it applies to
.dsc/.inf/etc too.


--
Rebecca Cran


















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




Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors basic formatting details

2023-02-28 Thread Ard Biesheuvel
On Tue, 28 Feb 2023 at 19:20, Rebecca Cran  wrote:
>
> Before I sent out an official v2 patch, does the following look good?
>

Looks fine to me, thanks.

>
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index ..587d5bbaa884
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,31 @@
> +# EditorConfig file: https://EditorConfig.org
> +
> +root = true
> +
> +[*]
> +charset = latin1
> +end_of_line = crlf
> +indent_style = space
> +indent_size = 2
> +insert_final_newline = true
> +trim_trailing_whitespace = true
> +
> +[*.py]
> +charset = utf-8
> +indent_style = space
> +indent_size = 4
> +
> +[*.sh]
> +end_of_line = lf
> +
> +[.gitattributes]
> +end_of_line = lf
> +
> +[.mailmap]
> +charset = utf-8
> +
> +[Maintainers.txt]
> +charset = utf-8
> +
> +[Makefile,GNUmakefile]
> +indent_style = tab
>
>
> --
> Rebecca Cran
>
>
> On 2/27/23 11:23 AM, Kinney, Michael D wrote:
> > .gitmodules also must also use tabs.
> >
> >> -Original Message-
> >> From: Kinney, Michael D 
> >> Sent: Monday, February 27, 2023 10:22 AM
> >> To: Ard Biesheuvel ; devel@edk2.groups.io; 
> >> rebe...@bsdio.com
> >> Cc: Andrew Fish ; Leif Lindholm 
> >> ; Kinney, Michael D 
> >> Subject: RE: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >> editors basic formatting details
> >>
> >> .gitmodules must be lf.  Not sure about other git config files.
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: Ard Biesheuvel 
> >>> Sent: Monday, February 27, 2023 10:18 AM
> >>> To: devel@edk2.groups.io; rebe...@bsdio.com
> >>> Cc: Kinney, Michael D ; Andrew Fish 
> >>> ; Leif Lindholm 
> >>> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >>> editors basic formatting details
> >>>
> >>> On Mon, 27 Feb 2023 at 17:35, Rebecca Cran  wrote:
>  Is it just .sh files that need lf endings, or are there others?
> 
> >>> I think this only applies to .sh files.
> >>>
> 
>  On 2/27/23 9:14 AM, Michael D Kinney wrote:
> > There are a few file types that must be lf instead of crlf.  Can those 
> > be added as well?
> >
> > Mike
> >
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of Rebecca 
> >> Cran
> >> Sent: Monday, February 27, 2023 5:03 AM
> >> To: Ard Biesheuvel ; devel@edk2.groups.io
> >> Cc: Andrew Fish ; Leif Lindholm 
> >> ; Kinney, Michael D
> >>> 
> >> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >> editors basic formatting details
> >>
> >> On 2/27/23 1:04 AM, Ard Biesheuvel wrote:
> >>
> >>> On Mon, 27 Feb 2023 at 04:47, Rebecca Cran  wrote:
>  Add a .editorconfig file which editors can use for basic formatting
>  details of files, such as tabs/spaces, line endings etc.
> 
>  Signed-off-by: Rebecca Cran 
> >>> Thank you very much for this - this is very useful.
> >>>
> >>> Acked-by: Ard Biesheuvel 
> >>>
> >>> Could we add .dsc/.inf/.dec/etc files as well?
> >> I'll move the c/c++ indentation up to the [*] section so it applies to
> >> .dsc/.inf/etc too.
> >>
> >>
> >> --
> >> Rebecca Cran
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> 
>  
> 
> 


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




Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors basic formatting details

2023-02-28 Thread Michael D Kinney
What about .gitmodules?

Mike

> -Original Message-
> From: Rebecca Cran 
> Sent: Tuesday, February 28, 2023 10:21 AM
> To: Kinney, Michael D ; Ard Biesheuvel 
> ; devel@edk2.groups.io
> Cc: Andrew Fish ; Leif Lindholm 
> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> editors basic formatting details
> 
> Before I sent out an official v2 patch, does the following look good?
> 
> 
> diff --git a/.editorconfig b/.editorconfig
> new file mode 100644
> index ..587d5bbaa884
> --- /dev/null
> +++ b/.editorconfig
> @@ -0,0 +1,31 @@
> +# EditorConfig file: https://EditorConfig.org
> +
> +root = true
> +
> +[*]
> +charset = latin1
> +end_of_line = crlf
> +indent_style = space
> +indent_size = 2
> +insert_final_newline = true
> +trim_trailing_whitespace = true
> +
> +[*.py]
> +charset = utf-8
> +indent_style = space
> +indent_size = 4
> +
> +[*.sh]
> +end_of_line = lf
> +
> +[.gitattributes]
> +end_of_line = lf
> +
> +[.mailmap]
> +charset = utf-8
> +
> +[Maintainers.txt]
> +charset = utf-8
> +
> +[Makefile,GNUmakefile]
> +indent_style = tab
> 
> 
> --
> Rebecca Cran
> 
> 
> On 2/27/23 11:23 AM, Kinney, Michael D wrote:
> > .gitmodules also must also use tabs.
> >
> >> -Original Message-
> >> From: Kinney, Michael D 
> >> Sent: Monday, February 27, 2023 10:22 AM
> >> To: Ard Biesheuvel ; devel@edk2.groups.io; 
> >> rebe...@bsdio.com
> >> Cc: Andrew Fish ; Leif Lindholm 
> >> ; Kinney, Michael D 
> >> Subject: RE: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >> editors basic formatting details
> >>
> >> .gitmodules must be lf.  Not sure about other git config files.
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: Ard Biesheuvel 
> >>> Sent: Monday, February 27, 2023 10:18 AM
> >>> To: devel@edk2.groups.io; rebe...@bsdio.com
> >>> Cc: Kinney, Michael D ; Andrew Fish 
> >>> ; Leif Lindholm 
> >>> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >>> editors basic formatting details
> >>>
> >>> On Mon, 27 Feb 2023 at 17:35, Rebecca Cran  wrote:
>  Is it just .sh files that need lf endings, or are there others?
> 
> >>> I think this only applies to .sh files.
> >>>
> 
>  On 2/27/23 9:14 AM, Michael D Kinney wrote:
> > There are a few file types that must be lf instead of crlf.  Can those 
> > be added as well?
> >
> > Mike
> >
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of Rebecca 
> >> Cran
> >> Sent: Monday, February 27, 2023 5:03 AM
> >> To: Ard Biesheuvel ; devel@edk2.groups.io
> >> Cc: Andrew Fish ; Leif Lindholm 
> >> ; Kinney, Michael D
> >>> 
> >> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >> editors basic formatting details
> >>
> >> On 2/27/23 1:04 AM, Ard Biesheuvel wrote:
> >>
> >>> On Mon, 27 Feb 2023 at 04:47, Rebecca Cran  wrote:
>  Add a .editorconfig file which editors can use for basic formatting
>  details of files, such as tabs/spaces, line endings etc.
> 
>  Signed-off-by: Rebecca Cran 
> >>> Thank you very much for this - this is very useful.
> >>>
> >>> Acked-by: Ard Biesheuvel 
> >>>
> >>> Could we add .dsc/.inf/.dec/etc files as well?
> >> I'll move the c/c++ indentation up to the [*] section so it applies to
> >> .dsc/.inf/etc too.
> >>
> >>
> >> --
> >> Rebecca Cran
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> 
>  
> 
> 


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




Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile information in build report

2023-02-28 Thread Ni, Ray
What's the status of this patch?
Does report generation take time? If no, why not generate them by default 
without individual flag control.
I really like the feature to generate "compile_commands.json"

> -Original Message-
> From: Palomino Sosa, Guillermo A 
> Sent: Tuesday, February 28, 2023 7:42 AM
> To: Kinney, Michael D ; devel@edk2.groups.io;
> a...@kernel.org
> Cc: Ni, Ray ; Chen, Christine ;
> Feng, Bob C ; Gao, Liming
> ; Oram, Isaac W ;
> Sean Brogan 
> Subject: RE: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> information in build report
> 
> I have updated the pull based on Sean feedback. I added following fields to
> module_report.json:
> * LibraryClass
> * ModuleEntryPointList
> * ConstructorList
> * DestructorList
> 
> I have also added commit from Ard based on this request to fix build issue:
> https://github.com/tianocore/edk2-basetools/pull/88
> 
> Thanks
> 
> -Original Message-
> From: Kinney, Michael D 
> Sent: Monday, February 27, 2023 4:36 PM
> To: devel@edk2.groups.io; a...@kernel.org; Palomino Sosa, Guillermo A
> 
> Cc: Ni, Ray ; Chen, Christine ;
> Feng, Bob C ; Gao, Liming
> ; Oram, Isaac W ;
> Sean Brogan ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> information in build report
> 
> Hi Guillermo,
> 
> Can you please look at Ards PR and make sure his fix is included in your PR.
> 
> Also, please work with Christine and Bob to see what is going on with the
> Code Coverage check.  We do want it to be easy for all community members
> to submit change requests.  We may need support from the edk2-bastools
> maintainers to help with CI issues and help with changes to address.
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Ard
> > Biesheuvel
> > Sent: Monday, February 27, 2023 10:58 AM
> > To: devel@edk2.groups.io; Palomino Sosa, Guillermo A
> > 
> > Cc: Ni, Ray ; Kinney, Michael D
> > ; Chen, Christine ;
> > Feng, Bob C ; Gao, Liming
> > ; Oram, Isaac W ;
> > Sean Brogan 
> > Subject: Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile
> > information in build report
> >
> > On Mon, 27 Feb 2023 at 18:40, Guillermo Antonio Palomino Sosa
> >  wrote:
> > >
> > > Hi. I have submitted a pull request to edk2-basetools repository:
> > > https://github.com/tianocore/edk2-basetools/pull/88
> > > This is the feature request for it:
> > > https://github.com/tianocore/edk2-basetools/issues/87
> > > I'm also attaching the patch here:
> > > (0001-BaseTools-Generate-compile-information-in-build-repo.patch)
> > >
> > > On a side note, seems like tip of edk2-basetools is broken due this
> commit that makes direct import of Common package:
> > > https://github.com/tianocore/edk2-
> basetools/commit/8e6018d3ea4c1aae7
> > > 185f589d129cea14a5d89fd
> > > edk2-basetools\edk2basetools\GenFds\SubTypeGuidSection.py:
> > > import Common.LongFilePathOs as os
> > >
> > >
> >
> > I sent a fix and a PR for this about a month ago:
> >
> > https://github.com/tianocore/edk2-basetools/pull/86
> >
> > but CodeCov seems to take issue with it, for reasons I don't
> > understand (and I can't be bothered to spend more time on yet another
> > CI automation pass that adds to my workload rather than reduce it)
> >
> >
> > 
> >



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




[edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, February 28, 2023 #cal-reminder

2023-02-28 Thread Group Notification
*Reminder: TianoCore Bug Triage - APAC / NAMO*

*When:*
Tuesday, February 28, 2023
6:30pm to 7:30pm
(UTC-08:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d

*Organizer:* Liming Gao gaolim...@byosoft.com.cn ( 
gaolim...@byosoft.com.cn?subject=Re:%20Event:%20TianoCore%20Bug%20Triage%20-%20APAC%20%2F%20NAMO
 )

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=1753755 )

*Description:*

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao



Microsoft Teams meeting

*Join on your computer or mobile app*

Click here to join the meeting ( 
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d
 )

*Join with a video conferencing device*

te...@conf.intel.com

Video Conference ID: 116 062 094 0

Alternate VTC dialing instructions ( 
https://conf.intel.com/teams/?conf=1160620940&ivr=teams&d=conf.intel.com&test=test_call
 )

*Or call in (audio only)*

+1 916-245-6934,,77463821# ( tel:+19162456934,,77463821# ) United States, 
Sacramento

Phone Conference ID: 774 638 21#

Find a local number ( 
https://dialin.teams.microsoft.com/d195d438-2daa-420e-b9ea-da26f9d1d6d5?id=77463821
 ) | Reset PIN ( https://mysettings.lync.com/pstnconferencing )

Learn More ( https://aka.ms/JoinTeamsMeeting ) | Meeting options ( 
https://teams.microsoft.com/meetingOptions/?organizerId=b286b53a-1218-4db3-bfc9-3d4c5aa7669e&tenantId=46c98d88-e344-4ed4-8496-4ed7712e255d&threadId=19_meeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2&messageId=0&language=en-US
 )


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




Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors basic formatting details

2023-02-28 Thread Rebecca Cran

Mike,


It looks like the line endings and tab/spaces of .gitmodules doesn't 
matter: do we still want to list a preference for it?



"Given the following, I'm not sure line endings matter at all to git?


$ file .gitmodules
.gitmodules: ASCII text, with CRLF, LF line terminators
$ file .gitignore
.gitignore: ASCII text, with CRLF line terminators


There's a CRLF in .gitmodules at the end of the brotli section.

We could certainly specify that LF is _preferred_ for all .git files 
though?"



On 2/28/23 2:32 PM, Kinney, Michael D wrote:

What about .gitmodules?

Mike


-Original Message-
From: Rebecca Cran 
Sent: Tuesday, February 28, 2023 10:21 AM
To: Kinney, Michael D ; Ard Biesheuvel 
; devel@edk2.groups.io
Cc: Andrew Fish ; Leif Lindholm 
Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

Before I sent out an official v2 patch, does the following look good?


diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index ..587d5bbaa884
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,31 @@
+# EditorConfig file: https://EditorConfig.org
+
+root = true
+
+[*]
+charset = latin1
+end_of_line = crlf
+indent_style = space
+indent_size = 2
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.py]
+charset = utf-8
+indent_style = space
+indent_size = 4
+
+[*.sh]
+end_of_line = lf
+
+[.gitattributes]
+end_of_line = lf
+
+[.mailmap]
+charset = utf-8
+
+[Maintainers.txt]
+charset = utf-8
+
+[Makefile,GNUmakefile]
+indent_style = tab


--
Rebecca Cran


On 2/27/23 11:23 AM, Kinney, Michael D wrote:

.gitmodules also must also use tabs.


-Original Message-
From: Kinney, Michael D 
Sent: Monday, February 27, 2023 10:22 AM
To: Ard Biesheuvel ; devel@edk2.groups.io; rebe...@bsdio.com
Cc: Andrew Fish ; Leif Lindholm ; Kinney, 
Michael D 
Subject: RE: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

.gitmodules must be lf.  Not sure about other git config files.

Mike


-Original Message-
From: Ard Biesheuvel 
Sent: Monday, February 27, 2023 10:18 AM
To: devel@edk2.groups.io; rebe...@bsdio.com
Cc: Kinney, Michael D ; Andrew Fish ; 
Leif Lindholm 
Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

On Mon, 27 Feb 2023 at 17:35, Rebecca Cran  wrote:

Is it just .sh files that need lf endings, or are there others?


I think this only applies to .sh files.


On 2/27/23 9:14 AM, Michael D Kinney wrote:

There are a few file types that must be lf instead of crlf.  Can those be added 
as well?

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Rebecca Cran
Sent: Monday, February 27, 2023 5:03 AM
To: Ard Biesheuvel ; devel@edk2.groups.io
Cc: Andrew Fish ; Leif Lindholm ; 
Kinney, Michael D



Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors 
basic formatting details

On 2/27/23 1:04 AM, Ard Biesheuvel wrote:


On Mon, 27 Feb 2023 at 04:47, Rebecca Cran  wrote:

Add a .editorconfig file which editors can use for basic formatting
details of files, such as tabs/spaces, line endings etc.

Signed-off-by: Rebecca Cran 

Thank you very much for this - this is very useful.

Acked-by: Ard Biesheuvel 

Could we add .dsc/.inf/.dec/etc files as well?

I'll move the c/c++ indentation up to the [*] section so it applies to
.dsc/.inf/etc too.


--
Rebecca Cran
















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




Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell editors basic formatting details

2023-02-28 Thread Michael D Kinney
Thanks for looking into this more.  Given what you found, no additional changes 
are required.

I recall there are some other files that have specific requirements.

We can add those when we run into them again.

Mike

> -Original Message-
> From: Rebecca Cran 
> Sent: Tuesday, February 28, 2023 7:23 PM
> To: Kinney, Michael D ; Ard Biesheuvel 
> ; devel@edk2.groups.io
> Cc: Andrew Fish ; Leif Lindholm 
> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> editors basic formatting details
> 
> Mike,
> 
> 
> It looks like the line endings and tab/spaces of .gitmodules doesn't
> matter: do we still want to list a preference for it?
> 
> 
> "Given the following, I'm not sure line endings matter at all to git?
> 
> 
> $ file .gitmodules
> .gitmodules: ASCII text, with CRLF, LF line terminators
> $ file .gitignore
> .gitignore: ASCII text, with CRLF line terminators
> 
> 
> There's a CRLF in .gitmodules at the end of the brotli section.
> 
> We could certainly specify that LF is _preferred_ for all .git files
> though?"
> 
> 
> On 2/28/23 2:32 PM, Kinney, Michael D wrote:
> > What about .gitmodules?
> >
> > Mike
> >
> >> -Original Message-
> >> From: Rebecca Cran 
> >> Sent: Tuesday, February 28, 2023 10:21 AM
> >> To: Kinney, Michael D ; Ard Biesheuvel 
> >> ; devel@edk2.groups.io
> >> Cc: Andrew Fish ; Leif Lindholm 
> >> 
> >> Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> >> editors basic formatting details
> >>
> >> Before I sent out an official v2 patch, does the following look good?
> >>
> >>
> >> diff --git a/.editorconfig b/.editorconfig
> >> new file mode 100644
> >> index ..587d5bbaa884
> >> --- /dev/null
> >> +++ b/.editorconfig
> >> @@ -0,0 +1,31 @@
> >> +# EditorConfig file: https://EditorConfig.org
> >> +
> >> +root = true
> >> +
> >> +[*]
> >> +charset = latin1
> >> +end_of_line = crlf
> >> +indent_style = space
> >> +indent_size = 2
> >> +insert_final_newline = true
> >> +trim_trailing_whitespace = true
> >> +
> >> +[*.py]
> >> +charset = utf-8
> >> +indent_style = space
> >> +indent_size = 4
> >> +
> >> +[*.sh]
> >> +end_of_line = lf
> >> +
> >> +[.gitattributes]
> >> +end_of_line = lf
> >> +
> >> +[.mailmap]
> >> +charset = utf-8
> >> +
> >> +[Maintainers.txt]
> >> +charset = utf-8
> >> +
> >> +[Makefile,GNUmakefile]
> >> +indent_style = tab
> >>
> >>
> >> --
> >> Rebecca Cran
> >>
> >>
> >> On 2/27/23 11:23 AM, Kinney, Michael D wrote:
> >>> .gitmodules also must also use tabs.
> >>>
>  -Original Message-
>  From: Kinney, Michael D 
>  Sent: Monday, February 27, 2023 10:22 AM
>  To: Ard Biesheuvel ; devel@edk2.groups.io; 
>  rebe...@bsdio.com
>  Cc: Andrew Fish ; Leif Lindholm 
>  ; Kinney, Michael D
> 
>  Subject: RE: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
>  editors basic formatting details
> 
>  .gitmodules must be lf.  Not sure about other git config files.
> 
>  Mike
> 
> > -Original Message-
> > From: Ard Biesheuvel 
> > Sent: Monday, February 27, 2023 10:18 AM
> > To: devel@edk2.groups.io; rebe...@bsdio.com
> > Cc: Kinney, Michael D ; Andrew Fish 
> > ; Leif Lindholm
> 
> > Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to tell 
> > editors basic formatting details
> >
> > On Mon, 27 Feb 2023 at 17:35, Rebecca Cran  wrote:
> >> Is it just .sh files that need lf endings, or are there others?
> >>
> > I think this only applies to .sh files.
> >
> >> On 2/27/23 9:14 AM, Michael D Kinney wrote:
> >>> There are a few file types that must be lf instead of crlf.  Can 
> >>> those be added as well?
> >>>
> >>> Mike
> >>>
>  -Original Message-
>  From: devel@edk2.groups.io  On Behalf Of 
>  Rebecca Cran
>  Sent: Monday, February 27, 2023 5:03 AM
>  To: Ard Biesheuvel ; devel@edk2.groups.io
>  Cc: Andrew Fish ; Leif Lindholm 
>  ; Kinney, Michael D
> > 
>  Subject: Re: [edk2-devel] [PATCH 1/1] Add a .editorconfig file to 
>  tell editors basic formatting details
> 
>  On 2/27/23 1:04 AM, Ard Biesheuvel wrote:
> 
> > On Mon, 27 Feb 2023 at 04:47, Rebecca Cran  
> > wrote:
> >> Add a .editorconfig file which editors can use for basic formatting
> >> details of files, such as tabs/spaces, line endings etc.
> >>
> >> Signed-off-by: Rebecca Cran 
> > Thank you very much for this - this is very useful.
> >
> > Acked-by: Ard Biesheuvel 
> >
> > Could we add .dsc/.inf/.dec/etc files as well?
>  I'll move the c/c++ indentation up to the [*] section so it applies 
>  to
>  .dsc/.inf/etc too.
> 
> 
>  --
>  Rebecca Cran
> 
> 
> 
> 
> 
> >>>
> >>>
> >>

Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile information in build report

2023-02-28 Thread Guillermo Antonio Palomino Sosa
It takes same time as original build report to be generated as it constructed 
using the same data structures as build report. So I think its OK to not have 
it enabled by default.

Patch is ready in the pull request to be reviews.



-Original Message-
From: Ni, Ray  
Sent: Tuesday, February 28, 2023 6:52 PM
To: Palomino Sosa, Guillermo A ; Kinney, 
Michael D ; devel@edk2.groups.io; a...@kernel.org
Cc: Chen, Christine ; Feng, Bob C ; 
Gao, Liming ; Oram, Isaac W ; 
Sean Brogan 
Subject: RE: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile information 
in build report

What's the status of this patch?
Does report generation take time? If no, why not generate them by default 
without individual flag control.
I really like the feature to generate "compile_commands.json"

> -Original Message-
> From: Palomino Sosa, Guillermo A 
> Sent: Tuesday, February 28, 2023 7:42 AM
> To: Kinney, Michael D ; 
> devel@edk2.groups.io; a...@kernel.org
> Cc: Ni, Ray ; Chen, Christine 
> ; Feng, Bob C ; Gao, 
> Liming ; Oram, Isaac W 
> ; Sean Brogan 
> Subject: RE: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile 
> information in build report
> 
> I have updated the pull based on Sean feedback. I added following 
> fields to
> module_report.json:
> * LibraryClass
> * ModuleEntryPointList
> * ConstructorList
> * DestructorList
> 
> I have also added commit from Ard based on this request to fix build issue:
> https://github.com/tianocore/edk2-basetools/pull/88
> 
> Thanks
> 
> -Original Message-
> From: Kinney, Michael D 
> Sent: Monday, February 27, 2023 4:36 PM
> To: devel@edk2.groups.io; a...@kernel.org; Palomino Sosa, Guillermo A 
> 
> Cc: Ni, Ray ; Chen, Christine 
> ; Feng, Bob C ; Gao, 
> Liming ; Oram, Isaac W 
> ; Sean Brogan ; 
> Kinney, Michael D 
> Subject: RE: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile 
> information in build report
> 
> Hi Guillermo,
> 
> Can you please look at Ards PR and make sure his fix is included in your PR.
> 
> Also, please work with Christine and Bob to see what is going on with 
> the Code Coverage check.  We do want it to be easy for all community 
> members to submit change requests.  We may need support from the 
> edk2-bastools maintainers to help with CI issues and help with changes to 
> address.
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Ard 
> > Biesheuvel
> > Sent: Monday, February 27, 2023 10:58 AM
> > To: devel@edk2.groups.io; Palomino Sosa, Guillermo A 
> > 
> > Cc: Ni, Ray ; Kinney, Michael D 
> > ; Chen, Christine 
> > ; Feng, Bob C ; Gao, 
> > Liming ; Oram, Isaac W 
> > ; Sean Brogan 
> > Subject: Re: [edk2-devel][PATCH V1 1/1] BaseTools: Generate compile 
> > information in build report
> >
> > On Mon, 27 Feb 2023 at 18:40, Guillermo Antonio Palomino Sosa 
> >  wrote:
> > >
> > > Hi. I have submitted a pull request to edk2-basetools repository:
> > > https://github.com/tianocore/edk2-basetools/pull/88
> > > This is the feature request for it:
> > > https://github.com/tianocore/edk2-basetools/issues/87
> > > I'm also attaching the patch here:
> > > (0001-BaseTools-Generate-compile-information-in-build-repo.patch)
> > >
> > > On a side note, seems like tip of edk2-basetools is broken due 
> > > this
> commit that makes direct import of Common package:
> > > https://github.com/tianocore/edk2-
> basetools/commit/8e6018d3ea4c1aae7
> > > 185f589d129cea14a5d89fd
> > > edk2-basetools\edk2basetools\GenFds\SubTypeGuidSection.py:
> > > import Common.LongFilePathOs as os
> > >
> > >
> >
> > I sent a fix and a PR for this about a month ago:
> >
> > https://github.com/tianocore/edk2-basetools/pull/86
> >
> > but CodeCov seems to take issue with it, for reasons I don't 
> > understand (and I can't be bothered to spend more time on yet 
> > another CI automation pass that adds to my workload rather than 
> > reduce it)
> >
> >
> > 
> >



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




[edk2-devel] [PATCH v1] EmulatorPkg: Fix misspelling

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

pased should be passed.

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 EmulatorPkg/Unix/Host/Host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index 1f29dd00a3..42856dbf5a 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -136,7 +136,7 @@ main (
   FirmwareVolumesStr = (CHAR16 *)PcdGetPtr (PcdEmuFirmwareVolume);
 
   //
-  // PPIs pased into PEI_CORE
+  // PPIs passed into PEI_CORE
   //
   SecEmuThunkPpi = AllocateZeroPool (sizeof (EMU_THUNK_PPI) + FixedPcdGet32 
(PcdPersistentMemorySize));
   if (SecEmuThunkPpi == NULL) {
-- 
2.30.2



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




[edk2-devel] [PATCH v1] EmulatorPkg: Delete EMU_IO_THUNK_PROTOCO_GUID

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

Delete this macro because:

1. Nothing uses it.
2. It is misspelled.
3. It is a EDK I style GUID definition which is redundant with
   an existing EDK II style GUID definition.

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 EmulatorPkg/Include/Protocol/EmuIoThunk.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/EmulatorPkg/Include/Protocol/EmuIoThunk.h 
b/EmulatorPkg/Include/Protocol/EmuIoThunk.h
index b6da635177..5f025c0e3c 100644
--- a/EmulatorPkg/Include/Protocol/EmuIoThunk.h
+++ b/EmulatorPkg/Include/Protocol/EmuIoThunk.h
@@ -2,6 +2,7 @@
   Emulator Thunk to abstract OS services from pure EFI code
 
   Copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -10,9 +11,6 @@
 #ifndef __EMU_IO_THUNK__
 #define __EMU_IO_THUNK__
 
-#define EMU_IO_THUNK_PROTOCO_GUID  \
- { 0x453368F6, 0x7C85, 0x434A, { 0xA9, 0x8A, 0x72, 0xD1, 0xB7, 0xFF, 0xA9, 
0x26 } }
-
 typedef struct _EMU_IO_THUNK_PROTOCOL EMU_IO_THUNK_PROTOCOL;
 
 typedef
-- 
2.30.2



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




[edk2-devel] [PATCH v1] EmulatorPkg: Rename Variable

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

Rename PeiCorePe32File to SecCorePe32File, because the variable
actually contains the SEC core... not PEI core.

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 EmulatorPkg/Unix/Host/Host.c | 12 ++--
 EmulatorPkg/Unix/Host/Host.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index 1f29dd00a3..940e1953af 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -535,7 +535,7 @@ Arguments:
   LargestRegion   - Memory to use for SEC.
   LargestRegionSize   - Size of Memory to use for PEI
   BootFirmwareVolumeBase  - Start of the Boot FV
-  PeiCorePe32File - SEC PE32
+  SecCorePe32File - SEC PE32
 
 Returns:
   Success means control is transferred and thus we should never return
@@ -546,13 +546,13 @@ SecLoadFromCore (
   IN  UINTN  LargestRegion,
   IN  UINTN  LargestRegionSize,
   IN  UINTN  BootFirmwareVolumeBase,
-  IN  VOID   *PeiCorePe32File
+  IN  VOID   *SecCorePe32File
   )
 {
   EFI_STATUSStatus;
   EFI_PHYSICAL_ADDRESS  TopOfMemory;
   VOID  *TopOfStack;
-  EFI_PHYSICAL_ADDRESS  PeiCoreEntryPoint;
+  EFI_PHYSICAL_ADDRESS  SecCoreEntryPoint;
   EFI_SEC_PEI_HAND_OFF  *SecCoreData;
   UINTN PeiStackSize;
 
@@ -597,7 +597,7 @@ SecLoadFromCore (
   //
   // Find the SEC Core Entry Point
   //
-  Status = SecPeCoffGetEntryPoint (PeiCorePe32File, (VOID 
**)&PeiCoreEntryPoint);
+  Status = SecPeCoffGetEntryPoint (SecCorePe32File, (VOID 
**)&SecCoreEntryPoint);
   if (EFI_ERROR (Status)) {
 return;
   }
@@ -606,7 +606,7 @@ SecLoadFromCore (
   // Transfer control to the SEC Core
   //
   PeiSwitchStacks (
-(SWITCH_STACK_ENTRY_POINT)(UINTN)PeiCoreEntryPoint,
+(SWITCH_STACK_ENTRY_POINT)(UINTN)SecCoreEntryPoint,
 SecCoreData,
 (VOID *)gPpiList,
 TopOfStack
diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h
index 0c81cdfc01..aecebc0143 100644
--- a/EmulatorPkg/Unix/Host/Host.h
+++ b/EmulatorPkg/Unix/Host/Host.h
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -162,7 +162,7 @@ SecLoadFromCore (
   IN  UINTN  LargestRegion,
   IN  UINTN  LargestRegionSize,
   IN  UINTN  BootFirmwareVolumeBase,
-  IN  VOID   *PeiCoreFile
+  IN  VOID   *SecCoreFile
   );
 
 EFI_STATUS
-- 
2.30.2



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




[edk2-devel] [PATCH v1] EmulatorPkg: Remove Duplicate gEmuIoThunkProtocolGuid

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

Host.inf contains two redundant references to
gEmuIoThunkProtocolGuid. Removing one of them as it is superfluous.

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 EmulatorPkg/Unix/Host/Host.inf | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
index f5ebbed683..94997dde6a 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -2,7 +2,7 @@
 # Entry Point of Emu Emulator
 #
 # Main executable file of Unix Emulator that loads PEI core after 
initialization finished.
-# Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
 # Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -67,7 +67,6 @@
   gEmuThunkPpiGuid
 
 [Protocols]
-  gEmuIoThunkProtocolGuid
   gEmuIoThunkProtocolGuid
   gEmuGraphicsWindowProtocolGuid
   gEmuThreadThunkProtocolGuid
-- 
2.30.2



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




[edk2-devel] [PATCH v1] MdeModulePkg: Fix misspelling

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

confroms should be conforms.

Signed-off-by: Nate DeSimone 
Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Michael D Kinney 
Cc: Dandan Bi 
---
 MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c 
b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
index fdeaaa39d8..77fb6b8ff9 100644
--- a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
+++ b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
@@ -1,7 +1,7 @@
 /** @file
   Ia32-specific functionality for DxeLoad.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Incorporated. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -279,7 +279,7 @@ HandOffToDxeCore (
   if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
 //
 // Compute the top of the stack we were allocated, which is used to load 
X64 dxe core.
-// Pre-allocate a 32 bytes which confroms to x64 calling convention.
+// Pre-allocate a 32 bytes which conforms to x64 calling convention.
 //
 // The first four parameters to a function are passed in rcx, rdx, r8 and 
r9.
 // Any further parameters are pushed on the stack. Furthermore, space (4 * 
8bytes) for the
-- 
2.30.2



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




[edk2-devel] [PATCH v1] EmulatorPkg: Correct Comment

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

EFI_EMU_UGA_IO_PROTOCOL has been replaced by
EMU_GRAPHICS_WINDOW_PROTOCOL.

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 EmulatorPkg/Unix/Host/Gasket.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Gasket.h b/EmulatorPkg/Unix/Host/Gasket.h
index 6dafc903cf..b0d61893c3 100644
--- a/EmulatorPkg/Unix/Host/Gasket.h
+++ b/EmulatorPkg/Unix/Host/Gasket.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
-  Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
+  Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -200,7 +200,7 @@ ReverseGasketUint64Uint64 (
   );
 
 //
-// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
+// Gasket functions for EMU_GRAPHICS_WINDOW_PROTOCOL
 //
 
 EFI_STATUS
-- 
2.30.2



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




[edk2-devel] [PATCH v1] EmulatorPkg: Fix SecInterruptEnabled misspelling

2023-02-28 Thread Nate DeSimone
From: Nate DeSimone 

SecInterruptEanbled should be SecInterruptEnabled

Cc: Andrew Fish 
Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 EmulatorPkg/Unix/Host/EmuThunk.c | 4 ++--
 EmulatorPkg/Unix/Host/Host.h | 4 ++--
 EmulatorPkg/Unix/Host/Pthreads.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c b/EmulatorPkg/Unix/Host/EmuThunk.c
index 6422f056a6..4bbc6f32a8 100644
--- a/EmulatorPkg/Unix/Host/EmuThunk.c
+++ b/EmulatorPkg/Unix/Host/EmuThunk.c
@@ -9,7 +9,7 @@
   it may cause the table to be initialized with the members at the end being
   set to zero. This is bad as jumping to zero will crash.
 
-Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2023, Intel Corporation. All rights reserved.
 Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -229,7 +229,7 @@ SecDisableInterrupt (
 }
 
 BOOLEAN
-SecInterruptEanbled (
+SecInterruptEnabled (
   void
   )
 {
diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h
index 0c81cdfc01..ed3980c7fd 100644
--- a/EmulatorPkg/Unix/Host/Host.h
+++ b/EmulatorPkg/Unix/Host/Host.h
@@ -1,6 +1,6 @@
 /*++ @file
 
-Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -346,7 +346,7 @@ SecDisableInterrupt (
   );
 
 BOOLEAN
-SecInterruptEanbled (
+SecInterruptEnabled (
   VOID
   );
 
diff --git a/EmulatorPkg/Unix/Host/Pthreads.c b/EmulatorPkg/Unix/Host/Pthreads.c
index ec3a38e573..d5a7c473f7 100644
--- a/EmulatorPkg/Unix/Host/Pthreads.c
+++ b/EmulatorPkg/Unix/Host/Pthreads.c
@@ -2,7 +2,7 @@
  POSIX Pthreads to emulate APs and implement threads
 
 Copyright (c) 2011, Apple Inc. All rights reserved.
-Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -120,7 +120,7 @@ PthreadCreate (
   //
   // Threads inherit interrupt state so disable interrupts before we start 
thread
   //
-  if (SecInterruptEanbled ()) {
+  if (SecInterruptEnabled ()) {
 SecDisableInterrupt ();
 EnabledOnEntry = TRUE;
   } else {
-- 
2.30.2



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




Re: [edk2-devel] [PATCH v1] EmulatorPkg: Correct Comment

2023-02-28 Thread Ni, Ray
Acked-by: Ray Ni 

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Wednesday, March 1, 2023 12:55 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Andrew Fish
> ; Ni, Ray ; Kinney, Michael D
> ; Chiu, Chasel 
> Subject: [PATCH v1] EmulatorPkg: Correct Comment
> 
> From: Nate DeSimone 
> 
> EFI_EMU_UGA_IO_PROTOCOL has been replaced by
> EMU_GRAPHICS_WINDOW_PROTOCOL.
> 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  EmulatorPkg/Unix/Host/Gasket.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/Gasket.h
> b/EmulatorPkg/Unix/Host/Gasket.h
> index 6dafc903cf..b0d61893c3 100644
> --- a/EmulatorPkg/Unix/Host/Gasket.h
> +++ b/EmulatorPkg/Unix/Host/Gasket.h
> @@ -1,7 +1,7 @@
>  /** @file
> 
>Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
> -  Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
> +  Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -200,7 +200,7 @@ ReverseGasketUint64Uint64 (
>);
> 
>  //
> -// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
> +// Gasket functions for EMU_GRAPHICS_WINDOW_PROTOCOL
>  //
> 
>  EFI_STATUS
> --
> 2.30.2



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




Re: [edk2-devel] [PATCH v1] EmulatorPkg: Rename Variable

2023-02-28 Thread Ni, Ray
Nice change😊

Acked-by: Ray Ni 

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Wednesday, March 1, 2023 12:55 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Andrew Fish
> ; Ni, Ray ; Kinney, Michael D
> ; Chiu, Chasel 
> Subject: [PATCH v1] EmulatorPkg: Rename Variable
> 
> From: Nate DeSimone 
> 
> Rename PeiCorePe32File to SecCorePe32File, because the variable
> actually contains the SEC core... not PEI core.
> 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  EmulatorPkg/Unix/Host/Host.c | 12 ++--
>  EmulatorPkg/Unix/Host/Host.h |  4 ++--
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
> index 1f29dd00a3..940e1953af 100644
> --- a/EmulatorPkg/Unix/Host/Host.c
> +++ b/EmulatorPkg/Unix/Host/Host.c
> @@ -1,6 +1,6 @@
>  /*++ @file
> 
> -Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -535,7 +535,7 @@ Arguments:
>LargestRegion   - Memory to use for SEC.
>LargestRegionSize   - Size of Memory to use for PEI
>BootFirmwareVolumeBase  - Start of the Boot FV
> -  PeiCorePe32File - SEC PE32
> +  SecCorePe32File - SEC PE32
> 
>  Returns:
>Success means control is transferred and thus we should never return
> @@ -546,13 +546,13 @@ SecLoadFromCore (
>IN  UINTN  LargestRegion,
>IN  UINTN  LargestRegionSize,
>IN  UINTN  BootFirmwareVolumeBase,
> -  IN  VOID   *PeiCorePe32File
> +  IN  VOID   *SecCorePe32File
>)
>  {
>EFI_STATUSStatus;
>EFI_PHYSICAL_ADDRESS  TopOfMemory;
>VOID  *TopOfStack;
> -  EFI_PHYSICAL_ADDRESS  PeiCoreEntryPoint;
> +  EFI_PHYSICAL_ADDRESS  SecCoreEntryPoint;
>EFI_SEC_PEI_HAND_OFF  *SecCoreData;
>UINTN PeiStackSize;
> 
> @@ -597,7 +597,7 @@ SecLoadFromCore (
>//
>// Find the SEC Core Entry Point
>//
> -  Status = SecPeCoffGetEntryPoint (PeiCorePe32File, (VOID
> **)&PeiCoreEntryPoint);
> +  Status = SecPeCoffGetEntryPoint (SecCorePe32File, (VOID
> **)&SecCoreEntryPoint);
>if (EFI_ERROR (Status)) {
>  return;
>}
> @@ -606,7 +606,7 @@ SecLoadFromCore (
>// Transfer control to the SEC Core
>//
>PeiSwitchStacks (
> -(SWITCH_STACK_ENTRY_POINT)(UINTN)PeiCoreEntryPoint,
> +(SWITCH_STACK_ENTRY_POINT)(UINTN)SecCoreEntryPoint,
>  SecCoreData,
>  (VOID *)gPpiList,
>  TopOfStack
> diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h
> index 0c81cdfc01..aecebc0143 100644
> --- a/EmulatorPkg/Unix/Host/Host.h
> +++ b/EmulatorPkg/Unix/Host/Host.h
> @@ -1,6 +1,6 @@
>  /*++ @file
> 
> -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -162,7 +162,7 @@ SecLoadFromCore (
>IN  UINTN  LargestRegion,
>IN  UINTN  LargestRegionSize,
>IN  UINTN  BootFirmwareVolumeBase,
> -  IN  VOID   *PeiCoreFile
> +  IN  VOID   *SecCoreFile
>);
> 
>  EFI_STATUS
> --
> 2.30.2



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




Re: [edk2-devel] [PATCH v1] EmulatorPkg: Fix SecInterruptEnabled misspelling

2023-02-28 Thread Ni, Ray
Acked-by: Ray Ni 

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Wednesday, March 1, 2023 12:55 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Andrew Fish
> ; Ni, Ray ; Kinney, Michael D
> ; Chiu, Chasel 
> Subject: [PATCH v1] EmulatorPkg: Fix SecInterruptEnabled misspelling
> 
> From: Nate DeSimone 
> 
> SecInterruptEanbled should be SecInterruptEnabled
> 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  EmulatorPkg/Unix/Host/EmuThunk.c | 4 ++--
>  EmulatorPkg/Unix/Host/Host.h | 4 ++--
>  EmulatorPkg/Unix/Host/Pthreads.c | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c
> b/EmulatorPkg/Unix/Host/EmuThunk.c
> index 6422f056a6..4bbc6f32a8 100644
> --- a/EmulatorPkg/Unix/Host/EmuThunk.c
> +++ b/EmulatorPkg/Unix/Host/EmuThunk.c
> @@ -9,7 +9,7 @@
>it may cause the table to be initialized with the members at the end being
>set to zero. This is bad as jumping to zero will crash.
> 
> -Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) 2004 - 2023, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -229,7 +229,7 @@ SecDisableInterrupt (
>  }
> 
>  BOOLEAN
> -SecInterruptEanbled (
> +SecInterruptEnabled (
>void
>)
>  {
> diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h
> index 0c81cdfc01..ed3980c7fd 100644
> --- a/EmulatorPkg/Unix/Host/Host.h
> +++ b/EmulatorPkg/Unix/Host/Host.h
> @@ -1,6 +1,6 @@
>  /*++ @file
> 
> -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -346,7 +346,7 @@ SecDisableInterrupt (
>);
> 
>  BOOLEAN
> -SecInterruptEanbled (
> +SecInterruptEnabled (
>VOID
>);
> 
> diff --git a/EmulatorPkg/Unix/Host/Pthreads.c
> b/EmulatorPkg/Unix/Host/Pthreads.c
> index ec3a38e573..d5a7c473f7 100644
> --- a/EmulatorPkg/Unix/Host/Pthreads.c
> +++ b/EmulatorPkg/Unix/Host/Pthreads.c
> @@ -2,7 +2,7 @@
>   POSIX Pthreads to emulate APs and implement threads
> 
>  Copyright (c) 2011, Apple Inc. All rights reserved.
> -Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -120,7 +120,7 @@ PthreadCreate (
>//
>// Threads inherit interrupt state so disable interrupts before we start
> thread
>//
> -  if (SecInterruptEanbled ()) {
> +  if (SecInterruptEnabled ()) {
>  SecDisableInterrupt ();
>  EnabledOnEntry = TRUE;
>} else {
> --
> 2.30.2



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




Re: [edk2-devel] [PATCH v1] EmulatorPkg: Fix misspelling

2023-02-28 Thread Ni, Ray
Acked-by: Ray Ni 

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Wednesday, March 1, 2023 12:55 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Andrew Fish
> ; Ni, Ray ; Kinney, Michael D
> ; Chiu, Chasel 
> Subject: [PATCH v1] EmulatorPkg: Fix misspelling
> 
> From: Nate DeSimone 
> 
> pased should be passed.
> 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  EmulatorPkg/Unix/Host/Host.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
> index 1f29dd00a3..42856dbf5a 100644
> --- a/EmulatorPkg/Unix/Host/Host.c
> +++ b/EmulatorPkg/Unix/Host/Host.c
> @@ -1,6 +1,6 @@
>  /*++ @file
> 
> -Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
>  Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -136,7 +136,7 @@ main (
>FirmwareVolumesStr = (CHAR16 *)PcdGetPtr (PcdEmuFirmwareVolume);
> 
>//
> -  // PPIs pased into PEI_CORE
> +  // PPIs passed into PEI_CORE
>//
>SecEmuThunkPpi = AllocateZeroPool (sizeof (EMU_THUNK_PPI) +
> FixedPcdGet32 (PcdPersistentMemorySize));
>if (SecEmuThunkPpi == NULL) {
> --
> 2.30.2



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




Re: [edk2-devel] [PATCH v1] EmulatorPkg: Remove Duplicate gEmuIoThunkProtocolGuid

2023-02-28 Thread Ni, Ray
Acked-by: Ray Ni 

> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Wednesday, March 1, 2023 12:55 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Andrew Fish
> ; Ni, Ray ; Kinney, Michael D
> ; Chiu, Chasel 
> Subject: [PATCH v1] EmulatorPkg: Remove Duplicate
> gEmuIoThunkProtocolGuid
> 
> From: Nate DeSimone 
> 
> Host.inf contains two redundant references to
> gEmuIoThunkProtocolGuid. Removing one of them as it is superfluous.
> 
> Cc: Andrew Fish 
> Cc: Ray Ni 
> Cc: Michael D Kinney 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  EmulatorPkg/Unix/Host/Host.inf | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/Host.inf
> b/EmulatorPkg/Unix/Host/Host.inf
> index f5ebbed683..94997dde6a 100644
> --- a/EmulatorPkg/Unix/Host/Host.inf
> +++ b/EmulatorPkg/Unix/Host/Host.inf
> @@ -2,7 +2,7 @@
>  # Entry Point of Emu Emulator
>  #
>  # Main executable file of Unix Emulator that loads PEI core after 
> initialization
> finished.
> -# Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.
> +# Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
>  # Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -67,7 +67,6 @@
>gEmuThunkPpiGuid
> 
>  [Protocols]
> -  gEmuIoThunkProtocolGuid
>gEmuIoThunkProtocolGuid
>gEmuGraphicsWindowProtocolGuid
>gEmuThreadThunkProtocolGuid
> --
> 2.30.2



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




[edk2-devel] [Patch V4 0/8] Put APs in 64 bit mode before handoff to OS.

2023-02-28 Thread Yuanhao Xie
The purpose of this patch series is to put the APs in 64-bit mode 
before handing off the boot process to the OS, AMD 64-bit processors 
with SEV-ES follows the original logic.

Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=4234

Yuanhao Xie (8):
  UefiCpuPkg: Check AP_SAFE_STACK_SIZE during build time.
  UefiCpuPkg: Split the path in RelocateApLoop into two.
  UefiCpuPkg: Allocate contiguous memory for stacks and APs loop.
  OvmfPkg: Add CpuPageTableLib required by MpInitLib.
  UefiPayloadPkg: Add CpuPageTableLib required by MpInitLib.
  UefiCpuPkg: Put APs in 64 bit mode before handoff to OS.
  UefiCpuPkg: Rename AsmRelocateApLoopStart.
  UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to
AmdSev.nasm

 OvmfPkg/AmdSev/AmdSevX64.dsc|   3 ++-
 OvmfPkg/CloudHv/CloudHvX64.dsc  |   3 ++-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc|   4 +++-
 OvmfPkg/Microvm/MicrovmX64.dsc  |   3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc  |   3 ++-
 OvmfPkg/OvmfPkgX64.dsc  |   4 +++-
 OvmfPkg/OvmfXen.dsc |   3 ++-
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf   |   6 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 153 
+++--
 UefiCpuPkg/Library/MpInitLib/Ia32/CreatePageTable.c |  23 
+++
 UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm  |  26 
+-
 UefiCpuPkg/Library/MpInitLib/MpEqu.inc  |  22 
--
 UefiCpuPkg/Library/MpInitLib/MpLib.h|  52 

 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm| 170 
++
 UefiCpuPkg/Library/MpInitLib/X64/CreatePageTable.c  |  82 
++
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm   | 198 
++
 UefiPayloadPkg/UefiPayloadPkg.dsc   |   3 ++-
 17 files changed, 504 insertions(+), 254 deletions(-)
 create mode 100644 UefiCpuPkg/Library/MpInitLib/Ia32/CreatePageTable.c
 create mode 100644 UefiCpuPkg/Library/MpInitLib/X64/CreatePageTable.c

-- 
2.36.1.windows.1



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




[edk2-devel] [Patch V4 1/8] UefiCpuPkg: Check AP_SAFE_STACK_SIZE during build time.

2023-02-28 Thread Yuanhao Xie
Check if AP_SAFE_STACK_SIZE is aligned with CPU_STACK_ALIGNMENT
during build time.

No functional or structural changes.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index f5086e497e..a73a89d2a5 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -1,7 +1,7 @@
 /** @file
   Common header file for MP Initialize Library.
 
-  Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
   Copyright (c) 2020, AMD Inc. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -311,6 +311,7 @@ typedef struct {
 
 #define AP_SAFE_STACK_SIZE   128
 #define AP_RESET_STACK_SIZE  AP_SAFE_STACK_SIZE
+STATIC_ASSERT ((AP_SAFE_STACK_SIZE & (CPU_STACK_ALIGNMENT - 1)) == 0, 
"AP_SAFE_STACK_SIZE is not aligned with CPU_STACK_ALIGNMENT");
 
 #pragma pack(1)
 
-- 
2.36.1.windows.1



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




[edk2-devel] [Patch V4 2/8] UefiCpuPkg: Split the path in RelocateApLoop into two.

2023-02-28 Thread Yuanhao Xie
Add the union RELOCATE_AP_LOOP_ENTRY, split the path in RelocateApLoop
 into two:
 1. 64-bit AMD processors with SEV-ES
 2. Intel processors (32-bit or 64-bit), 32-bit AMD processors, or
 64-bit AMD processors without SEV-ES.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 70 
++
 UefiCpuPkg/Library/MpInitLib/MpLib.h|  6 ++
 2 files changed, 48 insertions(+), 28 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c 
b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index a84e9e33ba..e9ac858f4f 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -1,7 +1,7 @@
 /** @file
   MP initialize support functions for DXE phase.
 
-  Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -20,14 +20,14 @@
 
 #define  AP_SAFE_STACK_SIZE  128
 
-CPU_MP_DATA   *mCpuMpData  = NULL;
-EFI_EVENT mCheckAllApsEvent= NULL;
-EFI_EVENT mMpInitExitBootServicesEvent = NULL;
-EFI_EVENT mLegacyBootEvent = NULL;
-volatile BOOLEAN  mStopCheckAllApsStatus   = TRUE;
-VOID  *mReservedApLoopFunc = NULL;
-UINTN mReservedTopOfApStack;
-volatile UINT32   mNumberToFinish = 0;
+CPU_MP_DATA *mCpuMpData  = NULL;
+EFI_EVENT   mCheckAllApsEvent= NULL;
+EFI_EVENT   mMpInitExitBootServicesEvent = NULL;
+EFI_EVENT   mLegacyBootEvent = NULL;
+volatile BOOLEANmStopCheckAllApsStatus   = TRUE;
+RELOCATE_AP_LOOP_ENTRY  mReservedApLoop;
+UINTN   mReservedTopOfApStack;
+volatile UINT32 mNumberToFinish = 0;
 
 //
 // Begin wakeup buffer allocation below 0x88000
@@ -378,32 +378,46 @@ RelocateApLoop (
   IN OUT VOID  *Buffer
   )
 {
-  CPU_MP_DATA   *CpuMpData;
-  BOOLEAN   MwaitSupport;
-  ASM_RELOCATE_AP_LOOP  AsmRelocateApLoopFunc;
-  UINTN ProcessorNumber;
-  UINTN StackStart;
+  CPU_MP_DATA  *CpuMpData;
+  BOOLEAN  MwaitSupport;
+  UINTNProcessorNumber;
+  UINTNStackStart;
 
   MpInitLibWhoAmI (&ProcessorNumber);
   CpuMpData= GetCpuMpData ();
   MwaitSupport = IsMwaitSupport ();
   if (CpuMpData->UseSevEsAPMethod) {
+//
+// 64-bit AMD processors with SEV-ES
+//
 StackStart = CpuMpData->SevEsAPResetStackStart;
+mReservedApLoop.AmdSevEntry (
+  MwaitSupport,
+  CpuMpData->ApTargetCState,
+  CpuMpData->PmCodeSegment,
+  StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
+  (UINTN)&mNumberToFinish,
+  CpuMpData->Pm16CodeSegment,
+  CpuMpData->SevEsAPBuffer,
+  CpuMpData->WakeupBuffer
+  );
   } else {
+//
+// Intel processors (32-bit or 64-bit), 32-bit AMD processors, or 64-bit 
AMD processors without SEV-ES
+//
 StackStart = mReservedTopOfApStack;
+mReservedApLoop.GenericEntry (
+  MwaitSupport,
+  CpuMpData->ApTargetCState,
+  CpuMpData->PmCodeSegment,
+  StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
+  (UINTN)&mNumberToFinish,
+  CpuMpData->Pm16CodeSegment,
+  CpuMpData->SevEsAPBuffer,
+  CpuMpData->WakeupBuffer
+  );
   }
 
-  AsmRelocateApLoopFunc = (ASM_RELOCATE_AP_LOOP)(UINTN)mReservedApLoopFunc;
-  AsmRelocateApLoopFunc (
-MwaitSupport,
-CpuMpData->ApTargetCState,
-CpuMpData->PmCodeSegment,
-StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
-(UINTN)&mNumberToFinish,
-CpuMpData->Pm16CodeSegment,
-CpuMpData->SevEsAPBuffer,
-CpuMpData->WakeupBuffer
-);
   //
   // It should never reach here
   //
@@ -547,8 +561,8 @@ InitMpGlobalData (
);
   ASSERT_EFI_ERROR (Status);
 
-  mReservedApLoopFunc = (VOID *)(UINTN)Address;
-  ASSERT (mReservedApLoopFunc != NULL);
+  mReservedApLoop.Data = (VOID *)(UINTN)Address;
+  ASSERT (mReservedApLoop.Data != NULL);
 
   //
   // Make sure that the buffer memory is executable if NX protection is enabled
@@ -583,7 +597,7 @@ InitMpGlobalData (
   mReservedTopOfApStack = (UINTN)Address + ApSafeBufferSize;
   ASSERT ((mReservedTopOfApStack & (UINTN)(CPU_STACK_ALIGNMENT - 1)) == 0);
   CopyMem (
-mReservedApLoopFunc,
+mReservedApLoop.Data,
 CpuMpData->AddressMap.RelocateApLoopFuncAddress,
 CpuMpData->AddressMap.RelocateApLoopFuncSize
 );
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCp

[edk2-devel] [Patch V4 3/8] UefiCpuPkg: Allocate contiguous memory for stacks and APs loop.

2023-02-28 Thread Yuanhao Xie
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 40 
+---
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c 
b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index e9ac858f4f..224215878c 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -480,11 +480,12 @@ InitMpGlobalData (
 {
   EFI_STATUS   Status;
   EFI_PHYSICAL_ADDRESS Address;
-  UINTNApSafeBufferSize;
   UINTNIndex;
   EFI_GCD_MEMORY_SPACE_DESCRIPTOR  MemDesc;
   UINTNStackBase;
   CPU_INFO_IN_HOB  *CpuInfoInHob;
+  UINTNStackPages;
+  UINTNFuncPages;
 
   SaveCpuMpData (CpuMpData);
 
@@ -547,16 +548,23 @@ InitMpGlobalData (
   // Allocating it in advance since memory services are not available in
   // Exit Boot Services callback function.
   //
-  ApSafeBufferSize = EFI_PAGES_TO_SIZE (
-   EFI_SIZE_TO_PAGES (
- CpuMpData->AddressMap.RelocateApLoopFuncSize
- )
-   );
+  // ++ (TopOfApStack)
+  // |  Stack * N |
+  // ++ (stack base, 4k aligned)
+  // |  Padding   |
+  // ++
+  // |  Ap Loop   |
+  // ++ ((low address, 4k-aligned)
+  //
+
+  StackPages = EFI_SIZE_TO_PAGES (CpuMpData->CpuCount * AP_SAFE_STACK_SIZE);
+  FuncPages  = EFI_SIZE_TO_PAGES 
(CpuMpData->AddressMap.RelocateApLoopFuncSize);
+
   Address = BASE_4GB - 1;
   Status  = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
-   EFI_SIZE_TO_PAGES (ApSafeBufferSize),
+   StackPages + FuncPages,
&Address
);
   ASSERT_EFI_ERROR (Status);
@@ -575,26 +583,12 @@ InitMpGlobalData (
   if (!EFI_ERROR (Status)) {
 gDS->SetMemorySpaceAttributes (
Address,
-   ApSafeBufferSize,
+   EFI_PAGES_TO_SIZE (FuncPages),
MemDesc.Attributes & (~EFI_MEMORY_XP)
);
   }
 
-  ApSafeBufferSize = EFI_PAGES_TO_SIZE (
-   EFI_SIZE_TO_PAGES (
- CpuMpData->CpuCount * AP_SAFE_STACK_SIZE
- )
-   );
-  Address = BASE_4GB - 1;
-  Status  = gBS->AllocatePages (
-   AllocateMaxAddress,
-   EfiReservedMemoryType,
-   EFI_SIZE_TO_PAGES (ApSafeBufferSize),
-   &Address
-   );
-  ASSERT_EFI_ERROR (Status);
-
-  mReservedTopOfApStack = (UINTN)Address + ApSafeBufferSize;
+  mReservedTopOfApStack = (UINTN)Address + EFI_PAGES_TO_SIZE 
(StackPages+FuncPages);
   ASSERT ((mReservedTopOfApStack & (UINTN)(CPU_STACK_ALIGNMENT - 1)) == 0);
   CopyMem (
 mReservedApLoop.Data,
-- 
2.36.1.windows.1



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




[edk2-devel] [Patch V4 4/8] OvmfPkg: Add CpuPageTableLib required by MpInitLib.

2023-02-28 Thread Yuanhao Xie
Add CpuPageTableLib required by MpInitLib in OvmfPkg.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Yuanhao Xie 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 3 ++-
 OvmfPkg/CloudHv/CloudHvX64.dsc   | 3 ++-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc | 4 +++-
 OvmfPkg/Microvm/MicrovmX64.dsc   | 3 ++-
 OvmfPkg/OvmfPkgIa32X64.dsc   | 3 ++-
 OvmfPkg/OvmfPkgX64.dsc   | 4 +++-
 OvmfPkg/OvmfXen.dsc  | 3 ++-
 7 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 1cebd6b4bc..f0c4dc2310 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -3,7 +3,7 @@
 #  virtual machine remote attestation and secret injection
 #
 #  Copyright (c) 2020 James Bottomley, IBM Corporation.
-#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -353,6 +353,7 @@
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   
NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index fda7d2b9e5..327f53ff3c 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  Copyright (c) Microsoft Corporation.
 #
@@ -404,6 +404,7 @@
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   
NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 95b9594ddc..d093660283 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  Copyright (c) Microsoft Corporation.
 #
@@ -320,6 +320,7 @@
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf
   PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
+  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   
NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf
   QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf
@@ -590,6 +591,7 @@
   # Directly use DxeMpInitLib. It depends on DxeMpInitLibMpDepLib which
   # checks the Protocol of gEfiMpInitLibMpDepProtocolGuid.
   #
+  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibMpDepLib.inf
   }
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 0d65d21e65..76fc548650 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
 #
-#  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+#  Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 #  Copyright (c) Microsoft Corporation.
 #
@@ -403,6 +403,7 @@
   PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
   PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
   
PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf
+  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   
NestedInterruptTplLib|OvmfPkg/Library/NestedIn

[edk2-devel] [Patch V4 5/8] UefiPayloadPkg: Add CpuPageTableLib required by MpInitLib.

2023-02-28 Thread Yuanhao Xie
Add CpuPageTableLib required by MpInitLib in UefiPayloadPkg.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 2dbd875f37..8cbbbe9a05 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -3,7 +3,7 @@
 #
 # Provides drivers and definitions to create uefi payload for bootloaders.
 #
-# Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2023, Intel Corporation. All rights reserved.
 # Copyright (c) Microsoft Corporation.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -340,6 +340,7 @@
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+  CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
   MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
 !if $(PERFORMANCE_MEASUREMENT_ENABLE)
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
-- 
2.36.1.windows.1



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




[edk2-devel] [Patch V4 7/8] UefiCpuPkg: Rename AsmRelocateApLoopStart.

2023-02-28 Thread Yuanhao Xie
Rename AsmRelocateApLoopStart to AsmRelocateApLoopStartAmdSev

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c   |  4 ++--
 UefiCpuPkg/Library/MpInitLib/MpEqu.inc|  4 ++--
 UefiCpuPkg/Library/MpInitLib/MpLib.h  |  8 
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 40 

 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c 
b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index d292277d10..330676b700 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -547,8 +547,8 @@ InitMpGlobalData (
 // 64-bit AMD processors with SEV-ES
 //
 Address= BASE_4GB - 1;
-ApLoopFunc = AddressMap->RelocateApLoopFuncAddress;
-ApLoopFuncSize = AddressMap->RelocateApLoopFuncSize;
+ApLoopFunc = AddressMap->RelocateApLoopFuncAddressAmdSev;
+ApLoopFuncSize = AddressMap->RelocateApLoopFuncSizeAmdSev;
   } else {
 //
 // Intel processors (32-bit or 64-bit), 32-bit AMD processors, or 64-bit 
AMD processors without SEV-ES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpEqu.inc 
b/UefiCpuPkg/Library/MpInitLib/MpEqu.inc
index 09c1817426..72af196513 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/MpEqu.inc
@@ -26,8 +26,8 @@ struc MP_ASSEMBLY_ADDRESS_MAP
   .RendezvousFunnelSize   CTYPE_UINTN 1
   .RelocateApLoopFuncAddressGeneric   CTYPE_UINTN 1
   .RelocateApLoopFuncSizeGeneric  CTYPE_UINTN 1
-  .RelocateApLoopFuncAddress  CTYPE_UINTN 1
-  .RelocateApLoopFuncSize CTYPE_UINTN 1
+  .RelocateApLoopFuncAddressAmdSevCTYPE_UINTN 1
+  .RelocateApLoopFuncSizeAmdSev   CTYPE_UINTN 1
   .ModeTransitionOffset   CTYPE_UINTN 1
   .SwitchToRealNoNxOffset CTYPE_UINTN 1
   .SwitchToRealPM16ModeOffset CTYPE_UINTN 1
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index e137545fc6..6f235dcf6d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -179,8 +179,8 @@ typedef struct {
   UINTNRendezvousFunnelSize;
   UINT8*RelocateApLoopFuncAddressGeneric;
   UINTNRelocateApLoopFuncSizeGeneric;
-  UINT8*RelocateApLoopFuncAddress;
-  UINTNRelocateApLoopFuncSize;
+  UINT8*RelocateApLoopFuncAddressAmdSev;
+  UINTNRelocateApLoopFuncSizeAmdSev;
   UINTNModeTransitionOffset;
   UINTNSwitchToRealNoNxOffset;
   UINTNSwitchToRealPM16ModeOffset;
@@ -388,7 +388,7 @@ typedef
 **/
 typedef
   VOID
-(EFIAPI *ASM_RELOCATE_AP_LOOP)(
+(EFIAPI *ASM_RELOCATE_AP_LOOP_AMDSEV)(
   IN BOOLEAN MwaitSupport,
   IN UINTN   ApTargetCState,
   IN UINTN   PmCodeSegment,
@@ -429,7 +429,7 @@ AsmExchangeRole (
 
 typedef union {
   VOID*Data;
-  ASM_RELOCATE_AP_LOOPAmdSevEntry;  // 64-bit AMD Sev processors
+  ASM_RELOCATE_AP_LOOP_AMDSEV AmdSevEntry;  // 64-bit AMD Sev processors
   ASM_RELOCATE_AP_LOOP_GENERICGenericEntry; // Intel processors (32-bit or 
64-bit), 32-bit AMD processors, or AMD non-Sev processors
 } RELOCATE_AP_LOOP_ENTRY;
 
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm 
b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
index c0d7355c6b..1a64d5681f 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
@@ -277,14 +277,14 @@ CProcedureInvoke:
 %include "AmdSev.nasm"
 
 RendezvousFunnelProcEnd:
-
 
;-
-;  AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, 
TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
+;  AsmRelocateApLoopAmdSev (MwaitSupport, ApTargetCState, PmCodeSegment, 
TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
 
;-
-AsmRelocateApLoopStart:
+
+AsmRelocateApLoopAmdSevStart:
 BITS 64
 cmpqword [rsp + 56], 0  ; SevEsAPJumpTable
-je NoSevEs
+je NoSevEsAmdSev
 
 ;
 ; Perform some SEV-ES related setup before leaving 64-bit mode
@@ -329,7 +329,7 @@ BITS 64
 poprdx
 poprcx
 
-NoSevEs:
+NoSevEsAmdSev:
 cli  ; Disable interrupt before switching to 
32-bit mode
 movrax, [rsp + 40]   ; CountTofinish
 lock dec   dword [rax]   ; (*CountTofinish)--
@@ -345,7 +345,7 @@ NoSevEs:
 push   rcx   ; Save MwaitSupport
 push   rdx   ; Save ApTargetCState
 
-learax, [PmEntry]; rax <- The start address of transition code
+learax, [PmEntryAmdSev]; rax <- The start address of 
tr

[edk2-devel] [Patch V4 6/8] UefiCpuPkg: Put APs in 64 bit mode before handoff to OS.

2023-02-28 Thread Yuanhao Xie
Add the 'AsmRelocateApLoopStartGeneric' for X64 processors except 64-bit
 AMD processors with SEV-ES.

Remove the unused arguments of AsmRelocateApLoopStartGeneric, updated
the stack offset.

Create PageTable for the allocated reserved memory.

Only keep 4GB limitation of memory allocation for the case APs still
need to be transferred to 32-bit mode before OS.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf   |  6 +-
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 63 
++-
 UefiCpuPkg/Library/MpInitLib/Ia32/CreatePageTable.c | 23 
+++
 UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm  | 26 
+-
 UefiCpuPkg/Library/MpInitLib/MpEqu.inc  | 22 --
 UefiCpuPkg/Library/MpInitLib/MpLib.h| 43 
---
 UefiCpuPkg/Library/MpInitLib/X64/CreatePageTable.c  | 82 
++
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm   | 57 
-
 8 files changed, 273 insertions(+), 49 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf 
b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index cd07de3a3c..4285dd06b4 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  MP Initialize Library instance for DXE driver.
 #
-#  Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
+#  Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -24,10 +24,12 @@
 [Sources.IA32]
   Ia32/AmdSev.c
   Ia32/MpFuncs.nasm
+  Ia32/CreatePageTable.c
 
 [Sources.X64]
   X64/AmdSev.c
   X64/MpFuncs.nasm
+  X64/CreatePageTable.c
 
 [Sources.common]
   AmdSev.c
@@ -56,6 +58,8 @@
   PcdLib
   CcExitLib
   MicrocodeLib
+[LibraryClasses.X64]
+  CpuPageTableLib
 
 [Protocols]
   gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c 
b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index 224215878c..d292277d10 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -28,6 +28,7 @@ volatile BOOLEANmStopCheckAllApsStatus   = TRUE;
 RELOCATE_AP_LOOP_ENTRY  mReservedApLoop;
 UINTN   mReservedTopOfApStack;
 volatile UINT32 mNumberToFinish = 0;
+UINTN   mApPageTable;
 
 //
 // Begin wakeup buffer allocation below 0x88000
@@ -409,12 +410,9 @@ RelocateApLoop (
 mReservedApLoop.GenericEntry (
   MwaitSupport,
   CpuMpData->ApTargetCState,
-  CpuMpData->PmCodeSegment,
   StackStart - ProcessorNumber * AP_SAFE_STACK_SIZE,
   (UINTN)&mNumberToFinish,
-  CpuMpData->Pm16CodeSegment,
-  CpuMpData->SevEsAPBuffer,
-  CpuMpData->WakeupBuffer
+  mApPageTable
   );
   }
 
@@ -484,6 +482,9 @@ InitMpGlobalData (
   EFI_GCD_MEMORY_SPACE_DESCRIPTOR  MemDesc;
   UINTNStackBase;
   CPU_INFO_IN_HOB  *CpuInfoInHob;
+  MP_ASSEMBLY_ADDRESS_MAP  *AddressMap;
+  UINT8*ApLoopFunc;
+  UINTNApLoopFuncSize;
   UINTNStackPages;
   UINTNFuncPages;
 
@@ -540,6 +541,23 @@ InitMpGlobalData (
 }
   }
 
+  AddressMap = &CpuMpData->AddressMap;
+  if (CpuMpData->UseSevEsAPMethod) {
+//
+// 64-bit AMD processors with SEV-ES
+//
+Address= BASE_4GB - 1;
+ApLoopFunc = AddressMap->RelocateApLoopFuncAddress;
+ApLoopFuncSize = AddressMap->RelocateApLoopFuncSize;
+  } else {
+//
+// Intel processors (32-bit or 64-bit), 32-bit AMD processors, or 64-bit 
AMD processors without SEV-ES
+//
+Address= MAX_ADDRESS;
+ApLoopFunc = AddressMap->RelocateApLoopFuncAddressGeneric;
+ApLoopFuncSize = AddressMap->RelocateApLoopFuncSizeGeneric;
+  }
+
   //
   // Avoid APs access invalid buffer data which allocated by BootServices,
   // so we will allocate reserved data for AP loop code. We also need to
@@ -558,19 +576,15 @@ InitMpGlobalData (
   //
 
   StackPages = EFI_SIZE_TO_PAGES (CpuMpData->CpuCount * AP_SAFE_STACK_SIZE);
-  FuncPages  = EFI_SIZE_TO_PAGES 
(CpuMpData->AddressMap.RelocateApLoopFuncSize);
-
-  Address = BASE_4GB - 1;
-  Status  = gBS->AllocatePages (
-   AllocateMaxAddress,
-   EfiReservedMemoryType,
-   StackPages + FuncPages,
-   &Address
-  

[edk2-devel] [Patch V4 8/8] UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm

2023-02-28 Thread Yuanhao Xie
Cc: Guo Dong 
Cc: Ray Ni 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Yuanhao Xie 
---
 UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm  | 170 
++
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 169 
-
 2 files changed, 170 insertions(+), 169 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm 
b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm
index 7c2469f9c5..2efa3cb104 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/AmdSev.nasm
@@ -346,3 +346,173 @@ PM16Mode:
 iret
 
 SwitchToRealProcEnd:
+
+;-
+;  AsmRelocateApLoopAmdSev (MwaitSupport, ApTargetCState, PmCodeSegment, 
TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
+;-
+
+AsmRelocateApLoopAmdSevStart:
+BITS 64
+cmpqword [rsp + 56], 0  ; SevEsAPJumpTable
+je NoSevEsAmdSev
+
+;
+; Perform some SEV-ES related setup before leaving 64-bit mode
+;
+push   rcx
+push   rdx
+
+;
+; Get the RDX reset value using CPUID
+;
+movrax, 1
+cpuid
+movrsi, rax  ; Save off the reset value for RDX
+
+;
+; Prepare the GHCB for the AP_HLT_LOOP VMGEXIT call
+;   - Must be done while in 64-bit long mode so that writes to
+; the GHCB memory will be unencrypted.
+;   - No NAE events can be generated once this is set otherwise
+; the AP_RESET_HOLD SW_EXITCODE will be overwritten.
+;
+movrcx, 0xc0010130
+rdmsr; Retrieve current GHCB address
+shlrdx, 32
+or rdx, rax
+
+movrdi, rdx
+xorrax, rax
+movrcx, 0x800
+shrrcx, 3
+rep stosq; Clear the GHCB
+
+movrax, 0x8004   ; VMGEXIT AP_RESET_HOLD
+mov[rdx + 0x390], rax
+movrax, 114  ; Set SwExitCode valid bit
+bts[rdx + 0x3f0], rax
+incrax   ; Set SwExitInfo1 valid bit
+bts[rdx + 0x3f0], rax
+incrax   ; Set SwExitInfo2 valid bit
+bts[rdx + 0x3f0], rax
+
+poprdx
+poprcx
+
+NoSevEsAmdSev:
+cli  ; Disable interrupt before switching to 
32-bit mode
+movrax, [rsp + 40]   ; CountTofinish
+lock dec   dword [rax]   ; (*CountTofinish)--
+
+movr10, [rsp + 48]   ; Pm16CodeSegment
+movrax, [rsp + 56]   ; SevEsAPJumpTable
+movrbx, [rsp + 64]   ; WakeupBuffer
+movrsp, r9   ; TopOfApStack
+
+push   rax   ; Save SevEsAPJumpTable
+push   rbx   ; Save WakeupBuffer
+push   r10   ; Save Pm16CodeSegment
+push   rcx   ; Save MwaitSupport
+push   rdx   ; Save ApTargetCState
+
+learax, [PmEntryAmdSev]; rax <- The start address of 
transition code
+
+push   r8
+push   rax
+
+;
+; Clear R8 - R15, for reset, before going into 32-bit mode
+;
+xorr8, r8
+xorr9, r9
+xorr10, r10
+xorr11, r11
+xorr12, r12
+xorr13, r13
+xorr14, r14
+xorr15, r15
+
+;
+; Far return into 32-bit mode
+;
+o64 retf
+
+BITS 32
+PmEntryAmdSev:
+moveax, cr0
+btreax, 31   ; Clear CR0.PG
+movcr0, eax  ; Disable paging and caches
+
+movecx, 0xc080
+rdmsr
+andah, ~ 1   ; Clear LME
+wrmsr
+moveax, cr4
+andal, ~ (1 << 5); Clear PAE
+movcr4, eax
+
+popedx
+addesp, 4
+popecx,
+addesp, 4
+
+MwaitCheckAmdSev:
+cmpcl, 1  ; Check mwait-monitor support
+jnzHltLoopAmdSev
+movebx, edx   ; Save C-State to ebx
+MwaitLoopAmdSev:
+cli
+moveax, esp   ; Set Monitor Address
+xorecx, ecx   ; ecx = 0
+xoredx, edx   ; edx = 0
+monitor
+moveax, ebx   ; Mwait Cx, Target C-State per eax[7:4]
+shleax, 4
+mwait
+jmpMwaitLoopAmdSev
+
+HltLoopAmdSev:
+popedx; PM16CodeSegment
+addesp, 4
+popebx; WakeupBuffer
+addesp, 4
+pop 

[edk2-devel] [PATCH v1] MinPlatformPkg: Update MinDsdt device name from PCI0 to MinDsdt_PC00

2023-02-28 Thread Chen, Aryeh
From: Aryeh Chen 

Since AlderLake platform client project align Server project to use
PC00.

Signed-off-by: Aryeh Chen 
Cc: Chasel Chiu ,
Cc: Nate DeSimone ,
Cc: Isaac Oram ,
Cc: Liming Gao ,
Cc: Eric Dong 
---
 Platform/Intel/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl 
b/Platform/Intel/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl
index 4efb8709ac..d84393d465 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl
+++ b/Platform/Intel/MinPlatformPkg/Acpi/MinDsdt/MinDsdt.asl
@@ -23,7 +23,7 @@ DefinitionBlock (
   //---
   // Begin PCI tree object scope
   //---
-Device(PCI0) { // PCI Bridge "Host Bridge"
+Device(PC00) { // PCI Bridge "Host Bridge"
   Name(_HID, EISAID("PNP0A08")) // Indicates PCI Express/PCI-X Mode2 host 
hierarchy
   Name(_CID, EISAID("PNP0A03")) // To support legacy OS that doesn't 
understand the new HID
   Name(_SEG, 0)
-- 
2.26.2.windows.1



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




Re: [edk2-devel] [Patch V4 0/8] Put APs in 64 bit mode before handoff to OS.

2023-02-28 Thread Gerd Hoffmann
On Wed, Mar 01, 2023 at 02:09:46PM +0800, Yuanhao Xie wrote:
> The purpose of this patch series is to put the APs in 64-bit mode 
> before handing off the boot process to the OS, AMD 64-bit processors 
> with SEV-ES follows the original logic.
> 
> Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=4234

Acked-by: Gerd Hoffmann 
Tested-by: Gerd Hoffmann 



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




[edk2-devel] [edk2 0/2] RISC-V SBI-backed SerialLib

2023-02-28 Thread Andrei Warkentin
Hello!

Here are two patches that give a SerialLib backed by
SBI console. Both legacy and DBCN mechanisms are
supported and have been tested (with UART and HTIF).

This is also available at https://github.com/andreiw/edk2-rv-wip/tree/patchset-2

Andrei Warkentin (2):
  MdePkg: BaseRiscVSbiLib: make more useful to consumers
  MdePkg: add BaseSerialPortLibRiscVSbi

 MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.inf |  32 
+++
 MdePkg/Include/Library/BaseRiscVSbiLib.h   |  40 
++-
 MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c   |   3 +-
 MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.c   | 260 

 MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.uni |  16 ++
 5 files changed, 346 insertions(+), 5 deletions(-)
 create mode 100644 
MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.inf
 create mode 100644 
MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.c
 create mode 100644 
MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.uni

-- 
2.25.1



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




[edk2-devel] [edk2 1/2] MdePkg: BaseRiscVSbiLib: make more useful to consumers

2023-02-28 Thread Andrei Warkentin
Add a few more definitions and make SbiCall and TranslateError
usable (not static) by library users.

Cc: Daniel Schaefer 
Cc: Sunil V L 
Signed-off-by: Andrei Warkentin 
---
 MdePkg/Include/Library/BaseRiscVSbiLib.h | 40 ++--
 MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c |  3 +-
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Include/Library/BaseRiscVSbiLib.h 
b/MdePkg/Include/Library/BaseRiscVSbiLib.h
index e75520b4b888..2244165a6b6a 100644
--- a/MdePkg/Include/Library/BaseRiscVSbiLib.h
+++ b/MdePkg/Include/Library/BaseRiscVSbiLib.h
@@ -2,6 +2,7 @@
   Library to call the RISC-V SBI ecalls
 
   Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights 
reserved.
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -18,10 +19,28 @@
 #include 
 
 /* SBI Extension IDs */
-#define SBI_EXT_TIME  0x54494D45
-#define SBI_EXT_SRST  0x53525354
+#define SBI_EXT_0_1_CONSOLE_PUTCHAR  0x1
+#define SBI_EXT_0_1_CONSOLE_GETCHAR  0x2
+#define SBI_EXT_BASE 0x10
+#define SBI_EXT_DBCN 0x4442434E
+#define SBI_EXT_TIME 0x54494D45
+#define SBI_EXT_SRST 0x53525354
 
-/* SBI function IDs for TIME extension*/
+/* SBI function IDs for base extension */
+#define SBI_EXT_BASE_SPEC_VERSION   0x0
+#define SBI_EXT_BASE_IMPL_ID0x1
+#define SBI_EXT_BASE_IMPL_VERSION   0x2
+#define SBI_EXT_BASE_PROBE_EXT  0x3
+#define SBI_EXT_BASE_GET_MVENDORID  0x4
+#define SBI_EXT_BASE_GET_MARCHID0x5
+#define SBI_EXT_BASE_GET_MIMPID 0x6
+
+/* SBI function IDs for DBCN extension */
+#define SBI_EXT_DBCN_WRITE   0x0
+#define SBI_EXT_DBCN_READ0x1
+#define SBI_EXT_DBCN_WRITE_BYTE  0x2
+
+/* SBI function IDs for TIME extension */
 #define SBI_EXT_TIME_SET_TIMER  0x0
 
 /* SBI function IDs for SRST extension */
@@ -62,6 +81,21 @@ typedef struct {
   UINTNValue; ///< Value returned
 } SBI_RET;
 
+SBI_RET
+EFIAPI
+SbiCall (
+  IN  UINTN  ExtId,
+  IN  UINTN  FuncId,
+  IN  UINTN  NumArgs,
+  ...
+  );
+
+EFI_STATUS
+EFIAPI
+TranslateError (
+  IN  UINTN  SbiError
+  );
+
 VOID
 EFIAPI
 SbiSetTimer (
diff --git a/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c 
b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c
index 2ba8f5ed366a..1141abfab9d0 100644
--- a/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c
+++ b/MdePkg/Library/BaseRiscVSbiLib/BaseRiscVSbiLib.c
@@ -4,6 +4,7 @@
   It allows calling an SBI function via an ecall from S-Mode.
 
   Copyright (c) 2021-2022, Hewlett Packard Development LP. All rights 
reserved.
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -31,7 +32,6 @@
   @retval  Returns SBI_RET structure with value and error code.
 
 **/
-STATIC
 SBI_RET
 EFIAPI
 SbiCall (
@@ -88,7 +88,6 @@ SbiCall (
   @param[in] SbiError   SBI error code
   @retval EFI_STATUS
 **/
-STATIC
 EFI_STATUS
 EFIAPI
 TranslateError (
-- 
2.25.1



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




[edk2-devel] [edk2 2/2] MdePkg: add BaseSerialPortLibRiscVSbi

2023-02-28 Thread Andrei Warkentin
This is an implementation of SerialPortLib using SBI console services.

Tested with:
- Qemu RiscVVirt (non-DBCN case, backed by UART)
- TinyEMU + RiscVVirt (non-DBCN case, HTIF)
- TinyEMU + RiscVVirt (DBCN case, HTIF)

Cc: Daniel Schaefer 
Cc: Sunil V L 
Signed-off-by: Andrei Warkentin 
---
 MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.inf |  32 
+++
 MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.c   | 260 

 MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.uni |  16 ++
 3 files changed, 308 insertions(+)

diff --git 
a/MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.inf 
b/MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.inf
new file mode 100644
index ..70c8e48ea48e
--- /dev/null
+++ b/MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.inf
@@ -0,0 +1,32 @@
+## @file
+#  Serial Port Library backed by SBI console.
+#
+#  Copyright (c) 2023, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = BaseSerialPortLibRiscVSbi
+  MODULE_UNI_FILE= BaseSerialPortLibRiscVSbi.uni
+  FILE_GUID  = E4541241-8897-4bba-91F8-7D7E45654346
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = SerialPortLib
+
+
+#
+#  VALID_ARCHITECTURES   = RISCV64
+#
+
+[Sources]
+  BaseSerialPortLibRiscVSbi.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  RiscVSbiLib
diff --git 
a/MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.c 
b/MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.c
new file mode 100644
index ..46bdf26fec71
--- /dev/null
+++ b/MdePkg/Library/BaseSerialPortLibRiscVSbi/BaseSerialPortLibRiscVSbi.c
@@ -0,0 +1,260 @@
+/** @file
+  Serial Port Library backed by SBI console.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+
+STATIC BOOLEAN  mHaveDbcn= FALSE;
+STATIC INT64mLastGetChar = -1;
+
+/**
+  Initialize the serial device hardware.
+
+  If no initialization is required, then return RETURN_SUCCESS.
+  If the serial device was successfully initialized, then return 
RETURN_SUCCESS.
+  If the serial device could not be initialized, then return 
RETURN_DEVICE_ERROR.
+
+  @retval RETURN_SUCCESSThe serial device was initialized.
+  @retval RETURN_DEVICE_ERROR   The serial device could not be initialized.
+
+**/
+RETURN_STATUS
+EFIAPI
+SerialPortInitialize (
+  VOID
+  )
+{
+  SBI_RET  Ret;
+
+  Ret = SbiCall (SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT, 1, SBI_EXT_DBCN);
+  if ((TranslateError (Ret.Error) == EFI_SUCCESS) &&
+  (Ret.Value != 0))
+  {
+mHaveDbcn = TRUE;
+  }
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Write data from buffer to serial device.
+
+  Writes NumberOfBytes data bytes from Buffer to the serial device.
+  The number of bytes actually written to the serial device is returned.
+  If the return value is less than NumberOfBytes, then the write operation 
failed.
+  If Buffer is NULL, then ASSERT().
+  If NumberOfBytes is zero, then return 0.
+
+  @param  Buffer   The pointer to the data buffer to be written.
+  @param  NumberOfBytesThe number of bytes to written to the serial device.
+
+  @retval 0NumberOfBytes is 0.
+  @retval >0   The number of bytes written to the serial device.
+   If this value is less than NumberOfBytes, then the 
write operation failed.
+
+**/
+UINTN
+EFIAPI
+SerialPortWrite (
+  IN UINT8  *Buffer,
+  IN UINTN  NumberOfBytes
+  )
+{
+  UINTN  Index;
+
+  if (mHaveDbcn) {
+SBI_RET  Ret;
+Ret = SbiCall (
+SBI_EXT_DBCN,
+SBI_EXT_DBCN_WRITE,
+3,
+NumberOfBytes,
+((UINTN)Buffer),
+0
+);
+if (TranslateError (Ret.Error) != EFI_SUCCESS) {
+  return 0;
+}
+
+return Ret.Value;
+  }
+
+  for (Index = 0; Index < NumberOfBytes; Index++) {
+SbiCall (SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, 1, Buffer[Index]);
+  }
+
+  return Index;
+}
+
+/**
+  Read data from serial device and save the datas in buffer.
+
+  Reads NumberOfBytes data bytes from a serial device into the buffer
+  specified by Buffer. The number of bytes actually read is returned.
+  If the return value is less than NumberOfBytes, then the rest operation 
failed.
+  If Buffer is NULL, then ASSERT().
+  If NumberOfBytes is zero, then return 0.
+
+  @param  Buffer   The pointer to the data buffer to store the data 
read from the serial device.
+  @param  NumberOfBytesThe number of bytes which will be read.
+
+  @retval 0Read data failed; No data is to be read.
+  @retval >0